From 19a2176793661204763efefb268881d9550afb72 Mon Sep 17 00:00:00 2001 From: PascalCorpsman Date: Wed, 20 Nov 2024 16:52:16 +0100 Subject: [PATCH 1/8] ADD: Support for dynamic linking first version that can be compiled under Windows and Linux --- units/ctypes.inc | 406 +-- units/jedi.inc | 1032 +++---- units/sdl.inc | 188 +- units/sdl2.pas | 47 +- units/sdl_dnymic_linking.inc | 1143 ++++++++ units/sdlatomic.inc | 218 +- units/sdlaudio.inc | 3179 +++++++++++---------- units/sdlblendmode.inc | 172 +- units/sdlclipboard.inc | 258 +- units/sdlcpuinfo.inc | 438 +-- units/sdlerror.inc | 180 +- units/sdlevents.inc | 1714 ++++++------ units/sdlfilesystem.inc | 226 +- units/sdlgamecontroller.inc | 1630 ++++++----- units/sdlgesture.inc | 176 +- units/sdlguid.inc | 136 +- units/sdlhaptic.inc | 2856 ++++++++++--------- units/sdlhidapi.inc | 852 +++--- units/sdlhints.inc | 5104 +++++++++++++++++----------------- units/sdljoystick.inc | 2617 ++++++++++------- units/sdlkeyboard.inc | 760 ++--- units/sdlkeycode.inc | 640 ++--- units/sdlloadso.inc | 168 +- units/sdllocale.inc | 108 +- units/sdllog.inc | 450 +-- units/sdlmessagebox.inc | 264 +- units/sdlmisc.inc | 58 +- units/sdlmouse.inc | 999 ++++--- units/sdlmutex.inc | 850 +++--- units/sdlpixels.inc | 1725 ++++++------ units/sdlplatform.inc | 26 +- units/sdlpower.inc | 78 +- units/sdlrect.inc | 536 ++-- units/sdlrenderer.inc | 2315 +++++++-------- units/sdlrwops.inc | 776 ++++-- units/sdlscancode.inc | 788 +++--- units/sdlsensor.inc | 590 ++-- units/sdlshape.inc | 290 +- units/sdlstdinc.inc | 1914 ++++++++----- units/sdlsurface.inc | 1390 +++++---- units/sdlsystem.inc | 1290 +++++---- units/sdlsyswm.inc | 730 ++--- units/sdlthread.inc | 932 ++++--- units/sdltimer.inc | 202 +- units/sdltouch.inc | 208 +- units/sdltypes.inc | 20 +- units/sdlversion.inc | 260 +- units/sdlvideo.inc | 3758 +++++++++++++++---------- 48 files changed, 25180 insertions(+), 19517 deletions(-) create mode 100644 units/sdl_dnymic_linking.inc diff --git a/units/ctypes.inc b/units/ctypes.inc index cd0b26ff..57b62cc3 100644 --- a/units/ctypes.inc +++ b/units/ctypes.inc @@ -1,203 +1,203 @@ -// C data types - -{ - Simple DirectMedia Layer - Copyright (C) 1997-2013 Sam Lantinga - - Pascal-Header-Conversion - Copyright (C) 2012-2020 Tim Blume aka End/EV1313 - - SDL2-for-Pascal - Copyright (C) 2020-2021 PGD Community - - This file is part of the project above. It has solely the purpose - to map common C data types correctly by Pascal compilers. - - FPC: Most C data types are found in the native ctypes unit. - Delphi + others: Relies on this file for C data type mapping. - - These native C types should be strictly separated from - types defined by SDL which can be found in sdlstdinc.inc. -} - -{$IFNDEF FPC} -type - DWord = LongWord; - - ppcbool = ^pcbool; - pcbool = ^cbool; - cbool = LongBool; - {$EXTERNALSYM cbool} - - ppcint8 = ^pcint8; - pcint8 = ^cint8; - cint8 = ShortInt; - {$EXTERNALSYM cint8} - - pcuint8 = ^cuint8; - cuint8 = Byte; - {$EXTERNALSYM cuint8} - - ppcint16 = ^pcint16; - pcint16 = ^cint16; - cint16 = SmallInt; - {$EXTERNALSYM cint16} - - ppcuint16 = ^pcuint16; - pcuint16 = ^cuint16; - cuint16 = Word; - {$EXTERNALSYM cuint16} - - ppcushort = ^pcushort; - pcushort = ^cushort; - cushort = Word; - {$EXTERNALSYM cushort} - - ppcint32 = ^pcint32; - pcint32 = ^cint32; - cint32 = LongInt; - {$EXTERNALSYM cint32} - - ppcuint32 = ^pcuint32; - pcuint32 = ^cuint32; - cuint32 = LongWord; - {$EXTERNALSYM cuint32} - - {$IFNDEF Has_Int64} - ppcint64 = ^pcint64; - pcint64 = ^cint64; - cint64 = record - hi: cuint32; - lo: cuint32; - end; - {$EXTERNALSYM cint64} - - ppcuint64 = ^pcuint64; - pcuint64 = ^cuint64; - cuint64 = record - hi: cuint32; - lo: cuint32; - end; - {$EXTERNALSYM cuint64} - {$ELSE} - ppcint64 = ^pcint64; - pcint64 = ^cint64; - cint64 = Int64; - {$EXTERNALSYM cint64} - - ppcuint64 = ^pcuint64; - pcuint64 = ^cuint64; - cuint64 = UInt64; - {$EXTERNALSYM cuint64} - {$ENDIF} - - ppcsize_t = ^pcsize_t; - pcsize_t = ^csize_t; - {$IFNDEF WIN64} - csize_t = cuint32; - {$ELSE} - csize_t = cuint64; - {$ENDIF} - {$EXTERNALSYM csize_t} - - ppcfloat = ^pcfloat; - pcfloat = ^cfloat; - cfloat = Single; - {$EXTERNALSYM cfloat} - - ppcdouble = ^pcdouble; - pcdouble = ^cdouble; - cdouble = Double; - {$EXTERNALSYM cfloat} - - ppcint = ^pcint; - pcint = ^cint; - - ppcuint = ^pcuint; - pcuint = ^cuint; - - ppclong = ^pclong; - pclong = ^clong; - - ppculong = ^pculong; - pculong = ^culong; - { - Integer type sizes based on: - https://en.cppreference.com/w/c/language/arithmetic_types#Data_models - } - cint = cint32; - cuint = cuint32; - {$IF DEFINED(CPU32) OR DEFINED(CPU32BITS)} - clong = cint32; - culong = cuint32; - {$ELSE} // 64-bit - {$IFDEF MSWINDOWS} - clong = cint32; - culong = cuint32; - {$ELSE} - clong = cint64; - culong = cuint64; - {$ENDIF} - {$ENDIF} - {$EXTERNALSYM cint} - {$EXTERNALSYM cuint} - {$EXTERNALSYM clong} - {$EXTERNALSYM culong} - -{$ENDIF} - -{ Data types for all compilers } -type - PPUInt8Array = ^PUInt8Array; - PUInt8Array = ^TUInt8Array; - TUInt8Array = array [0..MAXINT shr 1] of cuint8; - - ppcuint8 = ^pcuint8; - - { "The following type designates an unsigned integer type [or signed respectivly] - with the property that any valid pointer to void can be - converted to this type, then converted back to a pointer - to void, and the result will compare equal to the original - pointer: uintptr_t" - Source: https://pubs.opengroup.org/onlinepubs/000095399/basedefs/stdint.h.html - } - {$IFNDEF FPC} - cuintptr_t = UIntPtr; - {$EXTERNALSYM cuintptr_t} - cintptr_t = IntPtr; - {$EXTERNALSYM cintptr_t} - {$ELSE} - cuintptr_t = PtrUInt; - {$EXTERNALSYM cuintptr_t} - cintptr_t = PtrInt; - {$EXTERNALSYM cintptr_t} - {$ENDIF} - - {$IFDEF WANT_CWCHAR_T} - (* wchar_t is the "wide character" type of the C language. - * The size of this type is platform- and compiler-dependent. - * - * While FPC does have it's own "wide character" type, System.WideChar, - * that one is defined as always being 16-bits, so we can't re-use it here. - * - * When using FPC on Unices, the UnixType unit provides a wchar_t definition. - * - * On other systems/compiler combos, let's just go - * by what the CPP reference wiki claims, i.e: - * - wchar_t is 16-bits on Windows - * - wchar_t is 32-bits on Linux "and many other non-Windows systems" - * - * See: https://en.cppreference.com/w/cpp/language/types#Character_types - *) - {$IF DEFINED(FPC) AND DEFINED(UNIX)} - cwchar_t = UnixType.wchar_t; - {$ELSE} - {$IF DEFINED(WIN32) OR DEFINED(WIN64)} - cwchar_t = cuint16; - {$ELSE} - cwchar_t = cuint32; - {$ENDIF} - {$ENDIF} - {$EXTERNALSYM cwchar_t} - pcwchar_t = ^cwchar_t; - {$ENDIF} +// C data types + +{ + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + Pascal-Header-Conversion + Copyright (C) 2012-2020 Tim Blume aka End/EV1313 + + SDL2-for-Pascal + Copyright (C) 2020-2021 PGD Community + + This file is part of the project above. It has solely the purpose + to map common C data types correctly by Pascal compilers. + + FPC: Most C data types are found in the native ctypes unit. + Delphi + others: Relies on this file for C data type mapping. + + These native C types should be strictly separated from + types defined by SDL which can be found in sdlstdinc.inc. +} + +{$IFNDEF FPC} +type + DWord = LongWord; + + ppcbool = ^pcbool; + pcbool = ^cbool; + cbool = LongBool; + {$EXTERNALSYM cbool} + + ppcint8 = ^pcint8; + pcint8 = ^cint8; + cint8 = ShortInt; + {$EXTERNALSYM cint8} + + pcuint8 = ^cuint8; + cuint8 = Byte; + {$EXTERNALSYM cuint8} + + ppcint16 = ^pcint16; + pcint16 = ^cint16; + cint16 = SmallInt; + {$EXTERNALSYM cint16} + + ppcuint16 = ^pcuint16; + pcuint16 = ^cuint16; + cuint16 = Word; + {$EXTERNALSYM cuint16} + + ppcushort = ^pcushort; + pcushort = ^cushort; + cushort = Word; + {$EXTERNALSYM cushort} + + ppcint32 = ^pcint32; + pcint32 = ^cint32; + cint32 = LongInt; + {$EXTERNALSYM cint32} + + ppcuint32 = ^pcuint32; + pcuint32 = ^cuint32; + cuint32 = LongWord; + {$EXTERNALSYM cuint32} + + {$IFNDEF Has_Int64} + ppcint64 = ^pcint64; + pcint64 = ^cint64; + cint64 = record + hi: cuint32; + lo: cuint32; + end; + {$EXTERNALSYM cint64} + + ppcuint64 = ^pcuint64; + pcuint64 = ^cuint64; + cuint64 = record + hi: cuint32; + lo: cuint32; + end; + {$EXTERNALSYM cuint64} + {$ELSE} + ppcint64 = ^pcint64; + pcint64 = ^cint64; + cint64 = Int64; + {$EXTERNALSYM cint64} + + ppcuint64 = ^pcuint64; + pcuint64 = ^cuint64; + cuint64 = UInt64; + {$EXTERNALSYM cuint64} + {$ENDIF} + + ppcsize_t = ^pcsize_t; + pcsize_t = ^csize_t; + {$IFNDEF WIN64} + csize_t = cuint32; + {$ELSE} + csize_t = cuint64; + {$ENDIF} + {$EXTERNALSYM csize_t} + + ppcfloat = ^pcfloat; + pcfloat = ^cfloat; + cfloat = Single; + {$EXTERNALSYM cfloat} + + ppcdouble = ^pcdouble; + pcdouble = ^cdouble; + cdouble = Double; + {$EXTERNALSYM cfloat} + + ppcint = ^pcint; + pcint = ^cint; + + ppcuint = ^pcuint; + pcuint = ^cuint; + + ppclong = ^pclong; + pclong = ^clong; + + ppculong = ^pculong; + pculong = ^culong; + { + Integer type sizes based on: + https://en.cppreference.com/w/c/language/arithmetic_types#Data_models + } + cint = cint32; + cuint = cuint32; + {$IF DEFINED(CPU32) OR DEFINED(CPU32BITS)} + clong = cint32; + culong = cuint32; + {$ELSE} // 64-bit + {$IFDEF MSWINDOWS} + clong = cint32; + culong = cuint32; + {$ELSE} + clong = cint64; + culong = cuint64; + {$ENDIF} + {$ENDIF} + {$EXTERNALSYM cint} + {$EXTERNALSYM cuint} + {$EXTERNALSYM clong} + {$EXTERNALSYM culong} + +{$ENDIF} + +{ Data types for all compilers } +type + PPUInt8Array = ^PUInt8Array; + PUInt8Array = ^TUInt8Array; + TUInt8Array = array [0..MAXINT shr 1] of cuint8; + + ppcuint8 = ^pcuint8; + + { "The following type designates an unsigned integer type [or signed respectivly] + with the property that any valid pointer to void can be + converted to this type, then converted back to a pointer + to void, and the result will compare equal to the original + pointer: uintptr_t" + Source: https://pubs.opengroup.org/onlinepubs/000095399/basedefs/stdint.h.html + } + {$IFNDEF FPC} + cuintptr_t = UIntPtr; + {$EXTERNALSYM cuintptr_t} + cintptr_t = IntPtr; + {$EXTERNALSYM cintptr_t} + {$ELSE} + cuintptr_t = PtrUInt; + {$EXTERNALSYM cuintptr_t} + cintptr_t = PtrInt; + {$EXTERNALSYM cintptr_t} + {$ENDIF} + + {$IFDEF WANT_CWCHAR_T} + (* wchar_t is the "wide character" type of the C language. + * The size of this type is platform- and compiler-dependent. + * + * While FPC does have it's own "wide character" type, System.WideChar, + * that one is defined as always being 16-bits, so we can't re-use it here. + * + * When using FPC on Unices, the UnixType unit provides a wchar_t definition. + * + * On other systems/compiler combos, let's just go + * by what the CPP reference wiki claims, i.e: + * - wchar_t is 16-bits on Windows + * - wchar_t is 32-bits on Linux "and many other non-Windows systems" + * + * See: https://en.cppreference.com/w/cpp/language/types#Character_types + *) + {$IF DEFINED(FPC) AND DEFINED(UNIX)} + cwchar_t = UnixType.wchar_t; + {$ELSE} + {$IF DEFINED(WIN32) OR DEFINED(WIN64)} + cwchar_t = cuint16; + {$ELSE} + cwchar_t = cuint32; + {$ENDIF} + {$ENDIF} + {$EXTERNALSYM cwchar_t} + pcwchar_t = ^cwchar_t; + {$ENDIF} diff --git a/units/jedi.inc b/units/jedi.inc index 0e305e70..23c4aa5e 100644 --- a/units/jedi.inc +++ b/units/jedi.inc @@ -1,516 +1,516 @@ -{ - This file (jedi.inc) is part of SDL2-for-Pascal. - It defines some variables for several Pascal-Compilers and OS-versions. - - It is based upon: - - Pascal-Header-Conversion - Copyright (c) 2012/13 Tim Blume aka End - - jedi-sdl.inc: Global Conditional Definitions for JEDI-SDL cross-compilation - Copyright (C) 2000 - 2013 Prof. Abimbola Olowofoyeku and Tim Blume - See: https://github.com/ev1313/ - - 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. -} - -{.$define Debug} { uncomment for debugging } - -{$IFNDEF FPC} - {$IFDEF Debug} - {$F+,D+,Q-,L+,R+,I-,S+,Y+,A+} - {$ELSE} - {$F+,Q-,R-,S-,I-,A+} - {$ENDIF} -{$ELSE} - {$MODE DELPHI} - {$IFDEF VER3_2} - {$WARN 6058 OFF} { Turn off compiler hint: Call to subroutine "..." marked as inline is not inlined - See: https://forum.lazarus.freepascal.org/index.php?topic=50585.0 } - {$ENDIF} -{$ENDIF} - -{$IFDEF LINUX} -{$DEFINE UNIX} -{$ENDIF} - -{$IFDEF ver70} - {$IFDEF Windows} - {$DEFINE Win16} - {$ENDIF Windows} - {$IFDEF MSDOS} - {$DEFINE NO_EXPORTS} - {$ENDIF MSDOS} - {$IFDEF DPMI} - {$DEFINE BP_DPMI} - {$ENDIF} - {$DEFINE OS_16_BIT} - {$DEFINE __OS_DOS__} -{$ENDIF ver70} - -{$IFDEF ver80} - {$DEFINE Delphi} {Delphi 1.x} - {$DEFINE Delphi16} - {$DEFINE Win16} - {$DEFINE OS_16_BIT} - {$DEFINE __OS_DOS__} -{$ENDIF ver80} - -{$IFDEF ver90} - {$DEFINE Delphi} {Delphi 2.x} - {$DEFINE WIN32} - {$DEFINE WINDOWS} -{$ENDIF ver90} - -{$IFDEF ver100} - {$DEFINE Delphi} {Delphi 3.x} - {$DEFINE WIN32} - {$DEFINE WINDOWS} -{$ENDIF ver100} - -{$IFDEF ver93} - {$DEFINE Delphi} {C++ Builder 1.x} - {$DEFINE WINDOWS} -{$ENDIF ver93} - -{$IFDEF ver110} - {$DEFINE Delphi} {C++ Builder 3.x} - {$DEFINE WINDOWS} -{$ENDIF ver110} - -{$IFDEF ver120} - {$DEFINE Delphi} {Delphi 4.x} - {$DEFINE Delphi4UP} - {$DEFINE Has_Int64} - {$DEFINE WINDOWS} -{$ENDIF ver120} - -{$IFDEF ver130} - {$DEFINE Delphi} {Delphi / C++ Builder 5.x} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Has_Int64} - {$DEFINE WINDOWS} -{$ENDIF ver130} - -{$IFDEF ver140} - {$DEFINE Delphi} {Delphi / C++ Builder 6.x} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Has_Int64} - {$DEFINE HAS_TYPES} -{$ENDIF ver140} - -{$IFDEF ver150} - {$DEFINE Delphi} {Delphi 7.x} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver150} - -{$IFDEF ver160} - {$DEFINE Delphi} {Delphi 8.x} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver160} - -{$IFDEF ver170} - {$DEFINE Delphi} {Delphi / C++ Builder 2005} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver170} - -{$IFDEF ver180} - {$DEFINE Delphi} {Delphi / C++ Builder 2006 / 2007} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver180} - -{$IFDEF ver185} - {$DEFINE Delphi} {Delphi / C++ Builder 2007} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$DEFINE Delphi11UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver185} - -{$IFDEF ver190} - {$DEFINE Delphi} {Delphi / C++ Builder 2007 } - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$DEFINE Delphi11UP} - {$DEFINE Delphi12UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver190} - -{$IFDEF ver200} - {$DEFINE Delphi} {Delphi / C++ Builder 2009 } - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$DEFINE Delphi11UP} - {$DEFINE Delphi12UP} - {$DEFINE Delphi13UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver200} - -{$IFDEF ver210} - {$DEFINE Delphi} {Delphi / C++ Builder 2010} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$DEFINE Delphi11UP} - {$DEFINE Delphi12UP} - {$DEFINE Delphi13UP} - {$DEFINE Delphi14UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver210} - -{$IFDEF ver220} - {$DEFINE Delphi} {Delphi / C++ Builder XE} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$DEFINE Delphi11UP} - {$DEFINE Delphi12UP} - {$DEFINE Delphi13UP} - {$DEFINE Delphi14UP} - {$DEFINE Delphi15UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver220} - -{$IFDEF ver230} - {$DEFINE Delphi} {Delphi / C++ Builder XE2} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$DEFINE Delphi11UP} - {$DEFINE Delphi12UP} - {$DEFINE Delphi13UP} - {$DEFINE Delphi14UP} - {$DEFINE Delphi15UP} - {$DEFINE Delphi16UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver230} - -{$IFDEF ver240} - {$DEFINE Delphi} {Delphi / C++ Builder XE4} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$DEFINE Delphi11UP} - {$DEFINE Delphi12UP} - {$DEFINE Delphi13UP} - {$DEFINE Delphi14UP} - {$DEFINE Delphi15UP} - {$DEFINE Delphi16UP} - {$DEFINE Delphi17UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver240} - -{$IFDEF ver250} - {$DEFINE Delphi} {Delphi / C++ Builder XE5} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$DEFINE Delphi11UP} - {$DEFINE Delphi12UP} - {$DEFINE Delphi13UP} - {$DEFINE Delphi14UP} - {$DEFINE Delphi15UP} - {$DEFINE Delphi16UP} - {$DEFINE Delphi17UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver250} - -{$IFDEF ver260} - {$DEFINE Delphi} {Delphi / C++ Builder XE6} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$DEFINE Delphi11UP} - {$DEFINE Delphi12UP} - {$DEFINE Delphi13UP} - {$DEFINE Delphi14UP} - {$DEFINE Delphi15UP} - {$DEFINE Delphi16UP} - {$DEFINE Delphi17UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver260} - -{$IFDEF ver270} - {$DEFINE Delphi} {Delphi / C++ Builder XE7} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$DEFINE Delphi11UP} - {$DEFINE Delphi12UP} - {$DEFINE Delphi13UP} - {$DEFINE Delphi14UP} - {$DEFINE Delphi15UP} - {$DEFINE Delphi16UP} - {$DEFINE Delphi17UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver270} - -{$IFNDEF FPC} -{$IF CompilerVersion > 27} - {$DEFINE Delphi} {Delphi / C++ Builder} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$DEFINE Delphi11UP} - {$DEFINE Delphi12UP} - {$DEFINE Delphi13UP} - {$DEFINE Delphi14UP} - {$DEFINE Delphi15UP} - {$DEFINE Delphi16UP} - {$DEFINE Delphi17UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$IFEND} -{$ENDIF} - -{*************** define 16/32/64 Bit ********************} - -{$IFDEF WIN16} - {$DEFINE 16BIT} - {$DEFINE WINDOWS} -{$ELSE} - {$IFDEF WIN32} - {$DEFINE 32BIT} - {$DEFINE WINDOWS} - {$ELSE} - {$IFDEF WIN64} - {$DEFINE 64BIT} - {$DEFINE WINDOWS} - {$ELSE} - //TODO!! - {$DEFINE 32BIT} - {$ENDIF} - {$ENDIF} -{$ENDIF} - -{$IFDEF Delphi} - {$DEFINE USE_STDCALL} - {$IFDEF 32Bit} - {$DEFINE DELPHI32} - {$ELSE} - {$IFDEF 64Bit} - {$DEFINE DELPHI64} - {$ELSE} - {$DEFINE DELPHI16} - {$ENDIF} - {$ENDIF} - //{$ALIGN ON} -{$ENDIF Delphi} - -{$IFDEF FPC} - {$H+} - {$PACKRECORDS C} // Added for record - {$PACKENUM DEFAULT} // Added for c-like enumerators - {$MACRO ON} // Added For OpenGL - {$DEFINE Delphi} - {$DEFINE UseAT} - {$UNDEF USE_STDCALL} - {$DEFINE OS_BigMem} - {$DEFINE NO_EXPORTS} - {$DEFINE Has_UInt64} - {$DEFINE Has_Int64} - {$DEFINE Has_Native} - {$DEFINE NOCRT} - {$IFDEF UNIX} - {$DEFINE fpc_unix} - {$ELSE} - {$DEFINE __OS_DOS__} - {$ENDIF} - {$IFDEF WIN32} - {$DEFINE UseWin} - {$ENDIF} - {$DEFINE HAS_TYPES} -{$ENDIF FPC} - -{$IFDEF Win16} - {$K+} {smart callbacks} -{$ENDIF Win16} - -{$IFDEF Win32} - {$DEFINE OS_BigMem} -{$ENDIF Win32} - -{ ************************** dos/dos-like platforms **************} -{$IFDEF Windows} - {$DEFINE __OS_DOS__} - {$DEFINE UseWin} - {$DEFINE MSWINDOWS} -{$ENDIF Delphi} - -{$IFDEF OS2} - {$DEFINE __OS_DOS__} - {$DEFINE Can_Use_DLL} -{$ENDIF Delphi} - -{$IFDEF UseWin} - {$DEFINE Can_Use_DLL} -{$ENDIF} - -{$IFDEF Win16} - {$DEFINE Can_Use_DLL} -{$ENDIF} - -{$IFDEF BP_DPMI} - {$DEFINE Can_Use_DLL} -{$ENDIF} - -{$IFDEF USE_STDCALL} - {$DEFINE BY_NAME} -{$ENDIF} - -{*************** define LITTLE ENDIAN platforms ********************} - - -{$IFDEF Delphi} - {$DEFINE IA32} -{$ENDIF} - -{$IFDEF FPC} - {$IFDEF FPC_LITTLE_ENDIAN} - {$DEFINE IA32} - {$ENDIF} -{$ENDIF} +{ + This file (jedi.inc) is part of SDL2-for-Pascal. + It defines some variables for several Pascal-Compilers and OS-versions. + + It is based upon: + + Pascal-Header-Conversion + Copyright (c) 2012/13 Tim Blume aka End + + jedi-sdl.inc: Global Conditional Definitions for JEDI-SDL cross-compilation + Copyright (C) 2000 - 2013 Prof. Abimbola Olowofoyeku and Tim Blume + See: https://github.com/ev1313/ + + 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. +} + +{.$define Debug} { uncomment for debugging } + +{$IFNDEF FPC} + {$IFDEF Debug} + {$F+,D+,Q-,L+,R+,I-,S+,Y+,A+} + {$ELSE} + {$F+,Q-,R-,S-,I-,A+} + {$ENDIF} +{$ELSE} + {$MODE DELPHI} + {$IFDEF VER3_2} + {$WARN 6058 OFF} { Turn off compiler hint: Call to subroutine "..." marked as inline is not inlined + See: https://forum.lazarus.freepascal.org/index.php?topic=50585.0 } + {$ENDIF} +{$ENDIF} + +{$IFDEF LINUX} +{$DEFINE UNIX} +{$ENDIF} + +{$IFDEF ver70} + {$IFDEF Windows} + {$DEFINE Win16} + {$ENDIF Windows} + {$IFDEF MSDOS} + {$DEFINE NO_EXPORTS} + {$ENDIF MSDOS} + {$IFDEF DPMI} + {$DEFINE BP_DPMI} + {$ENDIF} + {$DEFINE OS_16_BIT} + {$DEFINE __OS_DOS__} +{$ENDIF ver70} + +{$IFDEF ver80} + {$DEFINE Delphi} {Delphi 1.x} + {$DEFINE Delphi16} + {$DEFINE Win16} + {$DEFINE OS_16_BIT} + {$DEFINE __OS_DOS__} +{$ENDIF ver80} + +{$IFDEF ver90} + {$DEFINE Delphi} {Delphi 2.x} + {$DEFINE WIN32} + {$DEFINE WINDOWS} +{$ENDIF ver90} + +{$IFDEF ver100} + {$DEFINE Delphi} {Delphi 3.x} + {$DEFINE WIN32} + {$DEFINE WINDOWS} +{$ENDIF ver100} + +{$IFDEF ver93} + {$DEFINE Delphi} {C++ Builder 1.x} + {$DEFINE WINDOWS} +{$ENDIF ver93} + +{$IFDEF ver110} + {$DEFINE Delphi} {C++ Builder 3.x} + {$DEFINE WINDOWS} +{$ENDIF ver110} + +{$IFDEF ver120} + {$DEFINE Delphi} {Delphi 4.x} + {$DEFINE Delphi4UP} + {$DEFINE Has_Int64} + {$DEFINE WINDOWS} +{$ENDIF ver120} + +{$IFDEF ver130} + {$DEFINE Delphi} {Delphi / C++ Builder 5.x} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Has_Int64} + {$DEFINE WINDOWS} +{$ENDIF ver130} + +{$IFDEF ver140} + {$DEFINE Delphi} {Delphi / C++ Builder 6.x} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Has_Int64} + {$DEFINE HAS_TYPES} +{$ENDIF ver140} + +{$IFDEF ver150} + {$DEFINE Delphi} {Delphi 7.x} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver150} + +{$IFDEF ver160} + {$DEFINE Delphi} {Delphi 8.x} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver160} + +{$IFDEF ver170} + {$DEFINE Delphi} {Delphi / C++ Builder 2005} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver170} + +{$IFDEF ver180} + {$DEFINE Delphi} {Delphi / C++ Builder 2006 / 2007} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver180} + +{$IFDEF ver185} + {$DEFINE Delphi} {Delphi / C++ Builder 2007} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$DEFINE Delphi11UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver185} + +{$IFDEF ver190} + {$DEFINE Delphi} {Delphi / C++ Builder 2007 } + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$DEFINE Delphi11UP} + {$DEFINE Delphi12UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver190} + +{$IFDEF ver200} + {$DEFINE Delphi} {Delphi / C++ Builder 2009 } + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$DEFINE Delphi11UP} + {$DEFINE Delphi12UP} + {$DEFINE Delphi13UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver200} + +{$IFDEF ver210} + {$DEFINE Delphi} {Delphi / C++ Builder 2010} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$DEFINE Delphi11UP} + {$DEFINE Delphi12UP} + {$DEFINE Delphi13UP} + {$DEFINE Delphi14UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver210} + +{$IFDEF ver220} + {$DEFINE Delphi} {Delphi / C++ Builder XE} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$DEFINE Delphi11UP} + {$DEFINE Delphi12UP} + {$DEFINE Delphi13UP} + {$DEFINE Delphi14UP} + {$DEFINE Delphi15UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver220} + +{$IFDEF ver230} + {$DEFINE Delphi} {Delphi / C++ Builder XE2} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$DEFINE Delphi11UP} + {$DEFINE Delphi12UP} + {$DEFINE Delphi13UP} + {$DEFINE Delphi14UP} + {$DEFINE Delphi15UP} + {$DEFINE Delphi16UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver230} + +{$IFDEF ver240} + {$DEFINE Delphi} {Delphi / C++ Builder XE4} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$DEFINE Delphi11UP} + {$DEFINE Delphi12UP} + {$DEFINE Delphi13UP} + {$DEFINE Delphi14UP} + {$DEFINE Delphi15UP} + {$DEFINE Delphi16UP} + {$DEFINE Delphi17UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver240} + +{$IFDEF ver250} + {$DEFINE Delphi} {Delphi / C++ Builder XE5} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$DEFINE Delphi11UP} + {$DEFINE Delphi12UP} + {$DEFINE Delphi13UP} + {$DEFINE Delphi14UP} + {$DEFINE Delphi15UP} + {$DEFINE Delphi16UP} + {$DEFINE Delphi17UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver250} + +{$IFDEF ver260} + {$DEFINE Delphi} {Delphi / C++ Builder XE6} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$DEFINE Delphi11UP} + {$DEFINE Delphi12UP} + {$DEFINE Delphi13UP} + {$DEFINE Delphi14UP} + {$DEFINE Delphi15UP} + {$DEFINE Delphi16UP} + {$DEFINE Delphi17UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver260} + +{$IFDEF ver270} + {$DEFINE Delphi} {Delphi / C++ Builder XE7} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$DEFINE Delphi11UP} + {$DEFINE Delphi12UP} + {$DEFINE Delphi13UP} + {$DEFINE Delphi14UP} + {$DEFINE Delphi15UP} + {$DEFINE Delphi16UP} + {$DEFINE Delphi17UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver270} + +{$IFNDEF FPC} +{$IF CompilerVersion > 27} + {$DEFINE Delphi} {Delphi / C++ Builder} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$DEFINE Delphi11UP} + {$DEFINE Delphi12UP} + {$DEFINE Delphi13UP} + {$DEFINE Delphi14UP} + {$DEFINE Delphi15UP} + {$DEFINE Delphi16UP} + {$DEFINE Delphi17UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$IFEND} +{$ENDIF} + +{*************** define 16/32/64 Bit ********************} + +{$IFDEF WIN16} + {$DEFINE 16BIT} + {$DEFINE WINDOWS} +{$ELSE} + {$IFDEF WIN32} + {$DEFINE 32BIT} + {$DEFINE WINDOWS} + {$ELSE} + {$IFDEF WIN64} + {$DEFINE 64BIT} + {$DEFINE WINDOWS} + {$ELSE} + //TODO!! + {$DEFINE 32BIT} + {$ENDIF} + {$ENDIF} +{$ENDIF} + +{$IFDEF Delphi} + {$DEFINE USE_STDCALL} + {$IFDEF 32Bit} + {$DEFINE DELPHI32} + {$ELSE} + {$IFDEF 64Bit} + {$DEFINE DELPHI64} + {$ELSE} + {$DEFINE DELPHI16} + {$ENDIF} + {$ENDIF} + //{$ALIGN ON} +{$ENDIF Delphi} + +{$IFDEF FPC} + {$H+} + {$PACKRECORDS C} // Added for record + {$PACKENUM DEFAULT} // Added for c-like enumerators + {$MACRO ON} // Added For OpenGL + {$DEFINE Delphi} + {$DEFINE UseAT} + {$UNDEF USE_STDCALL} + {$DEFINE OS_BigMem} + {$DEFINE NO_EXPORTS} + {$DEFINE Has_UInt64} + {$DEFINE Has_Int64} + {$DEFINE Has_Native} + {$DEFINE NOCRT} + {$IFDEF UNIX} + {$DEFINE fpc_unix} + {$ELSE} + {$DEFINE __OS_DOS__} + {$ENDIF} + {$IFDEF WIN32} + {$DEFINE UseWin} + {$ENDIF} + {$DEFINE HAS_TYPES} +{$ENDIF FPC} + +{$IFDEF Win16} + {$K+} {smart callbacks} +{$ENDIF Win16} + +{$IFDEF Win32} + {$DEFINE OS_BigMem} +{$ENDIF Win32} + +{ ************************** dos/dos-like platforms **************} +{$IFDEF Windows} + {$DEFINE __OS_DOS__} + {$DEFINE UseWin} + {$DEFINE MSWINDOWS} +{$ENDIF Delphi} + +{$IFDEF OS2} + {$DEFINE __OS_DOS__} + {$DEFINE Can_Use_DLL} +{$ENDIF Delphi} + +{$IFDEF UseWin} + {$DEFINE Can_Use_DLL} +{$ENDIF} + +{$IFDEF Win16} + {$DEFINE Can_Use_DLL} +{$ENDIF} + +{$IFDEF BP_DPMI} + {$DEFINE Can_Use_DLL} +{$ENDIF} + +{$IFDEF USE_STDCALL} + {$DEFINE BY_NAME} +{$ENDIF} + +{*************** define LITTLE ENDIAN platforms ********************} + + +{$IFDEF Delphi} + {$DEFINE IA32} +{$ENDIF} + +{$IFDEF FPC} + {$IFDEF FPC_LITTLE_ENDIAN} + {$DEFINE IA32} + {$ENDIF} +{$ENDIF} diff --git a/units/sdl.inc b/units/sdl.inc index 0f0a1b31..2bfaf96b 100644 --- a/units/sdl.inc +++ b/units/sdl.inc @@ -1,74 +1,114 @@ -// based on "sdl.h" - -type - PPSDL_Init = ^PSDL_Init; - PSDL_Init = ^TSDL_Init; - TSDL_Init = type cuint32; - -const - SDL_INIT_TIMER = TSDL_Init($00000001); - {$EXTERNALSYM SDL_INIT_TIMER} - SDL_INIT_AUDIO = TSDL_Init($00000010); - {$EXTERNALSYM SDL_INIT_AUDIO} - SDL_INIT_VIDEO = TSDL_Init($00000020); // SDL_INIT_VIDEO implies SDL_INIT_EVENTS - {$EXTERNALSYM SDL_INIT_VIDEO} - SDL_INIT_JOYSTICK = TSDL_Init($00000200); // SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS - {$EXTERNALSYM SDL_INIT_JOYSTICK} - SDL_INIT_HAPTIC = TSDL_Init($00001000); - {$EXTERNALSYM SDL_INIT_HAPTIC} - SDL_INIT_GAMECONTROLLER = TSDL_Init($00002000); //turn on game controller also implicitly does JOYSTICK - {$EXTERNALSYM SDL_INIT_GAMECONTROLLER} // SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK - SDL_INIT_EVENTS = TSDL_Init($00004000); - {$EXTERNALSYM SDL_INIT_EVENTS} - SDL_INIT_SENSOR = TSDL_Init($00008000); - {$EXTERNALSYM SDL_INIT_SENSOR} - SDL_INIT_NOPARACHUTE = TSDL_Init($00100000); //Don't catch fatal signals - {$EXTERNALSYM SDL_INIT_NOPARACHUTE} // compatibility; this flag is ignored. - SDL_INIT_EVERYTHING = TSDL_Init( - 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 or - SDL_INIT_SENSOR - ); - {$EXTERNALSYM SDL_INIT_EVERYTHING} - -{** - * This function initializes the subsystems specified by flags - * Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup - * signal handlers for some commonly ignored fatal signals (like SIGSEGV). - *} -function SDL_Init(flags: TSDL_Init): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Init' {$ENDIF} {$ENDIF}; - -{** - * This function initializes specific SDL subsystems - *} -function SDL_InitSubSystem(flags: TSDL_Init): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_InitSubSystem' {$ENDIF} {$ENDIF}; - -{** - * This function cleans up specific SDL subsystems - *} -procedure SDL_QuitSubSystem(flags: TSDL_Init); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_QuitSubSystem' {$ENDIF} {$ENDIF}; - -{** - * This function returns a mask of the specified subsystems which have - * previously been initialized. - * - * If flags is 0, it returns a mask of all initialized subsystems. - *} -function SDL_WasInit(flags: TSDL_Init): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WasInit' {$ENDIF} {$ENDIF}; - -{** - * This function cleans up all initialized subsystems. You should - * call it upon all exit conditions. - *} -procedure SDL_Quit(); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Quit' {$ENDIF} {$ENDIF}; - +// based on "sdl.h" + +type + PPSDL_Init = ^PSDL_Init; + PSDL_Init = ^TSDL_Init; + TSDL_Init = type cuint32; + +const + SDL_INIT_TIMER = TSDL_Init($00000001); + {$EXTERNALSYM SDL_INIT_TIMER} + SDL_INIT_AUDIO = TSDL_Init($00000010); + {$EXTERNALSYM SDL_INIT_AUDIO} + SDL_INIT_VIDEO = TSDL_Init($00000020); // SDL_INIT_VIDEO implies SDL_INIT_EVENTS + {$EXTERNALSYM SDL_INIT_VIDEO} + SDL_INIT_JOYSTICK = TSDL_Init($00000200); // SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS + {$EXTERNALSYM SDL_INIT_JOYSTICK} + SDL_INIT_HAPTIC = TSDL_Init($00001000); + {$EXTERNALSYM SDL_INIT_HAPTIC} + SDL_INIT_GAMECONTROLLER = TSDL_Init($00002000); //turn on game controller also implicitly does JOYSTICK + {$EXTERNALSYM SDL_INIT_GAMECONTROLLER} // SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK + SDL_INIT_EVENTS = TSDL_Init($00004000); + {$EXTERNALSYM SDL_INIT_EVENTS} + SDL_INIT_SENSOR = TSDL_Init($00008000); + {$EXTERNALSYM SDL_INIT_SENSOR} + SDL_INIT_NOPARACHUTE = TSDL_Init($00100000); //Don't catch fatal signals + {$EXTERNALSYM SDL_INIT_NOPARACHUTE} // compatibility; this flag is ignored. + SDL_INIT_EVERYTHING = TSDL_Init( + 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 or + SDL_INIT_SENSOR + ); + {$EXTERNALSYM SDL_INIT_EVERYTHING} + +{** + * This function initializes the subsystems specified by flags + * Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup + * signal handlers for some commonly ignored fatal signals (like SIGSEGV). + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_Init_fun = function(flags: TSDL_Init): cint; cdecl; +Var + SDL_Init : TSDL_Init_fun = Nil; +{$else} + +function SDL_Init(flags: TSDL_Init): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Init' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * This function initializes specific SDL subsystems + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_InitSubSystem_fun = function(flags: TSDL_Init): cint; cdecl; +Var + SDL_InitSubSystem : TSDL_InitSubSystem_fun = Nil; +{$else} + +function SDL_InitSubSystem(flags: TSDL_Init): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_InitSubSystem' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * This function cleans up specific SDL subsystems + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_QuitSubSystem_proc = procedure(flags: TSDL_Init); cdecl; +Var + SDL_QuitSubSystem : TSDL_QuitSubSystem_proc = Nil; +{$else} + +procedure SDL_QuitSubSystem(flags: TSDL_Init); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_QuitSubSystem' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * This function returns a mask of the specified subsystems which have + * previously been initialized. + * + * If flags is 0, it returns a mask of all initialized subsystems. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WasInit_fun = function(flags: TSDL_Init): cuint32; cdecl; +Var + SDL_WasInit : TSDL_WasInit_fun = Nil; +{$else} + +function SDL_WasInit(flags: TSDL_Init): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WasInit' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * This function cleans up all initialized subsystems. You should + * call it upon all exit conditions. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_Quit_proc = procedure(); cdecl; +Var + SDL_Quit : TSDL_Quit_proc = Nil; +{$else} + +procedure SDL_Quit(); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Quit' {$ENDIF} {$ENDIF}; +{$endif} + diff --git a/units/sdl2.pas b/units/sdl2.pas index c6077030..10f68b22 100644 --- a/units/sdl2.pas +++ b/units/sdl2.pas @@ -61,6 +61,30 @@ {$I jedi.inc} +(* + * If you get a compiler error with missing file + * just create a file namend "sdl2_cfg.inc" in your project folder and + * insert the following content: + * + * ---------- Content of file ---------- + + {* + * set this define if you want to use dynamic linking instead of static linking + * ! Attention ! + * Not all functions are "ported" yet, so use is on own risk + * port missing functions. + *} + {.$DEFINE SDL_DYNAMIC_LINKING} + + * ---------- End content of file ---------- + * + * ! Attention ! + * If you use the dynamic link feature, don't forget to call the SDL_LoadLib + * function. + *) + +{$I sdl2_cfg.inc} + interface {$IFDEF WINDOWS} @@ -169,6 +193,11 @@ interface {$I sdlsystem.inc} // 2.24.0 {$I sdl.inc} // 2.0.14 +{$ifdef SDL_DYNAMIC_LINKING} +Function SDL_LoadLib(LibFilename: String): Boolean; +Procedure SDL_UnLoadLib(); +{$endif} + implementation (* @@ -183,7 +212,12 @@ implementation {$ELSE} AnsiStrings {$ENDIF} - ; + {$ifdef SDL_DYNAMIC_LINKING} + , dynlibs + {$endif} + ; + +{$I sdl_dnymic_linking.inc} // Macros from "sdl_version.h" procedure SDL_VERSION(out x: TSDL_Version); @@ -219,13 +253,13 @@ function SDL_Button(X: cint): cint; {$IFDEF WINDOWS} //from "sdl_thread.h" -function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PAnsiChar; +function SDL_CreateThread2(fn: TSDL_ThreadFunction; name: PAnsiChar; data: Pointer): PSDL_Thread; overload; begin Result := SDL_CreateThread(fn,name,data,nil,nil); end; -function SDL_CreateThreadWithStackSize(fn: TSDL_ThreadFunction; +function SDL_CreateThreadWithStackSize2(fn: TSDL_ThreadFunction; name: PAnsiChar; const stacksize: csize_t; data: Pointer ): PSDL_Thread; overload; begin @@ -480,4 +514,11 @@ function SDL_GameControllerAddMappingsFromFile(const FilePath: PAnsiChar Result := SDL_GameControllerAddMappingsFromRW(SDL_RWFromFile(FilePath, 'rb'), 1) end; + +{$IFDEF SDL_DYNAMIC_LINKING} + +Finalization + SDL_UnLoadLib(); +{$ENDIF} + end. diff --git a/units/sdl_dnymic_linking.inc b/units/sdl_dnymic_linking.inc new file mode 100644 index 00000000..b7999669 --- /dev/null +++ b/units/sdl_dnymic_linking.inc @@ -0,0 +1,1143 @@ + +{$IFDEF SDL_DYNAMIC_LINKING} + +Var + LibHandle: TLibHandle = 0; + +Function SDL_LoadLib(LibFilename: String): Boolean; +Begin + result := false; + SDL_UnLoadLib(); + If LibFilename = '' Then + LibFilename := SDL_LibName; + LibHandle := LoadLibrary(LibFilename); + If LibHandle <> 0 Then Begin + (* + * Das hier ist nicht mal Ansatzweise fertig, aber es reicht um SDL2 zu initialisieren und einen Joystick ab zu fragen ;) + *) + result := true; + + SDL_Init := TSDL_Init_fun(GetProcAddress(LibHandle, 'SDL_Init')); + If Not assigned(SDL_Init) Then result := false; + SDL_InitSubSystem := TSDL_InitSubSystem_fun(GetProcAddress(LibHandle, 'SDL_InitSubSystem')); + If Not assigned(SDL_InitSubSystem) Then result := false; + SDL_QuitSubSystem := TSDL_QuitSubSystem_proc(GetProcAddress(LibHandle, 'SDL_QuitSubSystem')); + If Not assigned(SDL_QuitSubSystem) Then result := false; + SDL_WasInit := TSDL_WasInit_fun(GetProcAddress(LibHandle, 'SDL_WasInit')); + If Not assigned(SDL_WasInit) Then result := false; + SDL_Quit := TSDL_Quit_proc(GetProcAddress(LibHandle, 'SDL_Quit')); + If Not assigned(SDL_Quit) Then result := false; + SDL_GetAudioDriver := TSDL_GetAudioDriver_fun(GetProcAddress(LibHandle, 'SDL_GetAudioDriver')); + If Not assigned(SDL_GetAudioDriver) Then result := false; + SDL_AudioInit := TSDL_AudioInit_fun(GetProcAddress(LibHandle, 'SDL_AudioInit')); + If Not assigned(SDL_AudioInit) Then result := false; + SDL_OpenAudio := TSDL_OpenAudio_fun(GetProcAddress(LibHandle, 'SDL_OpenAudio')); + If Not assigned(SDL_OpenAudio) Then result := false; + SDL_GetNumAudioDevices := TSDL_GetNumAudioDevices_fun(GetProcAddress(LibHandle, 'SDL_GetNumAudioDevices')); + If Not assigned(SDL_GetNumAudioDevices) Then result := false; + SDL_GetAudioDeviceName := TSDL_GetAudioDeviceName_fun(GetProcAddress(LibHandle, 'SDL_GetAudioDeviceName')); + If Not assigned(SDL_GetAudioDeviceName) Then result := false; + //SDL_GetAudioDeviceSpec := TSDL_GetAudioDeviceSpec_fun(GetProcAddress(LibHandle, 'SDL_GetAudioDeviceSpec')); // TODO: Das geht nicht, warum ? + //If Not assigned(SDL_GetAudioDeviceSpec) Then result := false; + //SDL_GetDefaultAudioInfo := TSDL_GetDefaultAudioInfo_fun(GetProcAddress(LibHandle, 'SDL_GetDefaultAudioInfo')); // TODO: Das geht nicht, warum ? + //If Not assigned(SDL_GetDefaultAudioInfo) Then result := false; + SDL_OpenAudioDevice := TSDL_OpenAudioDevice_fun(GetProcAddress(LibHandle, 'SDL_OpenAudioDevice')); + If Not assigned(SDL_OpenAudioDevice) Then result := false; + SDL_GetAudioDeviceStatus := TSDL_GetAudioDeviceStatus_fun(GetProcAddress(LibHandle, 'SDL_GetAudioDeviceStatus')); + If Not assigned(SDL_GetAudioDeviceStatus) Then result := false; + SDL_PauseAudio := TSDL_PauseAudio_proc(GetProcAddress(LibHandle, 'SDL_PauseAudio')); + If Not assigned(SDL_PauseAudio) Then result := false; + SDL_PauseAudioDevice := TSDL_PauseAudioDevice_proc(GetProcAddress(LibHandle, 'SDL_PauseAudioDevice')); + If Not assigned(SDL_PauseAudioDevice) Then result := false; + SDL_LoadWAV_RW := TSDL_LoadWAV_RW_fun(GetProcAddress(LibHandle, 'SDL_LoadWAV_RW')); + If Not assigned(SDL_LoadWAV_RW) Then result := false; + SDL_FreeWAV := TSDL_FreeWAV_proc(GetProcAddress(LibHandle, 'SDL_FreeWAV')); + If Not assigned(SDL_FreeWAV) Then result := false; + SDL_BuildAudioCVT := TSDL_BuildAudioCVT_fun(GetProcAddress(LibHandle, 'SDL_BuildAudioCVT')); + If Not assigned(SDL_BuildAudioCVT) Then result := false; + SDL_ConvertAudio := TSDL_ConvertAudio_fun(GetProcAddress(LibHandle, 'SDL_ConvertAudio')); + If Not assigned(SDL_ConvertAudio) Then result := false; + SDL_NewAudioStream := TSDL_NewAudioStream_fun(GetProcAddress(LibHandle, 'SDL_NewAudioStream')); + If Not assigned(SDL_NewAudioStream) Then result := false; + SDL_AudioStreamPut := TSDL_AudioStreamPut_fun(GetProcAddress(LibHandle, 'SDL_AudioStreamPut')); + If Not assigned(SDL_AudioStreamPut) Then result := false; + SDL_AudioStreamGet := TSDL_AudioStreamGet_fun(GetProcAddress(LibHandle, 'SDL_AudioStreamGet')); + If Not assigned(SDL_AudioStreamGet) Then result := false; + SDL_AudioStreamAvailable := TSDL_AudioStreamAvailable_fun(GetProcAddress(LibHandle, 'SDL_AudioStreamAvailable')); + If Not assigned(SDL_AudioStreamAvailable) Then result := false; + SDL_AudioStreamFlush := TSDL_AudioStreamFlush_fun(GetProcAddress(LibHandle, 'SDL_AudioStreamFlush')); + If Not assigned(SDL_AudioStreamFlush) Then result := false; + SDL_AudioStreamClear := TSDL_AudioStreamClear_proc(GetProcAddress(LibHandle, 'SDL_AudioStreamClear')); + If Not assigned(SDL_AudioStreamClear) Then result := false; + SDL_FreeAudioStream := TSDL_FreeAudioStream_proc(GetProcAddress(LibHandle, 'SDL_FreeAudioStream')); + If Not assigned(SDL_FreeAudioStream) Then result := false; + SDL_MixAudio := TSDL_MixAudio_proc(GetProcAddress(LibHandle, 'SDL_MixAudio')); + If Not assigned(SDL_MixAudio) Then result := false; + SDL_MixAudioFormat := TSDL_MixAudioFormat_proc(GetProcAddress(LibHandle, 'SDL_MixAudioFormat')); + If Not assigned(SDL_MixAudioFormat) Then result := false; + SDL_QueueAudio := TSDL_QueueAudio_fun(GetProcAddress(LibHandle, 'SDL_QueueAudio')); + If Not assigned(SDL_QueueAudio) Then result := false; + SDL_DequeueAudio := TSDL_DequeueAudio_fun(GetProcAddress(LibHandle, 'SDL_DequeueAudio')); + If Not assigned(SDL_DequeueAudio) Then result := false; + SDL_GetQueuedAudioSize := TSDL_GetQueuedAudioSize_fun(GetProcAddress(LibHandle, 'SDL_GetQueuedAudioSize')); + If Not assigned(SDL_GetQueuedAudioSize) Then result := false; + SDL_ClearQueuedAudio := TSDL_ClearQueuedAudio_proc(GetProcAddress(LibHandle, 'SDL_ClearQueuedAudio')); + If Not assigned(SDL_ClearQueuedAudio) Then result := false; + SDL_LockAudioDevice := TSDL_LockAudioDevice_proc(GetProcAddress(LibHandle, 'SDL_LockAudioDevice')); + If Not assigned(SDL_LockAudioDevice) Then result := false; + SDL_UnlockAudioDevice := TSDL_UnlockAudioDevice_proc(GetProcAddress(LibHandle, 'SDL_UnlockAudioDevice')); + If Not assigned(SDL_UnlockAudioDevice) Then result := false; + SDL_CloseAudioDevice := TSDL_CloseAudioDevice_proc(GetProcAddress(LibHandle, 'SDL_CloseAudioDevice')); + If Not assigned(SDL_CloseAudioDevice) Then result := false; + SDL_ComposeCustomBlendMode := TSDL_ComposeCustomBlendMode_fun(GetProcAddress(LibHandle, 'SDL_ComposeCustomBlendMode')); + If Not assigned(SDL_ComposeCustomBlendMode) Then result := false; + SDL_SetClipboardText := TSDL_SetClipboardText_fun(GetProcAddress(LibHandle, 'SDL_SetClipboardText')); + If Not assigned(SDL_SetClipboardText) Then result := false; + SDL_GetClipboardText := TSDL_GetClipboardText_fun(GetProcAddress(LibHandle, 'SDL_GetClipboardText')); + If Not assigned(SDL_GetClipboardText) Then result := false; + SDL_HasClipboardText := TSDL_HasClipboardText_fun(GetProcAddress(LibHandle, 'SDL_HasClipboardText')); + If Not assigned(SDL_HasClipboardText) Then result := false; + //SDL_SetPrimarySelectionText := TSDL_SetPrimarySelectionText_fun(GetProcAddress(LibHandle, 'SDL_SetPrimarySelectionText')); // TODO: Das geht nicht, warum ? + //If Not assigned(SDL_SetPrimarySelectionText) Then result := false; + //SDL_GetPrimarySelectionText := TSDL_GetPrimarySelectionText_fun(GetProcAddress(LibHandle, 'SDL_GetPrimarySelectionText')); + //If Not assigned(SDL_GetPrimarySelectionText) Then result := false; + //SDL_HasPrimarySelectionText := TSDL_HasPrimarySelectionText_fun(GetProcAddress(LibHandle, 'SDL_HasPrimarySelectionText')); + //If Not assigned(SDL_HasPrimarySelectionText) Then result := false; + SDL_GetCPUCount := TSDL_GetCPUCount_fun(GetProcAddress(LibHandle, 'SDL_GetCPUCount')); + If Not assigned(SDL_GetCPUCount) Then result := false; + SDL_SetError := TSDL_SetError_fun(GetProcAddress(LibHandle, 'SDL_SetError')); + If Not assigned(SDL_SetError) Then result := false; + //SDL_GetErrorMsg := TSDL_GetErrorMsg_fun(GetProcAddress(LibHandle, 'SDL_GetErrorMsg')); + //If Not assigned(SDL_GetErrorMsg) Then result := false; + SDL_Error := TSDL_Error_fun(GetProcAddress(LibHandle, 'SDL_Error')); + If Not assigned(SDL_Error) Then result := false; + SDL_GetBasePath := TSDL_GetBasePath_fun(GetProcAddress(LibHandle, 'SDL_GetBasePath')); + If Not assigned(SDL_GetBasePath) Then result := false; + SDL_GetPrefPath := TSDL_GetPrefPath_fun(GetProcAddress(LibHandle, 'SDL_GetPrefPath')); + If Not assigned(SDL_GetPrefPath) Then result := false; + SDL_GameControllerAddMappingsFromRW := TSDL_GameControllerAddMappingsFromRW_fun(GetProcAddress(LibHandle, 'SDL_GameControllerAddMappingsFromRW')); + If Not assigned(SDL_GameControllerAddMappingsFromRW) Then result := false; + SDL_GameControllerNumMappings := TSDL_GameControllerNumMappings_fun(GetProcAddress(LibHandle, 'SDL_GameControllerNumMappings')); + If Not assigned(SDL_GameControllerNumMappings) Then result := false; + SDL_GameControllerMappingForIndex := TSDL_GameControllerMappingForIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerMappingForIndex')); + If Not assigned(SDL_GameControllerMappingForIndex) Then result := false; + //SDL_GameControllerPathForIndex := TSDL_GameControllerPathForIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerPathForIndex')); + //If Not assigned(SDL_GameControllerPathForIndex) Then result := false; + SDL_GameControllerTypeForIndex := TSDL_GameControllerTypeForIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerTypeForIndex')); + If Not assigned(SDL_GameControllerTypeForIndex) Then result := false; + SDL_GameControllerMappingForDeviceIndex := TSDL_GameControllerMappingForDeviceIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerMappingForDeviceIndex')); + If Not assigned(SDL_GameControllerMappingForDeviceIndex) Then result := false; + SDL_GameControllerFromInstanceID := TSDL_GameControllerFromInstanceID_fun(GetProcAddress(LibHandle, 'SDL_GameControllerFromInstanceID')); + If Not assigned(SDL_GameControllerFromInstanceID) Then result := false; + SDL_GameControllerFromPlayerIndex := TSDL_GameControllerFromPlayerIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerFromPlayerIndex')); + If Not assigned(SDL_GameControllerFromPlayerIndex) Then result := false; + //SDL_GameControllerPath := TSDL_GameControllerPath_fun(GetProcAddress(LibHandle, 'SDL_GameControllerPath')); + //If Not assigned(SDL_GameControllerPath) Then result := false; + SDL_GameControllerGetType := TSDL_GameControllerGetType_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetType')); + If Not assigned(SDL_GameControllerGetType) Then result := false; + SDL_GameControllerGetPlayerIndex := TSDL_GameControllerGetPlayerIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetPlayerIndex')); + If Not assigned(SDL_GameControllerGetPlayerIndex) Then result := false; + SDL_GameControllerSetPlayerIndex := TSDL_GameControllerSetPlayerIndex_proc(GetProcAddress(LibHandle, 'SDL_GameControllerSetPlayerIndex')); + If Not assigned(SDL_GameControllerSetPlayerIndex) Then result := false; + SDL_GameControllerGetVendor := TSDL_GameControllerGetVendor_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetVendor')); + If Not assigned(SDL_GameControllerGetVendor) Then result := false; + SDL_GameControllerGetProduct := TSDL_GameControllerGetProduct_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetProduct')); + If Not assigned(SDL_GameControllerGetProduct) Then result := false; + SDL_GameControllerGetProductVersion := TSDL_GameControllerGetProductVersion_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetProductVersion')); + If Not assigned(SDL_GameControllerGetProductVersion) Then result := false; + //SDL_GameControllerGetFirmwareVersion := TSDL_GameControllerGetFirmwareVersion_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetFirmwareVersion')); + //If Not assigned(SDL_GameControllerGetFirmwareVersion) Then result := false; + //SDL_GameControllerGetSerial := TSDL_GameControllerGetSerial_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetSerial')); + //If Not assigned(SDL_GameControllerGetSerial) Then result := false; + //SDL_GameControllerGetSteamHandle := TSDL_GameControllerGetSteamHandle_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetSteamHandle')); + //If Not assigned(SDL_GameControllerGetSteamHandle) Then result := false; + //SDL_GameControllerHasAxis := TSDL_GameControllerHasAxis_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasAxis')); + //If Not assigned(SDL_GameControllerHasAxis) Then result := false; + //SDL_GameControllerHasButton := TSDL_GameControllerHasButton_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasButton')); + //If Not assigned(SDL_GameControllerHasButton) Then result := false; + //SDL_GameControllerGetNumTouchpads := TSDL_GameControllerGetNumTouchpads_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetNumTouchpads')); + //If Not assigned(SDL_GameControllerGetNumTouchpads) Then result := false; + //SDL_GameControllerGetNumTouchpadFingers := TSDL_GameControllerGetNumTouchpadFingers_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetNumTouchpadFingers')); + //If Not assigned(SDL_GameControllerGetNumTouchpadFingers) Then result := false; + //SDL_GameControllerGetTouchpadFinger := TSDL_GameControllerGetTouchpadFinger_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetTouchpadFinger')); + //If Not assigned(SDL_GameControllerGetTouchpadFinger) Then result := false; + //SDL_GameControllerHasSensor := TSDL_GameControllerHasSensor_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasSensor')); + //If Not assigned(SDL_GameControllerHasSensor) Then result := false; + //SDL_GameControllerSetSensorEnabled := TSDL_GameControllerSetSensorEnabled_fun(GetProcAddress(LibHandle, 'SDL_GameControllerSetSensorEnabled')); + //If Not assigned(SDL_GameControllerSetSensorEnabled) Then result := false; + //SDL_GameControllerIsSensorEnabled := TSDL_GameControllerIsSensorEnabled_fun(GetProcAddress(LibHandle, 'SDL_GameControllerIsSensorEnabled')); + //If Not assigned(SDL_GameControllerIsSensorEnabled) Then result := false; + (*SDL_GameControllerGetSensorDataRate := TSDL_GameControllerGetSensorDataRate_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetSensorDataRate')); + If Not assigned(SDL_GameControllerGetSensorDataRate) Then result := false; + SDL_GameControllerGetSensorData := TSDL_GameControllerGetSensorData_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetSensorData')); + If Not assigned(SDL_GameControllerGetSensorData) Then result := false; + SDL_GameControllerGetSensorDataWithTimestamp := TSDL_GameControllerGetSensorDataWithTimestamp_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetSensorDataWithTimestamp')); + If Not assigned(SDL_GameControllerGetSensorDataWithTimestamp) Then result := false; + SDL_GameControllerHasRumble := TSDL_GameControllerHasRumble_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasRumble')); + If Not assigned(SDL_GameControllerHasRumble) Then result := false; + SDL_GameControllerRumble := TSDL_GameControllerRumble_fun(GetProcAddress(LibHandle, 'SDL_GameControllerRumble')); + If Not assigned(SDL_GameControllerRumble) Then result := false; + SDL_GameControllerHasRumbleTriggers := TSDL_GameControllerHasRumbleTriggers_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasRumbleTriggers')); + If Not assigned(SDL_GameControllerHasRumbleTriggers) Then result := false; + SDL_GameControllerRumbleTriggers := TSDL_GameControllerRumbleTriggers_fun(GetProcAddress(LibHandle, 'SDL_GameControllerRumbleTriggers')); + If Not assigned(SDL_GameControllerRumbleTriggers) Then result := false; + SDL_GameControllerHasLED := TSDL_GameControllerHasLED_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasLED')); + If Not assigned(SDL_GameControllerHasLED) Then result := false; + SDL_GameControllerSetLED := TSDL_GameControllerSetLED_fun(GetProcAddress(LibHandle, 'SDL_GameControllerSetLED')); + If Not assigned(SDL_GameControllerSetLED) Then result := false; + SDL_GameControllerSendEffect := TSDL_GameControllerSendEffect_fun(GetProcAddress(LibHandle, 'SDL_GameControllerSendEffect')); + If Not assigned(SDL_GameControllerSendEffect) Then result := false; + SDL_GameControllerGetAppleSFSymbolsNameForAxis := TSDL_GameControllerGetAppleSFSymbolsNameForAxis_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetAppleSFSymbolsNameForAxis')); + If Not assigned(SDL_GameControllerGetAppleSFSymbolsNameForAxis) Then result := false; + SDL_GameControllerGetAppleSFSymbolsNameForButton := TSDL_GameControllerGetAppleSFSymbolsNameForButton_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetAppleSFSymbolsNameForButton')); + If Not assigned(SDL_GameControllerGetAppleSFSymbolsNameForButton) Then result := false; + SDL_RecordGesture := TSDL_RecordGesture_fun(GetProcAddress(LibHandle, 'SDL_RecordGesture')); + If Not assigned(SDL_RecordGesture) Then result := false; + SDL_SaveAllDollarTemplates := TSDL_SaveAllDollarTemplates_fun(GetProcAddress(LibHandle, 'SDL_SaveAllDollarTemplates')); + If Not assigned(SDL_SaveAllDollarTemplates) Then result := false; + SDL_SaveDollarTemplate := TSDL_SaveDollarTemplate_fun(GetProcAddress(LibHandle, 'SDL_SaveDollarTemplate')); + If Not assigned(SDL_SaveDollarTemplate) Then result := false; + SDL_LoadDollarTemplates := TSDL_LoadDollarTemplates_fun(GetProcAddress(LibHandle, 'SDL_LoadDollarTemplates')); + If Not assigned(SDL_LoadDollarTemplates) Then result := false; + SDL_GUIDToString := TSDL_GUIDToString_proc(GetProcAddress(LibHandle, 'SDL_GUIDToString')); + If Not assigned(SDL_GUIDToString) Then result := false; + SDL_GUIDFromString := TSDL_GUIDFromString_fun(GetProcAddress(LibHandle, 'SDL_GUIDFromString')); + If Not assigned(SDL_GUIDFromString) Then result := false; + SDL_HapticName := TSDL_HapticName_fun(GetProcAddress(LibHandle, 'SDL_HapticName')); + If Not assigned(SDL_HapticName) Then result := false; + SDL_HapticOpen := TSDL_HapticOpen_fun(GetProcAddress(LibHandle, 'SDL_HapticOpen')); + If Not assigned(SDL_HapticOpen) Then result := false; + SDL_HapticOpened := TSDL_HapticOpened_fun(GetProcAddress(LibHandle, 'SDL_HapticOpened')); + If Not assigned(SDL_HapticOpened) Then result := false; + SDL_HapticIndex := TSDL_HapticIndex_fun(GetProcAddress(LibHandle, 'SDL_HapticIndex')); + If Not assigned(SDL_HapticIndex) Then result := false; + SDL_JoystickIsHaptic := TSDL_JoystickIsHaptic_fun(GetProcAddress(LibHandle, 'SDL_JoystickIsHaptic')); + If Not assigned(SDL_JoystickIsHaptic) Then result := false; + SDL_HapticOpenFromJoystick := TSDL_HapticOpenFromJoystick_fun(GetProcAddress(LibHandle, 'SDL_HapticOpenFromJoystick')); + If Not assigned(SDL_HapticOpenFromJoystick) Then result := false; + SDL_HapticClose := TSDL_HapticClose_proc(GetProcAddress(LibHandle, 'SDL_HapticClose')); + If Not assigned(SDL_HapticClose) Then result := false; + SDL_HapticNumEffects := TSDL_HapticNumEffects_fun(GetProcAddress(LibHandle, 'SDL_HapticNumEffects')); + If Not assigned(SDL_HapticNumEffects) Then result := false; + SDL_HapticNumEffectsPlaying := TSDL_HapticNumEffectsPlaying_fun(GetProcAddress(LibHandle, 'SDL_HapticNumEffectsPlaying')); + If Not assigned(SDL_HapticNumEffectsPlaying) Then result := false; + SDL_HapticQuery := TSDL_HapticQuery_fun(GetProcAddress(LibHandle, 'SDL_HapticQuery')); + If Not assigned(SDL_HapticQuery) Then result := false; + SDL_HapticNumAxes := TSDL_HapticNumAxes_fun(GetProcAddress(LibHandle, 'SDL_HapticNumAxes')); + If Not assigned(SDL_HapticNumAxes) Then result := false; + SDL_HapticEffectSupported := TSDL_HapticEffectSupported_fun(GetProcAddress(LibHandle, 'SDL_HapticEffectSupported')); + If Not assigned(SDL_HapticEffectSupported) Then result := false; + SDL_HapticNewEffect := TSDL_HapticNewEffect_fun(GetProcAddress(LibHandle, 'SDL_HapticNewEffect')); + If Not assigned(SDL_HapticNewEffect) Then result := false; + SDL_HapticUpdateEffect := TSDL_HapticUpdateEffect_fun(GetProcAddress(LibHandle, 'SDL_HapticUpdateEffect')); + If Not assigned(SDL_HapticUpdateEffect) Then result := false; + SDL_HapticRunEffect := TSDL_HapticRunEffect_fun(GetProcAddress(LibHandle, 'SDL_HapticRunEffect')); + If Not assigned(SDL_HapticRunEffect) Then result := false; + SDL_HapticStopEffect := TSDL_HapticStopEffect_fun(GetProcAddress(LibHandle, 'SDL_HapticStopEffect')); + If Not assigned(SDL_HapticStopEffect) Then result := false; + SDL_HapticDestroyEffect := TSDL_HapticDestroyEffect_proc(GetProcAddress(LibHandle, 'SDL_HapticDestroyEffect')); + If Not assigned(SDL_HapticDestroyEffect) Then result := false; + SDL_HapticGetEffectStatus := TSDL_HapticGetEffectStatus_fun(GetProcAddress(LibHandle, 'SDL_HapticGetEffectStatus')); + If Not assigned(SDL_HapticGetEffectStatus) Then result := false; + SDL_HapticSetGain := TSDL_HapticSetGain_fun(GetProcAddress(LibHandle, 'SDL_HapticSetGain')); + If Not assigned(SDL_HapticSetGain) Then result := false; + SDL_HapticSetAutocenter := TSDL_HapticSetAutocenter_fun(GetProcAddress(LibHandle, 'SDL_HapticSetAutocenter')); + If Not assigned(SDL_HapticSetAutocenter) Then result := false; + SDL_HapticPause := TSDL_HapticPause_fun(GetProcAddress(LibHandle, 'SDL_HapticPause')); + If Not assigned(SDL_HapticPause) Then result := false; + SDL_HapticUnpause := TSDL_HapticUnpause_fun(GetProcAddress(LibHandle, 'SDL_HapticUnpause')); + If Not assigned(SDL_HapticUnpause) Then result := false; + SDL_HapticStopAll := TSDL_HapticStopAll_fun(GetProcAddress(LibHandle, 'SDL_HapticStopAll')); + If Not assigned(SDL_HapticStopAll) Then result := false; + SDL_HapticRumbleSupported := TSDL_HapticRumbleSupported_fun(GetProcAddress(LibHandle, 'SDL_HapticRumbleSupported')); + If Not assigned(SDL_HapticRumbleSupported) Then result := false; + SDL_HapticRumbleInit := TSDL_HapticRumbleInit_fun(GetProcAddress(LibHandle, 'SDL_HapticRumbleInit')); + If Not assigned(SDL_HapticRumbleInit) Then result := false; + SDL_HapticRumblePlay := TSDL_HapticRumblePlay_fun(GetProcAddress(LibHandle, 'SDL_HapticRumblePlay')); + If Not assigned(SDL_HapticRumblePlay) Then result := false; + SDL_HapticRumbleStop := TSDL_HapticRumbleStop_fun(GetProcAddress(LibHandle, 'SDL_HapticRumbleStop')); + If Not assigned(SDL_HapticRumbleStop) Then result := false; + SDL_SetHintWithPriority := TSDL_SetHintWithPriority_fun(GetProcAddress(LibHandle, 'SDL_SetHintWithPriority')); + If Not assigned(SDL_SetHintWithPriority) Then result := false; + SDL_SetHint := TSDL_SetHint_fun(GetProcAddress(LibHandle, 'SDL_SetHint')); + If Not assigned(SDL_SetHint) Then result := false; + SDL_ResetHint := TSDL_ResetHint_fun(GetProcAddress(LibHandle, 'SDL_ResetHint')); + If Not assigned(SDL_ResetHint) Then result := false; + SDL_ResetHints := TSDL_ResetHints_proc(GetProcAddress(LibHandle, 'SDL_ResetHints')); + If Not assigned(SDL_ResetHints) Then result := false; + SDL_GetHint := TSDL_GetHint_fun(GetProcAddress(LibHandle, 'SDL_GetHint')); + If Not assigned(SDL_GetHint) Then result := false; + SDL_GetHintBoolean := TSDL_GetHintBoolean_fun(GetProcAddress(LibHandle, 'SDL_GetHintBoolean')); + If Not assigned(SDL_GetHintBoolean) Then result := false; + SDL_AddHintCallback := TSDL_AddHintCallback_proc(GetProcAddress(LibHandle, 'SDL_AddHintCallback')); + If Not assigned(SDL_AddHintCallback) Then result := false; + SDL_DelHintCallback := TSDL_DelHintCallback_proc(GetProcAddress(LibHandle, 'SDL_DelHintCallback')); + If Not assigned(SDL_DelHintCallback) Then result := false; + SDL_ClearHints := TSDL_ClearHints_proc(GetProcAddress(LibHandle, 'SDL_ClearHints')); + If Not assigned(SDL_ClearHints) Then result := false; + SDL_LockJoysticks := TSDL_LockJoysticks_proc(GetProcAddress(LibHandle, 'SDL_LockJoysticks')); + If Not assigned(SDL_LockJoysticks) Then result := false; + SDL_UnlockJoysticks := TSDL_UnlockJoysticks_proc(GetProcAddress(LibHandle, 'SDL_UnlockJoysticks')); + If Not assigned(SDL_UnlockJoysticks) Then result := false;//*) + SDL_NumJoysticks := TSDL_NumJoysticks_fun(GetProcAddress(LibHandle, 'SDL_NumJoysticks')); + If Not assigned(SDL_NumJoysticks) Then result := false; + SDL_JoystickNameForIndex := TSDL_JoystickNameForIndex_fun(GetProcAddress(LibHandle, 'SDL_JoystickNameForIndex')); + If Not assigned(SDL_JoystickNameForIndex) Then result := false; + (* SDL_JoystickPathForIndex := TSDL_JoystickPathForIndex_fun(GetProcAddress(LibHandle, 'SDL_JoystickPathForIndex')); + If Not assigned(SDL_JoystickPathForIndex) Then result := false; + SDL_JoystickGetDevicePlayerIndex := TSDL_JoystickGetDevicePlayerIndex_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDevicePlayerIndex')); + If Not assigned(SDL_JoystickGetDevicePlayerIndex) Then result := false; + SDL_JoystickGetDeviceGUID := TSDL_JoystickGetDeviceGUID_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceGUID')); + If Not assigned(SDL_JoystickGetDeviceGUID) Then result := false; + SDL_JoystickGetDeviceVendor := TSDL_JoystickGetDeviceVendor_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceVendor')); + If Not assigned(SDL_JoystickGetDeviceVendor) Then result := false; + SDL_JoystickGetDeviceProduct := TSDL_JoystickGetDeviceProduct_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceProduct')); + If Not assigned(SDL_JoystickGetDeviceProduct) Then result := false; + SDL_JoystickGetDeviceProductVersion := TSDL_JoystickGetDeviceProductVersion_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceProductVersion')); + If Not assigned(SDL_JoystickGetDeviceProductVersion) Then result := false; + SDL_JoystickGetDeviceType := TSDL_JoystickGetDeviceType_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceType')); + If Not assigned(SDL_JoystickGetDeviceType) Then result := false; + SDL_JoystickGetDeviceInstanceID := TSDL_JoystickGetDeviceInstanceID_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceInstanceID')); + If Not assigned(SDL_JoystickGetDeviceInstanceID) Then result := false;// *) + SDL_JoystickOpen := TSDL_JoystickOpen_fun(GetProcAddress(LibHandle, 'SDL_JoystickOpen')); + If Not assigned(SDL_JoystickOpen) Then result := false; + (* SDL_JoystickFromInstanceID := TSDL_JoystickFromInstanceID_fun(GetProcAddress(LibHandle, 'SDL_JoystickFromInstanceID')); + If Not assigned(SDL_JoystickFromInstanceID) Then result := false; + SDL_JoystickFromPlayerIndex := TSDL_JoystickFromPlayerIndex_fun(GetProcAddress(LibHandle, 'SDL_JoystickFromPlayerIndex')); + If Not assigned(SDL_JoystickFromPlayerIndex) Then result := false; + SDL_JoystickAttachVirtual := TSDL_JoystickAttachVirtual_fun(GetProcAddress(LibHandle, 'SDL_JoystickAttachVirtual')); + If Not assigned(SDL_JoystickAttachVirtual) Then result := false; + SDL_JoystickAttachVirtualEx := TSDL_JoystickAttachVirtualEx_fun(GetProcAddress(LibHandle, 'SDL_JoystickAttachVirtualEx')); + If Not assigned(SDL_JoystickAttachVirtualEx) Then result := false; + SDL_JoystickDetachVirtual := TSDL_JoystickDetachVirtual_fun(GetProcAddress(LibHandle, 'SDL_JoystickDetachVirtual')); + If Not assigned(SDL_JoystickDetachVirtual) Then result := false; + SDL_JoystickIsVirtual := TSDL_JoystickIsVirtual_fun(GetProcAddress(LibHandle, 'SDL_JoystickIsVirtual')); + If Not assigned(SDL_JoystickIsVirtual) Then result := false; + SDL_JoystickSetVirtualAxis := TSDL_JoystickSetVirtualAxis_fun(GetProcAddress(LibHandle, 'SDL_JoystickSetVirtualAxis')); + If Not assigned(SDL_JoystickSetVirtualAxis) Then result := false; + SDL_JoystickSetVirtualButton := TSDL_JoystickSetVirtualButton_fun(GetProcAddress(LibHandle, 'SDL_JoystickSetVirtualButton')); + If Not assigned(SDL_JoystickSetVirtualButton) Then result := false; + SDL_JoystickSetVirtualHat := TSDL_JoystickSetVirtualHat_fun(GetProcAddress(LibHandle, 'SDL_JoystickSetVirtualHat')); + If Not assigned(SDL_JoystickSetVirtualHat) Then result := false; + SDL_JoystickName := TSDL_JoystickName_fun(GetProcAddress(LibHandle, 'SDL_JoystickName')); + If Not assigned(SDL_JoystickName) Then result := false; + SDL_JoystickPath := TSDL_JoystickPath_fun(GetProcAddress(LibHandle, 'SDL_JoystickPath')); + If Not assigned(SDL_JoystickPath) Then result := false; + SDL_JoystickGetPlayerIndex := TSDL_JoystickGetPlayerIndex_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetPlayerIndex')); + If Not assigned(SDL_JoystickGetPlayerIndex) Then result := false; + SDL_JoystickSetPlayerIndex := TSDL_JoystickSetPlayerIndex_proc(GetProcAddress(LibHandle, 'SDL_JoystickSetPlayerIndex')); + If Not assigned(SDL_JoystickSetPlayerIndex) Then result := false; + SDL_JoystickGetGUID := TSDL_JoystickGetGUID_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetGUID')); + If Not assigned(SDL_JoystickGetGUID) Then result := false; + SDL_JoystickGetVendor := TSDL_JoystickGetVendor_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetVendor')); + If Not assigned(SDL_JoystickGetVendor) Then result := false; + SDL_JoystickGetProduct := TSDL_JoystickGetProduct_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetProduct')); + If Not assigned(SDL_JoystickGetProduct) Then result := false; + SDL_JoystickGetProductVersion := TSDL_JoystickGetProductVersion_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetProductVersion')); + If Not assigned(SDL_JoystickGetProductVersion) Then result := false; + SDL_JoystickGetFirmwareVersion := TSDL_JoystickGetFirmwareVersion_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetFirmwareVersion')); + If Not assigned(SDL_JoystickGetFirmwareVersion) Then result := false; + SDL_JoystickGetSerial := TSDL_JoystickGetSerial_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetSerial')); + If Not assigned(SDL_JoystickGetSerial) Then result := false; + SDL_JoystickGetType := TSDL_JoystickGetType_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetType')); + If Not assigned(SDL_JoystickGetType) Then result := false; + SDL_JoystickGetGUIDString := TSDL_JoystickGetGUIDString_proc(GetProcAddress(LibHandle, 'SDL_JoystickGetGUIDString')); + If Not assigned(SDL_JoystickGetGUIDString) Then result := false; + SDL_JoystickGetGUIDFromString := TSDL_JoystickGetGUIDFromString_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetGUIDFromString')); + If Not assigned(SDL_JoystickGetGUIDFromString) Then result := false; + SDL_GetJoystickGUIDInfo := TSDL_GetJoystickGUIDInfo_proc(GetProcAddress(LibHandle, 'SDL_GetJoystickGUIDInfo')); + If Not assigned(SDL_GetJoystickGUIDInfo) Then result := false; + SDL_JoystickGetAttached := TSDL_JoystickGetAttached_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetAttached')); + If Not assigned(SDL_JoystickGetAttached) Then result := false; + SDL_JoystickInstanceID := TSDL_JoystickInstanceID_fun(GetProcAddress(LibHandle, 'SDL_JoystickInstanceID')); + If Not assigned(SDL_JoystickInstanceID) Then result := false;//*) + SDL_JoystickNumAxes := TSDL_JoystickNumAxes_fun(GetProcAddress(LibHandle, 'SDL_JoystickNumAxes')); + If Not assigned(SDL_JoystickNumAxes) Then result := false; + (* SDL_JoystickNumBalls := TSDL_JoystickNumBalls_fun(GetProcAddress(LibHandle, 'SDL_JoystickNumBalls')); + If Not assigned(SDL_JoystickNumBalls) Then result := false; + SDL_JoystickNumHats := TSDL_JoystickNumHats_fun(GetProcAddress(LibHandle, 'SDL_JoystickNumHats')); + If Not assigned(SDL_JoystickNumHats) Then result := false; //*) + SDL_JoystickNumButtons := TSDL_JoystickNumButtons_fun(GetProcAddress(LibHandle, 'SDL_JoystickNumButtons')); + If Not assigned(SDL_JoystickNumButtons) Then result := false; + (* SDL_JoystickUpdate := TSDL_JoystickUpdate_proc(GetProcAddress(LibHandle, 'SDL_JoystickUpdate')); + If Not assigned(SDL_JoystickUpdate) Then result := false;// *) + SDL_JoystickEventState := TSDL_JoystickEventState_fun(GetProcAddress(LibHandle, 'SDL_JoystickEventState')); + If Not assigned(SDL_JoystickEventState) Then result := false; + SDL_JoystickGetAxis := TSDL_JoystickGetAxis_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetAxis')); + If Not assigned(SDL_JoystickGetAxis) Then result := false; + (* SDL_JoystickGetAxisInitialState := TSDL_JoystickGetAxisInitialState_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetAxisInitialState')); + If Not assigned(SDL_JoystickGetAxisInitialState) Then result := false; + SDL_JoystickGetHat := TSDL_JoystickGetHat_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetHat')); + If Not assigned(SDL_JoystickGetHat) Then result := false; + SDL_JoystickGetBall := TSDL_JoystickGetBall_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetBall')); + If Not assigned(SDL_JoystickGetBall) Then result := false;// *) + SDL_JoystickGetButton := TSDL_JoystickGetButton_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetButton')); + If Not assigned(SDL_JoystickGetButton) Then result := false; + (* SDL_JoystickRumble := TSDL_JoystickRumble_fun(GetProcAddress(LibHandle, 'SDL_JoystickRumble')); + If Not assigned(SDL_JoystickRumble) Then result := false; + SDL_JoystickRumbleTriggers := TSDL_JoystickRumbleTriggers_fun(GetProcAddress(LibHandle, 'SDL_JoystickRumbleTriggers')); + If Not assigned(SDL_JoystickRumbleTriggers) Then result := false; + SDL_JoystickHasLED := TSDL_JoystickHasLED_fun(GetProcAddress(LibHandle, 'SDL_JoystickHasLED')); + If Not assigned(SDL_JoystickHasLED) Then result := false; + SDL_JoystickHasRumble := TSDL_JoystickHasRumble_fun(GetProcAddress(LibHandle, 'SDL_JoystickHasRumble')); + If Not assigned(SDL_JoystickHasRumble) Then result := false; + SDL_JoystickHasRumbleTriggers := TSDL_JoystickHasRumbleTriggers_fun(GetProcAddress(LibHandle, 'SDL_JoystickHasRumbleTriggers')); + If Not assigned(SDL_JoystickHasRumbleTriggers) Then result := false; + SDL_JoystickSetLED := TSDL_JoystickSetLED_fun(GetProcAddress(LibHandle, 'SDL_JoystickSetLED')); + If Not assigned(SDL_JoystickSetLED) Then result := false; + SDL_JoystickSendEffect := TSDL_JoystickSendEffect_fun(GetProcAddress(LibHandle, 'SDL_JoystickSendEffect')); + If Not assigned(SDL_JoystickSendEffect) Then result := false;*) + SDL_JoystickClose := TSDL_JoystickClose_proc(GetProcAddress(LibHandle, 'SDL_JoystickClose')); + If Not assigned(SDL_JoystickClose) Then result := false; + (* SDL_JoystickCurrentPowerLevel := TSDL_JoystickCurrentPowerLevel_fun(GetProcAddress(LibHandle, 'SDL_JoystickCurrentPowerLevel')); + If Not assigned(SDL_JoystickCurrentPowerLevel) Then result := false; + SDL_GetKeyboardState := TSDL_GetKeyboardState_fun(GetProcAddress(LibHandle, 'SDL_GetKeyboardState')); + If Not assigned(SDL_GetKeyboardState) Then result := false; + SDL_SetModState := TSDL_SetModState_proc(GetProcAddress(LibHandle, 'SDL_SetModState')); + If Not assigned(SDL_SetModState) Then result := false; + SDL_GetKeyFromScancode := TSDL_GetKeyFromScancode_fun(GetProcAddress(LibHandle, 'SDL_GetKeyFromScancode')); + If Not assigned(SDL_GetKeyFromScancode) Then result := false; + SDL_GetScancodeFromKey := TSDL_GetScancodeFromKey_fun(GetProcAddress(LibHandle, 'SDL_GetScancodeFromKey')); + If Not assigned(SDL_GetScancodeFromKey) Then result := false; + SDL_GetScancodeName := TSDL_GetScancodeName_fun(GetProcAddress(LibHandle, 'SDL_GetScancodeName')); + If Not assigned(SDL_GetScancodeName) Then result := false; + SDL_GetScancodeFromName := TSDL_GetScancodeFromName_fun(GetProcAddress(LibHandle, 'SDL_GetScancodeFromName')); + If Not assigned(SDL_GetScancodeFromName) Then result := false; + SDL_GetKeyName := TSDL_GetKeyName_fun(GetProcAddress(LibHandle, 'SDL_GetKeyName')); + If Not assigned(SDL_GetKeyName) Then result := false; + SDL_GetKeyFromName := TSDL_GetKeyFromName_fun(GetProcAddress(LibHandle, 'SDL_GetKeyFromName')); + If Not assigned(SDL_GetKeyFromName) Then result := false; + SDL_SetTextInputRect := TSDL_SetTextInputRect_proc(GetProcAddress(LibHandle, 'SDL_SetTextInputRect')); + If Not assigned(SDL_SetTextInputRect) Then result := false; + SDL_IsScreenKeyboardShown := TSDL_IsScreenKeyboardShown_fun(GetProcAddress(LibHandle, 'SDL_IsScreenKeyboardShown')); + If Not assigned(SDL_IsScreenKeyboardShown) Then result := false; + SDL_LoadObject := TSDL_LoadObject_fun(GetProcAddress(LibHandle, 'SDL_LoadObject')); + If Not assigned(SDL_LoadObject) Then result := false; + SDL_UnloadObject := TSDL_UnloadObject_proc(GetProcAddress(LibHandle, 'SDL_UnloadObject')); + If Not assigned(SDL_UnloadObject) Then result := false; + SDL_LogSetAllPriority := TSDL_LogSetAllPriority_proc(GetProcAddress(LibHandle, 'SDL_LogSetAllPriority')); + If Not assigned(SDL_LogSetAllPriority) Then result := false; + SDL_LogSetPriority := TSDL_LogSetPriority_proc(GetProcAddress(LibHandle, 'SDL_LogSetPriority')); + If Not assigned(SDL_LogSetPriority) Then result := false; + SDL_LogGetPriority := TSDL_LogGetPriority_fun(GetProcAddress(LibHandle, 'SDL_LogGetPriority')); + If Not assigned(SDL_LogGetPriority) Then result := false; + SDL_LogResetPriorities := TSDL_LogResetPriorities_proc(GetProcAddress(LibHandle, 'SDL_LogResetPriorities')); + If Not assigned(SDL_LogResetPriorities) Then result := false; + SDL_Log := TSDL_Log_proc(GetProcAddress(LibHandle, 'SDL_Log')); + If Not assigned(SDL_Log) Then result := false; + SDL_LogVerbose := TSDL_LogVerbose_proc(GetProcAddress(LibHandle, 'SDL_LogVerbose')); + If Not assigned(SDL_LogVerbose) Then result := false; + SDL_LogDebug := TSDL_LogDebug_proc(GetProcAddress(LibHandle, 'SDL_LogDebug')); + If Not assigned(SDL_LogDebug) Then result := false; + SDL_LogInfo := TSDL_LogInfo_proc(GetProcAddress(LibHandle, 'SDL_LogInfo')); + If Not assigned(SDL_LogInfo) Then result := false; + SDL_LogWarn := TSDL_LogWarn_proc(GetProcAddress(LibHandle, 'SDL_LogWarn')); + If Not assigned(SDL_LogWarn) Then result := false; + SDL_LogError := TSDL_LogError_proc(GetProcAddress(LibHandle, 'SDL_LogError')); + If Not assigned(SDL_LogError) Then result := false; + SDL_LogCritical := TSDL_LogCritical_proc(GetProcAddress(LibHandle, 'SDL_LogCritical')); + If Not assigned(SDL_LogCritical) Then result := false; + SDL_LogMessage := TSDL_LogMessage_proc(GetProcAddress(LibHandle, 'SDL_LogMessage')); + If Not assigned(SDL_LogMessage) Then result := false; + SDL_LogMessageV := TSDL_LogMessageV_proc(GetProcAddress(LibHandle, 'SDL_LogMessageV')); + If Not assigned(SDL_LogMessageV) Then result := false; + SDL_ShowMessageBox := TSDL_ShowMessageBox_fun(GetProcAddress(LibHandle, 'SDL_ShowMessageBox')); + If Not assigned(SDL_ShowMessageBox) Then result := false; + SDL_ShowSimpleMessageBox := TSDL_ShowSimpleMessageBox_fun(GetProcAddress(LibHandle, 'SDL_ShowSimpleMessageBox')); + If Not assigned(SDL_ShowSimpleMessageBox) Then result := false; + SDL_GetMouseState := TSDL_GetMouseState_fun(GetProcAddress(LibHandle, 'SDL_GetMouseState')); + If Not assigned(SDL_GetMouseState) Then result := false; + SDL_GetGlobalMouseState := TSDL_GetGlobalMouseState_fun(GetProcAddress(LibHandle, 'SDL_GetGlobalMouseState')); + If Not assigned(SDL_GetGlobalMouseState) Then result := false; + SDL_GetRelativeMouseState := TSDL_GetRelativeMouseState_fun(GetProcAddress(LibHandle, 'SDL_GetRelativeMouseState')); + If Not assigned(SDL_GetRelativeMouseState) Then result := false; + SDL_WarpMouseInWindow := TSDL_WarpMouseInWindow_proc(GetProcAddress(LibHandle, 'SDL_WarpMouseInWindow')); + If Not assigned(SDL_WarpMouseInWindow) Then result := false; + SDL_WarpMouseGlobal := TSDL_WarpMouseGlobal_fun(GetProcAddress(LibHandle, 'SDL_WarpMouseGlobal')); + If Not assigned(SDL_WarpMouseGlobal) Then result := false; + SDL_SetRelativeMouseMode := TSDL_SetRelativeMouseMode_fun(GetProcAddress(LibHandle, 'SDL_SetRelativeMouseMode')); + If Not assigned(SDL_SetRelativeMouseMode) Then result := false; + SDL_CaptureMouse := TSDL_CaptureMouse_fun(GetProcAddress(LibHandle, 'SDL_CaptureMouse')); + If Not assigned(SDL_CaptureMouse) Then result := false; + SDL_CreateCursor := TSDL_CreateCursor_fun(GetProcAddress(LibHandle, 'SDL_CreateCursor')); + If Not assigned(SDL_CreateCursor) Then result := false; + SDL_CreateColorCursor := TSDL_CreateColorCursor_fun(GetProcAddress(LibHandle, 'SDL_CreateColorCursor')); + If Not assigned(SDL_CreateColorCursor) Then result := false; + SDL_CreateSystemCursor := TSDL_CreateSystemCursor_fun(GetProcAddress(LibHandle, 'SDL_CreateSystemCursor')); + If Not assigned(SDL_CreateSystemCursor) Then result := false; + SDL_SetCursor := TSDL_SetCursor_proc(GetProcAddress(LibHandle, 'SDL_SetCursor')); + If Not assigned(SDL_SetCursor) Then result := false; + SDL_FreeCursor := TSDL_FreeCursor_proc(GetProcAddress(LibHandle, 'SDL_FreeCursor')); + If Not assigned(SDL_FreeCursor) Then result := false; + SDL_ShowCursor := TSDL_ShowCursor_fun(GetProcAddress(LibHandle, 'SDL_ShowCursor')); + If Not assigned(SDL_ShowCursor) Then result := false; + SDL_LockMutex := TSDL_LockMutex_fun(GetProcAddress(LibHandle, 'SDL_LockMutex')); + If Not assigned(SDL_LockMutex) Then result := false; + SDL_TryLockMutex := TSDL_TryLockMutex_fun(GetProcAddress(LibHandle, 'SDL_TryLockMutex')); + If Not assigned(SDL_TryLockMutex) Then result := false; + SDL_UnlockMutex := TSDL_UnlockMutex_fun(GetProcAddress(LibHandle, 'SDL_UnlockMutex')); + If Not assigned(SDL_UnlockMutex) Then result := false; + SDL_DestroyMutex := TSDL_DestroyMutex_proc(GetProcAddress(LibHandle, 'SDL_DestroyMutex')); + If Not assigned(SDL_DestroyMutex) Then result := false; + SDL_CreateSemaphore := TSDL_CreateSemaphore_fun(GetProcAddress(LibHandle, 'SDL_CreateSemaphore')); + If Not assigned(SDL_CreateSemaphore) Then result := false; + SDL_DestroySemaphore := TSDL_DestroySemaphore_proc(GetProcAddress(LibHandle, 'SDL_DestroySemaphore')); + If Not assigned(SDL_DestroySemaphore) Then result := false; + SDL_SemWait := TSDL_SemWait_fun(GetProcAddress(LibHandle, 'SDL_SemWait')); + If Not assigned(SDL_SemWait) Then result := false; + SDL_SemTryWait := TSDL_SemTryWait_fun(GetProcAddress(LibHandle, 'SDL_SemTryWait')); + If Not assigned(SDL_SemTryWait) Then result := false; + SDL_SemWaitTimeout := TSDL_SemWaitTimeout_fun(GetProcAddress(LibHandle, 'SDL_SemWaitTimeout')); + If Not assigned(SDL_SemWaitTimeout) Then result := false; + SDL_SemPost := TSDL_SemPost_fun(GetProcAddress(LibHandle, 'SDL_SemPost')); + If Not assigned(SDL_SemPost) Then result := false; + SDL_SemValue := TSDL_SemValue_fun(GetProcAddress(LibHandle, 'SDL_SemValue')); + If Not assigned(SDL_SemValue) Then result := false; + SDL_DestroyCond := TSDL_DestroyCond_proc(GetProcAddress(LibHandle, 'SDL_DestroyCond')); + If Not assigned(SDL_DestroyCond) Then result := false; + SDL_CondSignal := TSDL_CondSignal_fun(GetProcAddress(LibHandle, 'SDL_CondSignal')); + If Not assigned(SDL_CondSignal) Then result := false; + SDL_CondBroadcast := TSDL_CondBroadcast_fun(GetProcAddress(LibHandle, 'SDL_CondBroadcast')); + If Not assigned(SDL_CondBroadcast) Then result := false; + SDL_CondWait := TSDL_CondWait_fun(GetProcAddress(LibHandle, 'SDL_CondWait')); + If Not assigned(SDL_CondWait) Then result := false; + SDL_CondWaitTimeout := TSDL_CondWaitTimeout_fun(GetProcAddress(LibHandle, 'SDL_CondWaitTimeout')); + If Not assigned(SDL_CondWaitTimeout) Then result := false; + SDL_GetPixelFormatName := TSDL_GetPixelFormatName_fun(GetProcAddress(LibHandle, 'SDL_GetPixelFormatName')); + If Not assigned(SDL_GetPixelFormatName) Then result := false; + SDL_PixelFormatEnumToMasks := TSDL_PixelFormatEnumToMasks_fun(GetProcAddress(LibHandle, 'SDL_PixelFormatEnumToMasks')); + If Not assigned(SDL_PixelFormatEnumToMasks) Then result := false; + SDL_MasksToPixelFormatEnum := TSDL_MasksToPixelFormatEnum_fun(GetProcAddress(LibHandle, 'SDL_MasksToPixelFormatEnum')); + If Not assigned(SDL_MasksToPixelFormatEnum) Then result := false; + SDL_AllocFormat := TSDL_AllocFormat_fun(GetProcAddress(LibHandle, 'SDL_AllocFormat')); + If Not assigned(SDL_AllocFormat) Then result := false; + SDL_FreeFormat := TSDL_FreeFormat_proc(GetProcAddress(LibHandle, 'SDL_FreeFormat')); + If Not assigned(SDL_FreeFormat) Then result := false; + SDL_AllocPalette := TSDL_AllocPalette_fun(GetProcAddress(LibHandle, 'SDL_AllocPalette')); + If Not assigned(SDL_AllocPalette) Then result := false; + SDL_SetPixelFormatPalette := TSDL_SetPixelFormatPalette_fun(GetProcAddress(LibHandle, 'SDL_SetPixelFormatPalette')); + If Not assigned(SDL_SetPixelFormatPalette) Then result := false; + SDL_SetPaletteColors := TSDL_SetPaletteColors_fun(GetProcAddress(LibHandle, 'SDL_SetPaletteColors')); + If Not assigned(SDL_SetPaletteColors) Then result := false; + SDL_FreePalette := TSDL_FreePalette_proc(GetProcAddress(LibHandle, 'SDL_FreePalette')); + If Not assigned(SDL_FreePalette) Then result := false; + SDL_MapRGB := TSDL_MapRGB_fun(GetProcAddress(LibHandle, 'SDL_MapRGB')); + If Not assigned(SDL_MapRGB) Then result := false; + SDL_MapRGBA := TSDL_MapRGBA_fun(GetProcAddress(LibHandle, 'SDL_MapRGBA')); + If Not assigned(SDL_MapRGBA) Then result := false; + SDL_GetRGB := TSDL_GetRGB_proc(GetProcAddress(LibHandle, 'SDL_GetRGB')); + If Not assigned(SDL_GetRGB) Then result := false; + SDL_GetRGBA := TSDL_GetRGBA_proc(GetProcAddress(LibHandle, 'SDL_GetRGBA')); + If Not assigned(SDL_GetRGBA) Then result := false; + SDL_CalculateGammaRamp := TSDL_CalculateGammaRamp_proc(GetProcAddress(LibHandle, 'SDL_CalculateGammaRamp')); + If Not assigned(SDL_CalculateGammaRamp) Then result := false; + SDL_GetPowerInfo := TSDL_GetPowerInfo_fun(GetProcAddress(LibHandle, 'SDL_GetPowerInfo')); + If Not assigned(SDL_GetPowerInfo) Then result := false; + SDL_HasIntersection := TSDL_HasIntersection_fun(GetProcAddress(LibHandle, 'SDL_HasIntersection')); + If Not assigned(SDL_HasIntersection) Then result := false; + SDL_IntersectRect := TSDL_IntersectRect_fun(GetProcAddress(LibHandle, 'SDL_IntersectRect')); + If Not assigned(SDL_IntersectRect) Then result := false; + SDL_UnionRect := TSDL_UnionRect_proc(GetProcAddress(LibHandle, 'SDL_UnionRect')); + If Not assigned(SDL_UnionRect) Then result := false; + SDL_EnclosePoints := TSDL_EnclosePoints_fun(GetProcAddress(LibHandle, 'SDL_EnclosePoints')); + If Not assigned(SDL_EnclosePoints) Then result := false; + SDL_IntersectRectAndLine := TSDL_IntersectRectAndLine_fun(GetProcAddress(LibHandle, 'SDL_IntersectRectAndLine')); + If Not assigned(SDL_IntersectRectAndLine) Then result := false; + SDL_HasIntersectionF := TSDL_HasIntersectionF_fun(GetProcAddress(LibHandle, 'SDL_HasIntersectionF')); + If Not assigned(SDL_HasIntersectionF) Then result := false; + SDL_IntersectFRect := TSDL_IntersectFRect_fun(GetProcAddress(LibHandle, 'SDL_IntersectFRect')); + If Not assigned(SDL_IntersectFRect) Then result := false; + SDL_UnionFRect := TSDL_UnionFRect_fun(GetProcAddress(LibHandle, 'SDL_UnionFRect')); + If Not assigned(SDL_UnionFRect) Then result := false; + SDL_EncloseFPoints := TSDL_EncloseFPoints_fun(GetProcAddress(LibHandle, 'SDL_EncloseFPoints')); + If Not assigned(SDL_EncloseFPoints) Then result := false; + SDL_IntersectFRectAndLine := TSDL_IntersectFRectAndLine_fun(GetProcAddress(LibHandle, 'SDL_IntersectFRectAndLine')); + If Not assigned(SDL_IntersectFRectAndLine) Then result := false; + SDL_LockTexture := TSDL_LockTexture_fun(GetProcAddress(LibHandle, 'SDL_LockTexture')); + If Not assigned(SDL_LockTexture) Then result := false; + SDL_LockTextureToSurface := TSDL_LockTextureToSurface_fun(GetProcAddress(LibHandle, 'SDL_LockTextureToSurface')); + If Not assigned(SDL_LockTextureToSurface) Then result := false; + SDL_RenderIsClipEnabled := TSDL_RenderIsClipEnabled_fun(GetProcAddress(LibHandle, 'SDL_RenderIsClipEnabled')); + If Not assigned(SDL_RenderIsClipEnabled) Then result := false; + SDL_RenderDrawPointF := TSDL_RenderDrawPointF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawPointF')); + If Not assigned(SDL_RenderDrawPointF) Then result := false; + SDL_RenderDrawPointsF := TSDL_RenderDrawPointsF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawPointsF')); + If Not assigned(SDL_RenderDrawPointsF) Then result := false; + SDL_RenderDrawLineF := TSDL_RenderDrawLineF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawLineF')); + If Not assigned(SDL_RenderDrawLineF) Then result := false; + SDL_RenderDrawLinesF := TSDL_RenderDrawLinesF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawLinesF')); + If Not assigned(SDL_RenderDrawLinesF) Then result := false; + SDL_RenderDrawRectF := TSDL_RenderDrawRectF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawRectF')); + If Not assigned(SDL_RenderDrawRectF) Then result := false; + SDL_RenderDrawRectsF := TSDL_RenderDrawRectsF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawRectsF')); + If Not assigned(SDL_RenderDrawRectsF) Then result := false; + SDL_RenderFillRectF := TSDL_RenderFillRectF_fun(GetProcAddress(LibHandle, 'SDL_RenderFillRectF')); + If Not assigned(SDL_RenderFillRectF) Then result := false; + SDL_RenderFillRectsF := TSDL_RenderFillRectsF_fun(GetProcAddress(LibHandle, 'SDL_RenderFillRectsF')); + If Not assigned(SDL_RenderFillRectsF) Then result := false; + SDL_RenderCopyF := TSDL_RenderCopyF_fun(GetProcAddress(LibHandle, 'SDL_RenderCopyF')); + If Not assigned(SDL_RenderCopyF) Then result := false; + SDL_RenderCopyExF := TSDL_RenderCopyExF_fun(GetProcAddress(LibHandle, 'SDL_RenderCopyExF')); + If Not assigned(SDL_RenderCopyExF) Then result := false; + SDL_RenderGetMetalLayer := TSDL_RenderGetMetalLayer_fun(GetProcAddress(LibHandle, 'SDL_RenderGetMetalLayer')); + If Not assigned(SDL_RenderGetMetalLayer) Then result := false; + SDL_RenderGetMetalCommandEncoder := TSDL_RenderGetMetalCommandEncoder_fun(GetProcAddress(LibHandle, 'SDL_RenderGetMetalCommandEncoder')); + If Not assigned(SDL_RenderGetMetalCommandEncoder) Then result := false; + SDL_UpdateYUVTexture := TSDL_UpdateYUVTexture_fun(GetProcAddress(LibHandle, 'SDL_UpdateYUVTexture')); + If Not assigned(SDL_UpdateYUVTexture) Then result := false; + SDL_RWFromFile := TSDL_RWFromFile_fun(GetProcAddress(LibHandle, 'SDL_RWFromFile')); + If Not assigned(SDL_RWFromFile) Then result := false; + SDL_RWFromFP := TSDL_RWFromFP_fun(GetProcAddress(LibHandle, 'SDL_RWFromFP')); + If Not assigned(SDL_RWFromFP) Then result := false; + SDL_RWFromMem := TSDL_RWFromMem_fun(GetProcAddress(LibHandle, 'SDL_RWFromMem')); + If Not assigned(SDL_RWFromMem) Then result := false; + SDL_RWFromConstMem := TSDL_RWFromConstMem_fun(GetProcAddress(LibHandle, 'SDL_RWFromConstMem')); + If Not assigned(SDL_RWFromConstMem) Then result := false; + SDL_FreeRW := TSDL_FreeRW_proc(GetProcAddress(LibHandle, 'SDL_FreeRW')); + If Not assigned(SDL_FreeRW) Then result := false; + SDL_RWsize := TSDL_RWsize_fun(GetProcAddress(LibHandle, 'SDL_RWsize')); + If Not assigned(SDL_RWsize) Then result := false; + SDL_RWseek := TSDL_RWseek_fun(GetProcAddress(LibHandle, 'SDL_RWseek')); + If Not assigned(SDL_RWseek) Then result := false; + SDL_RWtell := TSDL_RWtell_fun(GetProcAddress(LibHandle, 'SDL_RWtell')); + If Not assigned(SDL_RWtell) Then result := false; + SDL_RWread := TSDL_RWread_fun(GetProcAddress(LibHandle, 'SDL_RWread')); + If Not assigned(SDL_RWread) Then result := false; + SDL_RWwrite := TSDL_RWwrite_fun(GetProcAddress(LibHandle, 'SDL_RWwrite')); + If Not assigned(SDL_RWwrite) Then result := false; + SDL_RWclose := TSDL_RWclose_fun(GetProcAddress(LibHandle, 'SDL_RWclose')); + If Not assigned(SDL_RWclose) Then result := false; + SDL_LoadFile_RW := TSDL_LoadFile_RW_fun(GetProcAddress(LibHandle, 'SDL_LoadFile_RW')); + If Not assigned(SDL_LoadFile_RW) Then result := false; + SDL_LoadFile := TSDL_LoadFile_fun(GetProcAddress(LibHandle, 'SDL_LoadFile')); + If Not assigned(SDL_LoadFile) Then result := false; + SDL_ReadU8 := TSDL_ReadU8_fun(GetProcAddress(LibHandle, 'SDL_ReadU8')); + If Not assigned(SDL_ReadU8) Then result := false; + SDL_ReadLE16 := TSDL_ReadLE16_fun(GetProcAddress(LibHandle, 'SDL_ReadLE16')); + If Not assigned(SDL_ReadLE16) Then result := false; + SDL_ReadBE16 := TSDL_ReadBE16_fun(GetProcAddress(LibHandle, 'SDL_ReadBE16')); + If Not assigned(SDL_ReadBE16) Then result := false; + SDL_ReadLE32 := TSDL_ReadLE32_fun(GetProcAddress(LibHandle, 'SDL_ReadLE32')); + If Not assigned(SDL_ReadLE32) Then result := false; + SDL_ReadBE32 := TSDL_ReadBE32_fun(GetProcAddress(LibHandle, 'SDL_ReadBE32')); + If Not assigned(SDL_ReadBE32) Then result := false; + SDL_ReadLE64 := TSDL_ReadLE64_fun(GetProcAddress(LibHandle, 'SDL_ReadLE64')); + If Not assigned(SDL_ReadLE64) Then result := false; + SDL_ReadBE64 := TSDL_ReadBE64_fun(GetProcAddress(LibHandle, 'SDL_ReadBE64')); + If Not assigned(SDL_ReadBE64) Then result := false; + SDL_WriteU8 := TSDL_WriteU8_fun(GetProcAddress(LibHandle, 'SDL_WriteU8')); + If Not assigned(SDL_WriteU8) Then result := false; + SDL_WriteLE16 := TSDL_WriteLE16_fun(GetProcAddress(LibHandle, 'SDL_WriteLE16')); + If Not assigned(SDL_WriteLE16) Then result := false; + SDL_WriteBE16 := TSDL_WriteBE16_fun(GetProcAddress(LibHandle, 'SDL_WriteBE16')); + If Not assigned(SDL_WriteBE16) Then result := false; + SDL_WriteLE32 := TSDL_WriteLE32_fun(GetProcAddress(LibHandle, 'SDL_WriteLE32')); + If Not assigned(SDL_WriteLE32) Then result := false; + SDL_WriteBE32 := TSDL_WriteBE32_fun(GetProcAddress(LibHandle, 'SDL_WriteBE32')); + If Not assigned(SDL_WriteBE32) Then result := false; + SDL_WriteLE64 := TSDL_WriteLE64_fun(GetProcAddress(LibHandle, 'SDL_WriteLE64')); + If Not assigned(SDL_WriteLE64) Then result := false; + SDL_WriteBE64 := TSDL_WriteBE64_fun(GetProcAddress(LibHandle, 'SDL_WriteBE64')); + If Not assigned(SDL_WriteBE64) Then result := false; + SDL_CreateShapedWindow := TSDL_CreateShapedWindow_fun(GetProcAddress(LibHandle, 'SDL_CreateShapedWindow')); + If Not assigned(SDL_CreateShapedWindow) Then result := false; + SDL_IsShapedWindow := TSDL_IsShapedWindow_fun(GetProcAddress(LibHandle, 'SDL_IsShapedWindow')); + If Not assigned(SDL_IsShapedWindow) Then result := false; + SDL_SetWindowShape := TSDL_SetWindowShape_fun(GetProcAddress(LibHandle, 'SDL_SetWindowShape')); + If Not assigned(SDL_SetWindowShape) Then result := false; + SDL_GetShapedWindowMode := TSDL_GetShapedWindowMode_fun(GetProcAddress(LibHandle, 'SDL_GetShapedWindowMode')); + If Not assigned(SDL_GetShapedWindowMode) Then result := false; + SDL_GetNumAllocations := TSDL_GetNumAllocations_fun(GetProcAddress(LibHandle, 'SDL_GetNumAllocations')); + If Not assigned(SDL_GetNumAllocations) Then result := false; + SDL_malloc := TSDL_malloc_fun(GetProcAddress(LibHandle, 'SDL_malloc')); + If Not assigned(SDL_malloc) Then result := false; + SDL_calloc := TSDL_calloc_fun(GetProcAddress(LibHandle, 'SDL_calloc')); + If Not assigned(SDL_calloc) Then result := false; + SDL_realloc := TSDL_realloc_fun(GetProcAddress(LibHandle, 'SDL_realloc')); + If Not assigned(SDL_realloc) Then result := false; + SDL_free := TSDL_free_proc(GetProcAddress(LibHandle, 'SDL_free')); + If Not assigned(SDL_free) Then result := false; + SDL_isalpha := TSDL_isalpha_fun(GetProcAddress(LibHandle, 'SDL_isalpha')); + If Not assigned(SDL_isalpha) Then result := false; + SDL_isalnum := TSDL_isalnum_fun(GetProcAddress(LibHandle, 'SDL_isalnum')); + If Not assigned(SDL_isalnum) Then result := false; + SDL_isblank := TSDL_isblank_fun(GetProcAddress(LibHandle, 'SDL_isblank')); + If Not assigned(SDL_isblank) Then result := false; + SDL_iscntrl := TSDL_iscntrl_fun(GetProcAddress(LibHandle, 'SDL_iscntrl')); + If Not assigned(SDL_iscntrl) Then result := false; + SDL_isdigit := TSDL_isdigit_fun(GetProcAddress(LibHandle, 'SDL_isdigit')); + If Not assigned(SDL_isdigit) Then result := false; + SDL_isxdigit := TSDL_isxdigit_fun(GetProcAddress(LibHandle, 'SDL_isxdigit')); + If Not assigned(SDL_isxdigit) Then result := false; + SDL_ispunct := TSDL_ispunct_fun(GetProcAddress(LibHandle, 'SDL_ispunct')); + If Not assigned(SDL_ispunct) Then result := false; + SDL_isspace := TSDL_isspace_fun(GetProcAddress(LibHandle, 'SDL_isspace')); + If Not assigned(SDL_isspace) Then result := false; + SDL_isupper := TSDL_isupper_fun(GetProcAddress(LibHandle, 'SDL_isupper')); + If Not assigned(SDL_isupper) Then result := false; + SDL_islower := TSDL_islower_fun(GetProcAddress(LibHandle, 'SDL_islower')); + If Not assigned(SDL_islower) Then result := false; + SDL_isprint := TSDL_isprint_fun(GetProcAddress(LibHandle, 'SDL_isprint')); + If Not assigned(SDL_isprint) Then result := false; + SDL_isgraph := TSDL_isgraph_fun(GetProcAddress(LibHandle, 'SDL_isgraph')); + If Not assigned(SDL_isgraph) Then result := false; + SDL_toupper := TSDL_toupper_fun(GetProcAddress(LibHandle, 'SDL_toupper')); + If Not assigned(SDL_toupper) Then result := false; + SDL_tolower := TSDL_tolower_fun(GetProcAddress(LibHandle, 'SDL_tolower')); + If Not assigned(SDL_tolower) Then result := false; + SDL_acos := TSDL_acos_fun(GetProcAddress(LibHandle, 'SDL_acos')); + If Not assigned(SDL_acos) Then result := false; + SDL_acosf := TSDL_acosf_fun(GetProcAddress(LibHandle, 'SDL_acosf')); + If Not assigned(SDL_acosf) Then result := false; + SDL_asin := TSDL_asin_fun(GetProcAddress(LibHandle, 'SDL_asin')); + If Not assigned(SDL_asin) Then result := false; + SDL_asinf := TSDL_asinf_fun(GetProcAddress(LibHandle, 'SDL_asinf')); + If Not assigned(SDL_asinf) Then result := false; + SDL_atan := TSDL_atan_fun(GetProcAddress(LibHandle, 'SDL_atan')); + If Not assigned(SDL_atan) Then result := false; + SDL_atanf := TSDL_atanf_fun(GetProcAddress(LibHandle, 'SDL_atanf')); + If Not assigned(SDL_atanf) Then result := false; + SDL_atan2 := TSDL_atan2_fun(GetProcAddress(LibHandle, 'SDL_atan2')); + If Not assigned(SDL_atan2) Then result := false; + SDL_atan2f := TSDL_atan2f_fun(GetProcAddress(LibHandle, 'SDL_atan2f')); + If Not assigned(SDL_atan2f) Then result := false; + SDL_ceil := TSDL_ceil_fun(GetProcAddress(LibHandle, 'SDL_ceil')); + If Not assigned(SDL_ceil) Then result := false; + SDL_ceilf := TSDL_ceilf_fun(GetProcAddress(LibHandle, 'SDL_ceilf')); + If Not assigned(SDL_ceilf) Then result := false; + SDL_copysign := TSDL_copysign_fun(GetProcAddress(LibHandle, 'SDL_copysign')); + If Not assigned(SDL_copysign) Then result := false; + SDL_copysignf := TSDL_copysignf_fun(GetProcAddress(LibHandle, 'SDL_copysignf')); + If Not assigned(SDL_copysignf) Then result := false; + SDL_cos := TSDL_cos_fun(GetProcAddress(LibHandle, 'SDL_cos')); + If Not assigned(SDL_cos) Then result := false; + SDL_cosf := TSDL_cosf_fun(GetProcAddress(LibHandle, 'SDL_cosf')); + If Not assigned(SDL_cosf) Then result := false; + SDL_exp := TSDL_exp_fun(GetProcAddress(LibHandle, 'SDL_exp')); + If Not assigned(SDL_exp) Then result := false; + SDL_expf := TSDL_expf_fun(GetProcAddress(LibHandle, 'SDL_expf')); + If Not assigned(SDL_expf) Then result := false; + SDL_fabs := TSDL_fabs_fun(GetProcAddress(LibHandle, 'SDL_fabs')); + If Not assigned(SDL_fabs) Then result := false; + SDL_fabsf := TSDL_fabsf_fun(GetProcAddress(LibHandle, 'SDL_fabsf')); + If Not assigned(SDL_fabsf) Then result := false; + SDL_floor := TSDL_floor_fun(GetProcAddress(LibHandle, 'SDL_floor')); + If Not assigned(SDL_floor) Then result := false; + SDL_floorf := TSDL_floorf_fun(GetProcAddress(LibHandle, 'SDL_floorf')); + If Not assigned(SDL_floorf) Then result := false; + SDL_fmod := TSDL_fmod_fun(GetProcAddress(LibHandle, 'SDL_fmod')); + If Not assigned(SDL_fmod) Then result := false; + SDL_fmodf := TSDL_fmodf_fun(GetProcAddress(LibHandle, 'SDL_fmodf')); + If Not assigned(SDL_fmodf) Then result := false; + SDL_nlog := TSDL_nlog_fun(GetProcAddress(LibHandle, 'SDL_nlog')); + If Not assigned(SDL_nlog) Then result := false; + SDL_nlogf := TSDL_nlogf_fun(GetProcAddress(LibHandle, 'SDL_nlogf')); + If Not assigned(SDL_nlogf) Then result := false; + SDL_log10 := TSDL_log10_fun(GetProcAddress(LibHandle, 'SDL_log10')); + If Not assigned(SDL_log10) Then result := false; + SDL_log10f := TSDL_log10f_fun(GetProcAddress(LibHandle, 'SDL_log10f')); + If Not assigned(SDL_log10f) Then result := false; + SDL_lround := TSDL_lround_fun(GetProcAddress(LibHandle, 'SDL_lround')); + If Not assigned(SDL_lround) Then result := false; + SDL_lroundf := TSDL_lroundf_fun(GetProcAddress(LibHandle, 'SDL_lroundf')); + If Not assigned(SDL_lroundf) Then result := false; + SDL_pow := TSDL_pow_fun(GetProcAddress(LibHandle, 'SDL_pow')); + If Not assigned(SDL_pow) Then result := false; + SDL_powf := TSDL_powf_fun(GetProcAddress(LibHandle, 'SDL_powf')); + If Not assigned(SDL_powf) Then result := false; + SDL_round := TSDL_round_fun(GetProcAddress(LibHandle, 'SDL_round')); + If Not assigned(SDL_round) Then result := false; + SDL_roundf := TSDL_roundf_fun(GetProcAddress(LibHandle, 'SDL_roundf')); + If Not assigned(SDL_roundf) Then result := false; + SDL_scalbn := TSDL_scalbn_fun(GetProcAddress(LibHandle, 'SDL_scalbn')); + If Not assigned(SDL_scalbn) Then result := false; + SDL_scalbnf := TSDL_scalbnf_fun(GetProcAddress(LibHandle, 'SDL_scalbnf')); + If Not assigned(SDL_scalbnf) Then result := false; + SDL_sin := TSDL_sin_fun(GetProcAddress(LibHandle, 'SDL_sin')); + If Not assigned(SDL_sin) Then result := false; + SDL_sinf := TSDL_sinf_fun(GetProcAddress(LibHandle, 'SDL_sinf')); + If Not assigned(SDL_sinf) Then result := false; + SDL_sqrt := TSDL_sqrt_fun(GetProcAddress(LibHandle, 'SDL_sqrt')); + If Not assigned(SDL_sqrt) Then result := false; + SDL_sqrtf := TSDL_sqrtf_fun(GetProcAddress(LibHandle, 'SDL_sqrtf')); + If Not assigned(SDL_sqrtf) Then result := false; + SDL_tan := TSDL_tan_fun(GetProcAddress(LibHandle, 'SDL_tan')); + If Not assigned(SDL_tan) Then result := false; + SDL_tanf := TSDL_tanf_fun(GetProcAddress(LibHandle, 'SDL_tanf')); + If Not assigned(SDL_tanf) Then result := false; + SDL_trunc := TSDL_trunc_fun(GetProcAddress(LibHandle, 'SDL_trunc')); + If Not assigned(SDL_trunc) Then result := false; + SDL_truncf := TSDL_truncf_fun(GetProcAddress(LibHandle, 'SDL_truncf')); + If Not assigned(SDL_truncf) Then result := false; + SDL_iconv_string := TSDL_iconv_string_fun(GetProcAddress(LibHandle, 'SDL_iconv_string')); + If Not assigned(SDL_iconv_string) Then result := false; + SDL_iconv_open := TSDL_iconv_open_fun(GetProcAddress(LibHandle, 'SDL_iconv_open')); + If Not assigned(SDL_iconv_open) Then result := false; + SDL_iconv_close := TSDL_iconv_close_fun(GetProcAddress(LibHandle, 'SDL_iconv_close')); + If Not assigned(SDL_iconv_close) Then result := false; + SDL_iconv := TSDL_iconv_fun(GetProcAddress(LibHandle, 'SDL_iconv')); + If Not assigned(SDL_iconv) Then result := false; + SDL_CreateRGBSurface := TSDL_CreateRGBSurface_fun(GetProcAddress(LibHandle, 'SDL_CreateRGBSurface')); + If Not assigned(SDL_CreateRGBSurface) Then result := false; + SDL_CreateRGBSurfaceWithFormat := TSDL_CreateRGBSurfaceWithFormat_fun(GetProcAddress(LibHandle, 'SDL_CreateRGBSurfaceWithFormat')); + If Not assigned(SDL_CreateRGBSurfaceWithFormat) Then result := false; + SDL_CreateRGBSurfaceFrom := TSDL_CreateRGBSurfaceFrom_fun(GetProcAddress(LibHandle, 'SDL_CreateRGBSurfaceFrom')); + If Not assigned(SDL_CreateRGBSurfaceFrom) Then result := false; + SDL_CreateRGBSurfaceWithFormatFrom := TSDL_CreateRGBSurfaceWithFormatFrom_fun(GetProcAddress(LibHandle, 'SDL_CreateRGBSurfaceWithFormatFrom')); + If Not assigned(SDL_CreateRGBSurfaceWithFormatFrom) Then result := false; + SDL_FreeSurface := TSDL_FreeSurface_proc(GetProcAddress(LibHandle, 'SDL_FreeSurface')); + If Not assigned(SDL_FreeSurface) Then result := false; + SDL_SetSurfacePalette := TSDL_SetSurfacePalette_fun(GetProcAddress(LibHandle, 'SDL_SetSurfacePalette')); + If Not assigned(SDL_SetSurfacePalette) Then result := false; + SDL_LockSurface := TSDL_LockSurface_fun(GetProcAddress(LibHandle, 'SDL_LockSurface')); + If Not assigned(SDL_LockSurface) Then result := false; + SDL_UnlockSurface := TSDL_UnlockSurface_proc(GetProcAddress(LibHandle, 'SDL_UnlockSurface')); + If Not assigned(SDL_UnlockSurface) Then result := false; + SDL_LoadBMP_RW := TSDL_LoadBMP_RW_fun(GetProcAddress(LibHandle, 'SDL_LoadBMP_RW')); + If Not assigned(SDL_LoadBMP_RW) Then result := false; + SDL_SaveBMP_RW := TSDL_SaveBMP_RW_fun(GetProcAddress(LibHandle, 'SDL_SaveBMP_RW')); + If Not assigned(SDL_SaveBMP_RW) Then result := false; + SDL_SetSurfaceRLE := TSDL_SetSurfaceRLE_fun(GetProcAddress(LibHandle, 'SDL_SetSurfaceRLE')); + If Not assigned(SDL_SetSurfaceRLE) Then result := false; + SDL_HasSurfaceRLE := TSDL_HasSurfaceRLE_fun(GetProcAddress(LibHandle, 'SDL_HasSurfaceRLE')); + If Not assigned(SDL_HasSurfaceRLE) Then result := false; + SDL_SetColorKey := TSDL_SetColorKey_fun(GetProcAddress(LibHandle, 'SDL_SetColorKey')); + If Not assigned(SDL_SetColorKey) Then result := false; + SDL_HasColorKey := TSDL_HasColorKey_fun(GetProcAddress(LibHandle, 'SDL_HasColorKey')); + If Not assigned(SDL_HasColorKey) Then result := false; + SDL_GetColorKey := TSDL_GetColorKey_fun(GetProcAddress(LibHandle, 'SDL_GetColorKey')); + If Not assigned(SDL_GetColorKey) Then result := false; + SDL_SetSurfaceColorMod := TSDL_SetSurfaceColorMod_fun(GetProcAddress(LibHandle, 'SDL_SetSurfaceColorMod')); + If Not assigned(SDL_SetSurfaceColorMod) Then result := false; + SDL_GetSurfaceColorMod := TSDL_GetSurfaceColorMod_fun(GetProcAddress(LibHandle, 'SDL_GetSurfaceColorMod')); + If Not assigned(SDL_GetSurfaceColorMod) Then result := false; + SDL_SetSurfaceAlphaMod := TSDL_SetSurfaceAlphaMod_fun(GetProcAddress(LibHandle, 'SDL_SetSurfaceAlphaMod')); + If Not assigned(SDL_SetSurfaceAlphaMod) Then result := false; + SDL_GetSurfaceAlphaMod := TSDL_GetSurfaceAlphaMod_fun(GetProcAddress(LibHandle, 'SDL_GetSurfaceAlphaMod')); + If Not assigned(SDL_GetSurfaceAlphaMod) Then result := false; + SDL_SetSurfaceBlendMode := TSDL_SetSurfaceBlendMode_fun(GetProcAddress(LibHandle, 'SDL_SetSurfaceBlendMode')); + If Not assigned(SDL_SetSurfaceBlendMode) Then result := false; + SDL_GetSurfaceBlendMode := TSDL_GetSurfaceBlendMode_fun(GetProcAddress(LibHandle, 'SDL_GetSurfaceBlendMode')); + If Not assigned(SDL_GetSurfaceBlendMode) Then result := false; + SDL_SetClipRect := TSDL_SetClipRect_fun(GetProcAddress(LibHandle, 'SDL_SetClipRect')); + If Not assigned(SDL_SetClipRect) Then result := false; + SDL_GetClipRect := TSDL_GetClipRect_proc(GetProcAddress(LibHandle, 'SDL_GetClipRect')); + If Not assigned(SDL_GetClipRect) Then result := false; + SDL_DuplicateSurface := TSDL_DuplicateSurface_fun(GetProcAddress(LibHandle, 'SDL_DuplicateSurface')); + If Not assigned(SDL_DuplicateSurface) Then result := false; + SDL_ConvertSurface := TSDL_ConvertSurface_fun(GetProcAddress(LibHandle, 'SDL_ConvertSurface')); + If Not assigned(SDL_ConvertSurface) Then result := false; + SDL_ConvertSurfaceFormat := TSDL_ConvertSurfaceFormat_fun(GetProcAddress(LibHandle, 'SDL_ConvertSurfaceFormat')); + If Not assigned(SDL_ConvertSurfaceFormat) Then result := false; + SDL_ConvertPixels := TSDL_ConvertPixels_fun(GetProcAddress(LibHandle, 'SDL_ConvertPixels')); + If Not assigned(SDL_ConvertPixels) Then result := false; + SDL_FillRect := TSDL_FillRect_fun(GetProcAddress(LibHandle, 'SDL_FillRect')); + If Not assigned(SDL_FillRect) Then result := false; + SDL_FillRects := TSDL_FillRects_fun(GetProcAddress(LibHandle, 'SDL_FillRects')); + If Not assigned(SDL_FillRects) Then result := false; + SDL_BlitSurface := TSDL_BlitSurface_fun(GetProcAddress(LibHandle, 'SDL_BlitSurface')); + If Not assigned(SDL_BlitSurface) Then result := false; + SDL_UpperBlit := TSDL_UpperBlit_fun(GetProcAddress(LibHandle, 'SDL_UpperBlit')); + If Not assigned(SDL_UpperBlit) Then result := false; + SDL_LowerBlit := TSDL_LowerBlit_fun(GetProcAddress(LibHandle, 'SDL_LowerBlit')); + If Not assigned(SDL_LowerBlit) Then result := false; + SDL_SoftStretch := TSDL_SoftStretch_fun(GetProcAddress(LibHandle, 'SDL_SoftStretch')); + If Not assigned(SDL_SoftStretch) Then result := false; + SDL_BlitSurfaceScaled := TSDL_BlitSurfaceScaled_fun(GetProcAddress(LibHandle, 'SDL_BlitSurfaceScaled')); + If Not assigned(SDL_BlitSurfaceScaled) Then result := false; + SDL_UpperBlitScaled := TSDL_UpperBlitScaled_fun(GetProcAddress(LibHandle, 'SDL_UpperBlitScaled')); + If Not assigned(SDL_UpperBlitScaled) Then result := false; + SDL_LowerBlitScaled := TSDL_LowerBlitScaled_fun(GetProcAddress(LibHandle, 'SDL_LowerBlitScaled')); + If Not assigned(SDL_LowerBlitScaled) Then result := false; + SDL_SetYUVConversionMode := TSDL_SetYUVConversionMode_proc(GetProcAddress(LibHandle, 'SDL_SetYUVConversionMode')); + If Not assigned(SDL_SetYUVConversionMode) Then result := false; + SDL_GetYUVConversionModeForResolution := TSDL_GetYUVConversionModeForResolution_fun(GetProcAddress(LibHandle, 'SDL_GetYUVConversionModeForResolution')); + If Not assigned(SDL_GetYUVConversionModeForResolution) Then result := false; + SDL_SetWindowsMessageHook := TSDL_SetWindowsMessageHook_proc(GetProcAddress(LibHandle, 'SDL_SetWindowsMessageHook')); + If Not assigned(SDL_SetWindowsMessageHook) Then result := false; + SDL_Direct3D9GetAdapterIndex := TSDL_Direct3D9GetAdapterIndex_fun(GetProcAddress(LibHandle, 'SDL_Direct3D9GetAdapterIndex')); + If Not assigned(SDL_Direct3D9GetAdapterIndex) Then result := false; + SDL_RenderGetD3D9Device := TSDL_RenderGetD3D9Device_fun(GetProcAddress(LibHandle, 'SDL_RenderGetD3D9Device')); + If Not assigned(SDL_RenderGetD3D9Device) Then result := false; + SDL_RenderGetD3D11Device := TSDL_RenderGetD3D11Device_fun(GetProcAddress(LibHandle, 'SDL_RenderGetD3D11Device')); + If Not assigned(SDL_RenderGetD3D11Device) Then result := false; + SDL_RenderGetD3D12Device := TSDL_RenderGetD3D12Device_fun(GetProcAddress(LibHandle, 'SDL_RenderGetD3D12Device')); + If Not assigned(SDL_RenderGetD3D12Device) Then result := false; + SDL_DXGIGetOutputInfo := TSDL_DXGIGetOutputInfo_fun(GetProcAddress(LibHandle, 'SDL_DXGIGetOutputInfo')); + If Not assigned(SDL_DXGIGetOutputInfo) Then result := false; //*) +{$IFDEF LINUX} + SDL_LinuxSetThreadPriority := TSDL_LinuxSetThreadPriority_fun(GetProcAddress(LibHandle, 'SDL_LinuxSetThreadPriority')); + If Not assigned(SDL_LinuxSetThreadPriority) Then result := false; + SDL_LinuxSetThreadPriorityAndPolicy := TSDL_LinuxSetThreadPriorityAndPolicy_fun(GetProcAddress(LibHandle, 'SDL_LinuxSetThreadPriorityAndPolicy')); + If Not assigned(SDL_LinuxSetThreadPriorityAndPolicy) Then result := false; +{$IFDEF Windows} + SDL_iPhoneSetAnimationCallback := TSDL_iPhoneSetAnimationCallback_fun(GetProcAddress(LibHandle, 'SDL_iPhoneSetAnimationCallback')); + If Not assigned(SDL_iPhoneSetAnimationCallback) Then result := false; + SDL_iPhoneSetEventPump := TSDL_iPhoneSetEventPump_proc(GetProcAddress(LibHandle, 'SDL_iPhoneSetEventPump')); + If Not assigned(SDL_iPhoneSetEventPump) Then result := false; + SDL_AndroidGetJNIEnv := TSDL_AndroidGetJNIEnv_fun(GetProcAddress(LibHandle, 'SDL_AndroidGetJNIEnv')); + If Not assigned(SDL_AndroidGetJNIEnv) Then result := false; + SDL_AndroidGetActivity := TSDL_AndroidGetActivity_fun(GetProcAddress(LibHandle, 'SDL_AndroidGetActivity')); + If Not assigned(SDL_AndroidGetActivity) Then result := false; + SDL_GetAndroidSDKVersion := TSDL_GetAndroidSDKVersion_fun(GetProcAddress(LibHandle, 'SDL_GetAndroidSDKVersion')); + If Not assigned(SDL_GetAndroidSDKVersion) Then result := false; + SDL_IsAndroidTV := TSDL_IsAndroidTV_fun(GetProcAddress(LibHandle, 'SDL_IsAndroidTV')); + If Not assigned(SDL_IsAndroidTV) Then result := false; + SDL_IsChromebook := TSDL_IsChromebook_fun(GetProcAddress(LibHandle, 'SDL_IsChromebook')); + If Not assigned(SDL_IsChromebook) Then result := false; + SDL_IsDeXMode := TSDL_IsDeXMode_fun(GetProcAddress(LibHandle, 'SDL_IsDeXMode')); + If Not assigned(SDL_IsDeXMode) Then result := false; + SDL_AndroidBackButton := TSDL_AndroidBackButton_proc(GetProcAddress(LibHandle, 'SDL_AndroidBackButton')); + If Not assigned(SDL_AndroidBackButton) Then result := false; + SDL_AndroidGetInternalStoragePath := TSDL_AndroidGetInternalStoragePath_fun(GetProcAddress(LibHandle, 'SDL_AndroidGetInternalStoragePath')); + If Not assigned(SDL_AndroidGetInternalStoragePath) Then result := false; + SDL_AndroidGetExternalStorageState := TSDL_AndroidGetExternalStorageState_fun(GetProcAddress(LibHandle, 'SDL_AndroidGetExternalStorageState')); + If Not assigned(SDL_AndroidGetExternalStorageState) Then result := false; + SDL_AndroidGetExternalStoragePath := TSDL_AndroidGetExternalStoragePath_fun(GetProcAddress(LibHandle, 'SDL_AndroidGetExternalStoragePath')); + If Not assigned(SDL_AndroidGetExternalStoragePath) Then result := false; + SDL_AndroidRequestPermission := TSDL_AndroidRequestPermission_fun(GetProcAddress(LibHandle, 'SDL_AndroidRequestPermission')); + If Not assigned(SDL_AndroidRequestPermission) Then result := false; + SDL_AndroidShowToast := TSDL_AndroidShowToast_fun(GetProcAddress(LibHandle, 'SDL_AndroidShowToast')); + If Not assigned(SDL_AndroidShowToast) Then result := false; + SDL_AndroidSendMessage := TSDL_AndroidSendMessage_fun(GetProcAddress(LibHandle, 'SDL_AndroidSendMessage')); + If Not assigned(SDL_AndroidSendMessage) Then result := false; + SDL_WinRTGetFSPathUNICODE := TSDL_WinRTGetFSPathUNICODE_fun(GetProcAddress(LibHandle, 'SDL_WinRTGetFSPathUNICODE')); + If Not assigned(SDL_WinRTGetFSPathUNICODE) Then result := false; + SDL_WinRTGetFSPathUTF8 := TSDL_WinRTGetFSPathUTF8_fun(GetProcAddress(LibHandle, 'SDL_WinRTGetFSPathUTF8')); + If Not assigned(SDL_WinRTGetFSPathUTF8) Then result := false; + SDL_WinRTGetDeviceFamily := TSDL_WinRTGetDeviceFamily_fun(GetProcAddress(LibHandle, 'SDL_WinRTGetDeviceFamily')); + If Not assigned(SDL_WinRTGetDeviceFamily) Then result := false; +{$ENDIF} +{$ENDIF} + SDL_IsTablet := TSDL_IsTablet_fun(GetProcAddress(LibHandle, 'SDL_IsTablet')); + If Not assigned(SDL_IsTablet) Then result := false; + SDL_GetWindowWMInfo := TSDL_GetWindowWMInfo_fun(GetProcAddress(LibHandle, 'SDL_GetWindowWMInfo')); + If Not assigned(SDL_GetWindowWMInfo) Then result := false; + SDL_CreateThread := TSDL_CreateThread_fun(GetProcAddress(LibHandle, 'SDL_CreateThread')); + If Not assigned(SDL_CreateThread) Then result := false; + SDL_CreateThreadWithStackSize := TSDL_CreateThreadWithStackSize_fun(GetProcAddress(LibHandle, 'SDL_CreateThreadWithStackSize')); + If Not assigned(SDL_CreateThreadWithStackSize) Then result := false; + SDL_CreateThread := TSDL_CreateThread_fun(GetProcAddress(LibHandle, 'SDL_CreateThread')); + If Not assigned(SDL_CreateThread) Then result := false; + SDL_CreateThreadWithStackSize := TSDL_CreateThreadWithStackSize_fun(GetProcAddress(LibHandle, 'SDL_CreateThreadWithStackSize')); + If Not assigned(SDL_CreateThreadWithStackSize) Then result := false; + SDL_GetThreadName := TSDL_GetThreadName_fun(GetProcAddress(LibHandle, 'SDL_GetThreadName')); + If Not assigned(SDL_GetThreadName) Then result := false; + SDL_GetThreadID := TSDL_GetThreadID_fun(GetProcAddress(LibHandle, 'SDL_GetThreadID')); + If Not assigned(SDL_GetThreadID) Then result := false; + SDL_SetThreadPriority := TSDL_SetThreadPriority_fun(GetProcAddress(LibHandle, 'SDL_SetThreadPriority')); + If Not assigned(SDL_SetThreadPriority) Then result := false; + SDL_WaitThread := TSDL_WaitThread_proc(GetProcAddress(LibHandle, 'SDL_WaitThread')); + If Not assigned(SDL_WaitThread) Then result := false; + SDL_DetachThread := TSDL_DetachThread_proc(GetProcAddress(LibHandle, 'SDL_DetachThread')); + If Not assigned(SDL_DetachThread) Then result := false; + SDL_TLSGet := TSDL_TLSGet_fun(GetProcAddress(LibHandle, 'SDL_TLSGet')); + If Not assigned(SDL_TLSGet) Then result := false; + SDL_TLSSet := TSDL_TLSSet_fun(GetProcAddress(LibHandle, 'SDL_TLSSet')); + If Not assigned(SDL_TLSSet) Then result := false; + SDL_Delay := TSDL_Delay_proc(GetProcAddress(LibHandle, 'SDL_Delay')); + If Not assigned(SDL_Delay) Then result := false; + SDL_AddTimer := TSDL_AddTimer_fun(GetProcAddress(LibHandle, 'SDL_AddTimer')); + If Not assigned(SDL_AddTimer) Then result := false; + SDL_RemoveTimer := TSDL_RemoveTimer_fun(GetProcAddress(LibHandle, 'SDL_RemoveTimer')); + If Not assigned(SDL_RemoveTimer) Then result := false; + SDL_GetNumTouchDevices := TSDL_GetNumTouchDevices_fun(GetProcAddress(LibHandle, 'SDL_GetNumTouchDevices')); + If Not assigned(SDL_GetNumTouchDevices) Then result := false; + SDL_GetTouchDevice := TSDL_GetTouchDevice_fun(GetProcAddress(LibHandle, 'SDL_GetTouchDevice')); + If Not assigned(SDL_GetTouchDevice) Then result := false; + (* SDL_GetTouchName := TSDL_GetTouchName_fun(GetProcAddress(LibHandle, 'SDL_GetTouchName')); + If Not assigned(SDL_GetTouchName) Then result := false; + SDL_GetTouchDeviceType := TSDL_GetTouchDeviceType_fun(GetProcAddress(LibHandle, 'SDL_GetTouchDeviceType')); + If Not assigned(SDL_GetTouchDeviceType) Then result := false; + SDL_GetNumTouchFingers := TSDL_GetNumTouchFingers_fun(GetProcAddress(LibHandle, 'SDL_GetNumTouchFingers')); + If Not assigned(SDL_GetNumTouchFingers) Then result := false; + SDL_GetTouchFinger := TSDL_GetTouchFinger_fun(GetProcAddress(LibHandle, 'SDL_GetTouchFinger')); + If Not assigned(SDL_GetTouchFinger) Then result := false; //*) + SDL_GetVersion := TSDL_GetVersion_proc(GetProcAddress(LibHandle, 'SDL_GetVersion')); + If Not assigned(SDL_GetVersion) Then result := false; + (* SDL_GetVideoDriver := TSDL_GetVideoDriver_fun(GetProcAddress(LibHandle, 'SDL_GetVideoDriver')); + If Not assigned(SDL_GetVideoDriver) Then result := false; + SDL_VideoInit := TSDL_VideoInit_fun(GetProcAddress(LibHandle, 'SDL_VideoInit')); + If Not assigned(SDL_VideoInit) Then result := false; + SDL_GetDisplayName := TSDL_GetDisplayName_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayName')); + If Not assigned(SDL_GetDisplayName) Then result := false; + SDL_GetDisplayBounds := TSDL_GetDisplayBounds_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayBounds')); + If Not assigned(SDL_GetDisplayBounds) Then result := false; + SDL_GetDisplayUsableBounds := TSDL_GetDisplayUsableBounds_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayUsableBounds')); + If Not assigned(SDL_GetDisplayUsableBounds) Then result := false; + SDL_GetDisplayDPI := TSDL_GetDisplayDPI_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayDPI')); + If Not assigned(SDL_GetDisplayDPI) Then result := false; + SDL_GetDisplayOrientation := TSDL_GetDisplayOrientation_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayOrientation')); + If Not assigned(SDL_GetDisplayOrientation) Then result := false; + SDL_GetNumDisplayModes := TSDL_GetNumDisplayModes_fun(GetProcAddress(LibHandle, 'SDL_GetNumDisplayModes')); + If Not assigned(SDL_GetNumDisplayModes) Then result := false; + SDL_GetDisplayMode := TSDL_GetDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayMode')); + If Not assigned(SDL_GetDisplayMode) Then result := false; + SDL_GetDesktopDisplayMode := TSDL_GetDesktopDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_GetDesktopDisplayMode')); + If Not assigned(SDL_GetDesktopDisplayMode) Then result := false; + SDL_GetCurrentDisplayMode := TSDL_GetCurrentDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_GetCurrentDisplayMode')); + If Not assigned(SDL_GetCurrentDisplayMode) Then result := false; + SDL_GetClosestDisplayMode := TSDL_GetClosestDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_GetClosestDisplayMode')); + If Not assigned(SDL_GetClosestDisplayMode) Then result := false; + SDL_GetPointDisplayIndex := TSDL_GetPointDisplayIndex_fun(GetProcAddress(LibHandle, 'SDL_GetPointDisplayIndex')); + If Not assigned(SDL_GetPointDisplayIndex) Then result := false; + SDL_GetRectDisplayIndex := TSDL_GetRectDisplayIndex_fun(GetProcAddress(LibHandle, 'SDL_GetRectDisplayIndex')); + If Not assigned(SDL_GetRectDisplayIndex) Then result := false; + SDL_GetWindowDisplayIndex := TSDL_GetWindowDisplayIndex_fun(GetProcAddress(LibHandle, 'SDL_GetWindowDisplayIndex')); + If Not assigned(SDL_GetWindowDisplayIndex) Then result := false; + SDL_SetWindowDisplayMode := TSDL_SetWindowDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_SetWindowDisplayMode')); + If Not assigned(SDL_SetWindowDisplayMode) Then result := false; + SDL_GetWindowDisplayMode := TSDL_GetWindowDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_GetWindowDisplayMode')); + If Not assigned(SDL_GetWindowDisplayMode) Then result := false; + SDL_GetWindowICCProfile := TSDL_GetWindowICCProfile_fun(GetProcAddress(LibHandle, 'SDL_GetWindowICCProfile')); + If Not assigned(SDL_GetWindowICCProfile) Then result := false; + SDL_GetWindowPixelFormat := TSDL_GetWindowPixelFormat_fun(GetProcAddress(LibHandle, 'SDL_GetWindowPixelFormat')); + If Not assigned(SDL_GetWindowPixelFormat) Then result := false; + SDL_CreateWindow := TSDL_CreateWindow_fun(GetProcAddress(LibHandle, 'SDL_CreateWindow')); + If Not assigned(SDL_CreateWindow) Then result := false; + SDL_CreateWindowFrom := TSDL_CreateWindowFrom_fun(GetProcAddress(LibHandle, 'SDL_CreateWindowFrom')); + If Not assigned(SDL_CreateWindowFrom) Then result := false; + SDL_GetWindowID := TSDL_GetWindowID_fun(GetProcAddress(LibHandle, 'SDL_GetWindowID')); + If Not assigned(SDL_GetWindowID) Then result := false; + SDL_GetWindowFromID := TSDL_GetWindowFromID_fun(GetProcAddress(LibHandle, 'SDL_GetWindowFromID')); + If Not assigned(SDL_GetWindowFromID) Then result := false; + SDL_GetWindowFlags := TSDL_GetWindowFlags_fun(GetProcAddress(LibHandle, 'SDL_GetWindowFlags')); + If Not assigned(SDL_GetWindowFlags) Then result := false; + SDL_SetWindowTitle := TSDL_SetWindowTitle_proc(GetProcAddress(LibHandle, 'SDL_SetWindowTitle')); + If Not assigned(SDL_SetWindowTitle) Then result := false; + SDL_GetWindowTitle := TSDL_GetWindowTitle_fun(GetProcAddress(LibHandle, 'SDL_GetWindowTitle')); + If Not assigned(SDL_GetWindowTitle) Then result := false; + SDL_SetWindowIcon := TSDL_SetWindowIcon_proc(GetProcAddress(LibHandle, 'SDL_SetWindowIcon')); + If Not assigned(SDL_SetWindowIcon) Then result := false; + SDL_SetWindowData := TSDL_SetWindowData_fun(GetProcAddress(LibHandle, 'SDL_SetWindowData')); + If Not assigned(SDL_SetWindowData) Then result := false; + SDL_GetWindowData := TSDL_GetWindowData_fun(GetProcAddress(LibHandle, 'SDL_GetWindowData')); + If Not assigned(SDL_GetWindowData) Then result := false; + SDL_SetWindowPosition := TSDL_SetWindowPosition_proc(GetProcAddress(LibHandle, 'SDL_SetWindowPosition')); + If Not assigned(SDL_SetWindowPosition) Then result := false; + SDL_GetWindowPosition := TSDL_GetWindowPosition_proc(GetProcAddress(LibHandle, 'SDL_GetWindowPosition')); + If Not assigned(SDL_GetWindowPosition) Then result := false; + SDL_SetWindowSize := TSDL_SetWindowSize_proc(GetProcAddress(LibHandle, 'SDL_SetWindowSize')); + If Not assigned(SDL_SetWindowSize) Then result := false; + SDL_GetWindowSize := TSDL_GetWindowSize_proc(GetProcAddress(LibHandle, 'SDL_GetWindowSize')); + If Not assigned(SDL_GetWindowSize) Then result := false; + SDL_GetWindowBordersSize := TSDL_GetWindowBordersSize_fun(GetProcAddress(LibHandle, 'SDL_GetWindowBordersSize')); + If Not assigned(SDL_GetWindowBordersSize) Then result := false; + SDL_GetWindowSizeInPixels := TSDL_GetWindowSizeInPixels_proc(GetProcAddress(LibHandle, 'SDL_GetWindowSizeInPixels')); + If Not assigned(SDL_GetWindowSizeInPixels) Then result := false; + SDL_SetWindowMinimumSize := TSDL_SetWindowMinimumSize_proc(GetProcAddress(LibHandle, 'SDL_SetWindowMinimumSize')); + If Not assigned(SDL_SetWindowMinimumSize) Then result := false; + SDL_GetWindowMinimumSize := TSDL_GetWindowMinimumSize_proc(GetProcAddress(LibHandle, 'SDL_GetWindowMinimumSize')); + If Not assigned(SDL_GetWindowMinimumSize) Then result := false; + SDL_SetWindowMaximumSize := TSDL_SetWindowMaximumSize_proc(GetProcAddress(LibHandle, 'SDL_SetWindowMaximumSize')); + If Not assigned(SDL_SetWindowMaximumSize) Then result := false; + SDL_GetWindowMaximumSize := TSDL_GetWindowMaximumSize_proc(GetProcAddress(LibHandle, 'SDL_GetWindowMaximumSize')); + If Not assigned(SDL_GetWindowMaximumSize) Then result := false; + SDL_SetWindowBordered := TSDL_SetWindowBordered_proc(GetProcAddress(LibHandle, 'SDL_SetWindowBordered')); + If Not assigned(SDL_SetWindowBordered) Then result := false; + SDL_SetWindowResizable := TSDL_SetWindowResizable_proc(GetProcAddress(LibHandle, 'SDL_SetWindowResizable')); + If Not assigned(SDL_SetWindowResizable) Then result := false; + SDL_SetWindowAlwaysOnTop := TSDL_SetWindowAlwaysOnTop_proc(GetProcAddress(LibHandle, 'SDL_SetWindowAlwaysOnTop')); + If Not assigned(SDL_SetWindowAlwaysOnTop) Then result := false; + SDL_ShowWindow := TSDL_ShowWindow_proc(GetProcAddress(LibHandle, 'SDL_ShowWindow')); + If Not assigned(SDL_ShowWindow) Then result := false; + SDL_HideWindow := TSDL_HideWindow_proc(GetProcAddress(LibHandle, 'SDL_HideWindow')); + If Not assigned(SDL_HideWindow) Then result := false; + SDL_RaiseWindow := TSDL_RaiseWindow_proc(GetProcAddress(LibHandle, 'SDL_RaiseWindow')); + If Not assigned(SDL_RaiseWindow) Then result := false; + SDL_MaximizeWindow := TSDL_MaximizeWindow_proc(GetProcAddress(LibHandle, 'SDL_MaximizeWindow')); + If Not assigned(SDL_MaximizeWindow) Then result := false; + SDL_MinimizeWindow := TSDL_MinimizeWindow_proc(GetProcAddress(LibHandle, 'SDL_MinimizeWindow')); + If Not assigned(SDL_MinimizeWindow) Then result := false; + SDL_RestoreWindow := TSDL_RestoreWindow_proc(GetProcAddress(LibHandle, 'SDL_RestoreWindow')); + If Not assigned(SDL_RestoreWindow) Then result := false; + SDL_SetWindowFullscreen := TSDL_SetWindowFullscreen_fun(GetProcAddress(LibHandle, 'SDL_SetWindowFullscreen')); + If Not assigned(SDL_SetWindowFullscreen) Then result := false; + SDL_HasWindowSurface := TSDL_HasWindowSurface_fun(GetProcAddress(LibHandle, 'SDL_HasWindowSurface')); + If Not assigned(SDL_HasWindowSurface) Then result := false; + SDL_GetWindowSurface := TSDL_GetWindowSurface_fun(GetProcAddress(LibHandle, 'SDL_GetWindowSurface')); + If Not assigned(SDL_GetWindowSurface) Then result := false; + SDL_UpdateWindowSurface := TSDL_UpdateWindowSurface_fun(GetProcAddress(LibHandle, 'SDL_UpdateWindowSurface')); + If Not assigned(SDL_UpdateWindowSurface) Then result := false; + SDL_UpdateWindowSurfaceRects := TSDL_UpdateWindowSurfaceRects_fun(GetProcAddress(LibHandle, 'SDL_UpdateWindowSurfaceRects')); + If Not assigned(SDL_UpdateWindowSurfaceRects) Then result := false; + SDL_DestroyWindowSurface := TSDL_DestroyWindowSurface_fun(GetProcAddress(LibHandle, 'SDL_DestroyWindowSurface')); + If Not assigned(SDL_DestroyWindowSurface) Then result := false; + SDL_SetWindowGrab := TSDL_SetWindowGrab_proc(GetProcAddress(LibHandle, 'SDL_SetWindowGrab')); + If Not assigned(SDL_SetWindowGrab) Then result := false; + SDL_GetWindowGrab := TSDL_GetWindowGrab_fun(GetProcAddress(LibHandle, 'SDL_GetWindowGrab')); + If Not assigned(SDL_GetWindowGrab) Then result := false; + SDL_SetWindowKeyboardGrab := TSDL_SetWindowKeyboardGrab_proc(GetProcAddress(LibHandle, 'SDL_SetWindowKeyboardGrab')); + If Not assigned(SDL_SetWindowKeyboardGrab) Then result := false; + SDL_GetWindowKeyboardGrab := TSDL_GetWindowKeyboardGrab_fun(GetProcAddress(LibHandle, 'SDL_GetWindowKeyboardGrab')); + If Not assigned(SDL_GetWindowKeyboardGrab) Then result := false; + SDL_SetWindowMouseGrab := TSDL_SetWindowMouseGrab_proc(GetProcAddress(LibHandle, 'SDL_SetWindowMouseGrab')); + If Not assigned(SDL_SetWindowMouseGrab) Then result := false; + SDL_GetWindowMouseGrab := TSDL_GetWindowMouseGrab_fun(GetProcAddress(LibHandle, 'SDL_GetWindowMouseGrab')); + If Not assigned(SDL_GetWindowMouseGrab) Then result := false; + SDL_SetWindowMouseRect := TSDL_SetWindowMouseRect_proc(GetProcAddress(LibHandle, 'SDL_SetWindowMouseRect')); + If Not assigned(SDL_SetWindowMouseRect) Then result := false; + SDL_GetWindowMouseRect := TSDL_GetWindowMouseRect_fun(GetProcAddress(LibHandle, 'SDL_GetWindowMouseRect')); + If Not assigned(SDL_GetWindowMouseRect) Then result := false; + SDL_GetGrabbedWindow := TSDL_GetGrabbedWindow_fun(GetProcAddress(LibHandle, 'SDL_GetGrabbedWindow')); + If Not assigned(SDL_GetGrabbedWindow) Then result := false; + SDL_SetWindowBrightness := TSDL_SetWindowBrightness_fun(GetProcAddress(LibHandle, 'SDL_SetWindowBrightness')); + If Not assigned(SDL_SetWindowBrightness) Then result := false; + SDL_GetWindowBrightness := TSDL_GetWindowBrightness_fun(GetProcAddress(LibHandle, 'SDL_GetWindowBrightness')); + If Not assigned(SDL_GetWindowBrightness) Then result := false; + SDL_SetWindowOpacity := TSDL_SetWindowOpacity_fun(GetProcAddress(LibHandle, 'SDL_SetWindowOpacity')); + If Not assigned(SDL_SetWindowOpacity) Then result := false; + SDL_GetWindowOpacity := TSDL_GetWindowOpacity_fun(GetProcAddress(LibHandle, 'SDL_GetWindowOpacity')); + If Not assigned(SDL_GetWindowOpacity) Then result := false; + SDL_SetWindowModalFor := TSDL_SetWindowModalFor_fun(GetProcAddress(LibHandle, 'SDL_SetWindowModalFor')); + If Not assigned(SDL_SetWindowModalFor) Then result := false; + SDL_SetWindowInputFocus := TSDL_SetWindowInputFocus_fun(GetProcAddress(LibHandle, 'SDL_SetWindowInputFocus')); + If Not assigned(SDL_SetWindowInputFocus) Then result := false; + SDL_SetWindowGammaRamp := TSDL_SetWindowGammaRamp_fun(GetProcAddress(LibHandle, 'SDL_SetWindowGammaRamp')); + If Not assigned(SDL_SetWindowGammaRamp) Then result := false; + SDL_GetWindowGammaRamp := TSDL_GetWindowGammaRamp_fun(GetProcAddress(LibHandle, 'SDL_GetWindowGammaRamp')); + If Not assigned(SDL_GetWindowGammaRamp) Then result := false; + SDL_SetWindowHitTest := TSDL_SetWindowHitTest_fun(GetProcAddress(LibHandle, 'SDL_SetWindowHitTest')); + If Not assigned(SDL_SetWindowHitTest) Then result := false; + SDL_FlashWindow := TSDL_FlashWindow_fun(GetProcAddress(LibHandle, 'SDL_FlashWindow')); + If Not assigned(SDL_FlashWindow) Then result := false; + SDL_DestroyWindow := TSDL_DestroyWindow_proc(GetProcAddress(LibHandle, 'SDL_DestroyWindow')); + If Not assigned(SDL_DestroyWindow) Then result := false; + SDL_GL_LoadLibrary := TSDL_GL_LoadLibrary_fun(GetProcAddress(LibHandle, 'SDL_GL_LoadLibrary')); + If Not assigned(SDL_GL_LoadLibrary) Then result := false; + SDL_GL_GetProcAddress := TSDL_GL_GetProcAddress_fun(GetProcAddress(LibHandle, 'SDL_GL_GetProcAddress')); + If Not assigned(SDL_GL_GetProcAddress) Then result := false; + SDL_GL_ExtensionSupported := TSDL_GL_ExtensionSupported_fun(GetProcAddress(LibHandle, 'SDL_GL_ExtensionSupported')); + If Not assigned(SDL_GL_ExtensionSupported) Then result := false; + SDL_GL_ResetAttributes := TSDL_GL_ResetAttributes_proc(GetProcAddress(LibHandle, 'SDL_GL_ResetAttributes')); + If Not assigned(SDL_GL_ResetAttributes) Then result := false; + SDL_GL_SetAttribute := TSDL_GL_SetAttribute_fun(GetProcAddress(LibHandle, 'SDL_GL_SetAttribute')); + If Not assigned(SDL_GL_SetAttribute) Then result := false; + SDL_GL_GetAttribute := TSDL_GL_GetAttribute_fun(GetProcAddress(LibHandle, 'SDL_GL_GetAttribute')); + If Not assigned(SDL_GL_GetAttribute) Then result := false; + SDL_GL_CreateContext := TSDL_GL_CreateContext_fun(GetProcAddress(LibHandle, 'SDL_GL_CreateContext')); + If Not assigned(SDL_GL_CreateContext) Then result := false; + SDL_GL_MakeCurrent := TSDL_GL_MakeCurrent_fun(GetProcAddress(LibHandle, 'SDL_GL_MakeCurrent')); + If Not assigned(SDL_GL_MakeCurrent) Then result := false; + SDL_GL_GetDrawableSize := TSDL_GL_GetDrawableSize_proc(GetProcAddress(LibHandle, 'SDL_GL_GetDrawableSize')); + If Not assigned(SDL_GL_GetDrawableSize) Then result := false; + SDL_GL_SetSwapInterval := TSDL_GL_SetSwapInterval_fun(GetProcAddress(LibHandle, 'SDL_GL_SetSwapInterval')); + If Not assigned(SDL_GL_SetSwapInterval) Then result := false; + SDL_GL_SwapWindow := TSDL_GL_SwapWindow_proc(GetProcAddress(LibHandle, 'SDL_GL_SwapWindow')); + If Not assigned(SDL_GL_SwapWindow) Then result := false; + SDL_GL_DeleteContext := TSDL_GL_DeleteContext_proc(GetProcAddress(LibHandle, 'SDL_GL_DeleteContext')); + If Not assigned(SDL_GL_DeleteContext) Then result := false; + *) + End; + If Not result Then SDL_UnLoadLib(); +End; + +Procedure SDL_UnLoadLib(); +Begin + If LibHandle <> 0 Then Begin + UnloadLibrary(LibHandle); + LibHandle := 0; + End; +End; +{$ENDIF} + diff --git a/units/sdlatomic.inc b/units/sdlatomic.inc index d380ed40..725a55d0 100644 --- a/units/sdlatomic.inc +++ b/units/sdlatomic.inc @@ -1,109 +1,109 @@ -// from SDL_atomic.h - -{** - * Atomic locks are efficient spinlocks using CPU instructions, - * but are vulnerable to starvation and can spin forever if a thread - * holding a lock has been terminated. For this reason you should - * minimize the code executed inside an atomic lock and never do - * expensive things like API or system calls while holding them. - * - * The atomic locks are not safe to lock recursively. - *} -type - PPSDL_SpinLock = ^PSDL_SpinLock; - PSDL_SpinLock = ^TSDL_SpinLock; - TSDL_SpinLock = type cint; - -{** - * Try to lock a spin lock by setting it to a non-zero value. - *} -function SDL_AtomicTryLock(lock: PSDL_SpinLock): TSDL_bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicTryLock' {$ENDIF} {$ENDIF}; - -{** - * Lock a spin lock by setting it to a non-zero value. - *} -function SDL_AtomicLock(lock: PSDL_SpinLock): TSDL_bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicLock' {$ENDIF} {$ENDIF}; - -{** - * Unlock a spin lock by setting it to 0. - * - * Always returns immediately. - *} -procedure SDL_AtomicUnlock(lock: PSDL_SpinLock); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicUnlock' {$ENDIF} {$ENDIF}; - -{** - * The compiler barrier prevents the compiler from reordering - * reads and writes to globally visible variables across the call. - *} -procedure SDL_CompilerBarrier(); - -type - {** - * A type representing an atomic integer value. It is a record - * so people don't accidentally use numeric operations on it. - *} - PPSDL_Atomic = ^PSDL_Atomic; - PSDL_Atomic = ^TSDL_Atomic; - TSDL_Atomic = record - Value: cint - end; - -{** - * Set an atomic variable to a new value if it is currently an old value. - *} -function SDL_AtomicCAS(atomic: PSDL_Atomic; oldValue, newValue: cint): TSDL_bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicCAS' {$ENDIF} {$ENDIF}; - -{** - * Set an atomic variable to a new value and return the old one. - * - * This function also acts as a full memory barrier. - *} -function SDL_AtomicSet(atomic: PSDL_Atomic; value: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicSet' {$ENDIF} {$ENDIF}; - -{** - * Get the value of an atomic variable. - *} -function SDL_AtomicGet(atomic: PSDL_Atomic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicGet' {$ENDIF} {$ENDIF}; - -{** - * Add to an atomic variable, and return the old value. - * - * This function also acts as a full memory barrier. - *} -function SDL_AtomicAdd(atomic: PSDL_Atomic; value: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicAdd' {$ENDIF} {$ENDIF}; - -{** - * Increment an atomic variable used as a reference count. - *} -function SDL_AtomicIncRef(atomic: PSDL_Atomic): cint; -{** - * Decrement an atomic variable used as a reference count - * and check if it reached zero after decrementing. - *} -function SDL_AtomicDecRef(atomic: PSDL_Atomic): Boolean; - -{** - * Set a pointer to a new value if it is currently an old value. - *} -function SDL_AtomicCASPtr(ptr: PPointer; oldValue, newValue: Pointer): TSDL_bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicCASPtr' {$ENDIF} {$ENDIF}; - -{** - * Set a pointer to a new value atomically, and return the old value. - *} -function SDL_AtomicSetPtr(ptr: PPointer; value: Pointer): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicSetPtr' {$ENDIF} {$ENDIF}; - -{** - * Get the value of a pointer atomically. - *} -function SDL_AtomicGetPtr(ptr: PPointer): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicGetPtr' {$ENDIF} {$ENDIF}; - +// from SDL_atomic.h + +{** + * Atomic locks are efficient spinlocks using CPU instructions, + * but are vulnerable to starvation and can spin forever if a thread + * holding a lock has been terminated. For this reason you should + * minimize the code executed inside an atomic lock and never do + * expensive things like API or system calls while holding them. + * + * The atomic locks are not safe to lock recursively. + *} +type + PPSDL_SpinLock = ^PSDL_SpinLock; + PSDL_SpinLock = ^TSDL_SpinLock; + TSDL_SpinLock = type cint; + +{** + * Try to lock a spin lock by setting it to a non-zero value. + *} +function SDL_AtomicTryLock(lock: PSDL_SpinLock): TSDL_bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicTryLock' {$ENDIF} {$ENDIF}; + +{** + * Lock a spin lock by setting it to a non-zero value. + *} +function SDL_AtomicLock(lock: PSDL_SpinLock): TSDL_bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicLock' {$ENDIF} {$ENDIF}; + +{** + * Unlock a spin lock by setting it to 0. + * + * Always returns immediately. + *} +procedure SDL_AtomicUnlock(lock: PSDL_SpinLock); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicUnlock' {$ENDIF} {$ENDIF}; + +{** + * The compiler barrier prevents the compiler from reordering + * reads and writes to globally visible variables across the call. + *} +procedure SDL_CompilerBarrier(); + +type + {** + * A type representing an atomic integer value. It is a record + * so people don't accidentally use numeric operations on it. + *} + PPSDL_Atomic = ^PSDL_Atomic; + PSDL_Atomic = ^TSDL_Atomic; + TSDL_Atomic = record + Value: cint + end; + +{** + * Set an atomic variable to a new value if it is currently an old value. + *} +function SDL_AtomicCAS(atomic: PSDL_Atomic; oldValue, newValue: cint): TSDL_bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicCAS' {$ENDIF} {$ENDIF}; + +{** + * Set an atomic variable to a new value and return the old one. + * + * This function also acts as a full memory barrier. + *} +function SDL_AtomicSet(atomic: PSDL_Atomic; value: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicSet' {$ENDIF} {$ENDIF}; + +{** + * Get the value of an atomic variable. + *} +function SDL_AtomicGet(atomic: PSDL_Atomic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicGet' {$ENDIF} {$ENDIF}; + +{** + * Add to an atomic variable, and return the old value. + * + * This function also acts as a full memory barrier. + *} +function SDL_AtomicAdd(atomic: PSDL_Atomic; value: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicAdd' {$ENDIF} {$ENDIF}; + +{** + * Increment an atomic variable used as a reference count. + *} +function SDL_AtomicIncRef(atomic: PSDL_Atomic): cint; +{** + * Decrement an atomic variable used as a reference count + * and check if it reached zero after decrementing. + *} +function SDL_AtomicDecRef(atomic: PSDL_Atomic): Boolean; + +{** + * Set a pointer to a new value if it is currently an old value. + *} +function SDL_AtomicCASPtr(ptr: PPointer; oldValue, newValue: Pointer): TSDL_bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicCASPtr' {$ENDIF} {$ENDIF}; + +{** + * Set a pointer to a new value atomically, and return the old value. + *} +function SDL_AtomicSetPtr(ptr: PPointer; value: Pointer): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicSetPtr' {$ENDIF} {$ENDIF}; + +{** + * Get the value of a pointer atomically. + *} +function SDL_AtomicGetPtr(ptr: PPointer): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicGetPtr' {$ENDIF} {$ENDIF}; + diff --git a/units/sdlaudio.inc b/units/sdlaudio.inc index ce3ba352..f7d3f491 100644 --- a/units/sdlaudio.inc +++ b/units/sdlaudio.inc @@ -1,1458 +1,1721 @@ -//from sdl_audio.h - {** - * Audio format flags. - * - * These are what the 16 bits in SDL_AudioFormat currently mean... - * (Unspecified bits are always zero). - * - * - ++-----------------------sample is signed if set - || - || ++-----------sample is bigendian if set - || || - || || ++---sample is float if set - || || || - || || || +---sample bit size---+ - || || || | | - 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 - * - * There are macros in SDL 2.0 and later to query these bits. - *} -type - PPSDL_AudioFormat = ^PSDL_AudioFormat; - PSDL_AudioFormat = ^TSDL_AudioFormat; - TSDL_AudioFormat = cuint16; - - {** - * Audio flags - *} -const - SDL_AUDIO_MASK_BITSIZE = ($FF); - SDL_AUDIO_MASK_DATATYPE = (1 shl 8); - SDL_AUDIO_MASK_ENDIAN = (1 shl 12); - SDL_AUDIO_MASK_SIGNED = (1 shl 15); - -function SDL_AUDIO_BITSIZE(x: Cardinal): Cardinal; -function SDL_AUDIO_ISFLOAT(x: Cardinal): Cardinal; -function SDL_AUDIO_ISBIGENDIAN(x: Cardinal): Cardinal; -function SDL_AUDIO_ISSIGNED(x: Cardinal): Cardinal; -function SDL_AUDIO_ISINT(x: Cardinal): Cardinal; -function SDL_AUDIO_ISLITTLEENDIAN(x: Cardinal): Cardinal; -function SDL_AUDIO_ISUNSIGNED(x: Cardinal): Cardinal; - - {** - * Audio format flags - * - * Defaults to LSB byte order. - *} -const - AUDIO_U8 = $0008; {**< Unsigned 8-bit samples *} - AUDIO_S8 = $8008; {**< Signed 8-bit samples *} - AUDIO_U16LSB = $0010; {**< Unsigned 16-bit samples *} - AUDIO_S16LSB = $8010; {**< Signed 16-bit samples *} - AUDIO_U16MSB = $1010; {**< As above, but big-endian byte order *} - AUDIO_S16MSB = $9010; {**< As above, but big-endian byte order *} - AUDIO_U16 = AUDIO_U16LSB; - AUDIO_S16 = AUDIO_S16LSB; - - {** - * int32 support - *} -const - AUDIO_S32LSB = $8020; {**< 32-bit integer samples *} - AUDIO_S32MSB = $9020; {**< As above, but big-endian byte order *} - AUDIO_S32 = AUDIO_S32LSB; - - {** - * float32 support - *} -const - AUDIO_F32LSB = $8120; {**< 32-bit floating point samples *} - AUDIO_F32MSB = $9120; {**< As above, but big-endian byte order *} - AUDIO_F32 = AUDIO_F32LSB; - - {** - * Native audio byte ordering - *} -{$IFDEF FPC} - {$IF DEFINED(ENDIAN_LITTLE)} - AUDIO_U16SYS = AUDIO_U16LSB; - AUDIO_S16SYS = AUDIO_S16LSB; - AUDIO_S32SYS = AUDIO_S32LSB; - AUDIO_F32SYS = AUDIO_F32LSB; - {$ELSEIF DEFINED(ENDIAN_BIG)} - AUDIO_U16SYS = AUDIO_U16MSB; - AUDIO_S16SYS = AUDIO_S16MSB; - AUDIO_S32SYS = AUDIO_S32MSB; - AUDIO_F32SYS = AUDIO_F32MSB; - {$ELSE} - {$FATAL Cannot determine endianness.} - {$IFEND} -{$ENDIF} - - {** - * Allow change flags - * - * Which audio format changes are allowed when opening a device. - *} -const - SDL_AUDIO_ALLOW_FREQUENCY_CHANGE = $00000001; - SDL_AUDIO_ALLOW_FORMAT_CHANGE = $00000002; - SDL_AUDIO_ALLOW_CHANNELS_CHANGE = $00000004; - SDL_AUDIO_ALLOW_ANY_CHANGE = (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE or - SDL_AUDIO_ALLOW_FORMAT_CHANGE or - SDL_AUDIO_ALLOW_CHANNELS_CHANGE); - - {*Audio flags*} - - {** - * This function is called when the audio device needs more data. - * - * \param userdata An application-specific parameter saved in - * the SDL_AudioSpec structure - * \param stream A pointer to the audio data buffer. - * \param len The length of that buffer in bytes. - * - * Once the callback returns, the buffer will no longer be valid. - * Stereo samples are stored in a LRLRLR ordering. - * - * You can choose to avoid callbacks and use SDL_QueueAudio() instead, if - * you like. Just open your audio device with a NULL callback. - *} -type - PPSDL_AudioCallback = ^PSDL_AudioCallback; - PSDL_AudioCallback = ^TSDL_AudioCallback; - TSDL_AudioCallback = procedure(userdata: Pointer; stream: pcuint8; len: cint); cdecl; - - {** - * The calculated values in this structure are calculated by SDL_OpenAudio(). - * - * For multi-channel audio, the default SDL channel mapping is: - * 2: FL FR (stereo) - * 3: FL FR LFE (2.1 surround) - * 4: FL FR BL BR (quad) - * 5: FL FR LFE BL BR (4.1 surround) - * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR) - * 7: FL FR FC LFE BC SL SR (6.1 surround) - * 8: FL FR FC LFE BL BR SL SR (7.1 surround) - *} -type - PPSDL_AudioSpec = ^PSDL_AudioSpec; - PSDL_AudioSpec = ^TSDL_AudioSpec; - TSDL_AudioSpec = record - freq: cint; {**< DSP frequency -- samples per second *} - format: TSDL_AudioFormat; {**< Audio data format *} - channels: cuint8; {**< Number of channels: 1 mono, 2 stereo *} - silence: cuint8; {**< Audio buffer silence value (calculated) *} - samples: cuint16; {**< Audio buffer size in sample FRAMES (total samples divided by channel count) *} - padding: cuint16; {**< Necessary for some compile environments *} - size: cuint32; {**< Audio buffer size in bytes (calculated) *} - callback: TSDL_AudioCallback; {**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). *} - userdata: Pointer; {**< Userdata passed to callback (ignored for NULL callbacks). *} - end; - - {** - * \brief Upper limit of filters in SDL_AudioCVT - * - * The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is - * currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers, - * one of which is the terminating NULL pointer. - *} -const - SDL_AUDIOCVT_MAX_FILTERS = 9; - -type - PPSDL_AudioCVT = ^PSDL_AudioCVT; - PSDL_AudioCVT = ^TSDL_AudioCVT; - TSDL_AudioFilter = procedure(cvt: PSDL_AudioCVT; format: TSDL_AudioFormat); cdecl; - - {** - * \struct SDL_AudioCVT - * \brief A structure to hold a set of audio conversion filters and buffers. - * - * Note that various parts of the conversion pipeline can take advantage - * of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require - * you to pass it aligned data, but can possibly run much faster if you - * set both its (buf) field to a pointer that is aligned to 16 bytes, and its - * (len) field to something that's a multiple of 16, if possible. - *} - TSDL_AudioCVT = record - needed: cint; {**< Set to 1 if conversion possible *} - src_format: TSDL_AudioFormat; {**< Source audio format *} - dst_format: TSDL_AudioFormat; {**< Target audio format *} - rate_incr: cdouble; {**< Rate conversion increment *} - buf: pcuint8; {**< Buffer to hold entire audio data *} - len: cint; {**< Length of original audio buffer *} - len_cvt: cint; {**< Length of converted audio buffer *} - len_mult: cint; {**< buffer must be len*len_mult big *} - len_ratio: cdouble; {**< Given len, final size is len*len_ratio *} - filters: array[0..SDL_AUDIOCVT_MAX_FILTERS] of TSDL_AudioFilter; {**< NULL-terminated list of filter functions *} - filter_index: cint; {**< Current audio conversion function *} - end; - - - {* Function prototypes *} - - {** - * Driver discovery functions - * - * These functions return the list of built in audio drivers, in the - * order that they are normally initialized by default. - *} - - {** - * Use this function to get the number of built-in audio drivers. - * - * This function returns a hardcoded number. This never returns a negative - * value; if there are no drivers compiled into this build of SDL, this - * function returns zero. The presence of a driver in this list does not mean - * it will function, it just means SDL is capable of interacting with that - * interface. For example, a build of SDL might have esound support, but if - * there's no esound server available, SDL's esound driver would fail if used. - * - * By default, SDL tries all drivers, in its preferred order, until one is - * found to be usable. - * - * \returns the number of built-in audio drivers. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetAudioDriver - *} -function SDL_GetNumAudioDrivers: cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumAudioDrivers' {$ENDIF} {$ENDIF}; - -{** - * Use this function to get the name of a built in audio driver. - * - * The list of audio drivers is given in the order that they are normally - * initialized by default; the drivers that seem more reasonable to choose - * first (as far as the SDL developers believe) are earlier in the list. - * - * The names of drivers are all simple, low-ASCII identifiers, like "alsa", - * "coreaudio" or "xaudio2". These never have Unicode characters, and are not - * meant to be proper names. - * - * \param index the index of the audio driver; the value ranges from 0 to - * SDL_GetNumAudioDrivers() - 1 - * \returns the name of the audio driver at the requested index, or NULL if an - * invalid index was specified. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetNumAudioDrivers - *} -function SDL_GetAudioDriver(index: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetAudioDriver' {$ENDIF} {$ENDIF}; - - {** - * Initialization and cleanup - * - * These functions are used internally, and should not be used unless - * you have a specific need to specify the audio driver you want to - * use. You should normally use SDL_Init() or SDL_InitSubSystem(). - *} - -{** - * Use this function to initialize a particular audio driver. - * - * This function is used internally, and should not be used unless you have a - * specific need to designate the audio driver you want to use. You should - * normally use SDL_Init() or SDL_InitSubSystem(). - * - * \param driver_name the name of the desired audio driver - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AudioQuit - *} -function SDL_AudioInit(driver_name: PAnsiChar): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioInit' {$ENDIF} {$ENDIF}; - -{** - * Use this function to shut down audio if you initialized it with - * SDL_AudioInit(). - * - * This function is used internally, and should not be used unless you have a - * specific need to specify the audio driver you want to use. You should - * normally use SDL_Quit() or SDL_QuitSubSystem(). - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AudioInit - *} -procedure SDL_AudioQuit; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioQuit' {$ENDIF} {$ENDIF}; - - {** - * Get the name of the current audio driver. - * - * The returned string points to internal static memory and thus never becomes - * invalid, even if you quit the audio subsystem and initialize a new driver - * (although such a case would return a different static string from another - * call to this function, of course). As such, you should not modify or free - * the returned string. - * - * \returns the name of the current audio driver or NULL if no driver has been - * initialized. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AudioInit - *} -function SDL_GetCurrentAudioDriver: PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCurrentAudioDriver' {$ENDIF} {$ENDIF}; - -{** - * This function is a legacy means of opening the audio device. - * - * This function remains for compatibility with SDL 1.2, but also because it's - * slightly easier to use than the new functions in SDL 2.0. The new, more - * powerful, and preferred way to do this is SDL_OpenAudioDevice(). - * - * This function is roughly equivalent to: - * - * ```c - * SDL_OpenAudioDevice(NULL, 0, desired, obtained, SDL_AUDIO_ALLOW_ANY_CHANGE); - * ``` - * - * With two notable exceptions: - * - * - If `obtained` is NULL, we use `desired` (and allow no changes), which - * means desired will be modified to have the correct values for silence, - * etc, and SDL will convert any differences between your app's specific - * request and the hardware behind the scenes. - * - The return value is always success or failure, and not a device ID, which - * means you can only have one device open at a time with this function. - * - * \param desired an SDL_AudioSpec structure representing the desired output - * format. Please refer to the SDL_OpenAudioDevice - * documentation for details on how to prepare this structure. - * \param obtained an SDL_AudioSpec structure filled in with the actual - * parameters, or NULL. - * \returns 0 if successful, placing the actual hardware parameters in the - * structure pointed to by `obtained`. - * - * If `obtained` is NULL, the audio data passed to the callback - * function will be guaranteed to be in the requested format, and - * will be automatically converted to the actual hardware audio - * format if necessary. If `obtained` is NULL, `desired` will have - * fields modified. - * - * This function returns a negative error code on failure to open the - * audio device or failure to set up the audio thread; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_CloseAudio - * \sa SDL_LockAudio - * \sa SDL_PauseAudio - * \sa SDL_UnlockAudio - *} -function SDL_OpenAudio(desired: PSDL_AudioSpec; obtained: PSDL_AudioSpec): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_OpenAudio' {$ENDIF} {$ENDIF}; - - {** - * SDL Audio Device IDs. - * - * A successful call to SDL_OpenAudio() is always device id 1, and legacy - * SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls - * always returns devices >= 2 on success. The legacy calls are good both - * for backwards compatibility and when you don't care about multiple, - * specific, or capture devices. - *} -type - PPSDL_AudioDeviceID = ^PSDL_AudioDeviceID; - PSDL_AudioDeviceID = ^TSDL_AudioDeviceID; - TSDL_AudioDeviceID = cuint32; - -{** - * Get the number of built-in audio devices. - * - * This function is only valid after successfully initializing the audio - * subsystem. - * - * Note that audio capture support is not implemented as of SDL 2.0.4, so the - * `iscapture` parameter is for future expansion and should always be zero for - * now. - * - * This function will return -1 if an explicit list of devices can't be - * determined. Returning -1 is not an error. For example, if SDL is set up to - * talk to a remote audio server, it can't list every one available on the - * Internet, but it will still allow a specific host to be specified in - * SDL_OpenAudioDevice(). - * - * In many common cases, when this function returns a value <= 0, it can still - * successfully open the default device (NULL for first argument of - * SDL_OpenAudioDevice()). - * - * This function may trigger a complete redetect of available hardware. It - * should not be called for each iteration of a loop, but rather once at the - * start of a loop: - * - * ```c - * // Don't do this: - * for (int i = 0; i < SDL_GetNumAudioDevices(0); i++) - * - * // do this instead: - * const int count = SDL_GetNumAudioDevices(0); - * for (int i = 0; i < count; ++i) do_something_here(); - * ``` - * - * \param iscapture zero to request playback devices, non-zero to request - * recording devices - * \returns the number of available devices exposed by the current driver or - * -1 if an explicit list of devices can't be determined. A return - * value of -1 does not necessarily mean an error condition. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetAudioDeviceName - * \sa SDL_OpenAudioDevice - *} -function SDL_GetNumAudioDevices(iscapture: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumAudioDevices' {$ENDIF} {$ENDIF}; - -{** - * Get the human-readable name of a specific audio device. - * - * This function is only valid after successfully initializing the audio - * subsystem. The values returned by this function reflect the latest call to - * SDL_GetNumAudioDevices(); re-call that function to redetect available - * hardware. - * - * The string returned by this function is UTF-8 encoded, read-only, and - * managed internally. You are not to free it. If you need to keep the string - * for any length of time, you should make your own copy of it, as it will be - * invalid next time any of several other SDL functions are called. - * - * \param index the index of the audio device; valid values range from 0 to - * SDL_GetNumAudioDevices() - 1 - * \param iscapture non-zero to query the list of recording devices, zero to - * query the list of output devices. - * \returns the name of the audio device at the requested index, or NULL on - * error. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetNumAudioDevices - * \sa SDL_GetDefaultAudioInfo - *} -function SDL_GetAudioDeviceName(index: cint; iscapture: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetAudioDeviceName' {$ENDIF} {$ENDIF}; - -{* - * Get the preferred audio format of a specific audio device. - * - * This function is only valid after a successfully initializing the audio - * subsystem. The values returned by this function reflect the latest call to - * SDL_GetNumAudioDevices(); re-call that function to redetect available - * hardware. - * - * `spec` will be filled with the sample rate, sample format, and channel - * count. - * - * \param index the index of the audio device; valid values range from 0 to - * SDL_GetNumAudioDevices() - 1 - * \param iscapture non-zero to query the list of recording devices, zero to - * query the list of output devices. - * \param spec The SDL_AudioSpec to be initialized by this function. - * \returns 0 on success, nonzero on error - * - * \since This function is available since SDL 2.0.16. - * - * \sa SDL_GetNumAudioDevices - * \sa SDL_GetDefaultAudioInfo - } -function SDL_GetAudioDeviceSpec(index: cint; iscapture: cint; spec: PSDL_AudioSpec): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetAudioDeviceSpec' {$ENDIF} {$ENDIF}; - -{* - * Get the name and preferred format of the default audio device. - * - * Some (but not all!) platforms have an isolated mechanism to get information - * about the "default" device. This can actually be a completely different - * device that's not in the list you get from SDL_GetAudioDeviceSpec(). It can - * even be a network address! (This is discussed in SDL_OpenAudioDevice().) - * - * As a result, this call is not guaranteed to be performant, as it can query - * the sound server directly every time, unlike the other query functions. You - * should call this function sparingly! - * - * `spec` will be filled with the sample rate, sample format, and channel - * count, if a default device exists on the system. If `name` is provided, - * will be filled with either a dynamically-allocated UTF-8 string or nil. - * - * \param name A pointer to be filled with the name of the default device (can - * be nil). Please call SDL_free() when you are done with this - * pointer! - * \param spec The SDL_AudioSpec to be initialized by this function. - * \param iscapture non-zero to query the default recording device, zero to - * query the default output device. - * \returns 0 on success, nonzero on error - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_GetAudioDeviceName - * \sa SDL_GetAudioDeviceSpec - * \sa SDL_OpenAudioDevice - } -function SDL_GetDefaultAudioInfo(name: PPAnsiChar; spec: PSDL_AudioSpec; iscapture: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDefaultAudioInfo' {$ENDIF} {$ENDIF}; - -{** - * Open a specific audio device. - * - * SDL_OpenAudio(), unlike this function, always acts on device ID 1. As such, - * this function will never return a 1 so as not to conflict with the legacy - * function. - * - * Please note that SDL 2.0 before 2.0.5 did not support recording; as such, - * this function would fail if `iscapture` was not zero. Starting with SDL - * 2.0.5, recording is implemented and this value can be non-zero. - * - * Passing in a `device` name of NULL requests the most reasonable default - * (and is equivalent to what SDL_OpenAudio() does to choose a device). The - * `device` name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but - * some drivers allow arbitrary and driver-specific strings, such as a - * hostname/IP address for a remote audio server, or a filename in the - * diskaudio driver. - * - * An opened audio device starts out paused, and should be enabled for playing - * by calling SDL_PauseAudioDevice(devid, 0) when you are ready for your audio - * callback function to be called. Since the audio driver may modify the - * requested size of the audio buffer, you should allocate any local mixing - * buffers after you open the audio device. - * - * The audio callback runs in a separate thread in most cases; you can prevent - * race conditions between your callback and other threads without fully - * pausing playback with SDL_LockAudioDevice(). For more information about the - * callback, see SDL_AudioSpec. - * - * Managing the audio spec via 'desired' and 'obtained': - * - * When filling in the desired audio spec structure: - * - * - `desired->freq` should be the frequency in sample-frames-per-second (Hz). - * - `desired->format` should be the audio format (`AUDIO_S16SYS`, etc). - * - `desired->samples` is the desired size of the audio buffer, in _sample - * frames_ (with stereo output, two samples--left and right--would make a - * single sample frame). This number should be a power of two, and may be - * adjusted by the audio driver to a value more suitable for the hardware. - * Good values seem to range between 512 and 8096 inclusive, depending on - * the application and CPU speed. Smaller values reduce latency, but can - * lead to underflow if the application is doing heavy processing and cannot - * fill the audio buffer in time. Note that the number of sample frames is - * directly related to time by the following formula: `ms = - * (sampleframes*1000)/freq` - * - `desired->size` is the size in _bytes_ of the audio buffer, and is - * calculated by SDL_OpenAudioDevice(). You don't initialize this. - * - `desired->silence` is the value used to set the buffer to silence, and is - * calculated by SDL_OpenAudioDevice(). You don't initialize this. - * - `desired->callback` should be set to a function that will be called when - * the audio device is ready for more data. It is passed a pointer to the - * audio buffer, and the length in bytes of the audio buffer. This function - * usually runs in a separate thread, and so you should protect data - * structures that it accesses by calling SDL_LockAudioDevice() and - * SDL_UnlockAudioDevice() in your code. Alternately, you may pass a NULL - * pointer here, and call SDL_QueueAudio() with some frequency, to queue - * more audio samples to be played (or for capture devices, call - * SDL_DequeueAudio() with some frequency, to obtain audio samples). - * - `desired->userdata` is passed as the first parameter to your callback - * function. If you passed a NULL callback, this value is ignored. - * - * `allowed_changes` can have the following flags OR'd together: - * - * - `SDL_AUDIO_ALLOW_FREQUENCY_CHANGE` - * - `SDL_AUDIO_ALLOW_FORMAT_CHANGE` - * - `SDL_AUDIO_ALLOW_CHANNELS_CHANGE` - * - `SDL_AUDIO_ALLOW_SAMPLES_CHANGE` - * - `SDL_AUDIO_ALLOW_ANY_CHANGE` - * - * These flags specify how SDL should behave when a device cannot offer a - * specific feature. If the application requests a feature that the hardware - * doesn't offer, SDL will always try to get the closest equivalent. - * - * For example, if you ask for float32 audio format, but the sound card only - * supports int16, SDL will set the hardware to int16. If you had set - * SDL_AUDIO_ALLOW_FORMAT_CHANGE, SDL will change the format in the `obtained` - * structure. If that flag was *not* set, SDL will prepare to convert your - * callback's float32 audio to int16 before feeding it to the hardware and - * will keep the originally requested format in the `obtained` structure. - * - * The resulting audio specs, varying depending on hardware and on what - * changes were allowed, will then be written back to `obtained`. - * - * If your application can only handle one specific data format, pass a zero - * for `allowed_changes` and let SDL transparently handle any differences. - * - * \param device a UTF-8 string reported by SDL_GetAudioDeviceName() or a - * driver-specific name as appropriate. NULL requests the most - * reasonable default device. - * \param iscapture non-zero to specify a device should be opened for - * recording, not playback - * \param desired an SDL_AudioSpec structure representing the desired output - * format; see SDL_OpenAudio() for more information - * \param obtained an SDL_AudioSpec structure filled in with the actual output - * format; see SDL_OpenAudio() for more information - * \param allowed_changes 0, or one or more flags OR'd together - * \returns a valid device ID that is > 0 on success or 0 on failure; call - * SDL_GetError() for more information. - * - * For compatibility with SDL 1.2, this will never return 1, since - * SDL reserves that ID for the legacy SDL_OpenAudio() function. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_CloseAudioDevice - * \sa SDL_GetAudioDeviceName - * \sa SDL_LockAudioDevice - * \sa SDL_OpenAudio - * \sa SDL_PauseAudioDevice - * \sa SDL_UnlockAudioDevice - *} -function SDL_OpenAudioDevice(device: PAnsiChar; - iscapture: cint; - desired: PSDL_AudioSpec; - obtained: PSDL_AudioSpec; - allowed_changes: cint): TSDL_AudioDeviceID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_OpenAudioDevice' {$ENDIF} {$ENDIF}; - - {** - * Audio state - * - * Get the current audio state. - *} - -type - PPSDL_AudioStatus = ^PSDL_AudioStatus; - PSDL_AudioStatus = ^TSDL_AudioStatus; - TSDL_AudioStatus = type cint; - -const - SDL_AUDIO_STOPPED = TSDL_AudioStatus(0); - SDL_AUDIO_PLAYING = TSDL_AudioStatus(1); - SDL_AUDIO_PAUSED = TSDL_AudioStatus(2); - -{** - * This function is a legacy means of querying the audio device. - * - * New programs might want to use SDL_GetAudioDeviceStatus() instead. This - * function is equivalent to calling... - * - * ```c - * SDL_GetAudioDeviceStatus(1); - * ``` - * - * ...and is only useful if you used the legacy SDL_OpenAudio() function. - * - * \returns the SDL_AudioStatus of the audio device opened by SDL_OpenAudio(). - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetAudioDeviceStatus - *} -function SDL_GetAudioStatus: TSDL_AudioStatus; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetAudioStatus' {$ENDIF} {$ENDIF}; - -{** - * Use this function to get the current audio state of an audio device. - * - * \param dev the ID of an audio device previously opened with - * SDL_OpenAudioDevice() - * \returns the SDL_AudioStatus of the specified audio device. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_PauseAudioDevice - *} -function SDL_GetAudioDeviceStatus(dev: TSDL_AudioDeviceID): TSDL_AudioStatus; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetAudioDeviceStatus' {$ENDIF} {$ENDIF}; - -{*Audio State*} - - {** - * Pause audio functions - * - * These functions pause and unpause the audio callback processing. - * They should be called with a parameter of 0 after opening the audio - * device to start playing sound. This is so you can safely initialize - * data for your callback function after opening the audio device. - * Silence will be written to the audio device during the pause. - *} - -{** - * This function is a legacy means of pausing the audio device. - * - * New programs might want to use SDL_PauseAudioDevice() instead. This - * function is equivalent to calling... - * - * ```c - * SDL_PauseAudioDevice(1, pause_on); - * ``` - * - * ...and is only useful if you used the legacy SDL_OpenAudio() function. - * - * \param pause_on non-zero to pause, 0 to unpause - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetAudioStatus - * \sa SDL_PauseAudioDevice - *} -procedure SDL_PauseAudio(pause_on: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PauseAudio' {$ENDIF} {$ENDIF}; - -{** - * Use this function to pause and unpause audio playback on a specified - * device. - * - * This function pauses and unpauses the audio callback processing for a given - * device. Newly-opened audio devices start in the paused state, so you must - * call this function with **pause_on**=0 after opening the specified audio - * device to start playing sound. This allows you to safely initialize data - * for your callback function after opening the audio device. Silence will be - * written to the audio device while paused, and the audio callback is - * guaranteed to not be called. Pausing one device does not prevent other - * unpaused devices from running their callbacks. - * - * Pausing state does not stack; even if you pause a device several times, a - * single unpause will start the device playing again, and vice versa. This is - * different from how SDL_LockAudioDevice() works. - * - * If you just need to protect a few variables from race conditions vs your - * callback, you shouldn't pause the audio device, as it will lead to dropouts - * in the audio playback. Instead, you should use SDL_LockAudioDevice(). - * - * \param dev a device opened by SDL_OpenAudioDevice() - * \param pause_on non-zero to pause, 0 to unpause - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_LockAudioDevice - *} -procedure SDL_PauseAudioDevice(dev: TSDL_AudioDeviceID; pause_on: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PauseAudioDevice' {$ENDIF} {$ENDIF}; - -{*Pause audio functions*} - - {** - * Load the audio data of a WAVE file into memory. - * - * Loading a WAVE file requires `src`, `spec`, `audio_buf` and `audio_len` to - * be valid pointers. The entire data portion of the file is then loaded into - * memory and decoded if necessary. - * - * If `freesrc` is non-zero, the data source gets automatically closed and - * freed before the function returns. - * - * Supported formats are RIFF WAVE files with the formats PCM (8, 16, 24, and - * 32 bits), IEEE Float (32 bits), Microsoft ADPCM and IMA ADPCM (4 bits), and - * A-law and mu-law (8 bits). Other formats are currently unsupported and - * cause an error. - * - * If this function succeeds, the pointer returned by it is equal to `spec` - * and the pointer to the audio data allocated by the function is written to - * `audio_buf` and its length in bytes to `audio_len`. The SDL_AudioSpec - * members `freq`, `channels`, and `format` are set to the values of the audio - * data in the buffer. The `samples` member is set to a sane default and all - * others are set to zero. - * - * It's necessary to use SDL_FreeWAV() to free the audio data returned in - * `audio_buf` when it is no longer used. - * - * Because of the underspecification of the .WAV format, there are many - * problematic files in the wild that cause issues with strict decoders. To - * provide compatibility with these files, this decoder is lenient in regards - * to the truncation of the file, the fact chunk, and the size of the RIFF - * chunk. The hints `SDL_HINT_WAVE_RIFF_CHUNK_SIZE`, - * `SDL_HINT_WAVE_TRUNCATION`, and `SDL_HINT_WAVE_FACT_CHUNK` can be used to - * tune the behavior of the loading process. - * - * Any file that is invalid (due to truncation, corruption, or wrong values in - * the headers), too big, or unsupported causes an error. Additionally, any - * critical I/O error from the data source will terminate the loading process - * with an error. The function returns NULL on error and in all cases (with - * the exception of `src` being NULL), an appropriate error message will be - * set. - * - * It is required that the data source supports seeking. - * - * Example: - * - * ```c - * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, &spec, &buf, &len); - * ``` - * - * Note that the SDL_LoadWAV macro does this same thing for you, but in a less - * messy way: - * - * ```c - * SDL_LoadWAV("sample.wav", &spec, &buf, &len); - * ``` - * - * \param src The data source for the WAVE data - * \param freesrc If non-zero, SDL will _always_ free the data source - * \param spec An SDL_AudioSpec that will be filled in with the wave file's - * format details - * \param audio_buf A pointer filled with the audio data, allocated by the - * function. - * \param audio_len A pointer filled with the length of the audio data buffer - * in bytes - * \returns This function, if successfully called, returns `spec`, which will - * be filled with the audio data format of the wave source data. - * `audio_buf` will be filled with a pointer to an allocated buffer - * containing the audio data, and `audio_len` is filled with the - * length of that audio buffer in bytes. - * - * This function returns NULL if the .WAV file cannot be opened, uses - * an unknown data format, or is corrupt; call SDL_GetError() for - * more information. - * - * When the application is done with the data returned in - * `audio_buf`, it should call SDL_FreeWAV() to dispose of it. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_FreeWAV - * \sa SDL_LoadWAV - *} -function SDL_LoadWAV_RW(src: PSDL_RWops; - freesrc: cint; - spec: PSDL_AudioSpec; - audio_buf: ppcuint8; - audio_len: pcuint32): PSDL_AudioSpec; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadWAV_RW' {$ENDIF} {$ENDIF}; - -{** - * Loads a WAV from a file. - * Compatibility convenience function. - *} -function SDL_LoadWAV(file_: PAnsiChar; spec: PSDL_AudioSpec; audio_buf: ppcuint8; audio_len: pcuint32): PSDL_AudioSpec; - -{** - * Free data previously allocated with SDL_LoadWAV() or SDL_LoadWAV_RW(). - * - * After a WAVE file has been opened with SDL_LoadWAV() or SDL_LoadWAV_RW() - * its data can eventually be freed with SDL_FreeWAV(). It is safe to call - * this function with a NULL pointer. - * - * \param audio_buf a pointer to the buffer created by SDL_LoadWAV() or - * SDL_LoadWAV_RW() - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_LoadWAV - * \sa SDL_LoadWAV_RW - *} -procedure SDL_FreeWAV(audio_buf: pcuint8); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeWAV' {$ENDIF} {$ENDIF}; - -{** - * Initialize an SDL_AudioCVT structure for conversion. - * - * Before an SDL_AudioCVT structure can be used to convert audio data it must - * be initialized with source and destination information. - * - * This function will zero out every field of the SDL_AudioCVT, so it must be - * called before the application fills in the final buffer information. - * - * Once this function has returned successfully, and reported that a - * conversion is necessary, the application fills in the rest of the fields in - * SDL_AudioCVT, now that it knows how large a buffer it needs to allocate, - * and then can call SDL_ConvertAudio() to complete the conversion. - * - * \param cvt an SDL_AudioCVT structure filled in with audio conversion - * information - * \param src_format the source format of the audio data; for more info see - * SDL_AudioFormat - * \param src_channels the number of channels in the source - * \param src_rate the frequency (sample-frames-per-second) of the source - * \param dst_format the destination format of the audio data; for more info - * see SDL_AudioFormat - * \param dst_channels the number of channels in the destination - * \param dst_rate the frequency (sample-frames-per-second) of the destination - * \returns 1 if the audio filter is prepared, 0 if no conversion is needed, - * or a negative error code on failure; call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_ConvertAudio - *} -function SDL_BuildAudioCVT(cvt: PSDL_AudioCVT; - src_format: TSDL_AudioFormat; - src_channels: cuint8; - src_rate: cint; - dst_format: TSDL_AudioFormat; - dst_channels: cuint8; - dst_rate: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_BuildAudioCVT' {$ENDIF} {$ENDIF}; - -{** - * Convert audio data to a desired audio format. - * - * This function does the actual audio data conversion, after the application - * has called SDL_BuildAudioCVT() to prepare the conversion information and - * then filled in the buffer details. - * - * Once the application has initialized the `cvt` structure using - * SDL_BuildAudioCVT(), allocated an audio buffer and filled it with audio - * data in the source format, this function will convert the buffer, in-place, - * to the desired format. - * - * The data conversion may go through several passes; any given pass may - * possibly temporarily increase the size of the data. For example, SDL might - * expand 16-bit data to 32 bits before resampling to a lower frequency, - * shrinking the data size after having grown it briefly. Since the supplied - * buffer will be both the source and destination, converting as necessary - * in-place, the application must allocate a buffer that will fully contain - * the data during its largest conversion pass. After SDL_BuildAudioCVT() - * returns, the application should set the `cvt->len` field to the size, in - * bytes, of the source data, and allocate a buffer that is `cvt->len * - * cvt->len_mult` bytes long for the `buf` field. - * - * The source data should be copied into this buffer before the call to - * SDL_ConvertAudio(). Upon successful return, this buffer will contain the - * converted audio, and `cvt->len_cvt` will be the size of the converted data, - * in bytes. Any bytes in the buffer past `cvt->len_cvt` are undefined once - * this function returns. - * - * \param cvt an SDL_AudioCVT structure that was previously set up by - * SDL_BuildAudioCVT(). - * \returns 0 if the conversion was completed successfully or a negative error - * code on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_BuildAudioCVT - *} -function SDL_ConvertAudio(cvt: PSDL_AudioCVT): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ConvertAudio' {$ENDIF} {$ENDIF}; - -{ SDL_AudioStream is a new audio conversion interface. - The benefits vs SDL_AudioCVT: - - it can handle resampling data in chunks without generating - artifacts, when it doesn't have the complete buffer available. - - it can handle incoming data in any variable size. - - You push data as you have it, and pull it when you need it - } -{ this is opaque to the outside world. } -type - PSDL_AudioStream = type Pointer; - -{* - * Create a new audio stream. - * - * \param src_format The format of the source audio - * \param src_channels The number of channels of the source audio - * \param src_rate The sampling rate of the source audio - * \param dst_format The format of the desired audio output - * \param dst_channels The number of channels of the desired audio output - * \param dst_rate The sampling rate of the desired audio output - * \returns 0 on success, or -1 on error. - * - * \since This function is available since SDL 2.0.7. - * - * \sa SDL_AudioStreamPut - * \sa SDL_AudioStreamGet - * \sa SDL_AudioStreamAvailable - * \sa SDL_AudioStreamFlush - * \sa SDL_AudioStreamClear - * \sa SDL_FreeAudioStream - } -function SDL_NewAudioStream(src_format: TSDL_AudioFormat; src_channels: cuint8; src_rate: cint; dst_format: TSDL_AudioFormat; dst_channels: cuint8; - dst_rate: cint): PSDL_AudioStream; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_NewAudioStream' {$ENDIF} {$ENDIF}; - -{* - * Add data to be converted/resampled to the stream. - * - * \param stream The stream the audio data is being added to - * \param buf A pointer to the audio data to add - * \param len The number of bytes to write to the stream - * \returns 0 on success, or -1 on error. - * - * \since This function is available since SDL 2.0.7. - * - * \sa SDL_NewAudioStream - * \sa SDL_AudioStreamGet - * \sa SDL_AudioStreamAvailable - * \sa SDL_AudioStreamFlush - * \sa SDL_AudioStreamClear - * \sa SDL_FreeAudioStream - } -function SDL_AudioStreamPut(stream: PSDL_AudioStream; buf: pointer; len: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioStreamPut' {$ENDIF} {$ENDIF}; - -{* - * Get converted/resampled data from the stream - * - * \param stream The stream the audio is being requested from - * \param buf A buffer to fill with audio data - * \param len The maximum number of bytes to fill - * \returns the number of bytes read from the stream, or -1 on error - * - * \since This function is available since SDL 2.0.7. - * - * \sa SDL_NewAudioStream - * \sa SDL_AudioStreamPut - * \sa SDL_AudioStreamAvailable - * \sa SDL_AudioStreamFlush - * \sa SDL_AudioStreamClear - * \sa SDL_FreeAudioStream - } -function SDL_AudioStreamGet(stream: PSDL_AudioStream; buf: pointer; len: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioStreamGet' {$ENDIF} {$ENDIF}; - -{* - * Get the number of converted/resampled bytes available. - * - * The stream may be buffering data behind the scenes until it has enough to - * resample correctly, so this number might be lower than what you expect, or - * even be zero. Add more data or flush the stream if you need the data now. - * - * \since This function is available since SDL 2.0.7. - * - * \sa SDL_NewAudioStream - * \sa SDL_AudioStreamPut - * \sa SDL_AudioStreamGet - * \sa SDL_AudioStreamFlush - * \sa SDL_AudioStreamClear - * \sa SDL_FreeAudioStream - } -function SDL_AudioStreamAvailable(stream: PSDL_AudioStream): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioStreamAvailable' {$ENDIF} {$ENDIF}; - -{* - * Tell the stream that you're done sending data, and anything being buffered - * should be converted/resampled and made available immediately. - * - * It is legal to add more data to a stream after flushing, but there will be - * audio gaps in the output. Generally this is intended to signal the end of - * input, so the complete output becomes available. - * - * \since This function is available since SDL 2.0.7. - * - * \sa SDL_NewAudioStream - * \sa SDL_AudioStreamPut - * \sa SDL_AudioStreamGet - * \sa SDL_AudioStreamAvailable - * \sa SDL_AudioStreamClear - * \sa SDL_FreeAudioStream - } -function SDL_AudioStreamFlush(stream: PSDL_AudioStream): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioStreamFlush' {$ENDIF} {$ENDIF}; - -{* - * Clear any pending data in the stream without converting it - * - * \since This function is available since SDL 2.0.7. - * - * \sa SDL_NewAudioStream - * \sa SDL_AudioStreamPut - * \sa SDL_AudioStreamGet - * \sa SDL_AudioStreamAvailable - * \sa SDL_AudioStreamFlush - * \sa SDL_FreeAudioStream - } -procedure SDL_AudioStreamClear(stream: PSDL_AudioStream); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioStreamClear' {$ENDIF} {$ENDIF}; - -{* - * Free an audio stream - * - * \since This function is available since SDL 2.0.7. - * - * \sa SDL_NewAudioStream - * \sa SDL_AudioStreamPut - * \sa SDL_AudioStreamGet - * \sa SDL_AudioStreamAvailable - * \sa SDL_AudioStreamFlush - * \sa SDL_AudioStreamClear - } -procedure SDL_FreeAudioStream(stream: PSDL_AudioStream); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeAudioStream' {$ENDIF} {$ENDIF}; - -const - SDL_MIX_MAXVOLUME = 128; - -{** - * This function is a legacy means of mixing audio. - * - * This function is equivalent to calling... - * - * ```c - * SDL_MixAudioFormat(dst, src, format, len, volume); - * ``` - * - * ...where `format` is the obtained format of the audio device from the - * legacy SDL_OpenAudio() function. - * - * \param dst the destination for the mixed audio - * \param src the source audio buffer to be mixed - * \param len the length of the audio buffer in bytes - * \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME - * for full audio volume - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_MixAudioFormat - *} -procedure SDL_MixAudio(dst: pcuint8; src: pcuint8; len: cuint32; volume: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MixAudio' {$ENDIF} {$ENDIF}; - - {** - * Mix audio data in a specified format. - * - * This takes an audio buffer `src` of `len` bytes of `format` data and mixes - * it into `dst`, performing addition, volume adjustment, and overflow - * clipping. The buffer pointed to by `dst` must also be `len` bytes of - * `format` data. - * - * This is provided for convenience -- you can mix your own audio data. - * - * Do not use this function for mixing together more than two streams of - * sample data. The output from repeated application of this function may be - * distorted by clipping, because there is no accumulator with greater range - * than the input (not to mention this being an inefficient way of doing it). - * - * It is a common misconception that this function is required to write audio - * data to an output stream in an audio callback. While you can do that, - * SDL_MixAudioFormat() is really only needed when you're mixing a single - * audio stream with a volume adjustment. - * - * \param dst the destination for the mixed audio - * \param src the source audio buffer to be mixed - * \param format the SDL_AudioFormat structure representing the desired audio - * format - * \param len the length of the audio buffer in bytes - * \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME - * for full audio volume - * - * \since This function is available since SDL 2.0.0. - *} -procedure SDL_MixAudioFormat(dst: pcuint8; src: pcuint8; format: TSDL_AudioFormat; len: cuint32; volume: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MixAudioFormat' {$ENDIF} {$ENDIF}; - - {** - * Queue more audio on non-callback devices. - * - * If you are looking to retrieve queued audio from a non-callback capture - * device, you want SDL_DequeueAudio() instead. SDL_QueueAudio() will return - * -1 to signify an error if you use it with capture devices. - * - * SDL offers two ways to feed audio to the device: you can either supply a - * callback that SDL triggers with some frequency to obtain more audio (pull - * method), or you can supply no callback, and then SDL will expect you to - * supply data at regular intervals (push method) with this function. - * - * There are no limits on the amount of data you can queue, short of - * exhaustion of address space. Queued data will drain to the device as - * necessary without further intervention from you. If the device needs audio - * but there is not enough queued, it will play silence to make up the - * difference. This means you will have skips in your audio playback if you - * aren't routinely queueing sufficient data. - * - * This function copies the supplied data, so you are safe to free it when the - * function returns. This function is thread-safe, but queueing to the same - * device from two threads at once does not promise which buffer will be - * queued first. - * - * You may not queue audio on a device that is using an application-supplied - * callback; doing so returns an error. You have to use the audio callback or - * queue audio with this function, but not both. - * - * You should not call SDL_LockAudio() on the device before queueing; SDL - * handles locking internally for this function. - * - * Note that SDL2 does not support planar audio. You will need to resample - * from planar audio formats into a non-planar one (see SDL_AudioFormat) - * before queuing audio. - * - * \param dev the device ID to which we will queue audio - * \param data the data to queue to the device for later playback - * \param len the number of bytes (not samples!) to which `data` points - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.4. - * - * \sa SDL_ClearQueuedAudio - * \sa SDL_GetQueuedAudioSize - *} -function SDL_QueueAudio(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_QueueAudio' {$ENDIF} {$ENDIF}; - - {** - * Dequeue more audio on non-callback devices. - * - * If you are looking to queue audio for output on a non-callback playback - * device, you want SDL_QueueAudio() instead. SDL_DequeueAudio() will always - * return 0 if you use it with playback devices. - * - * SDL offers two ways to retrieve audio from a capture device: you can either - * supply a callback that SDL triggers with some frequency as the device - * records more audio data, (push method), or you can supply no callback, and - * then SDL will expect you to retrieve data at regular intervals (pull - * method) with this function. - * - * There are no limits on the amount of data you can queue, short of - * exhaustion of address space. Data from the device will keep queuing as - * necessary without further intervention from you. This means you will - * eventually run out of memory if you aren't routinely dequeueing data. - * - * Capture devices will not queue data when paused; if you are expecting to - * not need captured audio for some length of time, use SDL_PauseAudioDevice() - * to stop the capture device from queueing more data. This can be useful - * during, say, level loading times. When unpaused, capture devices will start - * queueing data from that point, having flushed any capturable data available - * while paused. - * - * This function is thread-safe, but dequeueing from the same device from two - * threads at once does not promise which thread will dequeue data first. - * - * You may not dequeue audio from a device that is using an - * application-supplied callback; doing so returns an error. You have to use - * the audio callback, or dequeue audio with this function, but not both. - * - * You should not call SDL_LockAudio() on the device before dequeueing; SDL - * handles locking internally for this function. - * - * \param dev the device ID from which we will dequeue audio - * \param data a pointer into where audio data should be copied - * \param len the number of bytes (not samples!) to which (data) points - * \returns the number of bytes dequeued, which could be less than requested; - * call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.5. - * - * \sa SDL_ClearQueuedAudio - * \sa SDL_GetQueuedAudioSize - *} -function SDL_DequeueAudio(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DequeueAudio' {$ENDIF} {$ENDIF}; - -{** - * Get the number of bytes of still-queued audio. - * - * For playback devices: this is the number of bytes that have been queued for - * playback with SDL_QueueAudio(), but have not yet been sent to the hardware. - * - * Once we've sent it to the hardware, this function can not decide the exact - * byte boundary of what has been played. It's possible that we just gave the - * hardware several kilobytes right before you called this function, but it - * hasn't played any of it yet, or maybe half of it, etc. - * - * For capture devices, this is the number of bytes that have been captured by - * the device and are waiting for you to dequeue. This number may grow at any - * time, so this only informs of the lower-bound of available data. - * - * You may not queue or dequeue audio on a device that is using an - * application-supplied callback; calling this function on such a device - * always returns 0. You have to use the audio callback or queue audio, but - * not both. - * - * You should not call SDL_LockAudio() on the device before querying; SDL - * handles locking internally for this function. - * - * \param dev the device ID of which we will query queued audio size - * \returns the number of bytes (not samples!) of queued audio. - * - * \since This function is available since SDL 2.0.4. - * - * \sa SDL_ClearQueuedAudio - * \sa SDL_QueueAudio - * \sa SDL_DequeueAudio - *} -function SDL_GetQueuedAudioSize(dev: TSDL_AudioDeviceID): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetQueuedAudioSize' {$ENDIF} {$ENDIF}; - - {** - * Drop any queued audio data waiting to be sent to the hardware. - * - * Immediately after this call, SDL_GetQueuedAudioSize() will return 0. For - * output devices, the hardware will start playing silence if more audio isn't - * queued. For capture devices, the hardware will start filling the empty - * queue with new data if the capture device isn't paused. - * - * This will not prevent playback of queued audio that's already been sent to - * the hardware, as we can not undo that, so expect there to be some fraction - * of a second of audio that might still be heard. This can be useful if you - * want to, say, drop any pending music or any unprocessed microphone input - * during a level change in your game. - * - * You may not queue or dequeue audio on a device that is using an - * application-supplied callback; calling this function on such a device - * always returns 0. You have to use the audio callback or queue audio, but - * not both. - * - * You should not call SDL_LockAudio() on the device before clearing the - * queue; SDL handles locking internally for this function. - * - * This function always succeeds and thus returns void. - * - * \param dev the device ID of which to clear the audio queue - * - * \since This function is available since SDL 2.0.4. - * - * \sa SDL_GetQueuedAudioSize - * \sa SDL_QueueAudio - * \sa SDL_DequeueAudio - *} -procedure SDL_ClearQueuedAudio(dev: TSDL_AudioDeviceID); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ClearQueuedAudio' {$ENDIF} {$ENDIF}; - - {** - * Audio lock functions - * - * The lock manipulated by these functions protects the callback function. - * During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that - * the callback function is not running. Do not call these from the callback - * function or you will cause deadlock. - *} - -{** - * This function is a legacy means of locking the audio device. - * - * New programs might want to use SDL_LockAudioDevice() instead. This function - * is equivalent to calling... - * - * ```c - * SDL_LockAudioDevice(1); - * ``` - * - * ...and is only useful if you used the legacy SDL_OpenAudio() function. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_LockAudioDevice - * \sa SDL_UnlockAudio - * \sa SDL_UnlockAudioDevice - *} -procedure SDL_LockAudio; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockAudio' {$ENDIF} {$ENDIF}; - -{** - * Use this function to lock out the audio callback function for a specified - * device. - * - * The lock manipulated by these functions protects the audio callback - * function specified in SDL_OpenAudioDevice(). During a - * SDL_LockAudioDevice()/SDL_UnlockAudioDevice() pair, you can be guaranteed - * that the callback function for that device is not running, even if the - * device is not paused. While a device is locked, any other unpaused, - * unlocked devices may still run their callbacks. - * - * Calling this function from inside your audio callback is unnecessary. SDL - * obtains this lock before calling your function, and releases it when the - * function returns. - * - * You should not hold the lock longer than absolutely necessary. If you hold - * it too long, you'll experience dropouts in your audio playback. Ideally, - * your application locks the device, sets a few variables and unlocks again. - * Do not do heavy work while holding the lock for a device. - * - * It is safe to lock the audio device multiple times, as long as you unlock - * it an equivalent number of times. The callback will not run until the - * device has been unlocked completely in this way. If your application fails - * to unlock the device appropriately, your callback will never run, you might - * hear repeating bursts of audio, and SDL_CloseAudioDevice() will probably - * deadlock. - * - * Internally, the audio device lock is a mutex; if you lock from two threads - * at once, not only will you block the audio callback, you'll block the other - * thread. - * - * \param dev the ID of the device to be locked - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_UnlockAudioDevice - *} -procedure SDL_LockAudioDevice(dev: TSDL_AudioDeviceID); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockAudioDevice' {$ENDIF} {$ENDIF}; - -{** - * This function is a legacy means of unlocking the audio device. - * - * New programs might want to use SDL_UnlockAudioDevice() instead. This - * function is equivalent to calling... - * - * ```c - * SDL_UnlockAudioDevice(1); - * ``` - * - * ...and is only useful if you used the legacy SDL_OpenAudio() function. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_LockAudio - * \sa SDL_UnlockAudioDevice - *} -procedure SDL_UnlockAudio; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Unlock' {$ENDIF} {$ENDIF}; - -{** - * Use this function to unlock the audio callback function for a specified - * device. - * - * This function should be paired with a previous SDL_LockAudioDevice() call. - * - * \param dev the ID of the device to be unlocked - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_LockAudioDevice - *} -procedure SDL_UnlockAudioDevice(dev: TSDL_AudioDeviceID); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnlockAudioDevice' {$ENDIF} {$ENDIF}; - -{*Audio lock functions*} - -{** - * This function is a legacy means of closing the audio device. - * - * This function is equivalent to calling... - * - * ```c - * SDL_CloseAudioDevice(1); - * ``` - * - * ...and is only useful if you used the legacy SDL_OpenAudio() function. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_OpenAudio - *} -procedure SDL_CloseAudio; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CloseAudio' {$ENDIF} {$ENDIF}; - -{** - * Use this function to shut down audio processing and close the audio device. - * - * The application should close open audio devices once they are no longer - * needed. Calling this function will wait until the device's audio callback - * is not running, release the audio hardware and then clean up internal - * state. No further audio will play from this device once this function - * returns. - * - * This function may block briefly while pending audio data is played by the - * hardware, so that applications don't drop the last buffer of data they - * supplied. - * - * The device ID is invalid as soon as the device is closed, and is eligible - * for reuse in a new SDL_OpenAudioDevice() call immediately. - * - * \param dev an audio device previously opened with SDL_OpenAudioDevice() - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_OpenAudioDevice - *} -procedure SDL_CloseAudioDevice(dev: TSDL_AudioDeviceID); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CloseAudioDevice' {$ENDIF} {$ENDIF}; - +//from sdl_audio.h + {** + * Audio format flags. + * + * These are what the 16 bits in SDL_AudioFormat currently mean... + * (Unspecified bits are always zero). + * + * + ++-----------------------sample is signed if set + || + || ++-----------sample is bigendian if set + || || + || || ++---sample is float if set + || || || + || || || +---sample bit size---+ + || || || | | + 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 + * + * There are macros in SDL 2.0 and later to query these bits. + *} +type + PPSDL_AudioFormat = ^PSDL_AudioFormat; + PSDL_AudioFormat = ^TSDL_AudioFormat; + TSDL_AudioFormat = cuint16; + + {** + * Audio flags + *} +const + SDL_AUDIO_MASK_BITSIZE = ($FF); + SDL_AUDIO_MASK_DATATYPE = (1 shl 8); + SDL_AUDIO_MASK_ENDIAN = (1 shl 12); + SDL_AUDIO_MASK_SIGNED = (1 shl 15); + +function SDL_AUDIO_BITSIZE(x: Cardinal): Cardinal; +function SDL_AUDIO_ISFLOAT(x: Cardinal): Cardinal; +function SDL_AUDIO_ISBIGENDIAN(x: Cardinal): Cardinal; +function SDL_AUDIO_ISSIGNED(x: Cardinal): Cardinal; +function SDL_AUDIO_ISINT(x: Cardinal): Cardinal; +function SDL_AUDIO_ISLITTLEENDIAN(x: Cardinal): Cardinal; +function SDL_AUDIO_ISUNSIGNED(x: Cardinal): Cardinal; + + {** + * Audio format flags + * + * Defaults to LSB byte order. + *} +const + AUDIO_U8 = $0008; {**< Unsigned 8-bit samples *} + AUDIO_S8 = $8008; {**< Signed 8-bit samples *} + AUDIO_U16LSB = $0010; {**< Unsigned 16-bit samples *} + AUDIO_S16LSB = $8010; {**< Signed 16-bit samples *} + AUDIO_U16MSB = $1010; {**< As above, but big-endian byte order *} + AUDIO_S16MSB = $9010; {**< As above, but big-endian byte order *} + AUDIO_U16 = AUDIO_U16LSB; + AUDIO_S16 = AUDIO_S16LSB; + + {** + * int32 support + *} +const + AUDIO_S32LSB = $8020; {**< 32-bit integer samples *} + AUDIO_S32MSB = $9020; {**< As above, but big-endian byte order *} + AUDIO_S32 = AUDIO_S32LSB; + + {** + * float32 support + *} +const + AUDIO_F32LSB = $8120; {**< 32-bit floating point samples *} + AUDIO_F32MSB = $9120; {**< As above, but big-endian byte order *} + AUDIO_F32 = AUDIO_F32LSB; + + {** + * Native audio byte ordering + *} +{$IFDEF FPC} + {$IF DEFINED(ENDIAN_LITTLE)} + AUDIO_U16SYS = AUDIO_U16LSB; + AUDIO_S16SYS = AUDIO_S16LSB; + AUDIO_S32SYS = AUDIO_S32LSB; + AUDIO_F32SYS = AUDIO_F32LSB; + {$ELSEIF DEFINED(ENDIAN_BIG)} + AUDIO_U16SYS = AUDIO_U16MSB; + AUDIO_S16SYS = AUDIO_S16MSB; + AUDIO_S32SYS = AUDIO_S32MSB; + AUDIO_F32SYS = AUDIO_F32MSB; + {$ELSE} + {$FATAL Cannot determine endianness.} + {$IFEND} +{$ENDIF} + + {** + * Allow change flags + * + * Which audio format changes are allowed when opening a device. + *} +const + SDL_AUDIO_ALLOW_FREQUENCY_CHANGE = $00000001; + SDL_AUDIO_ALLOW_FORMAT_CHANGE = $00000002; + SDL_AUDIO_ALLOW_CHANNELS_CHANGE = $00000004; + SDL_AUDIO_ALLOW_ANY_CHANGE = (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE or + SDL_AUDIO_ALLOW_FORMAT_CHANGE or + SDL_AUDIO_ALLOW_CHANNELS_CHANGE); + + {*Audio flags*} + + {** + * This function is called when the audio device needs more data. + * + * \param userdata An application-specific parameter saved in + * the SDL_AudioSpec structure + * \param stream A pointer to the audio data buffer. + * \param len The length of that buffer in bytes. + * + * Once the callback returns, the buffer will no longer be valid. + * Stereo samples are stored in a LRLRLR ordering. + * + * You can choose to avoid callbacks and use SDL_QueueAudio() instead, if + * you like. Just open your audio device with a NULL callback. + *} +type + PPSDL_AudioCallback = ^PSDL_AudioCallback; + PSDL_AudioCallback = ^TSDL_AudioCallback; + TSDL_AudioCallback = procedure(userdata: Pointer; stream: pcuint8; len: cint); cdecl; + + {** + * The calculated values in this structure are calculated by SDL_OpenAudio(). + * + * For multi-channel audio, the default SDL channel mapping is: + * 2: FL FR (stereo) + * 3: FL FR LFE (2.1 surround) + * 4: FL FR BL BR (quad) + * 5: FL FR LFE BL BR (4.1 surround) + * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR) + * 7: FL FR FC LFE BC SL SR (6.1 surround) + * 8: FL FR FC LFE BL BR SL SR (7.1 surround) + *} +type + PPSDL_AudioSpec = ^PSDL_AudioSpec; + PSDL_AudioSpec = ^TSDL_AudioSpec; + TSDL_AudioSpec = record + freq: cint; {**< DSP frequency -- samples per second *} + format: TSDL_AudioFormat; {**< Audio data format *} + channels: cuint8; {**< Number of channels: 1 mono, 2 stereo *} + silence: cuint8; {**< Audio buffer silence value (calculated) *} + samples: cuint16; {**< Audio buffer size in sample FRAMES (total samples divided by channel count) *} + padding: cuint16; {**< Necessary for some compile environments *} + size: cuint32; {**< Audio buffer size in bytes (calculated) *} + callback: TSDL_AudioCallback; {**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). *} + userdata: Pointer; {**< Userdata passed to callback (ignored for NULL callbacks). *} + end; + + {** + * \brief Upper limit of filters in SDL_AudioCVT + * + * The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is + * currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers, + * one of which is the terminating NULL pointer. + *} +const + SDL_AUDIOCVT_MAX_FILTERS = 9; + +type + PPSDL_AudioCVT = ^PSDL_AudioCVT; + PSDL_AudioCVT = ^TSDL_AudioCVT; + TSDL_AudioFilter = procedure(cvt: PSDL_AudioCVT; format: TSDL_AudioFormat); cdecl; + + {** + * \struct SDL_AudioCVT + * \brief A structure to hold a set of audio conversion filters and buffers. + * + * Note that various parts of the conversion pipeline can take advantage + * of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require + * you to pass it aligned data, but can possibly run much faster if you + * set both its (buf) field to a pointer that is aligned to 16 bytes, and its + * (len) field to something that's a multiple of 16, if possible. + *} + TSDL_AudioCVT = record + needed: cint; {**< Set to 1 if conversion possible *} + src_format: TSDL_AudioFormat; {**< Source audio format *} + dst_format: TSDL_AudioFormat; {**< Target audio format *} + rate_incr: cdouble; {**< Rate conversion increment *} + buf: pcuint8; {**< Buffer to hold entire audio data *} + len: cint; {**< Length of original audio buffer *} + len_cvt: cint; {**< Length of converted audio buffer *} + len_mult: cint; {**< buffer must be len*len_mult big *} + len_ratio: cdouble; {**< Given len, final size is len*len_ratio *} + filters: array[0..SDL_AUDIOCVT_MAX_FILTERS] of TSDL_AudioFilter; {**< NULL-terminated list of filter functions *} + filter_index: cint; {**< Current audio conversion function *} + end; + + + {* Function prototypes *} + + {** + * Driver discovery functions + * + * These functions return the list of built in audio drivers, in the + * order that they are normally initialized by default. + *} + + {** + * Use this function to get the number of built-in audio drivers. + * + * This function returns a hardcoded number. This never returns a negative + * value; if there are no drivers compiled into this build of SDL, this + * function returns zero. The presence of a driver in this list does not mean + * it will function, it just means SDL is capable of interacting with that + * interface. For example, a build of SDL might have esound support, but if + * there's no esound server available, SDL's esound driver would fail if used. + * + * By default, SDL tries all drivers, in its preferred order, until one is + * found to be usable. + * + * \returns the number of built-in audio drivers. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetAudioDriver + *} +function SDL_GetNumAudioDrivers: cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumAudioDrivers' {$ENDIF} {$ENDIF}; + +{** + * Use this function to get the name of a built in audio driver. + * + * The list of audio drivers is given in the order that they are normally + * initialized by default; the drivers that seem more reasonable to choose + * first (as far as the SDL developers believe) are earlier in the list. + * + * The names of drivers are all simple, low-ASCII identifiers, like "alsa", + * "coreaudio" or "xaudio2". These never have Unicode characters, and are not + * meant to be proper names. + * + * \param index the index of the audio driver; the value ranges from 0 to + * SDL_GetNumAudioDrivers() - 1 + * \returns the name of the audio driver at the requested index, or NULL if an + * invalid index was specified. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetNumAudioDrivers + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetAudioDriver_fun = function(index: cint): PAnsiChar; cdecl; +Var + SDL_GetAudioDriver : TSDL_GetAudioDriver_fun = Nil; +{$else} + +function SDL_GetAudioDriver(index: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetAudioDriver' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Initialization and cleanup + * + * These functions are used internally, and should not be used unless + * you have a specific need to specify the audio driver you want to + * use. You should normally use SDL_Init() or SDL_InitSubSystem(). + *} + +{** + * Use this function to initialize a particular audio driver. + * + * This function is used internally, and should not be used unless you have a + * specific need to designate the audio driver you want to use. You should + * normally use SDL_Init() or SDL_InitSubSystem(). + * + * \param driver_name the name of the desired audio driver + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AudioQuit + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AudioInit_fun = function(driver_name: PAnsiChar): cint; cdecl; +Var + SDL_AudioInit : TSDL_AudioInit_fun = Nil; +{$else} + +function SDL_AudioInit(driver_name: PAnsiChar): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioInit' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Use this function to shut down audio if you initialized it with + * SDL_AudioInit(). + * + * This function is used internally, and should not be used unless you have a + * specific need to specify the audio driver you want to use. You should + * normally use SDL_Quit() or SDL_QuitSubSystem(). + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AudioInit + *} +procedure SDL_AudioQuit; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioQuit' {$ENDIF} {$ENDIF}; + + {** + * Get the name of the current audio driver. + * + * The returned string points to internal static memory and thus never becomes + * invalid, even if you quit the audio subsystem and initialize a new driver + * (although such a case would return a different static string from another + * call to this function, of course). As such, you should not modify or free + * the returned string. + * + * \returns the name of the current audio driver or NULL if no driver has been + * initialized. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AudioInit + *} +function SDL_GetCurrentAudioDriver: PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCurrentAudioDriver' {$ENDIF} {$ENDIF}; + +{** + * This function is a legacy means of opening the audio device. + * + * This function remains for compatibility with SDL 1.2, but also because it's + * slightly easier to use than the new functions in SDL 2.0. The new, more + * powerful, and preferred way to do this is SDL_OpenAudioDevice(). + * + * This function is roughly equivalent to: + * + * ```c + * SDL_OpenAudioDevice(NULL, 0, desired, obtained, SDL_AUDIO_ALLOW_ANY_CHANGE); + * ``` + * + * With two notable exceptions: + * + * - If `obtained` is NULL, we use `desired` (and allow no changes), which + * means desired will be modified to have the correct values for silence, + * etc, and SDL will convert any differences between your app's specific + * request and the hardware behind the scenes. + * - The return value is always success or failure, and not a device ID, which + * means you can only have one device open at a time with this function. + * + * \param desired an SDL_AudioSpec structure representing the desired output + * format. Please refer to the SDL_OpenAudioDevice + * documentation for details on how to prepare this structure. + * \param obtained an SDL_AudioSpec structure filled in with the actual + * parameters, or NULL. + * \returns 0 if successful, placing the actual hardware parameters in the + * structure pointed to by `obtained`. + * + * If `obtained` is NULL, the audio data passed to the callback + * function will be guaranteed to be in the requested format, and + * will be automatically converted to the actual hardware audio + * format if necessary. If `obtained` is NULL, `desired` will have + * fields modified. + * + * This function returns a negative error code on failure to open the + * audio device or failure to set up the audio thread; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_CloseAudio + * \sa SDL_LockAudio + * \sa SDL_PauseAudio + * \sa SDL_UnlockAudio + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_OpenAudio_fun = function(desired: PSDL_AudioSpec; obtained: PSDL_AudioSpec): cint; cdecl; +Var + SDL_OpenAudio : TSDL_OpenAudio_fun = Nil; +{$else} + +function SDL_OpenAudio(desired: PSDL_AudioSpec; obtained: PSDL_AudioSpec): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_OpenAudio' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * SDL Audio Device IDs. + * + * A successful call to SDL_OpenAudio() is always device id 1, and legacy + * SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls + * always returns devices >= 2 on success. The legacy calls are good both + * for backwards compatibility and when you don't care about multiple, + * specific, or capture devices. + *} +type + PPSDL_AudioDeviceID = ^PSDL_AudioDeviceID; + PSDL_AudioDeviceID = ^TSDL_AudioDeviceID; + TSDL_AudioDeviceID = cuint32; + +{** + * Get the number of built-in audio devices. + * + * This function is only valid after successfully initializing the audio + * subsystem. + * + * Note that audio capture support is not implemented as of SDL 2.0.4, so the + * `iscapture` parameter is for future expansion and should always be zero for + * now. + * + * This function will return -1 if an explicit list of devices can't be + * determined. Returning -1 is not an error. For example, if SDL is set up to + * talk to a remote audio server, it can't list every one available on the + * Internet, but it will still allow a specific host to be specified in + * SDL_OpenAudioDevice(). + * + * In many common cases, when this function returns a value <= 0, it can still + * successfully open the default device (NULL for first argument of + * SDL_OpenAudioDevice()). + * + * This function may trigger a complete redetect of available hardware. It + * should not be called for each iteration of a loop, but rather once at the + * start of a loop: + * + * ```c + * // Don't do this: + * for (int i = 0; i < SDL_GetNumAudioDevices(0); i++) + * + * // do this instead: + * const int count = SDL_GetNumAudioDevices(0); + * for (int i = 0; i < count; ++i) do_something_here(); + * ``` + * + * \param iscapture zero to request playback devices, non-zero to request + * recording devices + * \returns the number of available devices exposed by the current driver or + * -1 if an explicit list of devices can't be determined. A return + * value of -1 does not necessarily mean an error condition. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetAudioDeviceName + * \sa SDL_OpenAudioDevice + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetNumAudioDevices_fun = function(iscapture: cint): cint; cdecl; +Var + SDL_GetNumAudioDevices : TSDL_GetNumAudioDevices_fun = Nil; +{$else} + +function SDL_GetNumAudioDevices(iscapture: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumAudioDevices' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the human-readable name of a specific audio device. + * + * This function is only valid after successfully initializing the audio + * subsystem. The values returned by this function reflect the latest call to + * SDL_GetNumAudioDevices(); re-call that function to redetect available + * hardware. + * + * The string returned by this function is UTF-8 encoded, read-only, and + * managed internally. You are not to free it. If you need to keep the string + * for any length of time, you should make your own copy of it, as it will be + * invalid next time any of several other SDL functions are called. + * + * \param index the index of the audio device; valid values range from 0 to + * SDL_GetNumAudioDevices() - 1 + * \param iscapture non-zero to query the list of recording devices, zero to + * query the list of output devices. + * \returns the name of the audio device at the requested index, or NULL on + * error. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetNumAudioDevices + * \sa SDL_GetDefaultAudioInfo + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetAudioDeviceName_fun = function(index: cint; iscapture: cint): PAnsiChar; cdecl; +Var + SDL_GetAudioDeviceName : TSDL_GetAudioDeviceName_fun = Nil; +{$else} + +function SDL_GetAudioDeviceName(index: cint; iscapture: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetAudioDeviceName' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get the preferred audio format of a specific audio device. + * + * This function is only valid after a successfully initializing the audio + * subsystem. The values returned by this function reflect the latest call to + * SDL_GetNumAudioDevices(); re-call that function to redetect available + * hardware. + * + * `spec` will be filled with the sample rate, sample format, and channel + * count. + * + * \param index the index of the audio device; valid values range from 0 to + * SDL_GetNumAudioDevices() - 1 + * \param iscapture non-zero to query the list of recording devices, zero to + * query the list of output devices. + * \param spec The SDL_AudioSpec to be initialized by this function. + * \returns 0 on success, nonzero on error + * + * \since This function is available since SDL 2.0.16. + * + * \sa SDL_GetNumAudioDevices + * \sa SDL_GetDefaultAudioInfo + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetAudioDeviceSpec_fun = function(index: cint; iscapture: cint; spec: PSDL_AudioSpec): cint; cdecl; +Var + SDL_GetAudioDeviceSpec : TSDL_GetAudioDeviceSpec_fun = Nil; +{$else} + +function SDL_GetAudioDeviceSpec(index: cint; iscapture: cint; spec: PSDL_AudioSpec): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetAudioDeviceSpec' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get the name and preferred format of the default audio device. + * + * Some (but not all!) platforms have an isolated mechanism to get information + * about the "default" device. This can actually be a completely different + * device that's not in the list you get from SDL_GetAudioDeviceSpec(). It can + * even be a network address! (This is discussed in SDL_OpenAudioDevice().) + * + * As a result, this call is not guaranteed to be performant, as it can query + * the sound server directly every time, unlike the other query functions. You + * should call this function sparingly! + * + * `spec` will be filled with the sample rate, sample format, and channel + * count, if a default device exists on the system. If `name` is provided, + * will be filled with either a dynamically-allocated UTF-8 string or nil. + * + * \param name A pointer to be filled with the name of the default device (can + * be nil). Please call SDL_free() when you are done with this + * pointer! + * \param spec The SDL_AudioSpec to be initialized by this function. + * \param iscapture non-zero to query the default recording device, zero to + * query the default output device. + * \returns 0 on success, nonzero on error + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GetAudioDeviceName + * \sa SDL_GetAudioDeviceSpec + * \sa SDL_OpenAudioDevice + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetDefaultAudioInfo_fun = function(name: PPAnsiChar; spec: PSDL_AudioSpec; iscapture: cint): cint; cdecl; +Var + SDL_GetDefaultAudioInfo : TSDL_GetDefaultAudioInfo_fun = Nil; +{$else} + +function SDL_GetDefaultAudioInfo(name: PPAnsiChar; spec: PSDL_AudioSpec; iscapture: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDefaultAudioInfo' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Open a specific audio device. + * + * SDL_OpenAudio(), unlike this function, always acts on device ID 1. As such, + * this function will never return a 1 so as not to conflict with the legacy + * function. + * + * Please note that SDL 2.0 before 2.0.5 did not support recording; as such, + * this function would fail if `iscapture` was not zero. Starting with SDL + * 2.0.5, recording is implemented and this value can be non-zero. + * + * Passing in a `device` name of NULL requests the most reasonable default + * (and is equivalent to what SDL_OpenAudio() does to choose a device). The + * `device` name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but + * some drivers allow arbitrary and driver-specific strings, such as a + * hostname/IP address for a remote audio server, or a filename in the + * diskaudio driver. + * + * An opened audio device starts out paused, and should be enabled for playing + * by calling SDL_PauseAudioDevice(devid, 0) when you are ready for your audio + * callback function to be called. Since the audio driver may modify the + * requested size of the audio buffer, you should allocate any local mixing + * buffers after you open the audio device. + * + * The audio callback runs in a separate thread in most cases; you can prevent + * race conditions between your callback and other threads without fully + * pausing playback with SDL_LockAudioDevice(). For more information about the + * callback, see SDL_AudioSpec. + * + * Managing the audio spec via 'desired' and 'obtained': + * + * When filling in the desired audio spec structure: + * + * - `desired->freq` should be the frequency in sample-frames-per-second (Hz). + * - `desired->format` should be the audio format (`AUDIO_S16SYS`, etc). + * - `desired->samples` is the desired size of the audio buffer, in _sample + * frames_ (with stereo output, two samples--left and right--would make a + * single sample frame). This number should be a power of two, and may be + * adjusted by the audio driver to a value more suitable for the hardware. + * Good values seem to range between 512 and 8096 inclusive, depending on + * the application and CPU speed. Smaller values reduce latency, but can + * lead to underflow if the application is doing heavy processing and cannot + * fill the audio buffer in time. Note that the number of sample frames is + * directly related to time by the following formula: `ms = + * (sampleframes*1000)/freq` + * - `desired->size` is the size in _bytes_ of the audio buffer, and is + * calculated by SDL_OpenAudioDevice(). You don't initialize this. + * - `desired->silence` is the value used to set the buffer to silence, and is + * calculated by SDL_OpenAudioDevice(). You don't initialize this. + * - `desired->callback` should be set to a function that will be called when + * the audio device is ready for more data. It is passed a pointer to the + * audio buffer, and the length in bytes of the audio buffer. This function + * usually runs in a separate thread, and so you should protect data + * structures that it accesses by calling SDL_LockAudioDevice() and + * SDL_UnlockAudioDevice() in your code. Alternately, you may pass a NULL + * pointer here, and call SDL_QueueAudio() with some frequency, to queue + * more audio samples to be played (or for capture devices, call + * SDL_DequeueAudio() with some frequency, to obtain audio samples). + * - `desired->userdata` is passed as the first parameter to your callback + * function. If you passed a NULL callback, this value is ignored. + * + * `allowed_changes` can have the following flags OR'd together: + * + * - `SDL_AUDIO_ALLOW_FREQUENCY_CHANGE` + * - `SDL_AUDIO_ALLOW_FORMAT_CHANGE` + * - `SDL_AUDIO_ALLOW_CHANNELS_CHANGE` + * - `SDL_AUDIO_ALLOW_SAMPLES_CHANGE` + * - `SDL_AUDIO_ALLOW_ANY_CHANGE` + * + * These flags specify how SDL should behave when a device cannot offer a + * specific feature. If the application requests a feature that the hardware + * doesn't offer, SDL will always try to get the closest equivalent. + * + * For example, if you ask for float32 audio format, but the sound card only + * supports int16, SDL will set the hardware to int16. If you had set + * SDL_AUDIO_ALLOW_FORMAT_CHANGE, SDL will change the format in the `obtained` + * structure. If that flag was *not* set, SDL will prepare to convert your + * callback's float32 audio to int16 before feeding it to the hardware and + * will keep the originally requested format in the `obtained` structure. + * + * The resulting audio specs, varying depending on hardware and on what + * changes were allowed, will then be written back to `obtained`. + * + * If your application can only handle one specific data format, pass a zero + * for `allowed_changes` and let SDL transparently handle any differences. + * + * \param device a UTF-8 string reported by SDL_GetAudioDeviceName() or a + * driver-specific name as appropriate. NULL requests the most + * reasonable default device. + * \param iscapture non-zero to specify a device should be opened for + * recording, not playback + * \param desired an SDL_AudioSpec structure representing the desired output + * format; see SDL_OpenAudio() for more information + * \param obtained an SDL_AudioSpec structure filled in with the actual output + * format; see SDL_OpenAudio() for more information + * \param allowed_changes 0, or one or more flags OR'd together + * \returns a valid device ID that is > 0 on success or 0 on failure; call + * SDL_GetError() for more information. + * + * For compatibility with SDL 1.2, this will never return 1, since + * SDL reserves that ID for the legacy SDL_OpenAudio() function. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_CloseAudioDevice + * \sa SDL_GetAudioDeviceName + * \sa SDL_LockAudioDevice + * \sa SDL_OpenAudio + * \sa SDL_PauseAudioDevice + * \sa SDL_UnlockAudioDevice + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_OpenAudioDevice_fun = function(device: PAnsiChar; + iscapture: cint; + desired: PSDL_AudioSpec; + obtained: PSDL_AudioSpec; + allowed_changes: cint): TSDL_AudioDeviceID; cdecl; +Var + SDL_OpenAudioDevice : TSDL_OpenAudioDevice_fun = Nil; +{$else} + +function SDL_OpenAudioDevice(device: PAnsiChar; + iscapture: cint; + desired: PSDL_AudioSpec; + obtained: PSDL_AudioSpec; + allowed_changes: cint): TSDL_AudioDeviceID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_OpenAudioDevice' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Audio state + * + * Get the current audio state. + *} + +type + PPSDL_AudioStatus = ^PSDL_AudioStatus; + PSDL_AudioStatus = ^TSDL_AudioStatus; + TSDL_AudioStatus = type cint; + +const + SDL_AUDIO_STOPPED = TSDL_AudioStatus(0); + SDL_AUDIO_PLAYING = TSDL_AudioStatus(1); + SDL_AUDIO_PAUSED = TSDL_AudioStatus(2); + +{** + * This function is a legacy means of querying the audio device. + * + * New programs might want to use SDL_GetAudioDeviceStatus() instead. This + * function is equivalent to calling... + * + * ```c + * SDL_GetAudioDeviceStatus(1); + * ``` + * + * ...and is only useful if you used the legacy SDL_OpenAudio() function. + * + * \returns the SDL_AudioStatus of the audio device opened by SDL_OpenAudio(). + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetAudioDeviceStatus + *} +function SDL_GetAudioStatus: TSDL_AudioStatus; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetAudioStatus' {$ENDIF} {$ENDIF}; + +{** + * Use this function to get the current audio state of an audio device. + * + * \param dev the ID of an audio device previously opened with + * SDL_OpenAudioDevice() + * \returns the SDL_AudioStatus of the specified audio device. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_PauseAudioDevice + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetAudioDeviceStatus_fun = function(dev: TSDL_AudioDeviceID): TSDL_AudioStatus; cdecl; +Var + SDL_GetAudioDeviceStatus : TSDL_GetAudioDeviceStatus_fun = Nil; +{$else} + +function SDL_GetAudioDeviceStatus(dev: TSDL_AudioDeviceID): TSDL_AudioStatus; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetAudioDeviceStatus' {$ENDIF} {$ENDIF}; +{$endif} + +{*Audio State*} + + {** + * Pause audio functions + * + * These functions pause and unpause the audio callback processing. + * They should be called with a parameter of 0 after opening the audio + * device to start playing sound. This is so you can safely initialize + * data for your callback function after opening the audio device. + * Silence will be written to the audio device during the pause. + *} + +{** + * This function is a legacy means of pausing the audio device. + * + * New programs might want to use SDL_PauseAudioDevice() instead. This + * function is equivalent to calling... + * + * ```c + * SDL_PauseAudioDevice(1, pause_on); + * ``` + * + * ...and is only useful if you used the legacy SDL_OpenAudio() function. + * + * \param pause_on non-zero to pause, 0 to unpause + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetAudioStatus + * \sa SDL_PauseAudioDevice + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_PauseAudio_proc = procedure(pause_on: cint); cdecl; +Var + SDL_PauseAudio : TSDL_PauseAudio_proc = Nil; +{$else} + +procedure SDL_PauseAudio(pause_on: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PauseAudio' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Use this function to pause and unpause audio playback on a specified + * device. + * + * This function pauses and unpauses the audio callback processing for a given + * device. Newly-opened audio devices start in the paused state, so you must + * call this function with **pause_on**=0 after opening the specified audio + * device to start playing sound. This allows you to safely initialize data + * for your callback function after opening the audio device. Silence will be + * written to the audio device while paused, and the audio callback is + * guaranteed to not be called. Pausing one device does not prevent other + * unpaused devices from running their callbacks. + * + * Pausing state does not stack; even if you pause a device several times, a + * single unpause will start the device playing again, and vice versa. This is + * different from how SDL_LockAudioDevice() works. + * + * If you just need to protect a few variables from race conditions vs your + * callback, you shouldn't pause the audio device, as it will lead to dropouts + * in the audio playback. Instead, you should use SDL_LockAudioDevice(). + * + * \param dev a device opened by SDL_OpenAudioDevice() + * \param pause_on non-zero to pause, 0 to unpause + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_LockAudioDevice + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_PauseAudioDevice_proc = procedure(dev: TSDL_AudioDeviceID; pause_on: cint); cdecl; +Var + SDL_PauseAudioDevice : TSDL_PauseAudioDevice_proc = Nil; +{$else} + +procedure SDL_PauseAudioDevice(dev: TSDL_AudioDeviceID; pause_on: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PauseAudioDevice' {$ENDIF} {$ENDIF}; +{$endif} + +{*Pause audio functions*} + + {** + * Load the audio data of a WAVE file into memory. + * + * Loading a WAVE file requires `src`, `spec`, `audio_buf` and `audio_len` to + * be valid pointers. The entire data portion of the file is then loaded into + * memory and decoded if necessary. + * + * If `freesrc` is non-zero, the data source gets automatically closed and + * freed before the function returns. + * + * Supported formats are RIFF WAVE files with the formats PCM (8, 16, 24, and + * 32 bits), IEEE Float (32 bits), Microsoft ADPCM and IMA ADPCM (4 bits), and + * A-law and mu-law (8 bits). Other formats are currently unsupported and + * cause an error. + * + * If this function succeeds, the pointer returned by it is equal to `spec` + * and the pointer to the audio data allocated by the function is written to + * `audio_buf` and its length in bytes to `audio_len`. The SDL_AudioSpec + * members `freq`, `channels`, and `format` are set to the values of the audio + * data in the buffer. The `samples` member is set to a sane default and all + * others are set to zero. + * + * It's necessary to use SDL_FreeWAV() to free the audio data returned in + * `audio_buf` when it is no longer used. + * + * Because of the underspecification of the .WAV format, there are many + * problematic files in the wild that cause issues with strict decoders. To + * provide compatibility with these files, this decoder is lenient in regards + * to the truncation of the file, the fact chunk, and the size of the RIFF + * chunk. The hints `SDL_HINT_WAVE_RIFF_CHUNK_SIZE`, + * `SDL_HINT_WAVE_TRUNCATION`, and `SDL_HINT_WAVE_FACT_CHUNK` can be used to + * tune the behavior of the loading process. + * + * Any file that is invalid (due to truncation, corruption, or wrong values in + * the headers), too big, or unsupported causes an error. Additionally, any + * critical I/O error from the data source will terminate the loading process + * with an error. The function returns NULL on error and in all cases (with + * the exception of `src` being NULL), an appropriate error message will be + * set. + * + * It is required that the data source supports seeking. + * + * Example: + * + * ```c + * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, &spec, &buf, &len); + * ``` + * + * Note that the SDL_LoadWAV macro does this same thing for you, but in a less + * messy way: + * + * ```c + * SDL_LoadWAV("sample.wav", &spec, &buf, &len); + * ``` + * + * \param src The data source for the WAVE data + * \param freesrc If non-zero, SDL will _always_ free the data source + * \param spec An SDL_AudioSpec that will be filled in with the wave file's + * format details + * \param audio_buf A pointer filled with the audio data, allocated by the + * function. + * \param audio_len A pointer filled with the length of the audio data buffer + * in bytes + * \returns This function, if successfully called, returns `spec`, which will + * be filled with the audio data format of the wave source data. + * `audio_buf` will be filled with a pointer to an allocated buffer + * containing the audio data, and `audio_len` is filled with the + * length of that audio buffer in bytes. + * + * This function returns NULL if the .WAV file cannot be opened, uses + * an unknown data format, or is corrupt; call SDL_GetError() for + * more information. + * + * When the application is done with the data returned in + * `audio_buf`, it should call SDL_FreeWAV() to dispose of it. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_FreeWAV + * \sa SDL_LoadWAV + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LoadWAV_RW_fun = function(src: PSDL_RWops; + freesrc: cint; + spec: PSDL_AudioSpec; + audio_buf: ppcuint8; + audio_len: pcuint32): PSDL_AudioSpec; cdecl; +Var + SDL_LoadWAV_RW : TSDL_LoadWAV_RW_fun = Nil; +{$else} + +function SDL_LoadWAV_RW(src: PSDL_RWops; + freesrc: cint; + spec: PSDL_AudioSpec; + audio_buf: ppcuint8; + audio_len: pcuint32): PSDL_AudioSpec; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadWAV_RW' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Loads a WAV from a file. + * Compatibility convenience function. + *} +function SDL_LoadWAV(file_: PAnsiChar; spec: PSDL_AudioSpec; audio_buf: ppcuint8; audio_len: pcuint32): PSDL_AudioSpec; + +{** + * Free data previously allocated with SDL_LoadWAV() or SDL_LoadWAV_RW(). + * + * After a WAVE file has been opened with SDL_LoadWAV() or SDL_LoadWAV_RW() + * its data can eventually be freed with SDL_FreeWAV(). It is safe to call + * this function with a NULL pointer. + * + * \param audio_buf a pointer to the buffer created by SDL_LoadWAV() or + * SDL_LoadWAV_RW() + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_LoadWAV + * \sa SDL_LoadWAV_RW + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_FreeWAV_proc = procedure(audio_buf: pcuint8); cdecl; +Var + SDL_FreeWAV : TSDL_FreeWAV_proc = Nil; +{$else} + +procedure SDL_FreeWAV(audio_buf: pcuint8); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeWAV' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Initialize an SDL_AudioCVT structure for conversion. + * + * Before an SDL_AudioCVT structure can be used to convert audio data it must + * be initialized with source and destination information. + * + * This function will zero out every field of the SDL_AudioCVT, so it must be + * called before the application fills in the final buffer information. + * + * Once this function has returned successfully, and reported that a + * conversion is necessary, the application fills in the rest of the fields in + * SDL_AudioCVT, now that it knows how large a buffer it needs to allocate, + * and then can call SDL_ConvertAudio() to complete the conversion. + * + * \param cvt an SDL_AudioCVT structure filled in with audio conversion + * information + * \param src_format the source format of the audio data; for more info see + * SDL_AudioFormat + * \param src_channels the number of channels in the source + * \param src_rate the frequency (sample-frames-per-second) of the source + * \param dst_format the destination format of the audio data; for more info + * see SDL_AudioFormat + * \param dst_channels the number of channels in the destination + * \param dst_rate the frequency (sample-frames-per-second) of the destination + * \returns 1 if the audio filter is prepared, 0 if no conversion is needed, + * or a negative error code on failure; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_ConvertAudio + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_BuildAudioCVT_fun = function(cvt: PSDL_AudioCVT; + src_format: TSDL_AudioFormat; + src_channels: cuint8; + src_rate: cint; + dst_format: TSDL_AudioFormat; + dst_channels: cuint8; + dst_rate: cint): cint; cdecl; +Var + SDL_BuildAudioCVT : TSDL_BuildAudioCVT_fun = Nil; +{$else} + +function SDL_BuildAudioCVT(cvt: PSDL_AudioCVT; + src_format: TSDL_AudioFormat; + src_channels: cuint8; + src_rate: cint; + dst_format: TSDL_AudioFormat; + dst_channels: cuint8; + dst_rate: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_BuildAudioCVT' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Convert audio data to a desired audio format. + * + * This function does the actual audio data conversion, after the application + * has called SDL_BuildAudioCVT() to prepare the conversion information and + * then filled in the buffer details. + * + * Once the application has initialized the `cvt` structure using + * SDL_BuildAudioCVT(), allocated an audio buffer and filled it with audio + * data in the source format, this function will convert the buffer, in-place, + * to the desired format. + * + * The data conversion may go through several passes; any given pass may + * possibly temporarily increase the size of the data. For example, SDL might + * expand 16-bit data to 32 bits before resampling to a lower frequency, + * shrinking the data size after having grown it briefly. Since the supplied + * buffer will be both the source and destination, converting as necessary + * in-place, the application must allocate a buffer that will fully contain + * the data during its largest conversion pass. After SDL_BuildAudioCVT() + * returns, the application should set the `cvt->len` field to the size, in + * bytes, of the source data, and allocate a buffer that is `cvt->len * + * cvt->len_mult` bytes long for the `buf` field. + * + * The source data should be copied into this buffer before the call to + * SDL_ConvertAudio(). Upon successful return, this buffer will contain the + * converted audio, and `cvt->len_cvt` will be the size of the converted data, + * in bytes. Any bytes in the buffer past `cvt->len_cvt` are undefined once + * this function returns. + * + * \param cvt an SDL_AudioCVT structure that was previously set up by + * SDL_BuildAudioCVT(). + * \returns 0 if the conversion was completed successfully or a negative error + * code on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_BuildAudioCVT + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ConvertAudio_fun = function(cvt: PSDL_AudioCVT): cint; cdecl; +Var + SDL_ConvertAudio : TSDL_ConvertAudio_fun = Nil; +{$else} + +function SDL_ConvertAudio(cvt: PSDL_AudioCVT): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ConvertAudio' {$ENDIF} {$ENDIF}; +{$endif} + +{ SDL_AudioStream is a new audio conversion interface. + The benefits vs SDL_AudioCVT: + - it can handle resampling data in chunks without generating + artifacts, when it doesn't have the complete buffer available. + - it can handle incoming data in any variable size. + - You push data as you have it, and pull it when you need it + } +{ this is opaque to the outside world. } +type + PSDL_AudioStream = type Pointer; + +{* + * Create a new audio stream. + * + * \param src_format The format of the source audio + * \param src_channels The number of channels of the source audio + * \param src_rate The sampling rate of the source audio + * \param dst_format The format of the desired audio output + * \param dst_channels The number of channels of the desired audio output + * \param dst_rate The sampling rate of the desired audio output + * \returns 0 on success, or -1 on error. + * + * \since This function is available since SDL 2.0.7. + * + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_NewAudioStream_fun = function(src_format: TSDL_AudioFormat; src_channels: cuint8; src_rate: cint; dst_format: TSDL_AudioFormat; dst_channels: cuint8; + dst_rate: cint): PSDL_AudioStream; cdecl; +Var + SDL_NewAudioStream : TSDL_NewAudioStream_fun = Nil; +{$else} + +function SDL_NewAudioStream(src_format: TSDL_AudioFormat; src_channels: cuint8; src_rate: cint; dst_format: TSDL_AudioFormat; dst_channels: cuint8; + dst_rate: cint): PSDL_AudioStream; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_NewAudioStream' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Add data to be converted/resampled to the stream. + * + * \param stream The stream the audio data is being added to + * \param buf A pointer to the audio data to add + * \param len The number of bytes to write to the stream + * \returns 0 on success, or -1 on error. + * + * \since This function is available since SDL 2.0.7. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AudioStreamPut_fun = function(stream: PSDL_AudioStream; buf: pointer; len: cint): cint; cdecl; +Var + SDL_AudioStreamPut : TSDL_AudioStreamPut_fun = Nil; +{$else} + +function SDL_AudioStreamPut(stream: PSDL_AudioStream; buf: pointer; len: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioStreamPut' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get converted/resampled data from the stream + * + * \param stream The stream the audio is being requested from + * \param buf A buffer to fill with audio data + * \param len The maximum number of bytes to fill + * \returns the number of bytes read from the stream, or -1 on error + * + * \since This function is available since SDL 2.0.7. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AudioStreamGet_fun = function(stream: PSDL_AudioStream; buf: pointer; len: cint): cint; cdecl; +Var + SDL_AudioStreamGet : TSDL_AudioStreamGet_fun = Nil; +{$else} + +function SDL_AudioStreamGet(stream: PSDL_AudioStream; buf: pointer; len: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioStreamGet' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get the number of converted/resampled bytes available. + * + * The stream may be buffering data behind the scenes until it has enough to + * resample correctly, so this number might be lower than what you expect, or + * even be zero. Add more data or flush the stream if you need the data now. + * + * \since This function is available since SDL 2.0.7. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AudioStreamAvailable_fun = function(stream: PSDL_AudioStream): cint; cdecl; +Var + SDL_AudioStreamAvailable : TSDL_AudioStreamAvailable_fun = Nil; +{$else} + +function SDL_AudioStreamAvailable(stream: PSDL_AudioStream): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioStreamAvailable' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Tell the stream that you're done sending data, and anything being buffered + * should be converted/resampled and made available immediately. + * + * It is legal to add more data to a stream after flushing, but there will be + * audio gaps in the output. Generally this is intended to signal the end of + * input, so the complete output becomes available. + * + * \since This function is available since SDL 2.0.7. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AudioStreamFlush_fun = function(stream: PSDL_AudioStream): cint; cdecl; +Var + SDL_AudioStreamFlush : TSDL_AudioStreamFlush_fun = Nil; +{$else} + +function SDL_AudioStreamFlush(stream: PSDL_AudioStream): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioStreamFlush' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Clear any pending data in the stream without converting it + * + * \since This function is available since SDL 2.0.7. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_FreeAudioStream + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AudioStreamClear_proc = procedure(stream: PSDL_AudioStream); cdecl; +Var + SDL_AudioStreamClear : TSDL_AudioStreamClear_proc = Nil; +{$else} + +procedure SDL_AudioStreamClear(stream: PSDL_AudioStream); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioStreamClear' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Free an audio stream + * + * \since This function is available since SDL 2.0.7. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_FreeAudioStream_proc = procedure(stream: PSDL_AudioStream); cdecl; +Var + SDL_FreeAudioStream : TSDL_FreeAudioStream_proc = Nil; +{$else} + +procedure SDL_FreeAudioStream(stream: PSDL_AudioStream); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeAudioStream' {$ENDIF} {$ENDIF}; +{$endif} + +const + SDL_MIX_MAXVOLUME = 128; + +{** + * This function is a legacy means of mixing audio. + * + * This function is equivalent to calling... + * + * ```c + * SDL_MixAudioFormat(dst, src, format, len, volume); + * ``` + * + * ...where `format` is the obtained format of the audio device from the + * legacy SDL_OpenAudio() function. + * + * \param dst the destination for the mixed audio + * \param src the source audio buffer to be mixed + * \param len the length of the audio buffer in bytes + * \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME + * for full audio volume + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_MixAudioFormat + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_MixAudio_proc = procedure(dst: pcuint8; src: pcuint8; len: cuint32; volume: cint); cdecl; +Var + SDL_MixAudio : TSDL_MixAudio_proc = Nil; +{$else} + +procedure SDL_MixAudio(dst: pcuint8; src: pcuint8; len: cuint32; volume: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MixAudio' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Mix audio data in a specified format. + * + * This takes an audio buffer `src` of `len` bytes of `format` data and mixes + * it into `dst`, performing addition, volume adjustment, and overflow + * clipping. The buffer pointed to by `dst` must also be `len` bytes of + * `format` data. + * + * This is provided for convenience -- you can mix your own audio data. + * + * Do not use this function for mixing together more than two streams of + * sample data. The output from repeated application of this function may be + * distorted by clipping, because there is no accumulator with greater range + * than the input (not to mention this being an inefficient way of doing it). + * + * It is a common misconception that this function is required to write audio + * data to an output stream in an audio callback. While you can do that, + * SDL_MixAudioFormat() is really only needed when you're mixing a single + * audio stream with a volume adjustment. + * + * \param dst the destination for the mixed audio + * \param src the source audio buffer to be mixed + * \param format the SDL_AudioFormat structure representing the desired audio + * format + * \param len the length of the audio buffer in bytes + * \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME + * for full audio volume + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_MixAudioFormat_proc = procedure(dst: pcuint8; src: pcuint8; format: TSDL_AudioFormat; len: cuint32; volume: cint); cdecl; +Var + SDL_MixAudioFormat : TSDL_MixAudioFormat_proc = Nil; +{$else} + +procedure SDL_MixAudioFormat(dst: pcuint8; src: pcuint8; format: TSDL_AudioFormat; len: cuint32; volume: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MixAudioFormat' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Queue more audio on non-callback devices. + * + * If you are looking to retrieve queued audio from a non-callback capture + * device, you want SDL_DequeueAudio() instead. SDL_QueueAudio() will return + * -1 to signify an error if you use it with capture devices. + * + * SDL offers two ways to feed audio to the device: you can either supply a + * callback that SDL triggers with some frequency to obtain more audio (pull + * method), or you can supply no callback, and then SDL will expect you to + * supply data at regular intervals (push method) with this function. + * + * There are no limits on the amount of data you can queue, short of + * exhaustion of address space. Queued data will drain to the device as + * necessary without further intervention from you. If the device needs audio + * but there is not enough queued, it will play silence to make up the + * difference. This means you will have skips in your audio playback if you + * aren't routinely queueing sufficient data. + * + * This function copies the supplied data, so you are safe to free it when the + * function returns. This function is thread-safe, but queueing to the same + * device from two threads at once does not promise which buffer will be + * queued first. + * + * You may not queue audio on a device that is using an application-supplied + * callback; doing so returns an error. You have to use the audio callback or + * queue audio with this function, but not both. + * + * You should not call SDL_LockAudio() on the device before queueing; SDL + * handles locking internally for this function. + * + * Note that SDL2 does not support planar audio. You will need to resample + * from planar audio formats into a non-planar one (see SDL_AudioFormat) + * before queuing audio. + * + * \param dev the device ID to which we will queue audio + * \param data the data to queue to the device for later playback + * \param len the number of bytes (not samples!) to which `data` points + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.4. + * + * \sa SDL_ClearQueuedAudio + * \sa SDL_GetQueuedAudioSize + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_QueueAudio_fun = function(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): cint; cdecl; +Var + SDL_QueueAudio : TSDL_QueueAudio_fun = Nil; +{$else} + +function SDL_QueueAudio(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_QueueAudio' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Dequeue more audio on non-callback devices. + * + * If you are looking to queue audio for output on a non-callback playback + * device, you want SDL_QueueAudio() instead. SDL_DequeueAudio() will always + * return 0 if you use it with playback devices. + * + * SDL offers two ways to retrieve audio from a capture device: you can either + * supply a callback that SDL triggers with some frequency as the device + * records more audio data, (push method), or you can supply no callback, and + * then SDL will expect you to retrieve data at regular intervals (pull + * method) with this function. + * + * There are no limits on the amount of data you can queue, short of + * exhaustion of address space. Data from the device will keep queuing as + * necessary without further intervention from you. This means you will + * eventually run out of memory if you aren't routinely dequeueing data. + * + * Capture devices will not queue data when paused; if you are expecting to + * not need captured audio for some length of time, use SDL_PauseAudioDevice() + * to stop the capture device from queueing more data. This can be useful + * during, say, level loading times. When unpaused, capture devices will start + * queueing data from that point, having flushed any capturable data available + * while paused. + * + * This function is thread-safe, but dequeueing from the same device from two + * threads at once does not promise which thread will dequeue data first. + * + * You may not dequeue audio from a device that is using an + * application-supplied callback; doing so returns an error. You have to use + * the audio callback, or dequeue audio with this function, but not both. + * + * You should not call SDL_LockAudio() on the device before dequeueing; SDL + * handles locking internally for this function. + * + * \param dev the device ID from which we will dequeue audio + * \param data a pointer into where audio data should be copied + * \param len the number of bytes (not samples!) to which (data) points + * \returns the number of bytes dequeued, which could be less than requested; + * call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.5. + * + * \sa SDL_ClearQueuedAudio + * \sa SDL_GetQueuedAudioSize + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_DequeueAudio_fun = function(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): cuint32; cdecl; +Var + SDL_DequeueAudio : TSDL_DequeueAudio_fun = Nil; +{$else} + +function SDL_DequeueAudio(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DequeueAudio' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the number of bytes of still-queued audio. + * + * For playback devices: this is the number of bytes that have been queued for + * playback with SDL_QueueAudio(), but have not yet been sent to the hardware. + * + * Once we've sent it to the hardware, this function can not decide the exact + * byte boundary of what has been played. It's possible that we just gave the + * hardware several kilobytes right before you called this function, but it + * hasn't played any of it yet, or maybe half of it, etc. + * + * For capture devices, this is the number of bytes that have been captured by + * the device and are waiting for you to dequeue. This number may grow at any + * time, so this only informs of the lower-bound of available data. + * + * You may not queue or dequeue audio on a device that is using an + * application-supplied callback; calling this function on such a device + * always returns 0. You have to use the audio callback or queue audio, but + * not both. + * + * You should not call SDL_LockAudio() on the device before querying; SDL + * handles locking internally for this function. + * + * \param dev the device ID of which we will query queued audio size + * \returns the number of bytes (not samples!) of queued audio. + * + * \since This function is available since SDL 2.0.4. + * + * \sa SDL_ClearQueuedAudio + * \sa SDL_QueueAudio + * \sa SDL_DequeueAudio + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetQueuedAudioSize_fun = function(dev: TSDL_AudioDeviceID): cuint32; cdecl; +Var + SDL_GetQueuedAudioSize : TSDL_GetQueuedAudioSize_fun = Nil; +{$else} + +function SDL_GetQueuedAudioSize(dev: TSDL_AudioDeviceID): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetQueuedAudioSize' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Drop any queued audio data waiting to be sent to the hardware. + * + * Immediately after this call, SDL_GetQueuedAudioSize() will return 0. For + * output devices, the hardware will start playing silence if more audio isn't + * queued. For capture devices, the hardware will start filling the empty + * queue with new data if the capture device isn't paused. + * + * This will not prevent playback of queued audio that's already been sent to + * the hardware, as we can not undo that, so expect there to be some fraction + * of a second of audio that might still be heard. This can be useful if you + * want to, say, drop any pending music or any unprocessed microphone input + * during a level change in your game. + * + * You may not queue or dequeue audio on a device that is using an + * application-supplied callback; calling this function on such a device + * always returns 0. You have to use the audio callback or queue audio, but + * not both. + * + * You should not call SDL_LockAudio() on the device before clearing the + * queue; SDL handles locking internally for this function. + * + * This function always succeeds and thus returns void. + * + * \param dev the device ID of which to clear the audio queue + * + * \since This function is available since SDL 2.0.4. + * + * \sa SDL_GetQueuedAudioSize + * \sa SDL_QueueAudio + * \sa SDL_DequeueAudio + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ClearQueuedAudio_proc = procedure(dev: TSDL_AudioDeviceID); cdecl; +Var + SDL_ClearQueuedAudio : TSDL_ClearQueuedAudio_proc = Nil; +{$else} + +procedure SDL_ClearQueuedAudio(dev: TSDL_AudioDeviceID); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ClearQueuedAudio' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Audio lock functions + * + * The lock manipulated by these functions protects the callback function. + * During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that + * the callback function is not running. Do not call these from the callback + * function or you will cause deadlock. + *} + +{** + * This function is a legacy means of locking the audio device. + * + * New programs might want to use SDL_LockAudioDevice() instead. This function + * is equivalent to calling... + * + * ```c + * SDL_LockAudioDevice(1); + * ``` + * + * ...and is only useful if you used the legacy SDL_OpenAudio() function. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_LockAudioDevice + * \sa SDL_UnlockAudio + * \sa SDL_UnlockAudioDevice + *} +procedure SDL_LockAudio; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockAudio' {$ENDIF} {$ENDIF}; + +{** + * Use this function to lock out the audio callback function for a specified + * device. + * + * The lock manipulated by these functions protects the audio callback + * function specified in SDL_OpenAudioDevice(). During a + * SDL_LockAudioDevice()/SDL_UnlockAudioDevice() pair, you can be guaranteed + * that the callback function for that device is not running, even if the + * device is not paused. While a device is locked, any other unpaused, + * unlocked devices may still run their callbacks. + * + * Calling this function from inside your audio callback is unnecessary. SDL + * obtains this lock before calling your function, and releases it when the + * function returns. + * + * You should not hold the lock longer than absolutely necessary. If you hold + * it too long, you'll experience dropouts in your audio playback. Ideally, + * your application locks the device, sets a few variables and unlocks again. + * Do not do heavy work while holding the lock for a device. + * + * It is safe to lock the audio device multiple times, as long as you unlock + * it an equivalent number of times. The callback will not run until the + * device has been unlocked completely in this way. If your application fails + * to unlock the device appropriately, your callback will never run, you might + * hear repeating bursts of audio, and SDL_CloseAudioDevice() will probably + * deadlock. + * + * Internally, the audio device lock is a mutex; if you lock from two threads + * at once, not only will you block the audio callback, you'll block the other + * thread. + * + * \param dev the ID of the device to be locked + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_UnlockAudioDevice + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LockAudioDevice_proc = procedure(dev: TSDL_AudioDeviceID); cdecl; +Var + SDL_LockAudioDevice : TSDL_LockAudioDevice_proc = Nil; +{$else} + +procedure SDL_LockAudioDevice(dev: TSDL_AudioDeviceID); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockAudioDevice' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * This function is a legacy means of unlocking the audio device. + * + * New programs might want to use SDL_UnlockAudioDevice() instead. This + * function is equivalent to calling... + * + * ```c + * SDL_UnlockAudioDevice(1); + * ``` + * + * ...and is only useful if you used the legacy SDL_OpenAudio() function. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_LockAudio + * \sa SDL_UnlockAudioDevice + *} +procedure SDL_UnlockAudio; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Unlock' {$ENDIF} {$ENDIF}; + +{** + * Use this function to unlock the audio callback function for a specified + * device. + * + * This function should be paired with a previous SDL_LockAudioDevice() call. + * + * \param dev the ID of the device to be unlocked + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_LockAudioDevice + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UnlockAudioDevice_proc = procedure(dev: TSDL_AudioDeviceID); cdecl; +Var + SDL_UnlockAudioDevice : TSDL_UnlockAudioDevice_proc = Nil; +{$else} + +procedure SDL_UnlockAudioDevice(dev: TSDL_AudioDeviceID); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnlockAudioDevice' {$ENDIF} {$ENDIF}; +{$endif} + +{*Audio lock functions*} + +{** + * This function is a legacy means of closing the audio device. + * + * This function is equivalent to calling... + * + * ```c + * SDL_CloseAudioDevice(1); + * ``` + * + * ...and is only useful if you used the legacy SDL_OpenAudio() function. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_OpenAudio + *} +procedure SDL_CloseAudio; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CloseAudio' {$ENDIF} {$ENDIF}; + +{** + * Use this function to shut down audio processing and close the audio device. + * + * The application should close open audio devices once they are no longer + * needed. Calling this function will wait until the device's audio callback + * is not running, release the audio hardware and then clean up internal + * state. No further audio will play from this device once this function + * returns. + * + * This function may block briefly while pending audio data is played by the + * hardware, so that applications don't drop the last buffer of data they + * supplied. + * + * The device ID is invalid as soon as the device is closed, and is eligible + * for reuse in a new SDL_OpenAudioDevice() call immediately. + * + * \param dev an audio device previously opened with SDL_OpenAudioDevice() + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_OpenAudioDevice + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CloseAudioDevice_proc = procedure(dev: TSDL_AudioDeviceID); cdecl; +Var + SDL_CloseAudioDevice : TSDL_CloseAudioDevice_proc = Nil; +{$else} + +procedure SDL_CloseAudioDevice(dev: TSDL_AudioDeviceID); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CloseAudioDevice' {$ENDIF} {$ENDIF}; +{$endif} + diff --git a/units/sdlblendmode.inc b/units/sdlblendmode.inc index 15dfb171..4a6fcb4d 100644 --- a/units/sdlblendmode.inc +++ b/units/sdlblendmode.inc @@ -1,82 +1,90 @@ -//from "sdl_blendmode.h" - -{** - * The blend mode used in SDL_RenderCopy() and drawing operations. - *} - -type - PPSDL_BlendMode = ^PSDL_BlendMode; - PSDL_BlendMode = ^TSDL_BlendMode; - TSDL_BlendMode = type DWord; - -const - SDL_BLENDMODE_NONE = TSDL_BlendMode($00000000); {**< no blending - dstRGBA = srcRGBA *} - SDL_BLENDMODE_BLEND = TSDL_BlendMode($00000001); {**< alpha blending - dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)) - dstA = srcA + (dstA * (1-srcA)) *} - SDL_BLENDMODE_ADD = TSDL_BlendMode($00000002); {**< additive blending - dstRGB = (srcRGB * srcA) + dstRGB - dstA = dstA *} - SDL_BLENDMODE_MOD = TSDL_BlendMode($00000004); {**< color modulate - dstRGB = srcRGB * dstRGB - dstA = dstA *} - SDL_BLENDMODE_MUL = TSDL_BlendMode($00000008); {**< color multiply - dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)) - dstA = (srcA * dstA) + (dstA * (1-srcA)) *} - SDL_BLENDMODE_INVALID = TSDL_BlendMode($7FFFFFFF); { } - - {* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() *} - - {** - * \brief The blend operation used when combining source and destination pixel components - *} -type - PPSDL_BlendOperation = ^PSDL_BlendOperation; - PSDL_BlendOperation = ^TSDL_BlendOperation; - TSDL_BlendOperation = type DWord; - -const - SDL_BLENDOPERATION_ADD = TSDL_BlendOperation($1); {**< dst + src: supported by all renderers *} - SDL_BLENDOPERATION_SUBTRACT = TSDL_BlendOperation($2); {**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES} - SDL_BLENDOPERATION_REV_SUBTRACT = TSDL_BlendOperation($3); {**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES} - SDL_BLENDOPERATION_MINIMUM = TSDL_BlendOperation($4); {**< min(dst, src) : supported by D3D11 *} - SDL_BLENDOPERATION_MAXIMUM = TSDL_BlendOperation($5); {**< max(dst, src) : supported by D3D11 *} - - {** - * \brief The normalized factor used to multiply pixel components - *} -type - PPSDL_BlendFactor = ^PSDL_BlendFactor; - PSDL_BlendFactor = ^TSDL_BlendFactor; - TSDL_BlendFactor = type DWord; - -const - SDL_BLENDFACTOR_ZERO = TSDL_BlendFactor($1); {**< 0, 0, 0, 0 *} - SDL_BLENDFACTOR_ONE = TSDL_BlendFactor($2); {**< 1, 1, 1, 1 *} - SDL_BLENDFACTOR_SRC_COLOR = TSDL_BlendFactor($3); {**< srcR, srcG, srcB, srcA *} - SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = TSDL_BlendFactor($4); {**< 1-srcR, 1-srcG, 1-srcB, 1-srcA *} - SDL_BLENDFACTOR_SRC_ALPHA = TSDL_BlendFactor($5); {**< srcA, srcA, srcA, srcA *} - SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = TSDL_BlendFactor($6); {**< 1-srcA, 1-srcA, 1-srcA, 1-srcA *} - SDL_BLENDFACTOR_DST_COLOR = TSDL_BlendFactor($7); {**< dstR, dstG, dstB, dstA *} - SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = TSDL_BlendFactor($8); {**< 1-dstR, 1-dstG, 1-dstB, 1-dstA *} - SDL_BLENDFACTOR_DST_ALPHA = TSDL_BlendFactor($9); {**< dstA, dstA, dstA, dstA *} - SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = TSDL_BlendFactor($A); {**< 1-dstA, 1-dstA, 1-dstA, 1-dstA *} - -{** - * \brief Create a custom blend mode, which may or may not be supported by a given renderer - * - * \param srcColorFactor source color factor - * \param dstColorFactor destination color factor - * \param colorOperation color operation - * \param srcAlphaFactor source alpha factor - * \param dstAlphaFactor destination alpha factor - * \param alphaOperation alpha operation - * - * The result of the blend mode operation will be: - * dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor - * and - * dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor - *} -function SDL_ComposeCustomBlendMode(srcColorFactor, dstColorFactor: TSDL_BlendFactor; colorOperation: TSDL_BlendOperation; srcAlphaFactor, dstAlphaFactor: TSDL_BlendFactor; alphaOperation: TSDL_BlendOperation): TSDL_BlendMode; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ComposeCustomBlendMode' {$ENDIF} {$ENDIF}; +//from "sdl_blendmode.h" + +{** + * The blend mode used in SDL_RenderCopy() and drawing operations. + *} + +type + PPSDL_BlendMode = ^PSDL_BlendMode; + PSDL_BlendMode = ^TSDL_BlendMode; + TSDL_BlendMode = type DWord; + +const + SDL_BLENDMODE_NONE = TSDL_BlendMode($00000000); {**< no blending + dstRGBA = srcRGBA *} + SDL_BLENDMODE_BLEND = TSDL_BlendMode($00000001); {**< alpha blending + dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)) + dstA = srcA + (dstA * (1-srcA)) *} + SDL_BLENDMODE_ADD = TSDL_BlendMode($00000002); {**< additive blending + dstRGB = (srcRGB * srcA) + dstRGB + dstA = dstA *} + SDL_BLENDMODE_MOD = TSDL_BlendMode($00000004); {**< color modulate + dstRGB = srcRGB * dstRGB + dstA = dstA *} + SDL_BLENDMODE_MUL = TSDL_BlendMode($00000008); {**< color multiply + dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)) + dstA = (srcA * dstA) + (dstA * (1-srcA)) *} + SDL_BLENDMODE_INVALID = TSDL_BlendMode($7FFFFFFF); { } + + {* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() *} + + {** + * \brief The blend operation used when combining source and destination pixel components + *} +type + PPSDL_BlendOperation = ^PSDL_BlendOperation; + PSDL_BlendOperation = ^TSDL_BlendOperation; + TSDL_BlendOperation = type DWord; + +const + SDL_BLENDOPERATION_ADD = TSDL_BlendOperation($1); {**< dst + src: supported by all renderers *} + SDL_BLENDOPERATION_SUBTRACT = TSDL_BlendOperation($2); {**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES} + SDL_BLENDOPERATION_REV_SUBTRACT = TSDL_BlendOperation($3); {**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES} + SDL_BLENDOPERATION_MINIMUM = TSDL_BlendOperation($4); {**< min(dst, src) : supported by D3D11 *} + SDL_BLENDOPERATION_MAXIMUM = TSDL_BlendOperation($5); {**< max(dst, src) : supported by D3D11 *} + + {** + * \brief The normalized factor used to multiply pixel components + *} +type + PPSDL_BlendFactor = ^PSDL_BlendFactor; + PSDL_BlendFactor = ^TSDL_BlendFactor; + TSDL_BlendFactor = type DWord; + +const + SDL_BLENDFACTOR_ZERO = TSDL_BlendFactor($1); {**< 0, 0, 0, 0 *} + SDL_BLENDFACTOR_ONE = TSDL_BlendFactor($2); {**< 1, 1, 1, 1 *} + SDL_BLENDFACTOR_SRC_COLOR = TSDL_BlendFactor($3); {**< srcR, srcG, srcB, srcA *} + SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = TSDL_BlendFactor($4); {**< 1-srcR, 1-srcG, 1-srcB, 1-srcA *} + SDL_BLENDFACTOR_SRC_ALPHA = TSDL_BlendFactor($5); {**< srcA, srcA, srcA, srcA *} + SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = TSDL_BlendFactor($6); {**< 1-srcA, 1-srcA, 1-srcA, 1-srcA *} + SDL_BLENDFACTOR_DST_COLOR = TSDL_BlendFactor($7); {**< dstR, dstG, dstB, dstA *} + SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = TSDL_BlendFactor($8); {**< 1-dstR, 1-dstG, 1-dstB, 1-dstA *} + SDL_BLENDFACTOR_DST_ALPHA = TSDL_BlendFactor($9); {**< dstA, dstA, dstA, dstA *} + SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = TSDL_BlendFactor($A); {**< 1-dstA, 1-dstA, 1-dstA, 1-dstA *} + +{** + * \brief Create a custom blend mode, which may or may not be supported by a given renderer + * + * \param srcColorFactor source color factor + * \param dstColorFactor destination color factor + * \param colorOperation color operation + * \param srcAlphaFactor source alpha factor + * \param dstAlphaFactor destination alpha factor + * \param alphaOperation alpha operation + * + * The result of the blend mode operation will be: + * dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor + * and + * dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ComposeCustomBlendMode_fun = function(srcColorFactor, dstColorFactor: TSDL_BlendFactor; colorOperation: TSDL_BlendOperation; srcAlphaFactor, dstAlphaFactor: TSDL_BlendFactor; alphaOperation: TSDL_BlendOperation): TSDL_BlendMode; cdecl; +Var + SDL_ComposeCustomBlendMode : TSDL_ComposeCustomBlendMode_fun = Nil; +{$else} + +function SDL_ComposeCustomBlendMode(srcColorFactor, dstColorFactor: TSDL_BlendFactor; colorOperation: TSDL_BlendOperation; srcAlphaFactor, dstAlphaFactor: TSDL_BlendFactor; alphaOperation: TSDL_BlendOperation): TSDL_BlendMode; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ComposeCustomBlendMode' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlclipboard.inc b/units/sdlclipboard.inc index 1b3929fa..2534c1de 100644 --- a/units/sdlclipboard.inc +++ b/units/sdlclipboard.inc @@ -1,105 +1,153 @@ - -{* - * \file SDL_clipboard.h - * - * Include file for SDL clipboard handling - } - -{* Function prototypes *} - -{* - * Put UTF-8 text into the clipboard. - * - * \param text the text to store in the clipboard - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetClipboardText - * \sa SDL_HasClipboardText - } -function SDL_SetClipboardText(text: PAnsiChar): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetClipboardText' {$ENDIF} {$ENDIF}; - -{* - * Get UTF-8 text from the clipboard, which must be freed with SDL_free(). - * - * This functions returns empty string if there was not enough memory left for - * a copy of the clipboard's content. - * - * \returns the clipboard text on success or an empty string on failure; call - * SDL_GetError() for more information. Caller must call SDL_free() - * on the returned pointer when done with it (even if there was an - * error). - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HasClipboardText - * \sa SDL_SetClipboardText - } -function SDL_GetClipboardText(): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetClipboardText' {$ENDIF} {$ENDIF}; - -{* - * Query whether the clipboard exists and contains a non-empty text string. - * - * \returns SDL_TRUE if the clipboard has text, or SDL_FALSE if it does not. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetClipboardText - * \sa SDL_SetClipboardText - } -function SDL_HasClipboardText(): TSDL_bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasClipboardText' {$ENDIF} {$ENDIF}; - -{* - * Put UTF-8 text into the primary selection. - * - * \param text the text to store in the primary selection - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.26.1. - * - * \sa SDL_GetPrimarySelectionText - * \sa SDL_HasPrimarySelectionText - } -function SDL_SetPrimarySelectionText(text: PAnsiChar): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetPrimarySelectionText' {$ENDIF} {$ENDIF}; - -{* - * Get UTF-8 text from the primary selection, which must be freed with - * SDL_free(). - * - * This functions returns empty string if there was not enough memory left for - * a copy of the primary selection's content. - * - * \returns the primary selection text on success or an empty string on - * failure; call SDL_GetError() for more information. Caller must - * call SDL_free() on the returned pointer when done with it (even if - * there was an error). - * - * \since This function is available since SDL 2.26.1. - * - * \sa SDL_HasPrimarySelectionText - * \sa SDL_SetPrimarySelectionText - } -function SDL_GetPrimarySelectionText(): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPrimarySelectionText' {$ENDIF} {$ENDIF}; - -{* - * Query whether the primary selection exists and contains a non-empty text - * string. - * - * \returns SDL_TRUE if the primary selection has text, or SDL_FALSE if it - * does not. - * - * \since This function is available since SDL 2.26.1. - * - * \sa SDL_GetPrimarySelectionText - * \sa SDL_SetPrimarySelectionText - } -function SDL_HasPrimarySelectionText(): TSDL_bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasPrimarySelectionText' {$ENDIF} {$ENDIF}; + +{* + * \file SDL_clipboard.h + * + * Include file for SDL clipboard handling + } + +{* Function prototypes *} + +{* + * Put UTF-8 text into the clipboard. + * + * \param text the text to store in the clipboard + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetClipboardText + * \sa SDL_HasClipboardText + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetClipboardText_fun = function(text: PAnsiChar): cint; cdecl; +Var + SDL_SetClipboardText : TSDL_SetClipboardText_fun = Nil; +{$else} + +function SDL_SetClipboardText(text: PAnsiChar): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetClipboardText' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get UTF-8 text from the clipboard, which must be freed with SDL_free(). + * + * This functions returns empty string if there was not enough memory left for + * a copy of the clipboard's content. + * + * \returns the clipboard text on success or an empty string on failure; call + * SDL_GetError() for more information. Caller must call SDL_free() + * on the returned pointer when done with it (even if there was an + * error). + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HasClipboardText + * \sa SDL_SetClipboardText + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetClipboardText_fun = function(): PAnsiChar; cdecl; +Var + SDL_GetClipboardText : TSDL_GetClipboardText_fun = Nil; +{$else} + +function SDL_GetClipboardText(): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetClipboardText' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Query whether the clipboard exists and contains a non-empty text string. + * + * \returns SDL_TRUE if the clipboard has text, or SDL_FALSE if it does not. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetClipboardText + * \sa SDL_SetClipboardText + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HasClipboardText_fun = function(): TSDL_bool; cdecl; +Var + SDL_HasClipboardText : TSDL_HasClipboardText_fun = Nil; +{$else} + +function SDL_HasClipboardText(): TSDL_bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasClipboardText' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Put UTF-8 text into the primary selection. + * + * \param text the text to store in the primary selection + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.26.1. + * + * \sa SDL_GetPrimarySelectionText + * \sa SDL_HasPrimarySelectionText + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetPrimarySelectionText_fun = function(text: PAnsiChar): cint; cdecl; +Var + SDL_SetPrimarySelectionText : TSDL_SetPrimarySelectionText_fun = Nil; +{$else} + +function SDL_SetPrimarySelectionText(text: PAnsiChar): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetPrimarySelectionText' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get UTF-8 text from the primary selection, which must be freed with + * SDL_free(). + * + * This functions returns empty string if there was not enough memory left for + * a copy of the primary selection's content. + * + * \returns the primary selection text on success or an empty string on + * failure; call SDL_GetError() for more information. Caller must + * call SDL_free() on the returned pointer when done with it (even if + * there was an error). + * + * \since This function is available since SDL 2.26.1. + * + * \sa SDL_HasPrimarySelectionText + * \sa SDL_SetPrimarySelectionText + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetPrimarySelectionText_fun = function(): PAnsiChar; cdecl; +Var + SDL_GetPrimarySelectionText : TSDL_GetPrimarySelectionText_fun = Nil; +{$else} + +function SDL_GetPrimarySelectionText(): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPrimarySelectionText' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Query whether the primary selection exists and contains a non-empty text + * string. + * + * \returns SDL_TRUE if the primary selection has text, or SDL_FALSE if it + * does not. + * + * \since This function is available since SDL 2.26.1. + * + * \sa SDL_GetPrimarySelectionText + * \sa SDL_SetPrimarySelectionText + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HasPrimarySelectionText_fun = function(): TSDL_bool; cdecl; +Var + SDL_HasPrimarySelectionText : TSDL_HasPrimarySelectionText_fun = Nil; +{$else} + +function SDL_HasPrimarySelectionText(): TSDL_bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasPrimarySelectionText' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlcpuinfo.inc b/units/sdlcpuinfo.inc index 6cf3701c..e9b99b04 100644 --- a/units/sdlcpuinfo.inc +++ b/units/sdlcpuinfo.inc @@ -1,215 +1,223 @@ - -{* - * This is a guess for the cacheline size used for padding. - * Most x86 processors have a 64 byte cache line. - * The 64-bit PowerPC processors have a 128 byte cache line. - * We'll use the larger value to be generally safe. - *} -const - SDL_CACHELINE_SIZE = 128; - -{** - * This function returns the number of CPU cores available. - *} -function SDL_GetCPUCount(): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCPUCount' {$ENDIF} {$ENDIF}; - -{** - * This function returns the L1 cache line size of the CPU. - * - * This is useful for determining multi-threaded structure padding - * or SIMD prefetch sizes. - *} -function SDL_GetCPUCacheLineSize(): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCPUCacheLineSize' {$ENDIF} {$ENDIF}; - -{** - * This function returns true if the CPU has the RDTSC instruction. - * - * This always returns false on CPUs that aren't using Intel instruction sets. - *} -function SDL_HasRDTSC(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasRDTSC' {$ENDIF} {$ENDIF}; - -{** - * This function returns true if the CPU has AltiVec features. - * - * This always returns false on CPUs that aren't using PowerPC - * instruction sets. - *} -function SDL_HasAltiVec(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasAltiVec' {$ENDIF} {$ENDIF}; - -{** - * This function returns true if the CPU has MMX features. - * - * This always returns false on CPUs that aren't using Intel instruction sets. - *} -function SDL_HasMMX(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasMMX' {$ENDIF} {$ENDIF}; - -{** - * This function returns true if the CPU has 3DNow! features. - * - * This always returns false on CPUs that aren't using AMD instruction sets. - *} -function SDL_Has3DNow(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Has3DNow' {$ENDIF} {$ENDIF}; - -{** - * This function returns true if the CPU has SSE features. - * - * This always returns false on CPUs that aren't using Intel instruction sets. - *} -function SDL_HasSSE(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSSE' {$ENDIF} {$ENDIF}; - -{** - * This function returns true if the CPU has SSE2 features. - * - * This always returns false on CPUs that aren't using Intel instruction sets. - *} -function SDL_HasSSE2(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSSE2' {$ENDIF} {$ENDIF}; - -{** - * This function returns true if the CPU has SSE3 features. - * - * This always returns false on CPUs that aren't using Intel instruction sets. - *} -function SDL_HasSSE3(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSSE3' {$ENDIF} {$ENDIF}; - -{** - * This function returns true if the CPU has SSE4.1 features. - * - * This always returns false on CPUs that aren't using Intel instruction sets. - *} -function SDL_HasSSE41(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSSE41' {$ENDIF} {$ENDIF}; - -{** - * This function returns true if the CPU has SSE4.2 features. - * - * This always returns false on CPUs that aren't using Intel instruction sets. - *} -function SDL_HasSSE42(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSSE42' {$ENDIF} {$ENDIF}; - -{** - * This function returns true if the CPU has AVX features. - * - * This always returns false on CPUs that aren't using Intel instruction sets. - *} -function SDL_HasAVX(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasAVX' {$ENDIF} {$ENDIF}; - -{** - * This function returns true if the CPU has AVX2 features. - * - * This always returns false on CPUs that aren't using Intel instruction sets. - *} -function SDL_HasAVX2(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasAVX2' {$ENDIF} {$ENDIF}; - -{** - * Determine whether the CPU has AVX-512F (foundation) features. - * - * This always returns false on CPUs that aren't using Intel instruction sets. - *} -function SDL_HasAVX512F(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasAVX512F' {$ENDIF} {$ENDIF}; - -{** - * Determine whether the CPU has ARM SIMD (ARMv6) features. - * This is different from ARM NEON, which is a different instruction set. - * - * This always returns false on CPUs that aren't using ARM instruction sets. - *} -function SDL_HasARMSIMD(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasARMSIMD' {$ENDIF} {$ENDIF}; - -{** - * Determine whether the CPU has NEON (ARM SIMD) features. - * - * This always returns false on CPUs that aren't using ARM instruction sets. - *} -function SDL_HasNEON(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasNEON' {$ENDIF} {$ENDIF}; - -{** - * This function returns the amount of RAM configured in the system, in MB. - *} -function SDL_GetSystemRAM(): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetSystemRAM' {$ENDIF} {$ENDIF}; - -{** - * Report the alignment this system needs for SIMD allocations. - * - * This will return the minimum number of bytes to which a pointer must be - * aligned to be compatible with SIMD instructions on the current machine. For - * example, if the machine supports SSE only, it will return 16, but if it - * supports AVX-512F, it'll return 64 (etc). This only reports values for - * instruction sets SDL knows about, so if your SDL build doesn't have - * SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and - * not 64 for the AVX-512 instructions that exist but SDL doesn't know about. - * Plan accordingly. - *} -function SDL_SIMDGetAlignment(): csize_t; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SIMDGetAlignment' {$ENDIF} {$ENDIF}; - -{* - * Allocate memory in a SIMD-friendly way. - * - * This will allocate a block of memory that is suitable for use with SIMD - * instructions. Specifically, it will be properly aligned and padded for the - * system's supported vector instructions. - * - * The memory returned will be padded such that it is safe to read or write an - * incomplete vector at the end of the memory block. This can be useful so you - * don't have to drop back to a scalar fallback at the end of your SIMD - * processing loop to deal with the final elements without overflowing the - * allocated buffer. - * - * You must free this memory with SDL_FreeSIMD(), not free() or SDL_free(). - * - * Note that SDL will only deal with SIMD instruction sets it is aware of; for - * example, SDL 2.0.8 knows that SSE wants 16-byte vectors (SDL_HasSSE()), and - * AVX2 wants 32 bytes (SDL_HasAVX2()), but doesn't know that AVX-512 wants - * 64. To be clear: if you can't decide to use an instruction set with an - * SDL_Has*() function, don't use that instruction set with memory allocated - * through here. - * - * SDL_AllocSIMD(0) will return a non-NULL pointer, assuming the system isn't - * out of memory, but you are not allowed to dereference it (because you only - * own zero bytes of that buffer). - *} -function SDL_SIMDAlloc(const len: csize_t): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SIMDAlloc' {$ENDIF} {$ENDIF}; - -{** - * Reallocate memory obtained from SDL_SIMDAlloc. - * - * It is not valid to use this function on a pointer from anything but - * SDL_SIMDAlloc(). It can't be used on pointers from SDL_malloc, GetMem, etc. - *} -function SDL_SIMDRealloc(mem: Pointer; const len: csize_t): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SIMDRealloc' {$ENDIF} {$ENDIF}; - -{** - * Deallocate memory obtained from SDL_SIMDAlloc. - * - * It is not valid to use this function on a pointer from anything but - * SDL_SIMDAlloc() or SDL_SIMDRealloc(). It can't be used on pointers from - * SDL_malloc, GetMem, etc. - * - * However, SDL_SIMDFree(NIL) is a legal no-op. - * - * The memory pointed to by `mem` is no longer valid for access upon return, - * and may be returned to the system or reused by a future allocation. The - * pointer passed to this function is no longer safe to dereference once this - * function returns, and should be discarded. - *} -procedure SDL_SIMDFree(mem: Pointer); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SIMDFree' {$ENDIF} {$ENDIF}; - + +{* + * This is a guess for the cacheline size used for padding. + * Most x86 processors have a 64 byte cache line. + * The 64-bit PowerPC processors have a 128 byte cache line. + * We'll use the larger value to be generally safe. + *} +const + SDL_CACHELINE_SIZE = 128; + +{** + * This function returns the number of CPU cores available. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetCPUCount_fun = function(): cint; cdecl; +Var + SDL_GetCPUCount : TSDL_GetCPUCount_fun = Nil; +{$else} + +function SDL_GetCPUCount(): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCPUCount' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * This function returns the L1 cache line size of the CPU. + * + * This is useful for determining multi-threaded structure padding + * or SIMD prefetch sizes. + *} +function SDL_GetCPUCacheLineSize(): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCPUCacheLineSize' {$ENDIF} {$ENDIF}; + +{** + * This function returns true if the CPU has the RDTSC instruction. + * + * This always returns false on CPUs that aren't using Intel instruction sets. + *} +function SDL_HasRDTSC(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasRDTSC' {$ENDIF} {$ENDIF}; + +{** + * This function returns true if the CPU has AltiVec features. + * + * This always returns false on CPUs that aren't using PowerPC + * instruction sets. + *} +function SDL_HasAltiVec(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasAltiVec' {$ENDIF} {$ENDIF}; + +{** + * This function returns true if the CPU has MMX features. + * + * This always returns false on CPUs that aren't using Intel instruction sets. + *} +function SDL_HasMMX(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasMMX' {$ENDIF} {$ENDIF}; + +{** + * This function returns true if the CPU has 3DNow! features. + * + * This always returns false on CPUs that aren't using AMD instruction sets. + *} +function SDL_Has3DNow(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Has3DNow' {$ENDIF} {$ENDIF}; + +{** + * This function returns true if the CPU has SSE features. + * + * This always returns false on CPUs that aren't using Intel instruction sets. + *} +function SDL_HasSSE(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSSE' {$ENDIF} {$ENDIF}; + +{** + * This function returns true if the CPU has SSE2 features. + * + * This always returns false on CPUs that aren't using Intel instruction sets. + *} +function SDL_HasSSE2(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSSE2' {$ENDIF} {$ENDIF}; + +{** + * This function returns true if the CPU has SSE3 features. + * + * This always returns false on CPUs that aren't using Intel instruction sets. + *} +function SDL_HasSSE3(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSSE3' {$ENDIF} {$ENDIF}; + +{** + * This function returns true if the CPU has SSE4.1 features. + * + * This always returns false on CPUs that aren't using Intel instruction sets. + *} +function SDL_HasSSE41(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSSE41' {$ENDIF} {$ENDIF}; + +{** + * This function returns true if the CPU has SSE4.2 features. + * + * This always returns false on CPUs that aren't using Intel instruction sets. + *} +function SDL_HasSSE42(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSSE42' {$ENDIF} {$ENDIF}; + +{** + * This function returns true if the CPU has AVX features. + * + * This always returns false on CPUs that aren't using Intel instruction sets. + *} +function SDL_HasAVX(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasAVX' {$ENDIF} {$ENDIF}; + +{** + * This function returns true if the CPU has AVX2 features. + * + * This always returns false on CPUs that aren't using Intel instruction sets. + *} +function SDL_HasAVX2(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasAVX2' {$ENDIF} {$ENDIF}; + +{** + * Determine whether the CPU has AVX-512F (foundation) features. + * + * This always returns false on CPUs that aren't using Intel instruction sets. + *} +function SDL_HasAVX512F(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasAVX512F' {$ENDIF} {$ENDIF}; + +{** + * Determine whether the CPU has ARM SIMD (ARMv6) features. + * This is different from ARM NEON, which is a different instruction set. + * + * This always returns false on CPUs that aren't using ARM instruction sets. + *} +function SDL_HasARMSIMD(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasARMSIMD' {$ENDIF} {$ENDIF}; + +{** + * Determine whether the CPU has NEON (ARM SIMD) features. + * + * This always returns false on CPUs that aren't using ARM instruction sets. + *} +function SDL_HasNEON(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasNEON' {$ENDIF} {$ENDIF}; + +{** + * This function returns the amount of RAM configured in the system, in MB. + *} +function SDL_GetSystemRAM(): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetSystemRAM' {$ENDIF} {$ENDIF}; + +{** + * Report the alignment this system needs for SIMD allocations. + * + * This will return the minimum number of bytes to which a pointer must be + * aligned to be compatible with SIMD instructions on the current machine. For + * example, if the machine supports SSE only, it will return 16, but if it + * supports AVX-512F, it'll return 64 (etc). This only reports values for + * instruction sets SDL knows about, so if your SDL build doesn't have + * SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and + * not 64 for the AVX-512 instructions that exist but SDL doesn't know about. + * Plan accordingly. + *} +function SDL_SIMDGetAlignment(): csize_t; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SIMDGetAlignment' {$ENDIF} {$ENDIF}; + +{* + * Allocate memory in a SIMD-friendly way. + * + * This will allocate a block of memory that is suitable for use with SIMD + * instructions. Specifically, it will be properly aligned and padded for the + * system's supported vector instructions. + * + * The memory returned will be padded such that it is safe to read or write an + * incomplete vector at the end of the memory block. This can be useful so you + * don't have to drop back to a scalar fallback at the end of your SIMD + * processing loop to deal with the final elements without overflowing the + * allocated buffer. + * + * You must free this memory with SDL_FreeSIMD(), not free() or SDL_free(). + * + * Note that SDL will only deal with SIMD instruction sets it is aware of; for + * example, SDL 2.0.8 knows that SSE wants 16-byte vectors (SDL_HasSSE()), and + * AVX2 wants 32 bytes (SDL_HasAVX2()), but doesn't know that AVX-512 wants + * 64. To be clear: if you can't decide to use an instruction set with an + * SDL_Has*() function, don't use that instruction set with memory allocated + * through here. + * + * SDL_AllocSIMD(0) will return a non-NULL pointer, assuming the system isn't + * out of memory, but you are not allowed to dereference it (because you only + * own zero bytes of that buffer). + *} +function SDL_SIMDAlloc(const len: csize_t): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SIMDAlloc' {$ENDIF} {$ENDIF}; + +{** + * Reallocate memory obtained from SDL_SIMDAlloc. + * + * It is not valid to use this function on a pointer from anything but + * SDL_SIMDAlloc(). It can't be used on pointers from SDL_malloc, GetMem, etc. + *} +function SDL_SIMDRealloc(mem: Pointer; const len: csize_t): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SIMDRealloc' {$ENDIF} {$ENDIF}; + +{** + * Deallocate memory obtained from SDL_SIMDAlloc. + * + * It is not valid to use this function on a pointer from anything but + * SDL_SIMDAlloc() or SDL_SIMDRealloc(). It can't be used on pointers from + * SDL_malloc, GetMem, etc. + * + * However, SDL_SIMDFree(NIL) is a legal no-op. + * + * The memory pointed to by `mem` is no longer valid for access upon return, + * and may be returned to the system or reused by a future allocation. The + * pointer passed to this function is no longer safe to dereference once this + * function returns, and should be discarded. + *} +procedure SDL_SIMDFree(mem: Pointer); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SIMDFree' {$ENDIF} {$ENDIF}; + diff --git a/units/sdlerror.inc b/units/sdlerror.inc index 49a370fd..bde7ffcc 100644 --- a/units/sdlerror.inc +++ b/units/sdlerror.inc @@ -1,78 +1,102 @@ -// based on "sdl_error.h" (2.0.14) - -{** - * \file SDL_error.h - * - * Simple error message routines for SDL. - *} - -{* Public functions *} - - {** - * \brief Set the error message for the current thread - * - * \return -1, there is no error handling for this function - *} -function SDL_SetError(const fmt: PAnsiChar; args: array of const): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetError' {$ENDIF} {$ENDIF}; - -{** - * \brief Get the last error message that was set - * - * SDL API functions may set error messages and then succeed, so you should - * only use the error value if a function fails. - * - * This returns a pointer to a static buffer for convenience and should not - * be called by multiple threads simultaneously. - * - * \return a pointer to the last error message that was set - *} -function SDL_GetError: PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetError' {$ENDIF} {$ENDIF}; - -{** - * \brief Get the last error message that was set for the current thread - * - * SDL API functions may set error messages and then succeed, so you should - * only use the error value if a function fails. - * - * \param errstr A buffer to fill with the last error message that was set - * for the current thread - * \param maxlen The size of the buffer pointed to by the errstr parameter - * - * \return errstr - *} -function SDL_GetErrorMsg(const errstr: PAnsiChar; maxlen: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetErrorMsg' {$ENDIF} {$ENDIF}; - -{** - * \brief Clear the error message for the current thread - *} -procedure SDL_ClearError cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ClearError' {$ENDIF} {$ENDIF}; - -{*Internal error functions*} -{** - * Internal error functions - * - * Private error reporting function - used internally. - *} - { -#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)) - } - - -type - PPSDL_ErrorCode = ^PSDL_ErrorCode; - PSDL_ErrorCode = ^TSDL_ErrorCode; - TSDL_ErrorCode = (SDL_ENOMEM, - SDL_EFREAD, - SDL_EFWRITE, - SDL_EFSEEK, - SDL_UNSUPPORTED, - SDL_LASTERROR); - -{* SDL_Error() unconditionally returns -1. *} -function SDL_Error(code: TSDL_ErrorCode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Error' {$ENDIF} {$ENDIF}; +// based on "sdl_error.h" (2.0.14) + +{** + * \file SDL_error.h + * + * Simple error message routines for SDL. + *} + +{* Public functions *} + + {** + * \brief Set the error message for the current thread + * + * \return -1, there is no error handling for this function + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetError_fun = function(const fmt: PAnsiChar; args: array of const): cint; cdecl; +Var + SDL_SetError : TSDL_SetError_fun = Nil; +{$else} + +function SDL_SetError(const fmt: PAnsiChar; args: array of const): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetError' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Get the last error message that was set + * + * SDL API functions may set error messages and then succeed, so you should + * only use the error value if a function fails. + * + * This returns a pointer to a static buffer for convenience and should not + * be called by multiple threads simultaneously. + * + * \return a pointer to the last error message that was set + *} +function SDL_GetError: PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetError' {$ENDIF} {$ENDIF}; + +{** + * \brief Get the last error message that was set for the current thread + * + * SDL API functions may set error messages and then succeed, so you should + * only use the error value if a function fails. + * + * \param errstr A buffer to fill with the last error message that was set + * for the current thread + * \param maxlen The size of the buffer pointed to by the errstr parameter + * + * \return errstr + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetErrorMsg_fun = function(const errstr: PAnsiChar; maxlen: cint): PAnsiChar; cdecl; +Var + SDL_GetErrorMsg : TSDL_GetErrorMsg_fun = Nil; +{$else} + +function SDL_GetErrorMsg(const errstr: PAnsiChar; maxlen: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetErrorMsg' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Clear the error message for the current thread + *} +procedure SDL_ClearError cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ClearError' {$ENDIF} {$ENDIF}; + +{*Internal error functions*} +{** + * Internal error functions + * + * Private error reporting function - used internally. + *} + { +#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)) + } + + +type + PPSDL_ErrorCode = ^PSDL_ErrorCode; + PSDL_ErrorCode = ^TSDL_ErrorCode; + TSDL_ErrorCode = (SDL_ENOMEM, + SDL_EFREAD, + SDL_EFWRITE, + SDL_EFSEEK, + SDL_UNSUPPORTED, + SDL_LASTERROR); + +{* SDL_Error() unconditionally returns -1. *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_Error_fun = function(code: TSDL_ErrorCode): cint; cdecl; +Var + SDL_Error : TSDL_Error_fun = Nil; +{$else} + +function SDL_Error(code: TSDL_ErrorCode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Error' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlevents.inc b/units/sdlevents.inc index 5f4fe6d1..63174872 100644 --- a/units/sdlevents.inc +++ b/units/sdlevents.inc @@ -1,857 +1,857 @@ -//from "sdl_events.h" - -type - PPSDL_EventType = ^PSDL_EventType; - PSDL_EventType = ^TSDL_EventType; - TSDL_EventType = type cuint32; - - {** - * The types of events that can be delivered. - *} -const - - { General keyboard/mouse state definitions } - SDL_RELEASED = 0; - SDL_PRESSED = 1; - - SDL_FIRSTEVENT = TSDL_EventType(0); // Unused (do not remove) (needed in pascal?) - - SDL_COMMONEVENT = TSDL_EventType(1); //added for pascal-compatibility - - { Application events } - SDL_QUITEV = TSDL_EventType($100); // User-requested quit (originally SDL_QUIT, but changed, cause theres a method called SDL_QUIT) - - - { These application events have special meaning on iOS, see README.iOS for details *} - - {* The application is being terminated by the OS. * - * Called on iOS in applicationWillTerminate() * - * Called on Android in onDestroy() *} - SDL_APP_TERMINATING = TSDL_EventType($101); - - {* The application is low on memory, free memory if possible. * - * Called on iOS in applicationDidReceiveMemoryWarning() * - * Called on Android in onLowMemory() *} - SDL_APP_LOWMEMORY = TSDL_EventType($102); - - {* The application is about to enter the background. * - * Called on iOS in applicationWillResignActive() * - * Called on Android in onPause() *} - SDL_APP_WILLENTERBACKGROUND = TSDL_EventType($103); - - {* The application did enter the background and may not get CPU for some time. * - * Called on iOS in applicationDidEnterBackground() * - * Called on Android in onPause() *} - SDL_APP_DIDENTERBACKGROUND = TSDL_EventType($104); - - {* The application is about to enter the foreground. * - * Called on iOS in applicationWillEnterForeground() * - * Called on Android in onResume() *} - SDL_APP_WILLENTERFOREGROUND = TSDL_EventType($105); - - {* The application is now interactive. * - * Called on iOS in applicationDidBecomeActive() * - * Called on Android in onResume() *} - SDL_APP_DIDENTERFOREGROUND = TSDL_EventType($106); - - {* The user's locale preferences have changed. *} - SDL_LOCALECHANGED = TSDL_EventType($107); - - { Display events } - SDL_DISPLAYEVENT = TSDL_EventType($150); // Display state change - - { Window events } - SDL_WINDOWEVENT = TSDL_EventType($200); // Window state change - SDL_SYSWMEVENT = TSDL_EventType($201); // System specific event - - { Keyboard events } - SDL_KEYDOWN = TSDL_EventType($300); // Key pressed - SDL_KEYUP = TSDL_EventType($301); // Key released - SDL_TEXTEDITING = TSDL_EventType($302); // Keyboard text editing (composition) - SDL_TEXTINPUT = TSDL_EventType($303); // Keyboard text input - SDL_KEYMAPCHANGED = TSDL_EventType($304); // Keymap changed due to a system event such as an input language or keyboard layout change. - SDL_TEXTEDITING_EXT = TSDL_EventType($305); // Extended keyboard text editing (composition) - - { Mouse events } - SDL_MOUSEMOTION = TSDL_EventType($400); // Mouse moved - SDL_MOUSEBUTTONDOWN = TSDL_EventType($401); // Mouse button pressed - SDL_MOUSEBUTTONUP = TSDL_EventType($402); // Mouse button released - SDL_MOUSEWHEEL = TSDL_EventType($403); // Mouse wheel motion - - { Joystick events } - SDL_JOYAXISMOTION = TSDL_EventType($600); // Joystick axis motion - SDL_JOYBALLMOTION = TSDL_EventType($601); // Joystick trackball motion - SDL_JOYHATMOTION = TSDL_EventType($602); // Joystick hat position change - SDL_JOYBUTTONDOWN = TSDL_EventType($603); // Joystick button pressed - SDL_JOYBUTTONUP = TSDL_EventType($604); // Joystick button released - SDL_JOYDEVICEADDED = TSDL_EventType($605); // A new joystick has been inserted into the system - SDL_JOYDEVICEREMOVED = TSDL_EventType($606); // An opened joystick has been removed - SDL_JOYBATTERYUPDATED = TSDL_EventType($607); // Joystick battery level change - - { Game controller events } - SDL_CONTROLLERAXISMOTION = TSDL_EventType($650); // Game controller axis motion - SDL_CONTROLLERBUTTONDOWN = TSDL_EventType($651); // Game controller button pressed - SDL_CONTROLLERBUTTONUP = TSDL_EventType($652); // Game controller button released - SDL_CONTROLLERDEVICEADDED = TSDL_EventType($653); // A new Game controller has been inserted into the system - SDL_CONTROLLERDEVICEREMOVED = TSDL_EventType($654); // An opened Game controller has been removed - SDL_CONTROLLERDEVICEREMAPPED = TSDL_EventType($655); // The controller mapping was updated - SDL_CONTROLLERTOUCHPADDOWN = TSDL_EventType($666); // Game controller touchpad was touched - SDL_CONTROLLERTOUCHPADMOTION = TSDL_EventType($667); // Game controller touchpad finger was moved - SDL_CONTROLLERTOUCHPADUP = TSDL_EventType($668); // Game controller touchpad finger was lifted - SDL_CONTROLLERSENSORUPDATE = TSDL_EventType($669); // Game controller sensor was updated - - { Touch events } - SDL_FINGERDOWN = TSDL_EventType($700); - SDL_FINGERUP = TSDL_EventType($701); - SDL_FINGERMOTION = TSDL_EventType($702); - - { Gesture events } - SDL_DOLLARGESTURE = TSDL_EventType($800); - SDL_DOLLARRECORD = TSDL_EventType($801); - SDL_MULTIGESTURE = TSDL_EventType($802); - - { Clipboard events } - SDL_CLIPBOARDUPDATE = TSDL_EventType($900); // The clipboard changed - - { Drag and drop events } - SDL_DROPFILE = TSDL_EventType($1000); // The system requests a file open - SDL_DROPTEXT = TSDL_EventType($1001); // text/plain drag-and-drop event - SDL_DROPBEGIN = TSDL_EventType($1002); // A new set of drops is beginning (NULL filename) - SDL_DROPCOMPLETE = TSDL_EventType($1003); // Current set of drops is now complete (NULL filename) - - { Audio hotplug events } - SDL_AUDIODEVICEADDED = TSDL_EventType($1100); // A new audio device is available - SDL_AUDIODEVICEREMOVED = TSDL_EventType($1101); // An audio device has been removed. - - { Sensor events } - SDL_SENSORUPDATED = TSDL_EventType($1200); // A sensor was updated - - { Render events } - SDL_RENDER_TARGETS_RESET = TSDL_EventType($2000); // The render targets have been reset - SDL_RENDER_DEVICE_RESET = TSDL_EventType($2001); // The device has been reset and all textures need to be recreated - - { Internal events } - SDL_POLLSENTINEL = TSDL_EventType($7F00); // Signals the end of an event poll cycle - - {** Events SDL_USEREVENT through SDL_LASTEVENT are for your use, - * and should be allocated with SDL_RegisterEvents() - *} - SDL_USEREVENT = TSDL_EventType($8000); - - {** - * This last event is only for bounding internal arrays (needed in pascal ??) - *} - SDL_LASTEVENT = TSDL_EventType($FFFF); - -type - {** - * Fields shared by every event - *} - PPSDL_CommonEvent = ^PSDL_CommonEvent; - PSDL_CommonEvent = ^TSDL_CommonEvent; - TSDL_CommonEvent = record - type_: cuint32; - timestamp: cuint32; - end; - - {** - * Display state change event data (event.display.*) - *} - PPSDL_DisplayEvent = ^PSDL_DisplayEvent; - PSDL_DisplayEvent = ^TSDL_DisplayEvent; - TSDL_DisplayEvent = record - type_: cuint32; // SDL_DISPLAYEVENT - timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() - display: cuint32; // The associated display index - event: cuint8; // SDL_DisplayEventID - padding1: cuint8; - padding2: cuint8; - padding3: cuint8; - data1: cint32; // event dependent data - end; - - {** - * Window state change event data (event.window.*) - *} - PPSDL_WindowEvent = ^PSDL_WindowEvent; - PSDL_WindowEvent = ^TSDL_WindowEvent; - TSDL_WindowEvent = record - type_: cuint32; // SDL_WINDOWEVENT - timestamp: cuint32; - windowID: cuint32; // The associated window - event: cuint8; // SDL_WindowEventID - padding1: cuint8; - padding2: cuint8; - padding3: cuint8; - data1: cint32; // event dependent data - data2: cint32; // event dependent data - end; - - {** - * Keyboard button event structure (event.key.*) - *} - PPSDL_KeyboardEvent = ^PSDL_KeyboardEvent; - PSDL_KeyboardEvent = ^TSDL_KeyboardEvent; - TSDL_KeyboardEvent = record - type_: cuint32; // SDL_KEYDOWN or SDL_KEYUP - timestamp: cuint32; - windowID: cuint32; // The window with keyboard focus, if any - state: cuint8; // SDL_PRESSED or SDL_RELEASED - repeat_: cuint8; // Non-zero if this is a key repeat - padding2: cuint8; - padding3: cuint8; - keysym: TSDL_KeySym; // The key that was pressed or released - end; - -const - SDL_TEXTEDITINGEVENT_TEXT_SIZE = 32; - -type - {** - * Keyboard text editing event structure (event.edit.*) - *} - PPSDL_TextEditingEvent = ^PSDL_TextEditingEvent; - PSDL_TextEditingEvent = ^TSDL_TextEditingEvent; - TSDL_TextEditingEvent = record - type_: cuint32; // SDL_TEXTEDITING - timestamp: cuint32; - windowID: cuint32; // The window with keyboard focus, if any - text: array[0..SDL_TEXTEDITINGEVENT_TEXT_SIZE - 1] of Char; // The editing text - start: cint32; // The start cursor of selected editing text - length: cint32; // The length of selected editing text - end; - - {** - * Extended keyboard text editing event structure (event.editExt.*) when text would be - * truncated if stored in the text buffer SDL_TextEditingEvent - *} - PPSDL_TextEditingExtEvent = ^PSDL_TextEditingExtEvent; - PSDL_TextEditingExtEvent = ^TSDL_TextEditingExtEvent; - TSDL_TextEditingExtEvent = record - type_: cuint32; // SDL_TEXTEDITING_EXT - timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() - windowID: cuint32; // The window with keyboard focus, if any - text: PAnsiChar; // The editing text, which should be freed with SDL_free(), and will not be NIL - start: cint32; // The start cursor of selected editing text - length: cint32; // The length of selected editing text - end; - -const - SDL_TEXTINPUTEVENT_TEXT_SIZE = 32; - -type - - {** - * Keyboard text input event structure (event.text.*) - *} - PPSDL_TextInputEvent = ^PSDL_TextInputEvent; - PSDL_TextInputEvent = ^TSDL_TextInputEvent; - TSDL_TextInputEvent = record - type_: cuint32; // SDL_TEXTINPUT - timestamp: cuint32; - windowID: cuint32; // The window with keyboard focus, if any - text: array[0..SDL_TEXTINPUTEVENT_TEXT_SIZE - 1] of Char; // The input text - end; - - {** - * Mouse motion event structure (event.motion.*) - *} - PPSDL_MouseMotionEvent = ^PSDL_MouseMotionEvent; - PSDL_MouseMotionEvent = ^TSDL_MouseMotionEvent; - TSDL_MouseMotionEvent = record - type_: cuint32; // SDL_MOUSEMOTION - timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() - windowID: cuint32; // The window with mouse focus, if any - which: cuint32; // The mouse instance id, or SDL_TOUCH_MOUSEID - state: cuint32; // The current button state - x: cint32; // X coordinate, relative to window - y: cint32; // Y coordinate, relative to window - xrel: cint32; // The relative motion in the X direction - yrel: cint32; // The relative motion in the Y direction - end; - - {** - * Mouse button event structure (event.button.*) - *} - PPSDL_MouseButtonEvent = ^PSDL_MouseButtonEvent; - PSDL_MouseButtonEvent = ^TSDL_MouseButtonEvent; - TSDL_MouseButtonEvent = record - type_: cuint32; // SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP - timestamp: cuint32; - windowID: cuint32; // The window with mouse focus, if any - which: cuint32; // The mouse instance id, or SDL_TOUCH_MOUSEID - button: cuint8; // The mouse button index - state: cuint8; // SDL_PRESSED or SDL_RELEASED - clicks: cuint8; // 1 for single-click, 2 for double-click, etc. - padding1: cuint8; - x: cint32; // X coordinate, relative to window - y: cint32; // Y coordinate, relative to window - end; - - {** - * Mouse wheel event structure (event.wheel.*) - *} - PPSDL_MouseWheelEvent = ^PSDL_MouseWheelEvent; - PSDL_MouseWheelEvent = ^TSDL_MouseWheelEvent; - TSDL_MouseWheelEvent = record - type_: cuint32; // SDL_MOUSEWHEEL - timestamp: cuint32; - windowID: cuint32; // The window with mouse focus, if any - which: cuint32; // The mouse instance id, or SDL_TOUCH_MOUSEID - x: cint32; // The amount scrolled horizontally - y: cint32; // The amount scrolled vertically - direction: cuint32; // Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back - preciseX: cfloat; // The amount scrolled horizontally, positive to the right and negative to the left, with float precision (added in 2.0.18) - preciseY: cfloat; // The amount scrolled vertically, positive away from the user and negative toward the user, with float precision (added in 2.0.18) - mouseX: cint32; // X coordinate, relative to window (added in 2.26.0) - mouseY: cint32; // Y coordinate, relative to window (added in 2.26.0) - end; - - {** - * Joystick axis motion event structure (event.jaxis.*) - *} - PPSDL_JoyAxisEvent = ^PSDL_JoyAxisEvent; - PSDL_JoyAxisEvent = ^TSDL_JoyAxisEvent; - TSDL_JoyAxisEvent = record - type_: cuint32; // SDL_JOYAXISMOTION - timestamp: cuint32; - which: TSDL_JoystickID; // The joystick instance id - axis: cuint8; // The joystick axis index - padding1: cuint8; - padding2: cuint8; - padding3: cuint8; - value: cint16; // The axis value (range: -32768 to 32767) - padding4: cuint16; - end; - - {** - * Joystick trackball motion event structure (event.jball.*) - *} - PPSDL_JoyBallEvent = ^PSDL_JoyBallEvent; - PSDL_JoyBallEvent = ^TSDL_JoyBallEvent; - TSDL_JoyBallEvent = record - type_: cuint32; // SDL_JOYBALLMOTION - timestamp: cuint32; - which: TSDL_JoystickID; // The joystick instance id - ball: cuint8; // The joystick trackball index - padding1: cuint8; - padding2: cuint8; - padding3: cuint8; - xrel: cint16; // The relative motion in the X direction - yrel: cint16; // The relative motion in the Y direction - end; - - {** - * Joystick hat position change event structure (event.jhat.*) - *} - PPSDL_JoyHatEvent = ^PSDL_JoyHatEvent; - PSDL_JoyHatEvent = ^TSDL_JoyHatEvent; - TSDL_JoyHatEvent = record - type_: cuint32; // SDL_JOYHATMOTION - timestamp: cuint32; - which: TSDL_JoystickID; // The joystick instance id - hat: cuint8; // The joystick hat index - value: cuint8; {* The hat position value. - * SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP - * SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT - * SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN - * - * Note that zero means the POV is centered. - *} - padding1: cuint8; - padding2: cuint8; - end; - - {** - * Joystick button event structure (event.jbutton.*) - *} - PPSDL_JoyButtonEvent = ^PSDL_JoyButtonEvent; - PSDL_JoyButtonEvent = ^TSDL_JoyButtonEvent; - TSDL_JoyButtonEvent = record - type_: cuint32; // SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP - timestamp: cuint32; - which: TSDL_JoystickID; // The joystick instance id - button: cuint8; // The joystick button index - state: cuint8; // SDL_PRESSED or SDL_RELEASED - padding1: cuint8; - padding2: cuint8; - end; - - {** - * Joystick device event structure (event.jdevice.*) - *} - PPSDL_JoyDeviceEvent = ^PSDL_JoyDeviceEvent; - PSDL_JoyDeviceEvent = ^TSDL_JoyDeviceEvent; - TSDL_JoyDeviceEvent = record - type_: cuint32; // SDL_JOYDEVICEADDED or SDL_JOYDEVICEREMOVED - timestamp: cuint32; - which: cint32; // The joystick device index for the ADDED event, instance id for the REMOVED event - end; - - {** - * Joysick battery level change event structure (event.jbattery.*) - *} - PPSDL_JoyBatteryEvent = ^PSDL_JoyBatteryEvent; - PSDL_JoyBatteryEvent = ^TSDL_JoyBatteryEvent; - TSDL_JoyBatteryEvent = record - type_: cuint32; // SDL_JOYBATTERYUPDATED - timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() - which: TSDL_JoystickID; // The joystick instance id - level: TSDL_JoystickPowerLevel; // The joystick battery level - end; - - {** - * Game controller axis motion event structure (event.caxis.*) - *} - PPSDL_ControllerAxisEvent = ^PSDL_ControllerAxisEvent; - PSDL_ControllerAxisEvent = ^TSDL_ControllerAxisEvent; - TSDL_ControllerAxisEvent = record - type_: cuint32; // SDL_CONTROLLERAXISMOTION - timestamp: cuint32; - which: TSDL_JoystickID; // The joystick instance id - axis: cuint8; // The controller axis (SDL_GameControllerAxis) - padding1: cuint8; - padding2: cuint8; - padding3: cuint8; - value: cint16; // The axis value (range: -32768 to 32767) - padding4: cuint16; - end; - - {** - * Game controller button event structure (event.cbutton.*) - *} - PPSDL_ControllerButtonEvent = ^PSDL_ControllerButtonEvent; - PSDL_ControllerButtonEvent = ^TSDL_ControllerButtonEvent; - TSDL_ControllerButtonEvent = record - type_: cuint32; // SDL_CONTROLLERBUTTONDOWN or SDL_CONTROLLERBUTTONUP - timestamp: cuint32; - which: TSDL_JoystickID; // The joystick instance id - button: cuint8; // The controller button (SDL_GameControllerButton) - state: cuint8; // SDL_PRESSED or SDL_RELEASED - padding1: cuint8; - padding2: cuint8; - end; - - - {** - * Controller device event structure (event.cdevice.*) - *} - PPSDL_ControllerDeviceEvent = ^PSDL_ControllerDeviceEvent; - PSDL_ControllerDeviceEvent = ^TSDL_ControllerDeviceEvent; - TSDL_ControllerDeviceEvent = record - type_: cuint32; // SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEREMOVED, or SDL_CONTROLLERDEVICEREMAPPED - timestamp: cuint32; - which: cint32; // The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event - end; - - {** - * Game controller touchpad event structure (event.ctouchpad.*) - *} - PPSDL_ControllerTouchpadEvent = ^PSDL_ControllerTouchpadEvent; - PSDL_ControllerTouchpadEvent = ^TSDL_ControllerTouchpadEvent; - TSDL_ControllerTouchpadEvent = record - type_: cuint32; // SDL_CONTROLLERTOUCHPADDOWN or SDL_CONTROLLERTOUCHPADMOTION or SDL_CONTROLLERTOUCHPADUP - timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() - which: TSDL_JoystickID; // The joystick instance id - touchpad: cint32; // The index of the touchpad - finger: cint32; // The index of the finger on the touchpad - x: cfloat; // Normalized in the range 0...1 with 0 being on the left - y: cfloat; // Normalized in the range 0...1 with 0 being at the top - pressure: cfloat; // Normalized in the range 0...1 - end; - - {** - * Game controller sensor event structure (event.csensor.*) - *} - PPSDL_ControllerSensorEvent = ^PSDL_ControllerSensorEvent; - PSDL_ControllerSensorEvent = ^TSDL_ControllerSensorEvent; - TSDL_ControllerSensorEvent = record - type_: cuint32; // SDL_CONTROLLERSENSORUPDATE - timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() - which: TSDL_JoystickID; // The joystick instance id - sensor: cint32; // The type of the sensor, one of the values of SDL_SensorType - data: array[0..2] of cfloat; // Up to 3 values from the sensor, as defined in SDL_sensor.h - end; - - {** - * Audio device event structure (event.adevice.*) - *} - PPSDL_AudioDeviceEvent = ^PSDL_AudioDeviceEvent; - PSDL_AudioDeviceEvent = ^TSDL_AudioDeviceEvent; - TSDL_AudioDeviceEvent = record - type_: cuint32; // ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED - timestamp: cuint32; - which: cuint32; // The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event - iscapture: cuint8; // zero if an output device, non-zero if a capture device. - padding1: cuint8; - padding2: cuint8; - padding3: cuint8; - end; - - - {** - * Touch finger event structure (event.tfinger.*) - *} - PPSDL_TouchFingerEvent = ^PSDL_TouchFingerEvent; - PSDL_TouchFingerEvent = ^TSDL_TouchFingerEvent; - TSDL_TouchFingerEvent = record - type_: cuint32; // SDL_FINGERMOTION or SDL_FINGERDOWN or SDL_FINGERUP - timestamp: cuint32; - touchId: TSDL_TouchID; // The touch device id - fingerId: TSDL_FingerID; - x: cfloat; // Normalized in the range 0...1 - y: cfloat; // Normalized in the range 0...1 - dx: cfloat; // Normalized in the range 0...1 - dy: cfloat; // Normalized in the range 0...1 - pressure: cfloat; // Normalized in the range 0...1 - window: cuint32; // The window underneath the finger, if any - end; - - {** - * Multiple Finger Gesture Event (event.mgesture.*) - *} - PPSDL_MultiGestureEvent = ^PSDL_MultiGestureEvent; - PSDL_MultiGestureEvent = ^TSDL_MultiGestureEvent; - TSDL_MultiGestureEvent = record - type_: cuint32; // SDL_MULTIGESTURE - timestamp: cuint32; - touchId: TSDL_TouchID; // The touch device index - dTheta: cfloat; - dDist: cfloat; - x: cfloat; - y: cfloat; - numFingers: cuint16; - padding: cuint16; - end; - - - {* (event.dgesture.*) *} - PPSDL_DollarGestureEvent = ^PSDL_DollarGestureEvent; - PSDL_DollarGestureEvent = ^TSDL_DollarGestureEvent; - TSDL_DollarGestureEvent = record - type_: cuint32; // SDL_DOLLARGESTURE - timestamp: cuint32; - touchId: TSDL_TouchID; // The touch device id - gestureId: TSDL_GestureID; - numFingers: cuint32; - error: cfloat; - x: cfloat; // Normalized center of gesture - y: cfloat; // Normalized center of gesture - end; - - - {** - * An event used to request a file open by the system (event.drop.*) - * This event is disabled by default, you can enable it with SDL_EventState() - * If you enable this event, you must free the filename in the event. - *} - PPSDL_DropEvent = ^PSDL_DropEvent; - PSDL_DropEvent = ^TSDL_DropEvent; - TSDL_DropEvent = record - type_: cuint32; // SDL_DROPBEGIN or SDL_DROPFILE or SDL_DROPTEXT or SDL_DROPCOMPLETE - timestamp: cuint32; - file_: PAnsiChar; // The file name, which should be freed with SDL_free(), is NIL on begin/complete - windowID: cuint32; // The window that was dropped on, if any - end; - - {** - * Sensor event structure (event.sensor.*) - *} - PPSDL_SensorEvent = ^PSDL_SensorEvent; - PSDL_SensorEvent = ^TSDL_SensorEvent; - TSDL_SensorEvent = record - type_: cuint32; // SDL_SENSORUPDATED - timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() - which: cint32; // The instance ID of the sensor - data: array[0..5] of cfloat; // Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() - end; - - {** - * The "quit requested" event - *} - PPSDL_QuitEvent = ^PSDL_QuitEvent; - PSDL_QuitEvent = ^TSDL_QuitEvent; - TSDL_QuitEvent = record - type_: cuint32; // SDL_QUIT - timestamp: cuint32; - end; - - {** - * A user-defined event type (event.user.*) - *} - PPSDL_UserEvent = ^PSDL_UserEvent; - PSDL_UserEvent = ^TSDL_UserEvent; - TSDL_UserEvent = record - type_: cuint32; // SDL_USEREVENT through SDL_NUMEVENTS-1 - timestamp: cuint32; - windowID: cuint32; // The associated window if any - code: cint32; // User defined event code - data1: Pointer; // User defined data pointer - data2: Pointer; // User defined data pointer - end; - - {** - * A video driver dependent system event (event.syswm.*) - * This event is disabled by default, you can enable it with SDL_EventState() - * - * If you want to use this event, you should include SDL_syswm.h. - *} - PPSDL_SysWMEvent = ^PSDL_SysWMEvent; - PSDL_SysWMEvent = ^TSDL_SysWMEvent; - TSDL_SysWMEvent = record - type_: cuint32; // SDL_SYSWMEVENT - timestamp: cuint32; - msg: PSDL_SysWMmsg; // driver dependent data (defined in SDL_syswm.h) - end; - - {** - * General event structure - *} - PPSDL_Event = ^PSDL_Event; - PSDL_Event = ^TSDL_Event; - TSDL_Event = record - case cint of - 0: (type_: cuint32); - - SDL_COMMONEVENT: (common: TSDL_CommonEvent); - SDL_DISPLAYEVENT: (display: TSDL_DisplayEvent); - SDL_WINDOWEVENT: (window: TSDL_WindowEvent); - - SDL_KEYUP, - SDL_KEYDOWN: (key: TSDL_KeyboardEvent); - SDL_TEXTEDITING: (edit: TSDL_TextEditingEvent); - SDL_TEXTEDITING_EXT: (exitExt: TSDL_TextEditingExtEvent); - SDL_TEXTINPUT: (text: TSDL_TextInputEvent); - - SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent); - SDL_MOUSEBUTTONUP, - SDL_MOUSEBUTTONDOWN: (button: TSDL_MouseButtonEvent); - SDL_MOUSEWHEEL: (wheel: TSDL_MouseWheelEvent); - - SDL_JOYAXISMOTION: (jaxis: TSDL_JoyAxisEvent); - SDL_JOYBALLMOTION: (jball: TSDL_JoyBallEvent); - SDL_JOYHATMOTION: (jhat: TSDL_JoyHatEvent); - SDL_JOYBUTTONDOWN, - SDL_JOYBUTTONUP: (jbutton: TSDL_JoyButtonEvent); - SDL_JOYDEVICEADDED, - SDL_JOYDEVICEREMOVED: (jdevice: TSDL_JoyDeviceEvent); - SDL_JOYBATTERYUPDATED: (jbattery: TSDL_JoyBatteryEvent); - - SDL_CONTROLLERAXISMOTION: (caxis: TSDL_ControllerAxisEvent); - SDL_CONTROLLERBUTTONUP, - SDL_CONTROLLERBUTTONDOWN: (cbutton: TSDL_ControllerButtonEvent); - SDL_CONTROLLERDEVICEADDED, - SDL_CONTROLLERDEVICEREMOVED, - SDL_CONTROLLERDEVICEREMAPPED: (cdevice: TSDL_ControllerDeviceEvent); - SDL_CONTROLLERTOUCHPADDOWN, - SDL_CONTROLLERTOUCHPADMOTION, - SDL_CONTROLLERTOUCHPADUP: (ctouchpad: TSDL_ControllerTouchpadEvent); - SDL_CONTROLLERSENSORUPDATE: (csensor: TSDL_ControllerSensorEvent); - - SDL_AUDIODEVICEADDED, - SDL_AUDIODEVICEREMOVED: (adevice: TSDL_AudioDeviceEvent); - - SDL_SENSORUPDATED: (sensor: TSDL_SensorEvent); - - SDL_QUITEV: (quit: TSDL_QuitEvent); - - SDL_USEREVENT: (user: TSDL_UserEvent); - SDL_SYSWMEVENT: (syswm: TSDL_SysWMEvent); - - SDL_FINGERDOWN, - SDL_FINGERUP, - SDL_FINGERMOTION: (tfinger: TSDL_TouchFingerEvent); - SDL_MULTIGESTURE: (mgesture: TSDL_MultiGestureEvent); - SDL_DOLLARGESTURE,SDL_DOLLARRECORD: (dgesture: TSDL_DollarGestureEvent); - - SDL_DROPFILE: (drop: TSDL_DropEvent); - end; - - - {* Function prototypes *} - - {** - * Pumps the event loop, gathering events from the input devices. - * - * This function updates the event queue and internal input device state. - * - * This should only be run in the thread that sets the video mode. - *} - procedure SDL_PumpEvents cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PumpEvents' {$ENDIF} {$ENDIF}; - -const - SDL_ADDEVENT = 0; - SDL_PEEKEVENT = 1; - SDL_GETEVENT = 2; - -type - PPSDL_EventAction = ^PSDL_EventAction; - PSDL_EventAction = ^TSDL_EventAction; - TSDL_EventAction = Word; - - {** - * Checks the event queue for messages and optionally returns them. - * - * If action is SDL_ADDEVENT, up to numevents events will be added to - * the back of the event queue. - * - * If action is SDL_PEEKEVENT, up to numevents events at the front - * of the event queue, within the specified minimum and maximum type, - * will be returned and will not be removed from the queue. - * - * If action is SDL_GETEVENT, up to numevents events at the front - * of the event queue, within the specified minimum and maximum type, - * will be returned and will be removed from the queue. - * - * Result: The number of events actually stored, or -1 if there was an error. - * - * This function is thread-safe. - *} - - function SDL_PeepEvents(events: PSDL_Event; numevents: cint32; action: TSDL_EventAction; minType, maxType: TSDL_EventType): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PeepEvents' {$ENDIF} {$ENDIF}; - - {** - * Checks to see if certain event types are in the event queue. - *} - - function SDL_HasEvent(type_: TSDL_EventType): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasEvent' {$ENDIF} {$ENDIF}; - function SDL_HasEvents(minType, maxType: TSDL_EventType): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasEvents' {$ENDIF} {$ENDIF}; - - {** - * This function clears events from the event queue - *} - - procedure SDL_FlushEvent(type_: TSDL_EventType) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FlushEvent' {$ENDIF} {$ENDIF}; - procedure SDL_FlushEvents(minType, maxType: TSDL_EventType) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FlushEvents' {$ENDIF} {$ENDIF}; - - {** - * Polls for currently pending events. - * - * 1 if there are any pending events, or 0 if there are none available. - * - * event - If not nil, the next event is removed from the queue and - * stored in that area. - *} - - function SDL_PollEvent(event: PSDL_Event): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PollEvent' {$ENDIF} {$ENDIF}; - - {** - * Waits indefinitely for the next available event. - * - * 1, or 0 if there was an error while waiting for events. - * - * event - If not nil, the next event is removed from the queue and - * stored in that area. - *} - - function SDL_WaitEvent(event: PSDL_Event): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WaitEvent' {$ENDIF} {$ENDIF}; - - {** - * Waits until the specified timeout (in milliseconds) for the next - * available event. - * - * 1, or 0 if there was an error while waiting for events. - * - * event - If not nil, the next event is removed from the queue and - * stored in that area. - *} - - function SDL_WaitEventTimeout(event: PSDL_Event; timeout: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WaitEventTimeout' {$ENDIF} {$ENDIF}; - - {** - * Add an event to the event queue. - * - * 1 on success, 0 if the event was filtered, or -1 if the event queue - * was full or there was some other error. - *} - - function SDL_PushEvent(event: PSDL_Event): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PumpEvents' {$ENDIF} {$ENDIF}; - -type - PPSDL_EventFilter = ^PSDL_EventFilter; - PSDL_EventFilter = ^TSDL_EventFilter; - {$IFNDEF GPC} - TSDL_EventFilter = function(userdata: Pointer; event: PSDL_Event): cint; cdecl; - {$ELSE} - TSDL_EventFilter = function( userdata: Pointer; event: PSDL_Event ): cint; - {$ENDIF} - - {** - * Sets up a filter to process all events before they change internal state and - * are posted to the internal event queue. - * - * If the filter returns 1, then the event will be added to the internal queue. - * If it returns 0, then the event will be dropped from the queue, but the - * internal state will still be updated. This allows selective filtering of - * dynamically arriving events. - * - * Be very careful of what you do in the event filter function, as - * it may run in a different thread! - * - * There is one caveat when dealing with the SDL_QUITEVENT event type. The - * event filter is only called when the window manager desires to close the - * application window. If the event filter returns 1, then the window will - * be closed, otherwise the window will remain open if possible. - * - * If the quit event is generated by an interrupt signal, it will bypass the - * internal queue and be delivered to the application at the next event poll. - *} - - procedure SDL_SetEventFilter(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetEventFilter' {$ENDIF} {$ENDIF}; - - {** - * Return the current event filter - can be used to "chain" filters. - * If there is no event filter set, this function returns SDL_FALSE. - *} - - function SDL_GetEventFilter(var filter: PSDL_EventFilter; var userdata: PPointer): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetEventFilter' {$ENDIF} {$ENDIF}; - - {** - * Add a function which is called when an event is added to the queue. - *} - - procedure SDL_AddEventWatch(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AddEventWatch' {$ENDIF} {$ENDIF}; - - {** - * Remove an event watch function added with SDL_AddEventWatch() - *} - - procedure SDL_DelEventWatch(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DelEventWatch' {$ENDIF} {$ENDIF}; - - {** - * Run the filter function on the current event queue, removing any - * events for which the filter returns 0. - *} - - procedure SDL_FilterEvents(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FilterEvents' {$ENDIF} {$ENDIF}; - -const - - SDL_QUERY = -1; - SDL_IGNORE = 0; - SDL_DISABLE = 0; - SDL_ENABLE = 1; - - {** - * This function allows you to set the state of processing certain events. - * - If state is set to SDL_IGNORE, that event will be automatically - * dropped from the event queue and will not event be filtered. - * - If state is set to SDL_ENABLE, that event will be processed - * normally. - * - If state is set to SDL_QUERY, SDL_EventState() will return the - * current processing state of the specified event. - *} - - function SDL_EventState(type_: TSDL_EventType; state: cint32): cuint8 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EventState' {$ENDIF} {$ENDIF}; - - function SDL_GetEventState(type_: TSDL_EventType): cuint8; - - {** - * This function allocates a set of user-defined events, and returns - * the beginning event number for that set of events. - * - * If there aren't enough user-defined events left, this function - * returns (Uint32)-1 - *} - - function SDL_RegisterEvents(numevents: cint32): cuint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RegisterEvents' {$ENDIF} {$ENDIF}; +//from "sdl_events.h" + +type + PPSDL_EventType = ^PSDL_EventType; + PSDL_EventType = ^TSDL_EventType; + TSDL_EventType = type cuint32; + + {** + * The types of events that can be delivered. + *} +const + + { General keyboard/mouse state definitions } + SDL_RELEASED = 0; + SDL_PRESSED = 1; + + SDL_FIRSTEVENT = TSDL_EventType(0); // Unused (do not remove) (needed in pascal?) + + SDL_COMMONEVENT = TSDL_EventType(1); //added for pascal-compatibility + + { Application events } + SDL_QUITEV = TSDL_EventType($100); // User-requested quit (originally SDL_QUIT, but changed, cause theres a method called SDL_QUIT) + + + { These application events have special meaning on iOS, see README.iOS for details *} + + {* The application is being terminated by the OS. * + * Called on iOS in applicationWillTerminate() * + * Called on Android in onDestroy() *} + SDL_APP_TERMINATING = TSDL_EventType($101); + + {* The application is low on memory, free memory if possible. * + * Called on iOS in applicationDidReceiveMemoryWarning() * + * Called on Android in onLowMemory() *} + SDL_APP_LOWMEMORY = TSDL_EventType($102); + + {* The application is about to enter the background. * + * Called on iOS in applicationWillResignActive() * + * Called on Android in onPause() *} + SDL_APP_WILLENTERBACKGROUND = TSDL_EventType($103); + + {* The application did enter the background and may not get CPU for some time. * + * Called on iOS in applicationDidEnterBackground() * + * Called on Android in onPause() *} + SDL_APP_DIDENTERBACKGROUND = TSDL_EventType($104); + + {* The application is about to enter the foreground. * + * Called on iOS in applicationWillEnterForeground() * + * Called on Android in onResume() *} + SDL_APP_WILLENTERFOREGROUND = TSDL_EventType($105); + + {* The application is now interactive. * + * Called on iOS in applicationDidBecomeActive() * + * Called on Android in onResume() *} + SDL_APP_DIDENTERFOREGROUND = TSDL_EventType($106); + + {* The user's locale preferences have changed. *} + SDL_LOCALECHANGED = TSDL_EventType($107); + + { Display events } + SDL_DISPLAYEVENT = TSDL_EventType($150); // Display state change + + { Window events } + SDL_WINDOWEVENT = TSDL_EventType($200); // Window state change + SDL_SYSWMEVENT = TSDL_EventType($201); // System specific event + + { Keyboard events } + SDL_KEYDOWN = TSDL_EventType($300); // Key pressed + SDL_KEYUP = TSDL_EventType($301); // Key released + SDL_TEXTEDITING = TSDL_EventType($302); // Keyboard text editing (composition) + SDL_TEXTINPUT = TSDL_EventType($303); // Keyboard text input + SDL_KEYMAPCHANGED = TSDL_EventType($304); // Keymap changed due to a system event such as an input language or keyboard layout change. + SDL_TEXTEDITING_EXT = TSDL_EventType($305); // Extended keyboard text editing (composition) + + { Mouse events } + SDL_MOUSEMOTION = TSDL_EventType($400); // Mouse moved + SDL_MOUSEBUTTONDOWN = TSDL_EventType($401); // Mouse button pressed + SDL_MOUSEBUTTONUP = TSDL_EventType($402); // Mouse button released + SDL_MOUSEWHEEL = TSDL_EventType($403); // Mouse wheel motion + + { Joystick events } + SDL_JOYAXISMOTION = TSDL_EventType($600); // Joystick axis motion + SDL_JOYBALLMOTION = TSDL_EventType($601); // Joystick trackball motion + SDL_JOYHATMOTION = TSDL_EventType($602); // Joystick hat position change + SDL_JOYBUTTONDOWN = TSDL_EventType($603); // Joystick button pressed + SDL_JOYBUTTONUP = TSDL_EventType($604); // Joystick button released + SDL_JOYDEVICEADDED = TSDL_EventType($605); // A new joystick has been inserted into the system + SDL_JOYDEVICEREMOVED = TSDL_EventType($606); // An opened joystick has been removed + SDL_JOYBATTERYUPDATED = TSDL_EventType($607); // Joystick battery level change + + { Game controller events } + SDL_CONTROLLERAXISMOTION = TSDL_EventType($650); // Game controller axis motion + SDL_CONTROLLERBUTTONDOWN = TSDL_EventType($651); // Game controller button pressed + SDL_CONTROLLERBUTTONUP = TSDL_EventType($652); // Game controller button released + SDL_CONTROLLERDEVICEADDED = TSDL_EventType($653); // A new Game controller has been inserted into the system + SDL_CONTROLLERDEVICEREMOVED = TSDL_EventType($654); // An opened Game controller has been removed + SDL_CONTROLLERDEVICEREMAPPED = TSDL_EventType($655); // The controller mapping was updated + SDL_CONTROLLERTOUCHPADDOWN = TSDL_EventType($666); // Game controller touchpad was touched + SDL_CONTROLLERTOUCHPADMOTION = TSDL_EventType($667); // Game controller touchpad finger was moved + SDL_CONTROLLERTOUCHPADUP = TSDL_EventType($668); // Game controller touchpad finger was lifted + SDL_CONTROLLERSENSORUPDATE = TSDL_EventType($669); // Game controller sensor was updated + + { Touch events } + SDL_FINGERDOWN = TSDL_EventType($700); + SDL_FINGERUP = TSDL_EventType($701); + SDL_FINGERMOTION = TSDL_EventType($702); + + { Gesture events } + SDL_DOLLARGESTURE = TSDL_EventType($800); + SDL_DOLLARRECORD = TSDL_EventType($801); + SDL_MULTIGESTURE = TSDL_EventType($802); + + { Clipboard events } + SDL_CLIPBOARDUPDATE = TSDL_EventType($900); // The clipboard changed + + { Drag and drop events } + SDL_DROPFILE = TSDL_EventType($1000); // The system requests a file open + SDL_DROPTEXT = TSDL_EventType($1001); // text/plain drag-and-drop event + SDL_DROPBEGIN = TSDL_EventType($1002); // A new set of drops is beginning (NULL filename) + SDL_DROPCOMPLETE = TSDL_EventType($1003); // Current set of drops is now complete (NULL filename) + + { Audio hotplug events } + SDL_AUDIODEVICEADDED = TSDL_EventType($1100); // A new audio device is available + SDL_AUDIODEVICEREMOVED = TSDL_EventType($1101); // An audio device has been removed. + + { Sensor events } + SDL_SENSORUPDATED = TSDL_EventType($1200); // A sensor was updated + + { Render events } + SDL_RENDER_TARGETS_RESET = TSDL_EventType($2000); // The render targets have been reset + SDL_RENDER_DEVICE_RESET = TSDL_EventType($2001); // The device has been reset and all textures need to be recreated + + { Internal events } + SDL_POLLSENTINEL = TSDL_EventType($7F00); // Signals the end of an event poll cycle + + {** Events SDL_USEREVENT through SDL_LASTEVENT are for your use, + * and should be allocated with SDL_RegisterEvents() + *} + SDL_USEREVENT = TSDL_EventType($8000); + + {** + * This last event is only for bounding internal arrays (needed in pascal ??) + *} + SDL_LASTEVENT = TSDL_EventType($FFFF); + +type + {** + * Fields shared by every event + *} + PPSDL_CommonEvent = ^PSDL_CommonEvent; + PSDL_CommonEvent = ^TSDL_CommonEvent; + TSDL_CommonEvent = record + type_: cuint32; + timestamp: cuint32; + end; + + {** + * Display state change event data (event.display.*) + *} + PPSDL_DisplayEvent = ^PSDL_DisplayEvent; + PSDL_DisplayEvent = ^TSDL_DisplayEvent; + TSDL_DisplayEvent = record + type_: cuint32; // SDL_DISPLAYEVENT + timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() + display: cuint32; // The associated display index + event: cuint8; // SDL_DisplayEventID + padding1: cuint8; + padding2: cuint8; + padding3: cuint8; + data1: cint32; // event dependent data + end; + + {** + * Window state change event data (event.window.*) + *} + PPSDL_WindowEvent = ^PSDL_WindowEvent; + PSDL_WindowEvent = ^TSDL_WindowEvent; + TSDL_WindowEvent = record + type_: cuint32; // SDL_WINDOWEVENT + timestamp: cuint32; + windowID: cuint32; // The associated window + event: cuint8; // SDL_WindowEventID + padding1: cuint8; + padding2: cuint8; + padding3: cuint8; + data1: cint32; // event dependent data + data2: cint32; // event dependent data + end; + + {** + * Keyboard button event structure (event.key.*) + *} + PPSDL_KeyboardEvent = ^PSDL_KeyboardEvent; + PSDL_KeyboardEvent = ^TSDL_KeyboardEvent; + TSDL_KeyboardEvent = record + type_: cuint32; // SDL_KEYDOWN or SDL_KEYUP + timestamp: cuint32; + windowID: cuint32; // The window with keyboard focus, if any + state: cuint8; // SDL_PRESSED or SDL_RELEASED + repeat_: cuint8; // Non-zero if this is a key repeat + padding2: cuint8; + padding3: cuint8; + keysym: TSDL_KeySym; // The key that was pressed or released + end; + +const + SDL_TEXTEDITINGEVENT_TEXT_SIZE = 32; + +type + {** + * Keyboard text editing event structure (event.edit.*) + *} + PPSDL_TextEditingEvent = ^PSDL_TextEditingEvent; + PSDL_TextEditingEvent = ^TSDL_TextEditingEvent; + TSDL_TextEditingEvent = record + type_: cuint32; // SDL_TEXTEDITING + timestamp: cuint32; + windowID: cuint32; // The window with keyboard focus, if any + text: array[0..SDL_TEXTEDITINGEVENT_TEXT_SIZE - 1] of Char; // The editing text + start: cint32; // The start cursor of selected editing text + length: cint32; // The length of selected editing text + end; + + {** + * Extended keyboard text editing event structure (event.editExt.*) when text would be + * truncated if stored in the text buffer SDL_TextEditingEvent + *} + PPSDL_TextEditingExtEvent = ^PSDL_TextEditingExtEvent; + PSDL_TextEditingExtEvent = ^TSDL_TextEditingExtEvent; + TSDL_TextEditingExtEvent = record + type_: cuint32; // SDL_TEXTEDITING_EXT + timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() + windowID: cuint32; // The window with keyboard focus, if any + text: PAnsiChar; // The editing text, which should be freed with SDL_free(), and will not be NIL + start: cint32; // The start cursor of selected editing text + length: cint32; // The length of selected editing text + end; + +const + SDL_TEXTINPUTEVENT_TEXT_SIZE = 32; + +type + + {** + * Keyboard text input event structure (event.text.*) + *} + PPSDL_TextInputEvent = ^PSDL_TextInputEvent; + PSDL_TextInputEvent = ^TSDL_TextInputEvent; + TSDL_TextInputEvent = record + type_: cuint32; // SDL_TEXTINPUT + timestamp: cuint32; + windowID: cuint32; // The window with keyboard focus, if any + text: array[0..SDL_TEXTINPUTEVENT_TEXT_SIZE - 1] of Char; // The input text + end; + + {** + * Mouse motion event structure (event.motion.*) + *} + PPSDL_MouseMotionEvent = ^PSDL_MouseMotionEvent; + PSDL_MouseMotionEvent = ^TSDL_MouseMotionEvent; + TSDL_MouseMotionEvent = record + type_: cuint32; // SDL_MOUSEMOTION + timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() + windowID: cuint32; // The window with mouse focus, if any + which: cuint32; // The mouse instance id, or SDL_TOUCH_MOUSEID + state: cuint32; // The current button state + x: cint32; // X coordinate, relative to window + y: cint32; // Y coordinate, relative to window + xrel: cint32; // The relative motion in the X direction + yrel: cint32; // The relative motion in the Y direction + end; + + {** + * Mouse button event structure (event.button.*) + *} + PPSDL_MouseButtonEvent = ^PSDL_MouseButtonEvent; + PSDL_MouseButtonEvent = ^TSDL_MouseButtonEvent; + TSDL_MouseButtonEvent = record + type_: cuint32; // SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP + timestamp: cuint32; + windowID: cuint32; // The window with mouse focus, if any + which: cuint32; // The mouse instance id, or SDL_TOUCH_MOUSEID + button: cuint8; // The mouse button index + state: cuint8; // SDL_PRESSED or SDL_RELEASED + clicks: cuint8; // 1 for single-click, 2 for double-click, etc. + padding1: cuint8; + x: cint32; // X coordinate, relative to window + y: cint32; // Y coordinate, relative to window + end; + + {** + * Mouse wheel event structure (event.wheel.*) + *} + PPSDL_MouseWheelEvent = ^PSDL_MouseWheelEvent; + PSDL_MouseWheelEvent = ^TSDL_MouseWheelEvent; + TSDL_MouseWheelEvent = record + type_: cuint32; // SDL_MOUSEWHEEL + timestamp: cuint32; + windowID: cuint32; // The window with mouse focus, if any + which: cuint32; // The mouse instance id, or SDL_TOUCH_MOUSEID + x: cint32; // The amount scrolled horizontally + y: cint32; // The amount scrolled vertically + direction: cuint32; // Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back + preciseX: cfloat; // The amount scrolled horizontally, positive to the right and negative to the left, with float precision (added in 2.0.18) + preciseY: cfloat; // The amount scrolled vertically, positive away from the user and negative toward the user, with float precision (added in 2.0.18) + mouseX: cint32; // X coordinate, relative to window (added in 2.26.0) + mouseY: cint32; // Y coordinate, relative to window (added in 2.26.0) + end; + + {** + * Joystick axis motion event structure (event.jaxis.*) + *} + PPSDL_JoyAxisEvent = ^PSDL_JoyAxisEvent; + PSDL_JoyAxisEvent = ^TSDL_JoyAxisEvent; + TSDL_JoyAxisEvent = record + type_: cuint32; // SDL_JOYAXISMOTION + timestamp: cuint32; + which: TSDL_JoystickID; // The joystick instance id + axis: cuint8; // The joystick axis index + padding1: cuint8; + padding2: cuint8; + padding3: cuint8; + value: cint16; // The axis value (range: -32768 to 32767) + padding4: cuint16; + end; + + {** + * Joystick trackball motion event structure (event.jball.*) + *} + PPSDL_JoyBallEvent = ^PSDL_JoyBallEvent; + PSDL_JoyBallEvent = ^TSDL_JoyBallEvent; + TSDL_JoyBallEvent = record + type_: cuint32; // SDL_JOYBALLMOTION + timestamp: cuint32; + which: TSDL_JoystickID; // The joystick instance id + ball: cuint8; // The joystick trackball index + padding1: cuint8; + padding2: cuint8; + padding3: cuint8; + xrel: cint16; // The relative motion in the X direction + yrel: cint16; // The relative motion in the Y direction + end; + + {** + * Joystick hat position change event structure (event.jhat.*) + *} + PPSDL_JoyHatEvent = ^PSDL_JoyHatEvent; + PSDL_JoyHatEvent = ^TSDL_JoyHatEvent; + TSDL_JoyHatEvent = record + type_: cuint32; // SDL_JOYHATMOTION + timestamp: cuint32; + which: TSDL_JoystickID; // The joystick instance id + hat: cuint8; // The joystick hat index + value: cuint8; {* The hat position value. + * SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP + * SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT + * SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN + * + * Note that zero means the POV is centered. + *} + padding1: cuint8; + padding2: cuint8; + end; + + {** + * Joystick button event structure (event.jbutton.*) + *} + PPSDL_JoyButtonEvent = ^PSDL_JoyButtonEvent; + PSDL_JoyButtonEvent = ^TSDL_JoyButtonEvent; + TSDL_JoyButtonEvent = record + type_: cuint32; // SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP + timestamp: cuint32; + which: TSDL_JoystickID; // The joystick instance id + button: cuint8; // The joystick button index + state: cuint8; // SDL_PRESSED or SDL_RELEASED + padding1: cuint8; + padding2: cuint8; + end; + + {** + * Joystick device event structure (event.jdevice.*) + *} + PPSDL_JoyDeviceEvent = ^PSDL_JoyDeviceEvent; + PSDL_JoyDeviceEvent = ^TSDL_JoyDeviceEvent; + TSDL_JoyDeviceEvent = record + type_: cuint32; // SDL_JOYDEVICEADDED or SDL_JOYDEVICEREMOVED + timestamp: cuint32; + which: cint32; // The joystick device index for the ADDED event, instance id for the REMOVED event + end; + + {** + * Joysick battery level change event structure (event.jbattery.*) + *} + PPSDL_JoyBatteryEvent = ^PSDL_JoyBatteryEvent; + PSDL_JoyBatteryEvent = ^TSDL_JoyBatteryEvent; + TSDL_JoyBatteryEvent = record + type_: cuint32; // SDL_JOYBATTERYUPDATED + timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() + which: TSDL_JoystickID; // The joystick instance id + level: TSDL_JoystickPowerLevel; // The joystick battery level + end; + + {** + * Game controller axis motion event structure (event.caxis.*) + *} + PPSDL_ControllerAxisEvent = ^PSDL_ControllerAxisEvent; + PSDL_ControllerAxisEvent = ^TSDL_ControllerAxisEvent; + TSDL_ControllerAxisEvent = record + type_: cuint32; // SDL_CONTROLLERAXISMOTION + timestamp: cuint32; + which: TSDL_JoystickID; // The joystick instance id + axis: cuint8; // The controller axis (SDL_GameControllerAxis) + padding1: cuint8; + padding2: cuint8; + padding3: cuint8; + value: cint16; // The axis value (range: -32768 to 32767) + padding4: cuint16; + end; + + {** + * Game controller button event structure (event.cbutton.*) + *} + PPSDL_ControllerButtonEvent = ^PSDL_ControllerButtonEvent; + PSDL_ControllerButtonEvent = ^TSDL_ControllerButtonEvent; + TSDL_ControllerButtonEvent = record + type_: cuint32; // SDL_CONTROLLERBUTTONDOWN or SDL_CONTROLLERBUTTONUP + timestamp: cuint32; + which: TSDL_JoystickID; // The joystick instance id + button: cuint8; // The controller button (SDL_GameControllerButton) + state: cuint8; // SDL_PRESSED or SDL_RELEASED + padding1: cuint8; + padding2: cuint8; + end; + + + {** + * Controller device event structure (event.cdevice.*) + *} + PPSDL_ControllerDeviceEvent = ^PSDL_ControllerDeviceEvent; + PSDL_ControllerDeviceEvent = ^TSDL_ControllerDeviceEvent; + TSDL_ControllerDeviceEvent = record + type_: cuint32; // SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEREMOVED, or SDL_CONTROLLERDEVICEREMAPPED + timestamp: cuint32; + which: cint32; // The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event + end; + + {** + * Game controller touchpad event structure (event.ctouchpad.*) + *} + PPSDL_ControllerTouchpadEvent = ^PSDL_ControllerTouchpadEvent; + PSDL_ControllerTouchpadEvent = ^TSDL_ControllerTouchpadEvent; + TSDL_ControllerTouchpadEvent = record + type_: cuint32; // SDL_CONTROLLERTOUCHPADDOWN or SDL_CONTROLLERTOUCHPADMOTION or SDL_CONTROLLERTOUCHPADUP + timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() + which: TSDL_JoystickID; // The joystick instance id + touchpad: cint32; // The index of the touchpad + finger: cint32; // The index of the finger on the touchpad + x: cfloat; // Normalized in the range 0...1 with 0 being on the left + y: cfloat; // Normalized in the range 0...1 with 0 being at the top + pressure: cfloat; // Normalized in the range 0...1 + end; + + {** + * Game controller sensor event structure (event.csensor.*) + *} + PPSDL_ControllerSensorEvent = ^PSDL_ControllerSensorEvent; + PSDL_ControllerSensorEvent = ^TSDL_ControllerSensorEvent; + TSDL_ControllerSensorEvent = record + type_: cuint32; // SDL_CONTROLLERSENSORUPDATE + timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() + which: TSDL_JoystickID; // The joystick instance id + sensor: cint32; // The type of the sensor, one of the values of SDL_SensorType + data: array[0..2] of cfloat; // Up to 3 values from the sensor, as defined in SDL_sensor.h + end; + + {** + * Audio device event structure (event.adevice.*) + *} + PPSDL_AudioDeviceEvent = ^PSDL_AudioDeviceEvent; + PSDL_AudioDeviceEvent = ^TSDL_AudioDeviceEvent; + TSDL_AudioDeviceEvent = record + type_: cuint32; // ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED + timestamp: cuint32; + which: cuint32; // The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event + iscapture: cuint8; // zero if an output device, non-zero if a capture device. + padding1: cuint8; + padding2: cuint8; + padding3: cuint8; + end; + + + {** + * Touch finger event structure (event.tfinger.*) + *} + PPSDL_TouchFingerEvent = ^PSDL_TouchFingerEvent; + PSDL_TouchFingerEvent = ^TSDL_TouchFingerEvent; + TSDL_TouchFingerEvent = record + type_: cuint32; // SDL_FINGERMOTION or SDL_FINGERDOWN or SDL_FINGERUP + timestamp: cuint32; + touchId: TSDL_TouchID; // The touch device id + fingerId: TSDL_FingerID; + x: cfloat; // Normalized in the range 0...1 + y: cfloat; // Normalized in the range 0...1 + dx: cfloat; // Normalized in the range 0...1 + dy: cfloat; // Normalized in the range 0...1 + pressure: cfloat; // Normalized in the range 0...1 + window: cuint32; // The window underneath the finger, if any + end; + + {** + * Multiple Finger Gesture Event (event.mgesture.*) + *} + PPSDL_MultiGestureEvent = ^PSDL_MultiGestureEvent; + PSDL_MultiGestureEvent = ^TSDL_MultiGestureEvent; + TSDL_MultiGestureEvent = record + type_: cuint32; // SDL_MULTIGESTURE + timestamp: cuint32; + touchId: TSDL_TouchID; // The touch device index + dTheta: cfloat; + dDist: cfloat; + x: cfloat; + y: cfloat; + numFingers: cuint16; + padding: cuint16; + end; + + + {* (event.dgesture.*) *} + PPSDL_DollarGestureEvent = ^PSDL_DollarGestureEvent; + PSDL_DollarGestureEvent = ^TSDL_DollarGestureEvent; + TSDL_DollarGestureEvent = record + type_: cuint32; // SDL_DOLLARGESTURE + timestamp: cuint32; + touchId: TSDL_TouchID; // The touch device id + gestureId: TSDL_GestureID; + numFingers: cuint32; + error: cfloat; + x: cfloat; // Normalized center of gesture + y: cfloat; // Normalized center of gesture + end; + + + {** + * An event used to request a file open by the system (event.drop.*) + * This event is disabled by default, you can enable it with SDL_EventState() + * If you enable this event, you must free the filename in the event. + *} + PPSDL_DropEvent = ^PSDL_DropEvent; + PSDL_DropEvent = ^TSDL_DropEvent; + TSDL_DropEvent = record + type_: cuint32; // SDL_DROPBEGIN or SDL_DROPFILE or SDL_DROPTEXT or SDL_DROPCOMPLETE + timestamp: cuint32; + file_: PAnsiChar; // The file name, which should be freed with SDL_free(), is NIL on begin/complete + windowID: cuint32; // The window that was dropped on, if any + end; + + {** + * Sensor event structure (event.sensor.*) + *} + PPSDL_SensorEvent = ^PSDL_SensorEvent; + PSDL_SensorEvent = ^TSDL_SensorEvent; + TSDL_SensorEvent = record + type_: cuint32; // SDL_SENSORUPDATED + timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() + which: cint32; // The instance ID of the sensor + data: array[0..5] of cfloat; // Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() + end; + + {** + * The "quit requested" event + *} + PPSDL_QuitEvent = ^PSDL_QuitEvent; + PSDL_QuitEvent = ^TSDL_QuitEvent; + TSDL_QuitEvent = record + type_: cuint32; // SDL_QUIT + timestamp: cuint32; + end; + + {** + * A user-defined event type (event.user.*) + *} + PPSDL_UserEvent = ^PSDL_UserEvent; + PSDL_UserEvent = ^TSDL_UserEvent; + TSDL_UserEvent = record + type_: cuint32; // SDL_USEREVENT through SDL_NUMEVENTS-1 + timestamp: cuint32; + windowID: cuint32; // The associated window if any + code: cint32; // User defined event code + data1: Pointer; // User defined data pointer + data2: Pointer; // User defined data pointer + end; + + {** + * A video driver dependent system event (event.syswm.*) + * This event is disabled by default, you can enable it with SDL_EventState() + * + * If you want to use this event, you should include SDL_syswm.h. + *} + PPSDL_SysWMEvent = ^PSDL_SysWMEvent; + PSDL_SysWMEvent = ^TSDL_SysWMEvent; + TSDL_SysWMEvent = record + type_: cuint32; // SDL_SYSWMEVENT + timestamp: cuint32; + msg: PSDL_SysWMmsg; // driver dependent data (defined in SDL_syswm.h) + end; + + {** + * General event structure + *} + PPSDL_Event = ^PSDL_Event; + PSDL_Event = ^TSDL_Event; + TSDL_Event = record + case cint of + 0: (type_: cuint32); + + SDL_COMMONEVENT: (common: TSDL_CommonEvent); + SDL_DISPLAYEVENT: (display: TSDL_DisplayEvent); + SDL_WINDOWEVENT: (window: TSDL_WindowEvent); + + SDL_KEYUP, + SDL_KEYDOWN: (key: TSDL_KeyboardEvent); + SDL_TEXTEDITING: (edit: TSDL_TextEditingEvent); + SDL_TEXTEDITING_EXT: (exitExt: TSDL_TextEditingExtEvent); + SDL_TEXTINPUT: (text: TSDL_TextInputEvent); + + SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent); + SDL_MOUSEBUTTONUP, + SDL_MOUSEBUTTONDOWN: (button: TSDL_MouseButtonEvent); + SDL_MOUSEWHEEL: (wheel: TSDL_MouseWheelEvent); + + SDL_JOYAXISMOTION: (jaxis: TSDL_JoyAxisEvent); + SDL_JOYBALLMOTION: (jball: TSDL_JoyBallEvent); + SDL_JOYHATMOTION: (jhat: TSDL_JoyHatEvent); + SDL_JOYBUTTONDOWN, + SDL_JOYBUTTONUP: (jbutton: TSDL_JoyButtonEvent); + SDL_JOYDEVICEADDED, + SDL_JOYDEVICEREMOVED: (jdevice: TSDL_JoyDeviceEvent); + SDL_JOYBATTERYUPDATED: (jbattery: TSDL_JoyBatteryEvent); + + SDL_CONTROLLERAXISMOTION: (caxis: TSDL_ControllerAxisEvent); + SDL_CONTROLLERBUTTONUP, + SDL_CONTROLLERBUTTONDOWN: (cbutton: TSDL_ControllerButtonEvent); + SDL_CONTROLLERDEVICEADDED, + SDL_CONTROLLERDEVICEREMOVED, + SDL_CONTROLLERDEVICEREMAPPED: (cdevice: TSDL_ControllerDeviceEvent); + SDL_CONTROLLERTOUCHPADDOWN, + SDL_CONTROLLERTOUCHPADMOTION, + SDL_CONTROLLERTOUCHPADUP: (ctouchpad: TSDL_ControllerTouchpadEvent); + SDL_CONTROLLERSENSORUPDATE: (csensor: TSDL_ControllerSensorEvent); + + SDL_AUDIODEVICEADDED, + SDL_AUDIODEVICEREMOVED: (adevice: TSDL_AudioDeviceEvent); + + SDL_SENSORUPDATED: (sensor: TSDL_SensorEvent); + + SDL_QUITEV: (quit: TSDL_QuitEvent); + + SDL_USEREVENT: (user: TSDL_UserEvent); + SDL_SYSWMEVENT: (syswm: TSDL_SysWMEvent); + + SDL_FINGERDOWN, + SDL_FINGERUP, + SDL_FINGERMOTION: (tfinger: TSDL_TouchFingerEvent); + SDL_MULTIGESTURE: (mgesture: TSDL_MultiGestureEvent); + SDL_DOLLARGESTURE,SDL_DOLLARRECORD: (dgesture: TSDL_DollarGestureEvent); + + SDL_DROPFILE: (drop: TSDL_DropEvent); + end; + + + {* Function prototypes *} + + {** + * Pumps the event loop, gathering events from the input devices. + * + * This function updates the event queue and internal input device state. + * + * This should only be run in the thread that sets the video mode. + *} + procedure SDL_PumpEvents cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PumpEvents' {$ENDIF} {$ENDIF}; + +const + SDL_ADDEVENT = 0; + SDL_PEEKEVENT = 1; + SDL_GETEVENT = 2; + +type + PPSDL_EventAction = ^PSDL_EventAction; + PSDL_EventAction = ^TSDL_EventAction; + TSDL_EventAction = Word; + + {** + * Checks the event queue for messages and optionally returns them. + * + * If action is SDL_ADDEVENT, up to numevents events will be added to + * the back of the event queue. + * + * If action is SDL_PEEKEVENT, up to numevents events at the front + * of the event queue, within the specified minimum and maximum type, + * will be returned and will not be removed from the queue. + * + * If action is SDL_GETEVENT, up to numevents events at the front + * of the event queue, within the specified minimum and maximum type, + * will be returned and will be removed from the queue. + * + * Result: The number of events actually stored, or -1 if there was an error. + * + * This function is thread-safe. + *} + + function SDL_PeepEvents(events: PSDL_Event; numevents: cint32; action: TSDL_EventAction; minType, maxType: TSDL_EventType): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PeepEvents' {$ENDIF} {$ENDIF}; + + {** + * Checks to see if certain event types are in the event queue. + *} + + function SDL_HasEvent(type_: TSDL_EventType): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasEvent' {$ENDIF} {$ENDIF}; + function SDL_HasEvents(minType, maxType: TSDL_EventType): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasEvents' {$ENDIF} {$ENDIF}; + + {** + * This function clears events from the event queue + *} + + procedure SDL_FlushEvent(type_: TSDL_EventType) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FlushEvent' {$ENDIF} {$ENDIF}; + procedure SDL_FlushEvents(minType, maxType: TSDL_EventType) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FlushEvents' {$ENDIF} {$ENDIF}; + + {** + * Polls for currently pending events. + * + * 1 if there are any pending events, or 0 if there are none available. + * + * event - If not nil, the next event is removed from the queue and + * stored in that area. + *} + + function SDL_PollEvent(event: PSDL_Event): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PollEvent' {$ENDIF} {$ENDIF}; + + {** + * Waits indefinitely for the next available event. + * + * 1, or 0 if there was an error while waiting for events. + * + * event - If not nil, the next event is removed from the queue and + * stored in that area. + *} + + function SDL_WaitEvent(event: PSDL_Event): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WaitEvent' {$ENDIF} {$ENDIF}; + + {** + * Waits until the specified timeout (in milliseconds) for the next + * available event. + * + * 1, or 0 if there was an error while waiting for events. + * + * event - If not nil, the next event is removed from the queue and + * stored in that area. + *} + + function SDL_WaitEventTimeout(event: PSDL_Event; timeout: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WaitEventTimeout' {$ENDIF} {$ENDIF}; + + {** + * Add an event to the event queue. + * + * 1 on success, 0 if the event was filtered, or -1 if the event queue + * was full or there was some other error. + *} + + function SDL_PushEvent(event: PSDL_Event): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PumpEvents' {$ENDIF} {$ENDIF}; + +type + PPSDL_EventFilter = ^PSDL_EventFilter; + PSDL_EventFilter = ^TSDL_EventFilter; + {$IFNDEF GPC} + TSDL_EventFilter = function(userdata: Pointer; event: PSDL_Event): cint; cdecl; + {$ELSE} + TSDL_EventFilter = function( userdata: Pointer; event: PSDL_Event ): cint; + {$ENDIF} + + {** + * Sets up a filter to process all events before they change internal state and + * are posted to the internal event queue. + * + * If the filter returns 1, then the event will be added to the internal queue. + * If it returns 0, then the event will be dropped from the queue, but the + * internal state will still be updated. This allows selective filtering of + * dynamically arriving events. + * + * Be very careful of what you do in the event filter function, as + * it may run in a different thread! + * + * There is one caveat when dealing with the SDL_QUITEVENT event type. The + * event filter is only called when the window manager desires to close the + * application window. If the event filter returns 1, then the window will + * be closed, otherwise the window will remain open if possible. + * + * If the quit event is generated by an interrupt signal, it will bypass the + * internal queue and be delivered to the application at the next event poll. + *} + + procedure SDL_SetEventFilter(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetEventFilter' {$ENDIF} {$ENDIF}; + + {** + * Return the current event filter - can be used to "chain" filters. + * If there is no event filter set, this function returns SDL_FALSE. + *} + + function SDL_GetEventFilter(var filter: PSDL_EventFilter; var userdata: PPointer): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetEventFilter' {$ENDIF} {$ENDIF}; + + {** + * Add a function which is called when an event is added to the queue. + *} + + procedure SDL_AddEventWatch(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AddEventWatch' {$ENDIF} {$ENDIF}; + + {** + * Remove an event watch function added with SDL_AddEventWatch() + *} + + procedure SDL_DelEventWatch(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DelEventWatch' {$ENDIF} {$ENDIF}; + + {** + * Run the filter function on the current event queue, removing any + * events for which the filter returns 0. + *} + + procedure SDL_FilterEvents(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FilterEvents' {$ENDIF} {$ENDIF}; + +const + + SDL_QUERY = -1; + SDL_IGNORE = 0; + SDL_DISABLE = 0; + SDL_ENABLE = 1; + + {** + * This function allows you to set the state of processing certain events. + * - If state is set to SDL_IGNORE, that event will be automatically + * dropped from the event queue and will not event be filtered. + * - If state is set to SDL_ENABLE, that event will be processed + * normally. + * - If state is set to SDL_QUERY, SDL_EventState() will return the + * current processing state of the specified event. + *} + + function SDL_EventState(type_: TSDL_EventType; state: cint32): cuint8 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EventState' {$ENDIF} {$ENDIF}; + + function SDL_GetEventState(type_: TSDL_EventType): cuint8; + + {** + * This function allocates a set of user-defined events, and returns + * the beginning event number for that set of events. + * + * If there aren't enough user-defined events left, this function + * returns (Uint32)-1 + *} + + function SDL_RegisterEvents(numevents: cint32): cuint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RegisterEvents' {$ENDIF} {$ENDIF}; diff --git a/units/sdlfilesystem.inc b/units/sdlfilesystem.inc index 39aeb315..a9117cc8 100644 --- a/units/sdlfilesystem.inc +++ b/units/sdlfilesystem.inc @@ -1,105 +1,121 @@ -{* - * \file SDL_filesystem.h - * - * \brief Include file for filesystem SDL API functions - } - -{* - * Get the directory where the application was run from. - * - * This is not necessarily a fast call, so you should call this once near - * startup and save the string if you need it. - * - * **Mac OS X and iOS Specific Functionality**: If the application is in a - * ".app" bundle, this function returns the Resource directory (e.g. - * MyApp.app/Contents/Resources/). This behaviour can be overridden by adding - * a property to the Info.plist file. Adding a string key with the name - * SDL_FILESYSTEM_BASE_DIR_TYPE with a supported value will change the - * behaviour. - * - * Supported values for the SDL_FILESYSTEM_BASE_DIR_TYPE property (Given an - * application in /Applications/SDLApp/MyApp.app): - * - * - `resource`: bundle resource directory (the default). For example: - * `/Applications/SDLApp/MyApp.app/Contents/Resources` - * - `bundle`: the Bundle directory. For example: - * `/Applications/SDLApp/MyApp.app/` - * - `parent`: the containing directory of the bundle. For example: - * `/Applications/SDLApp/` - * - * The returned path is guaranteed to end with a path separator ('\' on - * Windows, '/' on most other platforms). - * - * The pointer returned is owned by the caller. Please call SDL_free() on the - * pointer when done with it. - * - * \returns an absolute path in UTF-8 encoding to the application data - * directory. nil will be returned on error or when the platform - * doesn't implement this functionality, call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.1. - * - * \sa SDL_GetPrefPath - } -function SDL_GetBasePath(): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetBasePath' {$ENDIF} {$ENDIF}; - -{* - * Get the user-and-app-specific path where files can be written. - * - * Get the "pref dir". This is meant to be where users can write personal - * files (preferences and save games, etc) that are specific to your - * application. This directory is unique per user, per application. - * - * This function will decide the appropriate location in the native - * filesystem, create the directory if necessary, and return a string of the - * absolute path to the directory in UTF-8 encoding. - * - * On Windows, the string might look like: - * - * `C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\` - * - * On Linux, the string might look like: - * - * `/home/bob/.local/share/My Program Name/` - * - * On Mac OS X, the string might look like: - * - * `/Users/bob/Library/Application Support/My Program Name/` - * - * You should assume the path returned by this function is the only safe place - * to write files (and that SDL_GetBasePath(), while it might be writable, or - * even the parent of the returned path, isn't where you should be writing - * things). - * - * Both the org and app strings may become part of a directory name, so please - * follow these rules: - * - * - Try to use the same org string (_including case-sensitivity_) for all - * your applications that use this function. - * - Always use a unique app string for each one, and make sure it never - * changes for an app once you've decided on it. - * - Unicode characters are legal, as long as it's UTF-8 encoded, but... - * - ...only use letters, numbers, and spaces. Avoid punctuation like "Game - * Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient. - * - * The returned path is guaranteed to end with a path separator ('\' on - * Windows, '/' on most other platforms). - * - * The pointer returned is owned by the caller. Please call SDL_free() on the - * pointer when done with it. - * - * \param org the name of your organization - * \param app the name of your application - * \returns a UTF-8 string of the user directory in platform-dependent - * notation. nil if there's a problem (creating directory failed, - * etc.). - * - * \since This function is available since SDL 2.0.1. - * - * \sa SDL_GetBasePath - } -function SDL_GetPrefPath(org: PAnsiChar; app: PAnsiChar): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPrefPath' {$ENDIF} {$ENDIF}; - +{* + * \file SDL_filesystem.h + * + * \brief Include file for filesystem SDL API functions + } + +{* + * Get the directory where the application was run from. + * + * This is not necessarily a fast call, so you should call this once near + * startup and save the string if you need it. + * + * **Mac OS X and iOS Specific Functionality**: If the application is in a + * ".app" bundle, this function returns the Resource directory (e.g. + * MyApp.app/Contents/Resources/). This behaviour can be overridden by adding + * a property to the Info.plist file. Adding a string key with the name + * SDL_FILESYSTEM_BASE_DIR_TYPE with a supported value will change the + * behaviour. + * + * Supported values for the SDL_FILESYSTEM_BASE_DIR_TYPE property (Given an + * application in /Applications/SDLApp/MyApp.app): + * + * - `resource`: bundle resource directory (the default). For example: + * `/Applications/SDLApp/MyApp.app/Contents/Resources` + * - `bundle`: the Bundle directory. For example: + * `/Applications/SDLApp/MyApp.app/` + * - `parent`: the containing directory of the bundle. For example: + * `/Applications/SDLApp/` + * + * The returned path is guaranteed to end with a path separator ('\' on + * Windows, '/' on most other platforms). + * + * The pointer returned is owned by the caller. Please call SDL_free() on the + * pointer when done with it. + * + * \returns an absolute path in UTF-8 encoding to the application data + * directory. nil will be returned on error or when the platform + * doesn't implement this functionality, call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.1. + * + * \sa SDL_GetPrefPath + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetBasePath_fun = function(): PAnsiChar; cdecl; +Var + SDL_GetBasePath : TSDL_GetBasePath_fun = Nil; +{$else} + +function SDL_GetBasePath(): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetBasePath' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get the user-and-app-specific path where files can be written. + * + * Get the "pref dir". This is meant to be where users can write personal + * files (preferences and save games, etc) that are specific to your + * application. This directory is unique per user, per application. + * + * This function will decide the appropriate location in the native + * filesystem, create the directory if necessary, and return a string of the + * absolute path to the directory in UTF-8 encoding. + * + * On Windows, the string might look like: + * + * `C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\` + * + * On Linux, the string might look like: + * + * `/home/bob/.local/share/My Program Name/` + * + * On Mac OS X, the string might look like: + * + * `/Users/bob/Library/Application Support/My Program Name/` + * + * You should assume the path returned by this function is the only safe place + * to write files (and that SDL_GetBasePath(), while it might be writable, or + * even the parent of the returned path, isn't where you should be writing + * things). + * + * Both the org and app strings may become part of a directory name, so please + * follow these rules: + * + * - Try to use the same org string (_including case-sensitivity_) for all + * your applications that use this function. + * - Always use a unique app string for each one, and make sure it never + * changes for an app once you've decided on it. + * - Unicode characters are legal, as long as it's UTF-8 encoded, but... + * - ...only use letters, numbers, and spaces. Avoid punctuation like "Game + * Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient. + * + * The returned path is guaranteed to end with a path separator ('\' on + * Windows, '/' on most other platforms). + * + * The pointer returned is owned by the caller. Please call SDL_free() on the + * pointer when done with it. + * + * \param org the name of your organization + * \param app the name of your application + * \returns a UTF-8 string of the user directory in platform-dependent + * notation. nil if there's a problem (creating directory failed, + * etc.). + * + * \since This function is available since SDL 2.0.1. + * + * \sa SDL_GetBasePath + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetPrefPath_fun = function(org: PAnsiChar; app: PAnsiChar): PAnsiChar; cdecl; +Var + SDL_GetPrefPath : TSDL_GetPrefPath_fun = Nil; +{$else} + +function SDL_GetPrefPath(org: PAnsiChar; app: PAnsiChar): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPrefPath' {$ENDIF} {$ENDIF}; +{$endif} + diff --git a/units/sdlgamecontroller.inc b/units/sdlgamecontroller.inc index e4b67122..416dde8c 100644 --- a/units/sdlgamecontroller.inc +++ b/units/sdlgamecontroller.inc @@ -1,652 +1,978 @@ -//from sdl_gamecontroller.h - -{** - * SDL_gamecontroller.h - * - * In order to use these functions, SDL_Init() must have been called - * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system - * for game controllers, and load appropriate drivers. - * - * If you would like to receive controller updates while the application - * is in the background, you should set the following hint before calling - * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS - *} - -{* The gamecontroller structure used to identify an SDL game controller *} -type - PPSDL_GameController = ^PSDL_GameController; - PSDL_GameController = type Pointer; - - PPSDL_GameControllerType = ^PSDL_GameControllerType; - PSDL_GameControllerType = ^TSDL_GameControllerType; - TSDL_GameControllerType = type cint; -const - SDL_CONTROLLER_TYPE_UNKNOWN = TSDL_GameControllerType(0); - SDL_CONTROLLER_TYPE_XBOX360 = TSDL_GameControllerType(1); - SDL_CONTROLLER_TYPE_XBOXONE = TSDL_GameControllerType(2); - SDL_CONTROLLER_TYPE_PS3 = TSDL_GameControllerType(3); - SDL_CONTROLLER_TYPE_PS4 = TSDL_GameControllerType(4); - SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO = TSDL_GameControllerType(5); - SDL_CONTROLLER_TYPE_VIRTUAL = TSDL_GameControllerType(6); - SDL_CONTROLLER_TYPE_PS5 = TSDL_GameControllerType(7); - SDL_CONTROLLER_TYPE_AMAZON_LUNA = TSDL_GameControllerType(8); - SDL_CONTROLLER_TYPE_GOOGLE_STADIA = TSDL_GameControllerType(9); - SDL_CONTROLLER_TYPE_NVIDIA_SHIELD = TSDL_GameControllerType(10); - SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT = TSDL_GameControllerType(11); - SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT = TSDL_GameControllerType(12); - SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR = TSDL_GameControllerType(13); - -type - PPSDL_GameControllerBindType = ^PSDL_GameControllerBindType; - PSDL_GameControllerBindType = ^TSDL_GameControllerBindType; - TSDL_GameControllerBindType = type cint; -const - SDL_CONTROLLER_BINDTYPE_NONE = TSDL_GameControllerBindType(0); - SDL_CONTROLLER_BINDTYPE_BUTTON = TSDL_GameControllerBindType(1); - SDL_CONTROLLER_BINDTYPE_AXIS = TSDL_GameControllerBindType(2); - SDL_CONTROLLER_BINDTYPE_HAT = TSDL_GameControllerBindType(3); - - {** - * Get the SDL joystick layer binding for this controller button/axis mapping - *} -type - THat = record - hat: cint; - hat_mask: cint; - end; - - PPSDL_GameControllerButtonBind = ^PSDL_GameControllerButtonBind; - PSDL_GameControllerButtonBind = ^TSDL_GameControllerButtonBind; - TSDL_GameControllerButtonBind = record - bindType: TSDL_GameControllerBindType; - case cint of - 0: ( button: cint; ); - 1: ( axis: cint; ); - 2: ( hat: THat; ); - end; - - {** - * To count the number of game controllers in the system for the following: - * int nJoysticks = SDL_NumJoysticks(); - * int nGameControllers = 0; - * for ( int i = 0; i < nJoysticks; i++ ) [ - * if ( SDL_IsGameController(i) ) [ - * nGameControllers++; - * - * !! Pascal Conv.: Changed curly to square brackets in above example code - to prevent opening comment blocks! - * - * Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is: - * guid,name,mappings - * - * Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones. - * Under Windows there is a reserved GUID of "xinput" that covers any XInput devices. - * The mapping format for joystick is: - * bX - a joystick button, index X - * hX.Y - hat X with value Y - * aX - axis X of the joystick - * Buttons can be used as a controller axis and vice versa. - * - * This string shows an example of a valid mapping for a controller - * "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7", - * - *} - - {** - * Add or update an existing mapping configuration - * - * 1 if mapping is added, 0 if updated, -1 on error - *} -function SDL_GameControllerAddMapping( mappingString: PAnsiChar ): cint cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerAddMapping' {$ENDIF} {$ENDIF}; - - {** - * Load a set of mappings from a seekable SDL data stream (memory or file), filtered by the current SDL_GetPlatform() - * A community sourced database of controllers is available at https://raw.github.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt - * - * If freerw is non-zero, the stream will be closed after being read. - * - * Returns number of mappings added, -1 on error - *} -function SDL_GameControllerAddMappingsFromRW(rw: PSDL_RWops; freerw: cint32):cint32; - cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerAddMappingsFromRW' {$ENDIF} {$ENDIF}; - -{** - * Get the number of mappings installed. - *} -function SDL_GameControllerNumMappings():cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerNumMappings' {$ENDIF} {$ENDIF}; - - {** - * Get a mapping string for a GUID - * - * the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available - *} -function SDL_GameControllerMappingForGUID( guid: TSDL_JoystickGUID ): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerMappingForGUID' {$ENDIF} {$ENDIF}; - -{** - * Get the mapping at a particular index. - * - * Returns the mapping string. Must be freed with SDL_free(). - * Returns NIL if the index is out of range. - *} -function SDL_GameControllerMappingForIndex(mapping_index: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerMappingForIndex' {$ENDIF} {$ENDIF}; - - {** - * Get a mapping string for an open GameController - * - * the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available - *} -function SDL_GameControllerMapping( gamecontroller: PSDL_GameController ): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerMapping' {$ENDIF} {$ENDIF}; - - {** - * Is the joystick on this index supported by the game controller interface? - *} -function SDL_IsGameController(joystick_index: cint): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsGameController' {$ENDIF} {$ENDIF}; - - {** - * Get the implementation dependent name of a game controller. - * This can be called before any controllers are opened. - * If no name can be found, this function returns NULL. - *} -function SDL_GameControllerNameForIndex(joystick_index: cint): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerNameForIndex' {$ENDIF} {$ENDIF}; - -{** - * Get the implementation dependent path for the game controller. - * - * This function can be called before any controllers are opened. - * - * `joystick_index` is the same as the `device_index` passed to - * SDL_JoystickOpen(). - * - * \param joystick_index the device_index of a device, from zero to - * SDL_NumJoysticks()-1 - * \returns the implementation-dependent path for the game controller, or NIL - * if there is no path or the index is invalid. - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_GameControllerPath - *} -function SDL_GameControllerPathForIndex(joystick_index: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerPathForIndex' {$ENDIF} {$ENDIF}; - -{** - * Get the type of a game controller. - * This can be called before any controllers are opened. - *} -function SDL_GameControllerTypeForIndex(joystick_index: cint): TSDL_GameControllerType; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerTypeForIndex' {$ENDIF} {$ENDIF}; - -{** - * Get the mapping of a game controller. - * This can be called before any controllers are opened. - * - * Returns the mapping string. Must be freed with SDL_free(). - * Returns NIL if no mapping is available. - *} -function SDL_GameControllerMappingForDeviceIndex(joystick_index: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerMappingForDeviceIndex' {$ENDIF} {$ENDIF}; - - {** - * Open a game controller for use. - * The index passed as an argument refers to the N'th game controller on the system. - * This index is the value which will identify this controller in future controller - * events. - * - * A controller identifier, or NULL if an error occurred. - *} -function SDL_GameControllerOpen(joystick_index: cint): PSDL_GameController cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerOpen' {$ENDIF} {$ENDIF}; - - {** - * Return the SDL_GameController associated with an instance id. - *} -function SDL_GameControllerFromInstanceID(joyid: TSDL_JoystickID): PSDL_GameController; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerFromInstanceID' {$ENDIF} {$ENDIF}; - -{** - * Get the SDL_GameController associated with a player index. - * - * Please note that the player index is _not_ the device index, nor is it the - * instance id! - * - *} -function SDL_GameControllerFromPlayerIndex(player_index: cint): PSDL_GameController; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerFromPlayerIndex' {$ENDIF} {$ENDIF}; - - {** - * Return the name for this currently opened controller - *} -function SDL_GameControllerName(gamecontroller: PSDL_GameController): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerName' {$ENDIF} {$ENDIF}; - -{** - * Get the implementation-dependent path for an opened game controller. - * - * This is the same path as returned by SDL_GameControllerNameForIndex(), but - * it takes a controller identifier instead of the (unstable) device index. - * - * \param gamecontroller a game controller identifier previously returned by - * SDL_GameControllerOpen() - * \returns the implementation dependent path for the game controller, or NIL - * if there is no path or the identifier passed is invalid. - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_GameControllerPathForIndex - *} -function SDL_GameControllerPath(gamecontroller: PSDL_GameController): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerPath' {$ENDIF} {$ENDIF}; - -{** - * Get the type of this currently opened controller - * - * This is the same name as returned by SDL_GameControllerTypeForIndex(), but - * it takes a controller identifier instead of the (unstable) device index. - *} -function SDL_GameControllerGetType(gamecontroller: PSDL_GameController): TSDL_GameControllerType; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetType' {$ENDIF} {$ENDIF}; - -{** - * Get the player index of an opened game controller. - * For XInput controllers this returns the XInput user index. - * - * Returns the player index for controller, or -1 if it's not available. - *} -function SDL_GameControllerGetPlayerIndex(gamecontroller: PSDL_GameController): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetPlayerIndex' {$ENDIF} {$ENDIF}; - -{** - * Set the player index of an opened game controller. - *} -procedure SDL_GameControllerSetPlayerIndex(gamecontroller: PSDL_GameController; player_index: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerSetPlayerIndex' {$ENDIF} {$ENDIF}; - -{** - * Get the USB vendor ID of an opened controller, if available. - * - * If the vendor ID isn't available this function returns 0. - * - * \param gamecontroller the game controller object to query. - * \return the USB vendor ID, or zero if unavailable. - * - * \since This function is available since SDL 2.0.6. - *} -function SDL_GameControllerGetVendor(gamecontroller: PSDL_GameController): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetVendor' {$ENDIF} {$ENDIF}; - -{** - * Get the USB product ID of an opened controller, if available. - * If the product ID isn't available, this function returns 0. - *} -function SDL_GameControllerGetProduct(gamecontroller: PSDL_GameController): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetProduct' {$ENDIF} {$ENDIF}; - -{** - * Get the product version of an opened controller, if available. - * If the product version isn't available, this function returns 0. - *} -function SDL_GameControllerGetProductVersion(gamecontroller: PSDL_GameController): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetProductVersion' {$ENDIF} {$ENDIF}; - -{** - * Get the firmware version of an opened controller, if available. - * - * If the firmware version isn't available this function returns 0. - * - * \param gamecontroller the game controller object to query. - * \return the controller firmware version, or zero if unavailable. - * - * \since This function is available since SDL 2.24.0. - *} -function SDL_GameControllerGetFirmwareVersion(gamecontroller: PSDL_GameController): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetFirmwareVersion' {$ENDIF} {$ENDIF}; - -{** - * Get the serial number of an opened controller, if available. - * - * Returns a string containing the serial number of the controller, - * or NIL if it is not available. Do _not_ free the string with SDL_free(). - *} -function SDL_GameControllerGetSerial(gamecontroller: PSDL_GameController): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetSerial' {$ENDIF} {$ENDIF}; - -{** - * Get the Steam Input handle of an opened controller, if available. - * - * Returns an InputHandle_t for the controller that can be used with Steam Input API: - * https://partner.steamgames.com/doc/api/ISteamInput - * - * \param gamecontroller the game controller object to query. - * \returns the gamepad handle, or 0 if unavailable. - * - * \since This function is available since SDL 2.30.0. - *} -function SDL_GameControllerGetSteamHandle(gamecontroller: PSDL_GameController): cuint64; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetSteamHandle' {$ENDIF} {$ENDIF}; - - {** - * Returns SDL_TRUE if the controller has been opened and currently connected, - * or SDL_FALSE if it has not. - *} -function SDL_GameControllerGetAttached(gamecontroller: PSDL_GameController): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetAttached' {$ENDIF} {$ENDIF}; - - {** - * Get the underlying joystick object used by a controller - *} -function SDL_GameControllerGetJoystick(gamecontroller: PSDL_GameController): PSDL_Joystick cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetJoystick' {$ENDIF} {$ENDIF}; - - {** - * Enable/disable controller event polling. - * - * If controller events are disabled, you must call SDL_GameControllerUpdate() - * yourself and check the state of the controller when you want controller - * information. - * - * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE. - *} -function SDL_GameControllerEventState(state: cint): cint cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerEventState' {$ENDIF} {$ENDIF}; - - {** - * Update the current state of the open game controllers. - * - * This is called automatically by the event loop if any game controller - * events are enabled. - *} -procedure SDL_GameControllerUpdate() cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerUpdate' {$ENDIF} {$ENDIF}; - - {** - * The list of axes available from a controller - *} - -type - PPSDL_GameControllerAxis = ^PSDL_GameControllerAxis; - PSDL_GameControllerAxis = ^TSDL_GameControllerAxis; - TSDL_GameControllerAxis = type cint; -const - SDL_CONTROLLER_AXIS_INVALID = TSDL_GameControllerAxis(-1); - SDL_CONTROLLER_AXIS_LEFTX = TSDL_GameControllerAxis(0); - SDL_CONTROLLER_AXIS_LEFTY = TSDL_GameControllerAxis(1); - SDL_CONTROLLER_AXIS_RIGHTX = TSDL_GameControllerAxis(2); - SDL_CONTROLLER_AXIS_RIGHTY = TSDL_GameControllerAxis(3); - SDL_CONTROLLER_AXIS_TRIGGERLEFT = TSDL_GameControllerAxis(4); - SDL_CONTROLLER_AXIS_TRIGGERRIGHT = TSDL_GameControllerAxis(5); - SDL_CONTROLLER_AXIS_MAX = TSDL_GameControllerAxis(6); - - {** - * turn this string into a axis mapping - *} -function SDL_GameControllerGetAxisFromString(pchString: PAnsiChar): TSDL_GameControllerAxis cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetAxisFromString' {$ENDIF} {$ENDIF}; - - {** - * turn this axis enum into a string mapping - *} -function SDL_GameControllerGetStringForAxis(axis: TSDL_GameControllerAxis): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetStringForAxis' {$ENDIF} {$ENDIF}; - - {** - * Get the SDL joystick layer binding for this controller button mapping - *} -function SDL_GameControllerGetBindForAxis(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): TSDL_GameControllerButtonBind cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetBindForAxis' {$ENDIF} {$ENDIF}; - -{** - * Query whether a game controller has a given axis. - * - * This merely reports whether the controller's mapping defined this axis, - * as that is all the information SDL has about the physical device. - *} -function SDL_GameControllerHasAxis(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasAxis' {$ENDIF} {$ENDIF}; - - {** - * Get the current state of an axis control on a game controller. - * - * The state is a value ranging from -32768 to 32767. - * - * The axis indices start at index 0. - *} -function SDL_GameControllerGetAxis(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): cint16 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetAxis' {$ENDIF} {$ENDIF}; - - {** - * The list of buttons available from a controller - *} -type - PPSDL_GameControllerButton = ^PSDL_GameControllerButton; - PSDL_GameControllerButton = ^TSDL_GameControllerButton; - TSDL_GameControllerButton = type cint; -const - SDL_CONTROLLER_BUTTON_INVALID = TSDL_GameControllerButton(-1); - SDL_CONTROLLER_BUTTON_A = TSDL_GameControllerButton(0); - SDL_CONTROLLER_BUTTON_B = TSDL_GameControllerButton(1); - SDL_CONTROLLER_BUTTON_X = TSDL_GameControllerButton(2); - SDL_CONTROLLER_BUTTON_Y = TSDL_GameControllerButton(3); - SDL_CONTROLLER_BUTTON_BACK = TSDL_GameControllerButton(4); - SDL_CONTROLLER_BUTTON_GUIDE = TSDL_GameControllerButton(5); - SDL_CONTROLLER_BUTTON_START = TSDL_GameControllerButton(6); - SDL_CONTROLLER_BUTTON_LEFTSTICK = TSDL_GameControllerButton(7); - SDL_CONTROLLER_BUTTON_RIGHTSTICK = TSDL_GameControllerButton(8); - SDL_CONTROLLER_BUTTON_LEFTSHOULDER = TSDL_GameControllerButton(9); - SDL_CONTROLLER_BUTTON_RIGHTSHOULDER = TSDL_GameControllerButton(10); - SDL_CONTROLLER_BUTTON_DPAD_UP = TSDL_GameControllerButton(11); - SDL_CONTROLLER_BUTTON_DPAD_DOWN = TSDL_GameControllerButton(12); - SDL_CONTROLLER_BUTTON_DPAD_LEFT = TSDL_GameControllerButton(13); - SDL_CONTROLLER_BUTTON_DPAD_RIGHT = TSDL_GameControllerButton(14); - SDL_CONTROLLER_BUTTON_MISC1 = TSDL_GameControllerButton(15); {**< Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button *} - SDL_CONTROLLER_BUTTON_PADDLE1 = TSDL_GameControllerButton(16); {**< Xbox Elite paddle P1 *} - SDL_CONTROLLER_BUTTON_PADDLE2 = TSDL_GameControllerButton(17); {**< Xbox Elite paddle P3 *} - SDL_CONTROLLER_BUTTON_PADDLE3 = TSDL_GameControllerButton(18); {**< Xbox Elite paddle P2 *} - SDL_CONTROLLER_BUTTON_PADDLE4 = TSDL_GameControllerButton(19); {**< Xbox Elite paddle P4 *} - SDL_CONTROLLER_BUTTON_TOUCHPAD = TSDL_GameControllerButton(20); {**< PS4/PS5 touchpad button *} - SDL_CONTROLLER_BUTTON_MAX = TSDL_GameControllerButton(21); - - {** - * turn this string into a button mapping - *} -function SDL_GameControllerGetButtonFromString(pchString: PAnsiChar): TSDL_GameControllerButton cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetButtonFromString' {$ENDIF} {$ENDIF}; - - {** - * turn this button enum into a string mapping - *} -function SDL_GameControllerGetStringForButton(button: TSDL_GameControllerButton): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetStringForButton' {$ENDIF} {$ENDIF}; - -{** - * Get the SDL joystick layer binding for this controller button mapping - *} -function SDL_GameControllerGetBindForButton(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): TSDL_GameControllerButtonBind cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetBindForButton' {$ENDIF} {$ENDIF}; - -{** - * Query whether a game controller has a given button. - * - * This merely reports whether the controller's mapping defined this button, - * as that is all the information SDL has about the physical device. - *} -function SDL_GameControllerHasButton(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasButton' {$ENDIF} {$ENDIF}; - -{** - * Get the current state of a button on a game controller. - * - * The button indices start at index 0. - *} -function SDL_GameControllerGetButton(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): cuint8 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetButton' {$ENDIF} {$ENDIF}; - -{** - * Get the number of touchpads on a game controller. - *} -function SDL_GameControllerGetNumTouchpads(gamecontroller: PSDL_GameController): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetNumTouchpads' {$ENDIF} {$ENDIF}; - -{** - * Get the number of supported simultaneous fingers on a touchpad on a game controller. - *} -function SDL_GameControllerGetNumTouchpadFingers(gamecontroller: PSDL_GameController; touchpad: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetNumTouchpadFingers' {$ENDIF} {$ENDIF}; - -{** - * Get the current state of a finger on a touchpad on a game controller. - *} -function SDL_GameControllerGetTouchpadFinger( - gamecontroller: PSDL_GameController; - touchpad, finger: cint; - state: pcuint8; - x, y, pressure: pcfloat -): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetTouchpadFinger' {$ENDIF} {$ENDIF}; - -{** - * Return whether a game controller has a particular sensor. - *} -function SDL_GameControllerHasSensor(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasSensor' {$ENDIF} {$ENDIF}; - -{** - * Set whether data reporting for a game controller sensor is enabled. - *} -function SDL_GameControllerSetSensorEnabled(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; enabled: TSDL_bool): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerSetSensorEnabled' {$ENDIF} {$ENDIF}; - -{** - * Query whether sensor data reporting is enabled for a game controller. - *} -function SDL_GameControllerIsSensorEnabled(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerIsSensorEnabled' {$ENDIF} {$ENDIF}; - -{** - * Get the data rate (number of events per second) of - * a game controller sensor. - * - * Returns the data rate, or 0.0 if the data rate is not available. - *} -function SDL_GameControllerGetSensorDataRate(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetSensorDataRate' {$ENDIF} {$ENDIF}; - -{** - * Get the current state of a game controller sensor. - * - * The number of values and interpretation of the data is sensor dependent. - * See sdlsensor.inc for the details for each type of sensor. - *} -function SDL_GameControllerGetSensorData(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; data: pcfloat; num_values: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetSensorData' {$ENDIF} {$ENDIF}; - -{** - * Get the current state of a game controller sensor with the timestamp of the - * last update. - * - * The number of values and interpretation of the data is sensor dependent. - * See SDL_sensor.h for the details for each type of sensor. - * - * \param gamecontroller The controller to query - * \param type The type of sensor to query - * \param timestamp A pointer filled with the timestamp in microseconds of the - * current sensor reading if available, or 0 if not - * \param data A pointer filled with the current sensor state - * \param num_values The number of values to write to data - * \return 0 or -1 if an error occurred. - * - * \since This function is available since SDL 2.26.0. - *} -function SDL_GameControllerGetSensorDataWithTimestamp( - gamecontroller: PSDL_GameController; - senstype: TSDL_SensorType; - timestamp: pcuint64; - data: pcfloat; - num_values: cint -): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetSensorDataWithTimestamp' {$ENDIF} {$ENDIF}; - -{** - * Query whether a game controller has rumble support. - *} -function SDL_GameControllerHasRumble(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasRumble' {$ENDIF} {$ENDIF}; - -{** - * Start a rumble effect on a game controller. - * - * Each call to this function cancels any previous rumble effect, and calling - * it with 0 intensity stops any rumbling. - * - * Returns 0, or -1 if rumble isn't supported on this controller. - *} -function SDL_GameControllerRumble( - gamecontroller: PSDL_GameController; - low_frequency_rumble, high_frequency_rumble: cuint16; - duration_ms: cuint32 -): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerRumble' {$ENDIF} {$ENDIF}; - -{** - * Query whether a game controller has rumble support on triggers. - *} -function SDL_GameControllerHasRumbleTriggers(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasRumbleTriggers' {$ENDIF} {$ENDIF}; - -{** - * Start a rumble effect in the game controller's triggers. - * - * Each call to this function cancels any previous trigger rumble effect, and - * calling it with 0 intensity stops any rumbling. - * - * Note that this is rumbling of the _triggers_ and not the game controller as - * a whole. This is currently only supported on Xbox One controllers. If you - * want the (more common) whole-controller rumble, use - * SDL_GameControllerRumble() instead. - * - * Returns 0, or -1 if trigger rumble isn't supported on this controller - *} -function SDL_GameControllerRumbleTriggers( - gamecontroller: PSDL_GameController; - left_rumble, right_rumble: cuint16; - duration_ms: cuint32 -): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerRumbleTriggers' {$ENDIF} {$ENDIF}; - -{** - * Query whether a game controller has an LED. - *} -function SDL_GameControllerHasLED(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasLED' {$ENDIF} {$ENDIF}; - -{** - * Update a game controller's LED color. - * - * Returns 0, or -1 if this controller does not have a modifiable LED. - *} -function SDL_GameControllerSetLED(gamecontroller: PSDL_GameController; red, green, blue: cuint8): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerSetLED' {$ENDIF} {$ENDIF}; - -{** - * Send a controller-specific effect packet. - * - * Returns 0, or -1 if this controller or driver does not - * support effect packets. - *} -function SDL_GameControllerSendEffect(gamecontroller: PSDL_GameController; data: Pointer; size: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerSendEffect' {$ENDIF} {$ENDIF}; - -{** - * Close a controller previously opened with SDL_GameControllerOpen(). - *} -procedure SDL_GameControllerClose(gamecontroller: PSDL_GameController) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerClose' {$ENDIF} {$ENDIF}; - -{** - * Return the sfSymbolsName for a given axis on a game controller - * on Apple platforms. - * - * Returns the sfSymbolsName, or NIL if the name can't be found. - * Do _not_ pass this string to SDL_free(). - *} -function SDL_GameControllerGetAppleSFSymbolsNameForAxis(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetAppleSFSymbolsNameForAxis' {$ENDIF} {$ENDIF}; - -{** - * Return the sfSymbolsName for a given button on a game controller - * on Apple platforms. - * - * Returns the sfSymbolsName, or NIL if the name can't be found. - * Do _not_ pass this string to SDL_free(). - *} -function SDL_GameControllerGetAppleSFSymbolsNameForButton(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetAppleSFSymbolsNameForButton' {$ENDIF} {$ENDIF}; - - -function SDL_GameControllerAddMappingsFromFile(Const FilePath:PAnsiChar):cint32; +//from sdl_gamecontroller.h + +{** + * SDL_gamecontroller.h + * + * In order to use these functions, SDL_Init() must have been called + * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system + * for game controllers, and load appropriate drivers. + * + * If you would like to receive controller updates while the application + * is in the background, you should set the following hint before calling + * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS + *} + +{* The gamecontroller structure used to identify an SDL game controller *} +type + PPSDL_GameController = ^PSDL_GameController; + PSDL_GameController = type Pointer; + + PPSDL_GameControllerType = ^PSDL_GameControllerType; + PSDL_GameControllerType = ^TSDL_GameControllerType; + TSDL_GameControllerType = type cint; +const + SDL_CONTROLLER_TYPE_UNKNOWN = TSDL_GameControllerType(0); + SDL_CONTROLLER_TYPE_XBOX360 = TSDL_GameControllerType(1); + SDL_CONTROLLER_TYPE_XBOXONE = TSDL_GameControllerType(2); + SDL_CONTROLLER_TYPE_PS3 = TSDL_GameControllerType(3); + SDL_CONTROLLER_TYPE_PS4 = TSDL_GameControllerType(4); + SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO = TSDL_GameControllerType(5); + SDL_CONTROLLER_TYPE_VIRTUAL = TSDL_GameControllerType(6); + SDL_CONTROLLER_TYPE_PS5 = TSDL_GameControllerType(7); + SDL_CONTROLLER_TYPE_AMAZON_LUNA = TSDL_GameControllerType(8); + SDL_CONTROLLER_TYPE_GOOGLE_STADIA = TSDL_GameControllerType(9); + SDL_CONTROLLER_TYPE_NVIDIA_SHIELD = TSDL_GameControllerType(10); + SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT = TSDL_GameControllerType(11); + SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT = TSDL_GameControllerType(12); + SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR = TSDL_GameControllerType(13); + +type + PPSDL_GameControllerBindType = ^PSDL_GameControllerBindType; + PSDL_GameControllerBindType = ^TSDL_GameControllerBindType; + TSDL_GameControllerBindType = type cint; +const + SDL_CONTROLLER_BINDTYPE_NONE = TSDL_GameControllerBindType(0); + SDL_CONTROLLER_BINDTYPE_BUTTON = TSDL_GameControllerBindType(1); + SDL_CONTROLLER_BINDTYPE_AXIS = TSDL_GameControllerBindType(2); + SDL_CONTROLLER_BINDTYPE_HAT = TSDL_GameControllerBindType(3); + + {** + * Get the SDL joystick layer binding for this controller button/axis mapping + *} +type + THat = record + hat: cint; + hat_mask: cint; + end; + + PPSDL_GameControllerButtonBind = ^PSDL_GameControllerButtonBind; + PSDL_GameControllerButtonBind = ^TSDL_GameControllerButtonBind; + TSDL_GameControllerButtonBind = record + bindType: TSDL_GameControllerBindType; + case cint of + 0: ( button: cint; ); + 1: ( axis: cint; ); + 2: ( hat: THat; ); + end; + + {** + * To count the number of game controllers in the system for the following: + * int nJoysticks = SDL_NumJoysticks(); + * int nGameControllers = 0; + * for ( int i = 0; i < nJoysticks; i++ ) [ + * if ( SDL_IsGameController(i) ) [ + * nGameControllers++; + * + * !! Pascal Conv.: Changed curly to square brackets in above example code + to prevent opening comment blocks! + * + * Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is: + * guid,name,mappings + * + * Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones. + * Under Windows there is a reserved GUID of "xinput" that covers any XInput devices. + * The mapping format for joystick is: + * bX - a joystick button, index X + * hX.Y - hat X with value Y + * aX - axis X of the joystick + * Buttons can be used as a controller axis and vice versa. + * + * This string shows an example of a valid mapping for a controller + * "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7", + * + *} + + {** + * Add or update an existing mapping configuration + * + * 1 if mapping is added, 0 if updated, -1 on error + *} +function SDL_GameControllerAddMapping( mappingString: PAnsiChar ): cint cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerAddMapping' {$ENDIF} {$ENDIF}; + + {** + * Load a set of mappings from a seekable SDL data stream (memory or file), filtered by the current SDL_GetPlatform() + * A community sourced database of controllers is available at https://raw.github.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt + * + * If freerw is non-zero, the stream will be closed after being read. + * + * Returns number of mappings added, -1 on error + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerAddMappingsFromRW_fun = function(rw: PSDL_RWops; freerw: cint32):cint32; + cdecl; +Var + SDL_GameControllerAddMappingsFromRW : TSDL_GameControllerAddMappingsFromRW_fun = Nil; +{$else} + +function SDL_GameControllerAddMappingsFromRW(rw: PSDL_RWops; freerw: cint32):cint32; + cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerAddMappingsFromRW' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the number of mappings installed. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerNumMappings_fun = function():cint; cdecl; +Var + SDL_GameControllerNumMappings : TSDL_GameControllerNumMappings_fun = Nil; +{$else} + +function SDL_GameControllerNumMappings():cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerNumMappings' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get a mapping string for a GUID + * + * the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available + *} +function SDL_GameControllerMappingForGUID( guid: TSDL_JoystickGUID ): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerMappingForGUID' {$ENDIF} {$ENDIF}; + +{** + * Get the mapping at a particular index. + * + * Returns the mapping string. Must be freed with SDL_free(). + * Returns NIL if the index is out of range. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerMappingForIndex_fun = function(mapping_index: cint): PAnsiChar; cdecl; +Var + SDL_GameControllerMappingForIndex : TSDL_GameControllerMappingForIndex_fun = Nil; +{$else} + +function SDL_GameControllerMappingForIndex(mapping_index: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerMappingForIndex' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get a mapping string for an open GameController + * + * the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available + *} +function SDL_GameControllerMapping( gamecontroller: PSDL_GameController ): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerMapping' {$ENDIF} {$ENDIF}; + + {** + * Is the joystick on this index supported by the game controller interface? + *} +function SDL_IsGameController(joystick_index: cint): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsGameController' {$ENDIF} {$ENDIF}; + + {** + * Get the implementation dependent name of a game controller. + * This can be called before any controllers are opened. + * If no name can be found, this function returns NULL. + *} +function SDL_GameControllerNameForIndex(joystick_index: cint): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerNameForIndex' {$ENDIF} {$ENDIF}; + +{** + * Get the implementation dependent path for the game controller. + * + * This function can be called before any controllers are opened. + * + * `joystick_index` is the same as the `device_index` passed to + * SDL_JoystickOpen(). + * + * \param joystick_index the device_index of a device, from zero to + * SDL_NumJoysticks()-1 + * \returns the implementation-dependent path for the game controller, or NIL + * if there is no path or the index is invalid. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GameControllerPath + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerPathForIndex_fun = function(joystick_index: cint): PAnsiChar; cdecl; +Var + SDL_GameControllerPathForIndex : TSDL_GameControllerPathForIndex_fun = Nil; +{$else} + +function SDL_GameControllerPathForIndex(joystick_index: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerPathForIndex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the type of a game controller. + * This can be called before any controllers are opened. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerTypeForIndex_fun = function(joystick_index: cint): TSDL_GameControllerType; cdecl; +Var + SDL_GameControllerTypeForIndex : TSDL_GameControllerTypeForIndex_fun = Nil; +{$else} + +function SDL_GameControllerTypeForIndex(joystick_index: cint): TSDL_GameControllerType; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerTypeForIndex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the mapping of a game controller. + * This can be called before any controllers are opened. + * + * Returns the mapping string. Must be freed with SDL_free(). + * Returns NIL if no mapping is available. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerMappingForDeviceIndex_fun = function(joystick_index: cint): PAnsiChar; cdecl; +Var + SDL_GameControllerMappingForDeviceIndex : TSDL_GameControllerMappingForDeviceIndex_fun = Nil; +{$else} + +function SDL_GameControllerMappingForDeviceIndex(joystick_index: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerMappingForDeviceIndex' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Open a game controller for use. + * The index passed as an argument refers to the N'th game controller on the system. + * This index is the value which will identify this controller in future controller + * events. + * + * A controller identifier, or NULL if an error occurred. + *} +function SDL_GameControllerOpen(joystick_index: cint): PSDL_GameController cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerOpen' {$ENDIF} {$ENDIF}; + + {** + * Return the SDL_GameController associated with an instance id. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerFromInstanceID_fun = function(joyid: TSDL_JoystickID): PSDL_GameController; cdecl; +Var + SDL_GameControllerFromInstanceID : TSDL_GameControllerFromInstanceID_fun = Nil; +{$else} + +function SDL_GameControllerFromInstanceID(joyid: TSDL_JoystickID): PSDL_GameController; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerFromInstanceID' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the SDL_GameController associated with a player index. + * + * Please note that the player index is _not_ the device index, nor is it the + * instance id! + * + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerFromPlayerIndex_fun = function(player_index: cint): PSDL_GameController; cdecl; +Var + SDL_GameControllerFromPlayerIndex : TSDL_GameControllerFromPlayerIndex_fun = Nil; +{$else} + +function SDL_GameControllerFromPlayerIndex(player_index: cint): PSDL_GameController; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerFromPlayerIndex' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Return the name for this currently opened controller + *} +function SDL_GameControllerName(gamecontroller: PSDL_GameController): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerName' {$ENDIF} {$ENDIF}; + +{** + * Get the implementation-dependent path for an opened game controller. + * + * This is the same path as returned by SDL_GameControllerNameForIndex(), but + * it takes a controller identifier instead of the (unstable) device index. + * + * \param gamecontroller a game controller identifier previously returned by + * SDL_GameControllerOpen() + * \returns the implementation dependent path for the game controller, or NIL + * if there is no path or the identifier passed is invalid. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GameControllerPathForIndex + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerPath_fun = function(gamecontroller: PSDL_GameController): PAnsiChar; cdecl; +Var + SDL_GameControllerPath : TSDL_GameControllerPath_fun = Nil; +{$else} + +function SDL_GameControllerPath(gamecontroller: PSDL_GameController): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerPath' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the type of this currently opened controller + * + * This is the same name as returned by SDL_GameControllerTypeForIndex(), but + * it takes a controller identifier instead of the (unstable) device index. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetType_fun = function(gamecontroller: PSDL_GameController): TSDL_GameControllerType; cdecl; +Var + SDL_GameControllerGetType : TSDL_GameControllerGetType_fun = Nil; +{$else} + +function SDL_GameControllerGetType(gamecontroller: PSDL_GameController): TSDL_GameControllerType; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetType' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the player index of an opened game controller. + * For XInput controllers this returns the XInput user index. + * + * Returns the player index for controller, or -1 if it's not available. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetPlayerIndex_fun = function(gamecontroller: PSDL_GameController): cint; cdecl; +Var + SDL_GameControllerGetPlayerIndex : TSDL_GameControllerGetPlayerIndex_fun = Nil; +{$else} + +function SDL_GameControllerGetPlayerIndex(gamecontroller: PSDL_GameController): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetPlayerIndex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Set the player index of an opened game controller. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerSetPlayerIndex_proc = procedure(gamecontroller: PSDL_GameController; player_index: cint); cdecl; +Var + SDL_GameControllerSetPlayerIndex : TSDL_GameControllerSetPlayerIndex_proc = Nil; +{$else} + +procedure SDL_GameControllerSetPlayerIndex(gamecontroller: PSDL_GameController; player_index: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerSetPlayerIndex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the USB vendor ID of an opened controller, if available. + * + * If the vendor ID isn't available this function returns 0. + * + * \param gamecontroller the game controller object to query. + * \return the USB vendor ID, or zero if unavailable. + * + * \since This function is available since SDL 2.0.6. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetVendor_fun = function(gamecontroller: PSDL_GameController): cuint16; cdecl; +Var + SDL_GameControllerGetVendor : TSDL_GameControllerGetVendor_fun = Nil; +{$else} + +function SDL_GameControllerGetVendor(gamecontroller: PSDL_GameController): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetVendor' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the USB product ID of an opened controller, if available. + * If the product ID isn't available, this function returns 0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetProduct_fun = function(gamecontroller: PSDL_GameController): cuint16; cdecl; +Var + SDL_GameControllerGetProduct : TSDL_GameControllerGetProduct_fun = Nil; +{$else} + +function SDL_GameControllerGetProduct(gamecontroller: PSDL_GameController): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetProduct' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the product version of an opened controller, if available. + * If the product version isn't available, this function returns 0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetProductVersion_fun = function(gamecontroller: PSDL_GameController): cuint16; cdecl; +Var + SDL_GameControllerGetProductVersion : TSDL_GameControllerGetProductVersion_fun = Nil; +{$else} + +function SDL_GameControllerGetProductVersion(gamecontroller: PSDL_GameController): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetProductVersion' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the firmware version of an opened controller, if available. + * + * If the firmware version isn't available this function returns 0. + * + * \param gamecontroller the game controller object to query. + * \return the controller firmware version, or zero if unavailable. + * + * \since This function is available since SDL 2.24.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetFirmwareVersion_fun = function(gamecontroller: PSDL_GameController): cuint16; cdecl; +Var + SDL_GameControllerGetFirmwareVersion : TSDL_GameControllerGetFirmwareVersion_fun = Nil; +{$else} + +function SDL_GameControllerGetFirmwareVersion(gamecontroller: PSDL_GameController): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetFirmwareVersion' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the serial number of an opened controller, if available. + * + * Returns a string containing the serial number of the controller, + * or NIL if it is not available. Do _not_ free the string with SDL_free(). + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetSerial_fun = function(gamecontroller: PSDL_GameController): PAnsiChar; cdecl; +Var + SDL_GameControllerGetSerial : TSDL_GameControllerGetSerial_fun = Nil; +{$else} + +function SDL_GameControllerGetSerial(gamecontroller: PSDL_GameController): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetSerial' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the Steam Input handle of an opened controller, if available. + * + * Returns an InputHandle_t for the controller that can be used with Steam Input API: + * https://partner.steamgames.com/doc/api/ISteamInput + * + * \param gamecontroller the game controller object to query. + * \returns the gamepad handle, or 0 if unavailable. + * + * \since This function is available since SDL 2.30.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetSteamHandle_fun = function(gamecontroller: PSDL_GameController): cuint64; cdecl; +Var + SDL_GameControllerGetSteamHandle : TSDL_GameControllerGetSteamHandle_fun = Nil; +{$else} + +function SDL_GameControllerGetSteamHandle(gamecontroller: PSDL_GameController): cuint64; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetSteamHandle' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Returns SDL_TRUE if the controller has been opened and currently connected, + * or SDL_FALSE if it has not. + *} +function SDL_GameControllerGetAttached(gamecontroller: PSDL_GameController): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetAttached' {$ENDIF} {$ENDIF}; + + {** + * Get the underlying joystick object used by a controller + *} +function SDL_GameControllerGetJoystick(gamecontroller: PSDL_GameController): PSDL_Joystick cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetJoystick' {$ENDIF} {$ENDIF}; + + {** + * Enable/disable controller event polling. + * + * If controller events are disabled, you must call SDL_GameControllerUpdate() + * yourself and check the state of the controller when you want controller + * information. + * + * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE. + *} +function SDL_GameControllerEventState(state: cint): cint cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerEventState' {$ENDIF} {$ENDIF}; + + {** + * Update the current state of the open game controllers. + * + * This is called automatically by the event loop if any game controller + * events are enabled. + *} +procedure SDL_GameControllerUpdate() cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerUpdate' {$ENDIF} {$ENDIF}; + + {** + * The list of axes available from a controller + *} + +type + PPSDL_GameControllerAxis = ^PSDL_GameControllerAxis; + PSDL_GameControllerAxis = ^TSDL_GameControllerAxis; + TSDL_GameControllerAxis = type cint; +const + SDL_CONTROLLER_AXIS_INVALID = TSDL_GameControllerAxis(-1); + SDL_CONTROLLER_AXIS_LEFTX = TSDL_GameControllerAxis(0); + SDL_CONTROLLER_AXIS_LEFTY = TSDL_GameControllerAxis(1); + SDL_CONTROLLER_AXIS_RIGHTX = TSDL_GameControllerAxis(2); + SDL_CONTROLLER_AXIS_RIGHTY = TSDL_GameControllerAxis(3); + SDL_CONTROLLER_AXIS_TRIGGERLEFT = TSDL_GameControllerAxis(4); + SDL_CONTROLLER_AXIS_TRIGGERRIGHT = TSDL_GameControllerAxis(5); + SDL_CONTROLLER_AXIS_MAX = TSDL_GameControllerAxis(6); + + {** + * turn this string into a axis mapping + *} +function SDL_GameControllerGetAxisFromString(pchString: PAnsiChar): TSDL_GameControllerAxis cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetAxisFromString' {$ENDIF} {$ENDIF}; + + {** + * turn this axis enum into a string mapping + *} +function SDL_GameControllerGetStringForAxis(axis: TSDL_GameControllerAxis): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetStringForAxis' {$ENDIF} {$ENDIF}; + + {** + * Get the SDL joystick layer binding for this controller button mapping + *} +function SDL_GameControllerGetBindForAxis(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): TSDL_GameControllerButtonBind cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetBindForAxis' {$ENDIF} {$ENDIF}; + +{** + * Query whether a game controller has a given axis. + * + * This merely reports whether the controller's mapping defined this axis, + * as that is all the information SDL has about the physical device. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerHasAxis_fun = function(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): TSDL_Bool; cdecl; +Var + SDL_GameControllerHasAxis : TSDL_GameControllerHasAxis_fun = Nil; +{$else} + +function SDL_GameControllerHasAxis(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasAxis' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the current state of an axis control on a game controller. + * + * The state is a value ranging from -32768 to 32767. + * + * The axis indices start at index 0. + *} +function SDL_GameControllerGetAxis(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): cint16 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetAxis' {$ENDIF} {$ENDIF}; + + {** + * The list of buttons available from a controller + *} +type + PPSDL_GameControllerButton = ^PSDL_GameControllerButton; + PSDL_GameControllerButton = ^TSDL_GameControllerButton; + TSDL_GameControllerButton = type cint; +const + SDL_CONTROLLER_BUTTON_INVALID = TSDL_GameControllerButton(-1); + SDL_CONTROLLER_BUTTON_A = TSDL_GameControllerButton(0); + SDL_CONTROLLER_BUTTON_B = TSDL_GameControllerButton(1); + SDL_CONTROLLER_BUTTON_X = TSDL_GameControllerButton(2); + SDL_CONTROLLER_BUTTON_Y = TSDL_GameControllerButton(3); + SDL_CONTROLLER_BUTTON_BACK = TSDL_GameControllerButton(4); + SDL_CONTROLLER_BUTTON_GUIDE = TSDL_GameControllerButton(5); + SDL_CONTROLLER_BUTTON_START = TSDL_GameControllerButton(6); + SDL_CONTROLLER_BUTTON_LEFTSTICK = TSDL_GameControllerButton(7); + SDL_CONTROLLER_BUTTON_RIGHTSTICK = TSDL_GameControllerButton(8); + SDL_CONTROLLER_BUTTON_LEFTSHOULDER = TSDL_GameControllerButton(9); + SDL_CONTROLLER_BUTTON_RIGHTSHOULDER = TSDL_GameControllerButton(10); + SDL_CONTROLLER_BUTTON_DPAD_UP = TSDL_GameControllerButton(11); + SDL_CONTROLLER_BUTTON_DPAD_DOWN = TSDL_GameControllerButton(12); + SDL_CONTROLLER_BUTTON_DPAD_LEFT = TSDL_GameControllerButton(13); + SDL_CONTROLLER_BUTTON_DPAD_RIGHT = TSDL_GameControllerButton(14); + SDL_CONTROLLER_BUTTON_MISC1 = TSDL_GameControllerButton(15); {**< Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button *} + SDL_CONTROLLER_BUTTON_PADDLE1 = TSDL_GameControllerButton(16); {**< Xbox Elite paddle P1 *} + SDL_CONTROLLER_BUTTON_PADDLE2 = TSDL_GameControllerButton(17); {**< Xbox Elite paddle P3 *} + SDL_CONTROLLER_BUTTON_PADDLE3 = TSDL_GameControllerButton(18); {**< Xbox Elite paddle P2 *} + SDL_CONTROLLER_BUTTON_PADDLE4 = TSDL_GameControllerButton(19); {**< Xbox Elite paddle P4 *} + SDL_CONTROLLER_BUTTON_TOUCHPAD = TSDL_GameControllerButton(20); {**< PS4/PS5 touchpad button *} + SDL_CONTROLLER_BUTTON_MAX = TSDL_GameControllerButton(21); + + {** + * turn this string into a button mapping + *} +function SDL_GameControllerGetButtonFromString(pchString: PAnsiChar): TSDL_GameControllerButton cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetButtonFromString' {$ENDIF} {$ENDIF}; + + {** + * turn this button enum into a string mapping + *} +function SDL_GameControllerGetStringForButton(button: TSDL_GameControllerButton): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetStringForButton' {$ENDIF} {$ENDIF}; + +{** + * Get the SDL joystick layer binding for this controller button mapping + *} +function SDL_GameControllerGetBindForButton(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): TSDL_GameControllerButtonBind cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetBindForButton' {$ENDIF} {$ENDIF}; + +{** + * Query whether a game controller has a given button. + * + * This merely reports whether the controller's mapping defined this button, + * as that is all the information SDL has about the physical device. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerHasButton_fun = function(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): TSDL_Bool; cdecl; +Var + SDL_GameControllerHasButton : TSDL_GameControllerHasButton_fun = Nil; +{$else} + +function SDL_GameControllerHasButton(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasButton' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the current state of a button on a game controller. + * + * The button indices start at index 0. + *} +function SDL_GameControllerGetButton(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): cuint8 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetButton' {$ENDIF} {$ENDIF}; + +{** + * Get the number of touchpads on a game controller. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetNumTouchpads_fun = function(gamecontroller: PSDL_GameController): cint; cdecl; +Var + SDL_GameControllerGetNumTouchpads : TSDL_GameControllerGetNumTouchpads_fun = Nil; +{$else} + +function SDL_GameControllerGetNumTouchpads(gamecontroller: PSDL_GameController): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetNumTouchpads' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the number of supported simultaneous fingers on a touchpad on a game controller. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetNumTouchpadFingers_fun = function(gamecontroller: PSDL_GameController; touchpad: cint): cint; cdecl; +Var + SDL_GameControllerGetNumTouchpadFingers : TSDL_GameControllerGetNumTouchpadFingers_fun = Nil; +{$else} + +function SDL_GameControllerGetNumTouchpadFingers(gamecontroller: PSDL_GameController; touchpad: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetNumTouchpadFingers' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the current state of a finger on a touchpad on a game controller. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetTouchpadFinger_fun = function( + gamecontroller: PSDL_GameController; + touchpad, finger: cint; + state: pcuint8; + x, y, pressure: pcfloat + ): cint; cdecl; +Var + SDL_GameControllerGetTouchpadFinger : TSDL_GameControllerGetTouchpadFinger_fun = Nil; +{$else} + +function SDL_GameControllerGetTouchpadFinger( + gamecontroller: PSDL_GameController; + touchpad, finger: cint; + state: pcuint8; + x, y, pressure: pcfloat +): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetTouchpadFinger' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Return whether a game controller has a particular sensor. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerHasSensor_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): TSDL_Bool; cdecl; +Var + SDL_GameControllerHasSensor : TSDL_GameControllerHasSensor_fun = Nil; +{$else} + +function SDL_GameControllerHasSensor(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasSensor' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Set whether data reporting for a game controller sensor is enabled. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerSetSensorEnabled_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; enabled: TSDL_bool): cint; cdecl; +Var + SDL_GameControllerSetSensorEnabled : TSDL_GameControllerSetSensorEnabled_fun = Nil; +{$else} + +function SDL_GameControllerSetSensorEnabled(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; enabled: TSDL_bool): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerSetSensorEnabled' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Query whether sensor data reporting is enabled for a game controller. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerIsSensorEnabled_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): TSDL_Bool; cdecl; +Var + SDL_GameControllerIsSensorEnabled : TSDL_GameControllerIsSensorEnabled_fun = Nil; +{$else} + +function SDL_GameControllerIsSensorEnabled(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerIsSensorEnabled' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the data rate (number of events per second) of + * a game controller sensor. + * + * Returns the data rate, or 0.0 if the data rate is not available. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetSensorDataRate_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): cfloat; cdecl; +Var + SDL_GameControllerGetSensorDataRate : TSDL_GameControllerGetSensorDataRate_fun = Nil; +{$else} + +function SDL_GameControllerGetSensorDataRate(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetSensorDataRate' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the current state of a game controller sensor. + * + * The number of values and interpretation of the data is sensor dependent. + * See sdlsensor.inc for the details for each type of sensor. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetSensorData_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; data: pcfloat; num_values: cint): cint; cdecl; +Var + SDL_GameControllerGetSensorData : TSDL_GameControllerGetSensorData_fun = Nil; +{$else} + +function SDL_GameControllerGetSensorData(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; data: pcfloat; num_values: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetSensorData' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the current state of a game controller sensor with the timestamp of the + * last update. + * + * The number of values and interpretation of the data is sensor dependent. + * See SDL_sensor.h for the details for each type of sensor. + * + * \param gamecontroller The controller to query + * \param type The type of sensor to query + * \param timestamp A pointer filled with the timestamp in microseconds of the + * current sensor reading if available, or 0 if not + * \param data A pointer filled with the current sensor state + * \param num_values The number of values to write to data + * \return 0 or -1 if an error occurred. + * + * \since This function is available since SDL 2.26.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetSensorDataWithTimestamp_fun = function( + gamecontroller: PSDL_GameController; + senstype: TSDL_SensorType; + timestamp: pcuint64; + data: pcfloat; + num_values: cint + ): cint; cdecl; +Var + SDL_GameControllerGetSensorDataWithTimestamp : TSDL_GameControllerGetSensorDataWithTimestamp_fun = Nil; +{$else} + +function SDL_GameControllerGetSensorDataWithTimestamp( + gamecontroller: PSDL_GameController; + senstype: TSDL_SensorType; + timestamp: pcuint64; + data: pcfloat; + num_values: cint +): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetSensorDataWithTimestamp' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Query whether a game controller has rumble support. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerHasRumble_fun = function(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; +Var + SDL_GameControllerHasRumble : TSDL_GameControllerHasRumble_fun = Nil; +{$else} + +function SDL_GameControllerHasRumble(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasRumble' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Start a rumble effect on a game controller. + * + * Each call to this function cancels any previous rumble effect, and calling + * it with 0 intensity stops any rumbling. + * + * Returns 0, or -1 if rumble isn't supported on this controller. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerRumble_fun = function( + gamecontroller: PSDL_GameController; + low_frequency_rumble, high_frequency_rumble: cuint16; + duration_ms: cuint32 + ): cint; cdecl; + +Var + SDL_GameControllerRumble : TSDL_GameControllerRumble_fun = Nil; +{$else} + +function SDL_GameControllerRumble( + gamecontroller: PSDL_GameController; + low_frequency_rumble, high_frequency_rumble: cuint16; + duration_ms: cuint32 +): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerRumble' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Query whether a game controller has rumble support on triggers. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerHasRumbleTriggers_fun = function(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; +Var + SDL_GameControllerHasRumbleTriggers : TSDL_GameControllerHasRumbleTriggers_fun = Nil; +{$else} + +function SDL_GameControllerHasRumbleTriggers(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasRumbleTriggers' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Start a rumble effect in the game controller's triggers. + * + * Each call to this function cancels any previous trigger rumble effect, and + * calling it with 0 intensity stops any rumbling. + * + * Note that this is rumbling of the _triggers_ and not the game controller as + * a whole. This is currently only supported on Xbox One controllers. If you + * want the (more common) whole-controller rumble, use + * SDL_GameControllerRumble() instead. + * + * Returns 0, or -1 if trigger rumble isn't supported on this controller + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerRumbleTriggers_fun = function( + gamecontroller: PSDL_GameController; + left_rumble, right_rumble: cuint16; + duration_ms: cuint32 + ): cint; cdecl; + +Var + SDL_GameControllerRumbleTriggers : TSDL_GameControllerRumbleTriggers_fun = Nil; +{$else} + +function SDL_GameControllerRumbleTriggers( + gamecontroller: PSDL_GameController; + left_rumble, right_rumble: cuint16; + duration_ms: cuint32 +): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerRumbleTriggers' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Query whether a game controller has an LED. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerHasLED_fun = function(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; +Var + SDL_GameControllerHasLED : TSDL_GameControllerHasLED_fun = Nil; +{$else} + +function SDL_GameControllerHasLED(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasLED' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Update a game controller's LED color. + * + * Returns 0, or -1 if this controller does not have a modifiable LED. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerSetLED_fun = function(gamecontroller: PSDL_GameController; red, green, blue: cuint8): cint; cdecl; +Var + SDL_GameControllerSetLED : TSDL_GameControllerSetLED_fun = Nil; +{$else} + +function SDL_GameControllerSetLED(gamecontroller: PSDL_GameController; red, green, blue: cuint8): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerSetLED' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Send a controller-specific effect packet. + * + * Returns 0, or -1 if this controller or driver does not + * support effect packets. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerSendEffect_fun = function(gamecontroller: PSDL_GameController; data: Pointer; size: cint): cint; cdecl; +Var + SDL_GameControllerSendEffect : TSDL_GameControllerSendEffect_fun = Nil; +{$else} + +function SDL_GameControllerSendEffect(gamecontroller: PSDL_GameController; data: Pointer; size: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerSendEffect' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Close a controller previously opened with SDL_GameControllerOpen(). + *} +procedure SDL_GameControllerClose(gamecontroller: PSDL_GameController) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerClose' {$ENDIF} {$ENDIF}; + +{** + * Return the sfSymbolsName for a given axis on a game controller + * on Apple platforms. + * + * Returns the sfSymbolsName, or NIL if the name can't be found. + * Do _not_ pass this string to SDL_free(). + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetAppleSFSymbolsNameForAxis_fun = function(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): PAnsiChar; cdecl; +Var + SDL_GameControllerGetAppleSFSymbolsNameForAxis : TSDL_GameControllerGetAppleSFSymbolsNameForAxis_fun = Nil; +{$else} + +function SDL_GameControllerGetAppleSFSymbolsNameForAxis(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetAppleSFSymbolsNameForAxis' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Return the sfSymbolsName for a given button on a game controller + * on Apple platforms. + * + * Returns the sfSymbolsName, or NIL if the name can't be found. + * Do _not_ pass this string to SDL_free(). + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetAppleSFSymbolsNameForButton_fun = function(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): PAnsiChar; cdecl; +Var + SDL_GameControllerGetAppleSFSymbolsNameForButton : TSDL_GameControllerGetAppleSFSymbolsNameForButton_fun = Nil; +{$else} + +function SDL_GameControllerGetAppleSFSymbolsNameForButton(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetAppleSFSymbolsNameForButton' {$ENDIF} {$ENDIF}; +{$endif} + + +function SDL_GameControllerAddMappingsFromFile(Const FilePath:PAnsiChar):cint32; diff --git a/units/sdlgesture.inc b/units/sdlgesture.inc index 8ab4db4d..c24c2a8e 100644 --- a/units/sdlgesture.inc +++ b/units/sdlgesture.inc @@ -1,72 +1,104 @@ -//from "sdl_gesture.h" - -type - PPSDL_GestureID = ^PSDL_GestureID; - PSDL_GestureID = ^TSDL_GestureID; - TSDL_GestureID = type cint64; - - {* Function prototypes *} - - {/** - * Begin recording a gesture on a specified touch device or all touch devices. - * - * If the parameter `touchId` is -1 (i.e., all devices), this function will - * always return 1, regardless of whether there actually are any devices. - * - * \param touchId the touch device id, or -1 for all touch devices - * \returns 1 on success or 0 if the specified device could not be found. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetTouchDevice - *} -function SDL_RecordGesture(touchId: TSDL_TouchID): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RecordGesture' {$ENDIF} {$ENDIF}; - - {** - * Save all currently loaded Dollar Gesture templates. - * - * \param dst a SDL_RWops to save to - * \returns the number of saved templates on success or 0 on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_LoadDollarTemplates - * \sa SDL_SaveDollarTemplate - *} -function SDL_SaveAllDollarTemplates(dst: PSDL_RWops): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SaveAllDollarTemplates' {$ENDIF} {$ENDIF}; - - {** - * Save a currently loaded Dollar Gesture template. - * - * \param gestureId a gesture id - * \param dst a SDL_RWops to save to - * \returns 1 on success or 0 on failure; call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_LoadDollarTemplates - * \sa SDL_SaveAllDollarTemplates - *} -function SDL_SaveDollarTemplate(gestureId: TSDL_GestureID; dst: PSDL_RWops): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SaveDollarTemplate' {$ENDIF} {$ENDIF}; - - - {** - * Load Dollar Gesture templates from a file. - * - * \param touchId a touch id - * \param src a SDL_RWops to load from - * \returns the number of loaded templates on success or a negative error code - * (or 0) on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_SaveAllDollarTemplates - * \sa SDL_SaveDollarTemplate - *} -function SDL_LoadDollarTemplates(touchId: TSDL_TouchID; src: PSDL_RWops): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadDollarTemplates' {$ENDIF} {$ENDIF}; +//from "sdl_gesture.h" + +type + PPSDL_GestureID = ^PSDL_GestureID; + PSDL_GestureID = ^TSDL_GestureID; + TSDL_GestureID = type cint64; + + {* Function prototypes *} + + {/** + * Begin recording a gesture on a specified touch device or all touch devices. + * + * If the parameter `touchId` is -1 (i.e., all devices), this function will + * always return 1, regardless of whether there actually are any devices. + * + * \param touchId the touch device id, or -1 for all touch devices + * \returns 1 on success or 0 if the specified device could not be found. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetTouchDevice + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RecordGesture_fun = function(touchId: TSDL_TouchID): cint; cdecl; +Var + SDL_RecordGesture : TSDL_RecordGesture_fun = Nil; +{$else} + +function SDL_RecordGesture(touchId: TSDL_TouchID): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RecordGesture' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Save all currently loaded Dollar Gesture templates. + * + * \param dst a SDL_RWops to save to + * \returns the number of saved templates on success or 0 on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_LoadDollarTemplates + * \sa SDL_SaveDollarTemplate + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SaveAllDollarTemplates_fun = function(dst: PSDL_RWops): cint; cdecl; +Var + SDL_SaveAllDollarTemplates : TSDL_SaveAllDollarTemplates_fun = Nil; +{$else} + +function SDL_SaveAllDollarTemplates(dst: PSDL_RWops): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SaveAllDollarTemplates' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Save a currently loaded Dollar Gesture template. + * + * \param gestureId a gesture id + * \param dst a SDL_RWops to save to + * \returns 1 on success or 0 on failure; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_LoadDollarTemplates + * \sa SDL_SaveAllDollarTemplates + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SaveDollarTemplate_fun = function(gestureId: TSDL_GestureID; dst: PSDL_RWops): cint; cdecl; +Var + SDL_SaveDollarTemplate : TSDL_SaveDollarTemplate_fun = Nil; +{$else} + +function SDL_SaveDollarTemplate(gestureId: TSDL_GestureID; dst: PSDL_RWops): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SaveDollarTemplate' {$ENDIF} {$ENDIF}; +{$endif} + + + {** + * Load Dollar Gesture templates from a file. + * + * \param touchId a touch id + * \param src a SDL_RWops to load from + * \returns the number of loaded templates on success or a negative error code + * (or 0) on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_SaveAllDollarTemplates + * \sa SDL_SaveDollarTemplate + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LoadDollarTemplates_fun = function(touchId: TSDL_TouchID; src: PSDL_RWops): cint; cdecl; +Var + SDL_LoadDollarTemplates : TSDL_LoadDollarTemplates_fun = Nil; +{$else} + +function SDL_LoadDollarTemplates(touchId: TSDL_TouchID; src: PSDL_RWops): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadDollarTemplates' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlguid.inc b/units/sdlguid.inc index cd950cef..e2978e95 100644 --- a/units/sdlguid.inc +++ b/units/sdlguid.inc @@ -1,60 +1,76 @@ -{** - * \file SDL_guid.h - * - * Include file for handling ::SDL_GUID values. - *} - -{** - * An SDL_GUID is a 128-bit identifier for an input device that - * identifies that device across runs of SDL programs on the same - * platform. If the device is detached and then re-attached to a - * different port, or if the base system is rebooted, the device - * should still report the same GUID. - * - * GUIDs are as precise as possible but are not guaranteed to - * distinguish physically distinct but equivalent devices. For - * example, two game controllers from the same vendor with the same - * product ID and revision may have the same GUID. - * - * GUIDs may be platform-dependent (i.e., the same device may report - * different GUIDs on different operating systems). - *} -type - PPSDL_GUID = ^PSDL_GUID; - PSDL_GUID = ^TSDL_GUID; - TSDL_GUID = record - data: array[0..15] of cuint8; - end; - - {** - * Get an ASCII string representation for a given ::SDL_GUID. - * - * You should supply at least 33 bytes for pszGUID. - * - * \param guid the ::SDL_GUID you wish to convert to string - * \param pszGUID buffer in which to write the ASCII string - * \param cbGUID the size of pszGUID - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_GUIDFromString - *} -procedure SDL_GUIDToString(guid: TSDL_GUID; pszGUID: PAnsiChar; cbGUID: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GUIDToString' {$ENDIF} {$ENDIF}; - -{** - * Convert a GUID string into a ::SDL_GUID structure. - * - * Performs no error checking. If this function is given a string containing - * an invalid GUID, the function will silently succeed, but the GUID generated - * will not be useful. - * - * \param pchGUID string containing an ASCII representation of a GUID - * \returns a ::SDL_GUID structure. - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_GUIDToString - *} -function SDL_GUIDFromString(const pchGUID: PAnsiChar): TSDL_GUID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GUIDFromString' {$ENDIF} {$ENDIF}; +{** + * \file SDL_guid.h + * + * Include file for handling ::SDL_GUID values. + *} + +{** + * An SDL_GUID is a 128-bit identifier for an input device that + * identifies that device across runs of SDL programs on the same + * platform. If the device is detached and then re-attached to a + * different port, or if the base system is rebooted, the device + * should still report the same GUID. + * + * GUIDs are as precise as possible but are not guaranteed to + * distinguish physically distinct but equivalent devices. For + * example, two game controllers from the same vendor with the same + * product ID and revision may have the same GUID. + * + * GUIDs may be platform-dependent (i.e., the same device may report + * different GUIDs on different operating systems). + *} +type + PPSDL_GUID = ^PSDL_GUID; + PSDL_GUID = ^TSDL_GUID; + TSDL_GUID = record + data: array[0..15] of cuint8; + end; + + {** + * Get an ASCII string representation for a given ::SDL_GUID. + * + * You should supply at least 33 bytes for pszGUID. + * + * \param guid the ::SDL_GUID you wish to convert to string + * \param pszGUID buffer in which to write the ASCII string + * \param cbGUID the size of pszGUID + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GUIDFromString + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GUIDToString_proc = procedure(guid: TSDL_GUID; pszGUID: PAnsiChar; cbGUID: cint); cdecl; +Var + SDL_GUIDToString : TSDL_GUIDToString_proc = Nil; +{$else} + +procedure SDL_GUIDToString(guid: TSDL_GUID; pszGUID: PAnsiChar; cbGUID: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GUIDToString' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Convert a GUID string into a ::SDL_GUID structure. + * + * Performs no error checking. If this function is given a string containing + * an invalid GUID, the function will silently succeed, but the GUID generated + * will not be useful. + * + * \param pchGUID string containing an ASCII representation of a GUID + * \returns a ::SDL_GUID structure. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GUIDToString + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GUIDFromString_fun = function(const pchGUID: PAnsiChar): TSDL_GUID; cdecl; +Var + SDL_GUIDFromString : TSDL_GUIDFromString_fun = Nil; +{$else} + +function SDL_GUIDFromString(const pchGUID: PAnsiChar): TSDL_GUID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GUIDFromString' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlhaptic.inc b/units/sdlhaptic.inc index 48d36b81..43e0d55a 100644 --- a/units/sdlhaptic.inc +++ b/units/sdlhaptic.inc @@ -1,1320 +1,1536 @@ -//from "sdl_haptic.h" - -{** - * - * The SDL Haptic subsystem allows you to control haptic (force feedback) - * devices. - * - * The basic usage is as follows: - * - Initialize the Subsystem (::SDL_INIT_HAPTIC). - * - Open a Haptic Device. - * - SDL_HapticOpen() to open from index. - * - SDL_HapticOpenFromJoystick() to open from an existing joystick. - * - Create an effect (::SDL_HapticEffect). - * - Upload the effect with SDL_HapticNewEffect(). - * - Run the effect with SDL_HapticRunEffect(). - * - (optional) Free the effect with SDL_HapticDestroyEffect(). - * - Close the haptic device with SDL_HapticClose(). - * - * Simple rumble example: - * - * SDL_Haptic *haptic; - * - * // Open the device - * haptic = SDL_HapticOpen( 0 ); - * if (haptic == NULL) - * return -1; - * - * // Initialize simple rumble - * if (SDL_HapticRumbleInit( haptic ) != 0) - * return -1; - * - * // Play effect at 50% strength for 2 seconds - * if (SDL_HapticRumblePlay( haptic, 0.5, 2000 ) != 0) - * return -1; - * SDL_Delay( 2000 ); - * - * // Clean up - * SDL_HapticClose( haptic ); - * - * - * Complete example: - * - * int test_haptic( SDL_Joystick * joystick ) - * SDL_Haptic *haptic; - * SDL_HapticEffect effect; - * int effect_id; - * - * // Open the device - * haptic = SDL_HapticOpenFromJoystick( joystick ); - * if (haptic == NULL) return -1; // Most likely joystick isn't haptic - * - * // See if it can do sine waves - * if ((SDL_HapticQuery(haptic) & SDL_HAPTIC_SINE)==0) - * SDL_HapticClose(haptic); // No sine effect - * return -1; - * - * - * // Create the effect - * memset( &effect, 0, sizeof(SDL_HapticEffect) ); // 0 is safe default - * effect.type = SDL_HAPTIC_SINE; - * effect.periodic.direction.type = SDL_HAPTIC_POLAR; // Polar coordinates - * effect.periodic.direction.dir[0] = 18000; // Force comes from south - * effect.periodic.period = 1000; // 1000 ms - * effect.periodic.magnitude = 20000; // 20000/32767 strength - * effect.periodic.length = 5000; // 5 seconds long - * effect.periodic.attack_length = 1000; // Takes 1 second to get max strength - * effect.periodic.fade_length = 1000; // Takes 1 second to fade away - * - * // Upload the effect - * effect_id = SDL_HapticNewEffect( haptic, &effect ); - * - * // Test the effect - * SDL_HapticRunEffect( haptic, effect_id, 1 ); - * SDL_Delay( 5000); // Wait for the effect to finish - * - * // We destroy the effect, although closing the device also does this - * SDL_HapticDestroyEffect( haptic, effect_id ); - * - * // Close the device - * SDL_HapticClose(haptic); - * - * return 0; // Success - *} - - {** - * SDL_Haptic - * - * The haptic structure used to identify an SDL haptic. - * - * SDL_HapticOpen - * SDL_HapticOpenFromJoystick - * SDL_HapticClose - *} -type - PPSDL_Haptic = ^PSDL_Haptic; - PSDL_Haptic = type Pointer; - - {** - * Haptic features - * - * Different haptic features a device can have. - *} - - {** - * Haptic effects - *} - - {** - * Constant effect supported. - * - * Constant haptic effect. - * - * SDL_HapticCondition - *} -const - SDL_HAPTIC_CONSTANT = (1 shl 0); - - {** - * Sine wave effect supported. - * - * Periodic haptic effect that simulates sine waves. - * - * SDL_HapticPeriodic - *} -const - SDL_HAPTIC_SINE = (1 shl 1); - - {** - * Square wave effect supported. - * - * Periodic haptic effect that simulates square waves. - * - * SDL_HapticPeriodic - *} -const - SDL_HAPTIC_LEFTRIGHT = (1 shl 2); - - { !!! FIXME: put this back when we have more bits in 2.1 } - { #define SDL_HAPTIC_SQUARE (1<<2) } - SDL_HAPTIC_SQUARE = (1 shl 2); // SDL2-For-Pascal: Out-commented in C code. - // Why not keeping it for - // compatibility here? - - {** - * Triangle wave effect supported. - * - * Periodic haptic effect that simulates triangular waves. - * - * SDL_HapticPeriodic - *} -const - SDL_HAPTIC_TRIANGLE = (1 shl 3); - - {** - * Sawtoothup wave effect supported. - * - * Periodic haptic effect that simulates saw tooth up waves. - * - * SDL_HapticPeriodic - *} -const - SDL_HAPTIC_SAWTOOTHUP = (1 shl 4); - - {** - * Sawtoothdown wave effect supported. - * - * Periodic haptic effect that simulates saw tooth down waves. - * - * SDL_HapticPeriodic - *} -const - SDL_HAPTIC_SAWTOOTHDOWN = (1 shl 5); - - {** - * Ramp effect supported. - * - * Ramp haptic effect. - * - * SDL_HapticRamp - *} -const - SDL_HAPTIC_RAMP = (1 shl 6); - - {** - * Spring effect supported - uses axes position. - * - * Condition haptic effect that simulates a spring. Effect is based on the - * axes position. - * - * SDL_HapticCondition - *} -const - SDL_HAPTIC_SPRING = (1 shl 7); - - {** - * Damper effect supported - uses axes velocity. - * - * Condition haptic effect that simulates dampening. Effect is based on the - * axes velocity. - * - * SDL_HapticCondition - *} -const - SDL_HAPTIC_DAMPER = (1 shl 8); - - {** - * Inertia effect supported - uses axes acceleration. - * - * Condition haptic effect that simulates inertia. Effect is based on the axes - * acceleration. - * - * SDL_HapticCondition - *} -const - SDL_HAPTIC_INERTIA = (1 shl 9); - - {** - * Friction effect supported - uses axes movement. - * - * Condition haptic effect that simulates friction. Effect is based on the - * axes movement. - * - * SDL_HapticCondition - *} -const - SDL_HAPTIC_FRICTION = (1 shl 10); - - {** - * Custom effect is supported. - * - * User defined custom haptic effect. - *} -const - SDL_HAPTIC_CUSTOM = (1 shl 11); - - {*Haptic effects*} - - {* These last few are features the device has, not effects *} - - {** - * Device can set global gain. - * - * Device supports setting the global gain. - * - * SDL_HapticSetGain - *} -const - SDL_HAPTIC_GAIN = (1 shl 12); - - {** - * Device can set autocenter. - * - * Device supports setting autocenter. - * - * SDL_HapticSetAutocenter - *} -const - SDL_HAPTIC_AUTOCENTER = (1 shl 13); - - {** - * Device can be queried for effect status. - * - * Device can be queried for effect status. - * - * SDL_HapticGetEffectStatus - *} -const - SDL_HAPTIC_STATUS = (1 shl 14); - - {** - * Device can be paused. - * - * SDL_HapticPause - * SDL_HapticUnpause - *} -const - SDL_HAPTIC_PAUSE = (1 shl 15); - - {** - * Direction encodings - *} - - {** - * Uses polar coordinates for the direction. - * - * SDL_HapticDirection - *} -const - SDL_HAPTIC_POLAR = 0; - - {** - * Uses cartesian coordinates for the direction. - * - * SDL_HapticDirection - *} -const - SDL_HAPTIC_CARTESIAN = 1; - - {** - * Uses spherical coordinates for the direction. - * - * SDL_HapticDirection - *} -const - SDL_HAPTIC_SPHERICAL = 2; - - {** - * \brief Use this value to play an effect on the steering wheel axis. This - * provides better compatibility across platforms and devices as SDL will guess - * the correct axis. - * \sa SDL_HapticDirection - *} -const - SDL_HAPTIC_STEERING_AXIS = 3; - - {* - * Misc defines. - *} - - {** - * Used to play a device an infinite number of times. - * - * SDL_HapticRunEffect - *} -const - SDL_HAPTIC_INFINITY = 4294967295; // C: 4294967295U - - {** - * Structure that represents a haptic direction. - * - * Directions can be specified by: - * - SDL_HAPTIC_POLAR : Specified by polar coordinates. - * - SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates. - * - SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates. - * - * Cardinal directions of the haptic device are relative to the positioning - * of the device. North is considered to be away from the user. - * - * The following diagram represents the cardinal directions: - * - .--. - |__| .-------. - |=.| |.-----.| - |--| || || - | | |'-----'| - |__|~')_____(' - [ COMPUTER ] - - - North (0,-1) - ^ - | - | - (1,0) West <----[ HAPTIC ]----> East (-1,0) - | - | - v - South (0,1) - - - [ USER ] - \|||/ - (o o) - ---ooO-(_)-Ooo--- - - * - * If type is SDL_HAPTIC_POLAR, direction is encoded by hundredths of a - * degree starting north and turning clockwise. ::SDL_HAPTIC_POLAR only uses - * the first dir parameter. The cardinal directions would be: - * - North: 0 (0 degrees) - * - East: 9000 (90 degrees) - * - South: 18000 (180 degrees) - * - West: 27000 (270 degrees) - * - * If type is SDL_HAPTIC_CARTESIAN, direction is encoded by three positions - * (X axis, Y axis and Z axis (with 3 axes)). ::SDL_HAPTIC_CARTESIAN uses - * the first three dir parameters. The cardinal directions would be: - * - North: 0,-1, 0 - * - East: -1, 0, 0 - * - South: 0, 1, 0 - * - West: 1, 0, 0 - * - * The Z axis represents the height of the effect if supported, otherwise - * it's unused. In cartesian encoding (1, 2) would be the same as (2, 4), you - * can use any multiple you want, only the direction matters. - * - * If type is SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations. - * The first two dir parameters are used. The dir parameters are as - * follows (all values are in hundredths of degrees): - * - Degrees from (1, 0) rotated towards (0, 1). - * - Degrees towards (0, 0, 1) (device needs at least 3 axes). - * - * - * Example of force coming from the south with all encodings (force coming - * from the south means the user will have to pull the stick to counteract): - * - * SDL_HapticDirection direction; - * - * // Cartesian directions - * direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding. - * direction.dir[0] = 0; // X position - * direction.dir[1] = 1; // Y position - * // Assuming the device has 2 axes, we don't need to specify third parameter. - * - * // Polar directions - * direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding. - * direction.dir[0] = 18000; // Polar only uses first parameter - * - * // Spherical coordinates - * direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding - * direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters. - * - * - * SDL_HAPTIC_POLAR - * SDL_HAPTIC_CARTESIAN - * SDL_HAPTIC_SPHERICAL - * SDL_HapticEffect - * SDL_HapticNumAxes - *} -type - PPSDL_HapticDirection = ^PSDL_HapticDirection; - PSDL_HapticDirection = ^TSDL_HapticDirection; - TSDL_HapticDirection = record - type_: cuint8; {**< The type of encoding. *} - dir: array[0..2] of cint32; {**< The encoded direction. *} - end; - - {** - * A structure containing a template for a Constant effect. - * - * The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect. - * - * A constant effect applies a constant force in the specified direction - * to the joystick. - * - * SDL_HAPTIC_CONSTANT - * SDL_HapticEffect - *} -type - PPSDL_HapticConstant = ^PSDL_HapticConstant; - PSDL_HapticConstant = ^TSDL_HapticConstant; - TSDL_HapticConstant = record - {* Header *} - type_: cuint16; {**< SDL_HAPTIC_CONSTANT *} - direction: TSDL_HapticDirection; {**< Direction of the effect. *} - - {* Replay *} - length: cuint32; {**< Duration of the effect. *} - delay: cuint16; {**< Delay before starting the effect. *} - - {* Trigger *} - button: cuint16; {**< Button that triggers the effect. *} - interval: cuint16; {**< How soon it can be triggered again after button. *} - - {* Constant *} - level: cint16; {**< Strength of the constant effect. *} - - {* Envelope *} - attack_length: cuint16; {**< Duration of the attack. *} - attack_level: cuint16; {**< Level at the start of the attack. *} - fade_length: cuint16; {**< Duration of the fade. *} - fade_level: cuint16; {**< Level at the end of the fade. *} - end; - - {** - * A structure containing a template for a Periodic effect. - * - * The struct handles the following effects: - * - SDL_HAPTIC_SINE - * - SDL_HAPTIC_SQUARE - * - SDL_HAPTIC_TRIANGLE - * - SDL_HAPTIC_SAWTOOTHUP - * - SDL_HAPTIC_SAWTOOTHDOWN - * - * A periodic effect consists in a wave-shaped effect that repeats itself - * over time. The type determines the shape of the wave and the parameters - * determine the dimensions of the wave. - * - * Phase is given by hundredth of a cycle meaning that giving the phase a value - * of 9000 will displace it 25% of its period. Here are sample values: - * - 0: No phase displacement. - * - 9000: Displaced 25% of its period. - * - 18000: Displaced 50% of its period. - * - 27000: Displaced 75% of its period. - * - 36000: Displaced 100% of its period, same as 0, but 0 is preferred. - * - * Examples: - * - SDL_HAPTIC_SINE - __ __ __ __ - / \ / \ / \ / - / \__/ \__/ \__/ - - SDL_HAPTIC_SQUARE - __ __ __ __ __ - | | | | | | | | | | - | |__| |__| |__| |__| | - - SDL_HAPTIC_TRIANGLE - /\ /\ /\ /\ /\ - / \ / \ / \ / \ / - / \/ \/ \/ \/ - - SDL_HAPTIC_SAWTOOTHUP - /| /| /| /| /| /| /| - / | / | / | / | / | / | / | - / |/ |/ |/ |/ |/ |/ | - - SDL_HAPTIC_SAWTOOTHDOWN - \ |\ |\ |\ |\ |\ |\ | - \ | \ | \ | \ | \ | \ | \ | - \| \| \| \| \| \| \| - - * - * SDL_HAPTIC_SINE - * SDL_HAPTIC_SQUARE - * SDL_HAPTIC_TRIANGLE - * SDL_HAPTIC_SAWTOOTHUP - * SDL_HAPTIC_SAWTOOTHDOWN - * SDL_HapticEffect - *} -type - PPSDL_HapticPeriodic = ^PSDL_HapticPeriodic; - PSDL_HapticPeriodic = ^TSDL_HapticPeriodic; - TSDL_HapticPeriodic = record - { Header *} - type_: cuint16; {**< SDL_HAPTIC_SINE, SDL_HAPTIC_SQUARE, - SDL_HAPTIC_TRIANGLE, SDL_HAPTIC_SAWTOOTHUP or - SDL_HAPTIC_SAWTOOTHDOWN *} - direction: TSDL_HapticDirection; {**< Direction of the effect. *} - - {* Replay *} - length: cuint32; {**< Duration of the effect. *} - delay: cuint16; {**< Delay before starting the effect. *} - - {* Trigger *} - button: cuint16; {**< Button that triggers the effect. *} - interval: cuint16; {**< How soon it can be triggered again after button. *} - - {* Periodic *} - period: cuint16; {**< Period of the wave. *} - magnitude: cint16; {**< Peak value. *} - offset: cint16; {**< Mean value of the wave. *} - phase: cuint16; {**< Horizontal shift given by hundredth of a cycle. *} - - {* Envelope *} - attack_length: cuint16; {**< Duration of the attack. *} - attack_level: cuint16; {**< Level at the start of the attack. *} - fade_length: cuint16; {**< Duration of the fade. *} - fade_level: cuint16; {**< Level at the end of the fade. *} - end; - - {** - * A structure containing a template for a Condition effect. - * - * The struct handles the following effects: - * - SDL_HAPTIC_SPRING: Effect based on axes position. - * - SDL_HAPTIC_DAMPER: Effect based on axes velocity. - * - SDL_HAPTIC_INERTIA: Effect based on axes acceleration. - * - SDL_HAPTIC_FRICTION: Effect based on axes movement. - * - * Direction is handled by condition internals instead of a direction member. - * The condition effect specific members have three parameters. The first - * refers to the X axis, the second refers to the Y axis and the third - * refers to the Z axis. The right terms refer to the positive side of the - * axis and the left terms refer to the negative side of the axis. Please - * refer to the ::SDL_HapticDirection diagram for which side is positive and - * which is negative. - * - * SDL_HapticDirection - * SDL_HAPTIC_SPRING - * SDL_HAPTIC_DAMPER - * SDL_HAPTIC_INERTIA - * SDL_HAPTIC_FRICTION - * SDL_HapticEffect - *} -type - PPSDL_HapticCondition = ^PSDL_HapticCondition; - PSDL_HapticCondition = ^TSDL_HapticCondition; - TSDL_HapticCondition = record - {* Header *} - type_: cuint16; {**< SDL_HAPTIC_SPRING, SDL_HAPTIC_DAMPER, - SDL_HAPTIC_INERTIA or SDL_HAPTIC_FRICTION *} - direction: TSDL_HapticDirection; {**< Direction of the effect - Not used ATM. *} - - {* Replay *} - length: cuint32; {**< Duration of the effect. *} - delay: cuint16; {**< Delay before starting the effect. *} - - {* Trigger *} - button: cuint16; {**< Button that triggers the effect. *} - interval: cuint16; {**< How soon it can be triggered again after button. *} - - {* Condition *} - right_sat: array[0..2] of cuint16; {**< Level when joystick is to the positive side. *} - left_sat: array[0..2] of cuint16; {**< Level when joystick is to the negative side. *} - right_coeff: array[0..2] of cint16;{**< How fast to increase the force towards the positive side. *} - left_coeff: array[0..2] of cint16; {**< How fast to increase the force towards the negative side. *} - deadband: array[0..2] of cuint16; {**< Size of the dead zone. *} - center: array[0..2] of cint16; {**< Position of the dead zone. *} - end; - - {** - * A structure containing a template for a Ramp effect. - * - * This struct is exclusively for the ::SDL_HAPTIC_RAMP effect. - * - * The ramp effect starts at start strength and ends at end strength. - * It augments in linear fashion. If you use attack and fade with a ramp - * the effects get added to the ramp effect making the effect become - * quadratic instead of linear. - * - * SDL_HAPTIC_RAMP - * SDL_HapticEffect - *} -type - PPSDL_HapticRamp = ^PSDL_HapticRamp; - PSDL_HapticRamp = ^TSDL_HapticRamp; - TSDL_HapticRamp = record - {* Header *} - type_: cuint16; {**< SDL_HAPTIC_RAMP *} - direction: TSDL_HapticDirection; {**< Direction of the effect. *} - - {* Replay *} - length: cuint32; {**< Duration of the effect. *} - delay: cuint16; {**< Delay before starting the effect. *} - - {* Trigger *} - button: cuint16; {**< Button that triggers the effect. *} - interval: cuint16; {**< How soon it can be triggered again after button. *} - - {* Ramp *} - start: cint16; {**< Beginning strength level. *} - end_: cint16; {**< Ending strength level. *} - - {* Envelope *} - attack_length: cuint16; {**< Duration of the attack. *} - attack_level: cuint16; {**< Level at the start of the attack. *} - fade_length: cuint16; {**< Duration of the fade. *} - fade_level: cuint16; {**< Level at the end of the fade. *} - end; - - {** - * \brief A structure containing a template for a Left/Right effect. - * - * This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect. - * - * The Left/Right effect is used to explicitly control the large and small - * motors, commonly found in modern game controllers. The small (right) motor - * is high frequency, and the large (left) motor is low frequency. - * - * \sa SDL_HAPTIC_LEFTRIGHT - * \sa SDL_HapticEffect - *} -type - TSDL_HapticLeftRight = record - {* Header *} - type_: cuint16; {**< ::SDL_HAPTIC_LEFTRIGHT *} - - {* Replay *} - length: cuint32; {**< Duration of the effect in milliseconds. *} - - {* Rumble *} - large_magnitude: cuint16; {**< Control of the large controller motor. *} - small_magnitude: cuint16; {**< Control of the small controller motor. *} - end; - - {** - * A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect. - * - * A custom force feedback effect is much like a periodic effect, where the - * application can define its exact shape. You will have to allocate the - * data yourself. Data should consist of channels * samples Uint16 samples. - * - * If channels is one, the effect is rotated using the defined direction. - * Otherwise it uses the samples in data for the different axes. - * - * SDL_HAPTIC_CUSTOM - * SDL_HapticEffect - *} -type - PPSDL_HapticCustom = ^PSDL_HapticCustom; - PSDL_HapticCustom = ^TSDL_HapticCustom; - TSDL_HapticCustom = record - {* Header *} - type_: cuint16; {**< SDL_HAPTIC_CUSTOM *} - direction: TSDL_HapticDirection; {**< Direction of the effect. *} - - {* Replay *} - length: cuint32; {**< Duration of the effect. *} - delay: cuint16; {**< Delay before starting the effect. *} - - {* Trigger *} - button: cuint16; {**< Button that triggers the effect. *} - interval: cuint16; {**< How soon it can be triggered again after button. *} - - {* Custom *} - channels: cuint8; {**< Axes to use, minimum of one. *} - period: cuint16; {**< Sample periods. *} - samples: cuint16; {**< Amount of samples. *} - data: pcuint16; {**< Should contain channels*samples items. *} - - {* Envelope *} - attack_length: cuint16; {**< Duration of the attack. *} - attack_level: cuint16; {**< Level at the start of the attack. *} - fade_length: cuint16; {**< Duration of the fade. *} - fade_level: cuint16; {**< Level at the end of the fade. *} - end; - - {** - * The generic template for any haptic effect. - * - * All values max at 32767 (0x7FFF). Signed values also can be negative. - * Time values unless specified otherwise are in milliseconds. - * - * You can also pass SDL_HAPTIC_INFINITY to length instead of a 0-32767 - * value. Neither delay, interval, attack_length nor fade_length support - * SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends. - * - * Additionally, the SDL_HAPTIC_RAMP effect does not support a duration of - * SDL_HAPTIC_INFINITY. - * - * Button triggers may not be supported on all devices, it is advised to not - * use them if possible. Buttons start at index 1 instead of index 0 like - * the joystick. - * - * If both attack_length and fade_level are 0, the envelope is not used, - * otherwise both values are used. - * - * Common parts: - * - * // Replay - All effects have this - * Uint32 length; // Duration of effect (ms). - * Uint16 delay; // Delay before starting effect. - * - * // Trigger - All effects have this - * Uint16 button; // Button that triggers effect. - * Uint16 interval; // How soon before effect can be triggered again. - * - * // Envelope - All effects except condition effects have this - * Uint16 attack_length; // Duration of the attack (ms). - * Uint16 attack_level; // Level at the start of the attack. - * Uint16 fade_length; // Duration of the fade out (ms). - * Uint16 fade_level; // Level at the end of the fade. - * - * - * - * Here we have an example of a constant effect evolution in time: - * - Strength - ^ - | - | effect level --> _________________ - | / \ - | / \ - | / \ - | / \ - | attack_level --> | \ - | | | <--- fade_level - | - +--------------------------------------------------> Time - [--] [---] - attack_length fade_length - - [------------------][-----------------------] - delay length - - * - * Note either the attack_level or the fade_level may be above the actual - * effect level. - * - * SDL_HapticConstant - * SDL_HapticPeriodic - * SDL_HapticCondition - * SDL_HapticRamp - * SDL_HapticCustom - *} -type - PPSDL_HapticEffect = ^PSDL_HapticEffect; - PSDL_HapticEffect = ^TSDL_HapticEffect; - TSDL_HapticEffect = record - case cint of - {* Common for all force feedback effects *} - 0: (type_: cuint16); {**< Effect type. *} - 1: (constant: TSDL_HapticConstant;); {**< Constant effect. *} - 2: (periodic: TSDL_HapticPeriodic;); {**< Periodic effect. *} - 3: (condition: TSDL_HapticCondition;); {**< Condition effect. *} - 4: (ramp: TSDL_HapticRamp;); {**< Ramp effect. *} - 5: (leftright: TSDL_HapticLeftRight;); {**< Custom effect. *} - 6: (custom: TSDL_HapticCustom;); {**< Custom effect. *} - end; - - {* Function prototypes *} - - {** - * Count the number of haptic devices attached to the system. - * - * \returns the number of haptic devices detected on the system or a negative - * error code on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticName - *} -function SDL_NumHaptics: cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_NumHaptics' {$ENDIF} {$ENDIF}; - - {** - * Get the implementation dependent name of a haptic device. - * - * This can be called before any joysticks are opened. If no name can be - * found, this function returns NULL. - * - * \param device_index index of the device to query. - * \returns the name of the device or NULL on failure; call SDL_GetError() for - * more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_NumHaptics - *} -function SDL_HapticName(device_index: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticName' {$ENDIF} {$ENDIF}; - - {** - * Open a haptic device for use. - * - * The index passed as an argument refers to the N'th haptic device on this - * system. - * - * When opening a haptic device, its gain will be set to maximum and - * autocenter will be disabled. To modify these values use SDL_HapticSetGain() - * and SDL_HapticSetAutocenter(). - * - * \param device_index index of the device to open - * \returns the device identifier or NULL on failure; call SDL_GetError() for - * more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticClose - * \sa SDL_HapticIndex - * \sa SDL_HapticOpenFromJoystick - * \sa SDL_HapticOpenFromMouse - * \sa SDL_HapticPause - * \sa SDL_HapticSetAutocenter - * \sa SDL_HapticSetGain - * \sa SDL_HapticStopAll - *} -function SDL_HapticOpen(device_index: cint): PSDL_Haptic; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticOpen' {$ENDIF} {$ENDIF}; - - {** - * Check if the haptic device at the designated index has been opened. - * - * \param device_index the index of the device to query - * \returns 1 if it has been opened, 0 if it hasn't or on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticIndex - * \sa SDL_HapticOpen - *} -function SDL_HapticOpened(device_index: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticOpened' {$ENDIF} {$ENDIF}; - - {** - * Get the index of a haptic device. - * - * \param haptic the SDL_Haptic device to query - * \returns the index of the specified haptic device or a negative error code - * on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticOpen - * \sa SDL_HapticOpened - *} -function SDL_HapticIndex(haptic: PSDL_Haptic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticIndex' {$ENDIF} {$ENDIF}; - - {** - * Query whether or not the current mouse has haptic capabilities. - * - * \returns SDL_TRUE if the mouse is haptic or SDL_FALSE if it isn't. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticOpenFromMouse - *} -function SDL_MouseIsHaptic: cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MouseInHaptic' {$ENDIF} {$ENDIF}; - - {** - * Try to open a haptic device from the current mouse. - * - * \returns the haptic device identifier or NULL on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticOpen - * \sa SDL_MouseIsHaptic - *} -function SDL_HapticOpenFromMouse: PSDL_Haptic; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticOpenFromMouse' {$ENDIF} {$ENDIF}; - - {** - * Query if a joystick has haptic features. - * - * \param joystick the SDL_Joystick to test for haptic capabilities - * \returns SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't, or a - * negative error code on failure; call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticOpenFromJoystick - *} -function SDL_JoystickIsHaptic(joystick: PSDL_Joystick): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickIsHaptic' {$ENDIF} {$ENDIF}; - - {** - * Open a haptic device for use from a joystick device. - * - * You must still close the haptic device separately. It will not be closed - * with the joystick. - * - * When opened from a joystick you should first close the haptic device before - * closing the joystick device. If not, on some implementations the haptic - * device will also get unallocated and you'll be unable to use force feedback - * on that device. - * - * \param joystick the SDL_Joystick to create a haptic device from - * \returns a valid haptic device identifier on success or NULL on failure; - * call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticClose - * \sa SDL_HapticOpen - * \sa SDL_JoystickIsHaptic - *} -function SDL_HapticOpenFromJoystick(joystick: PSDL_Joystick): PSDL_Haptic; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticOpenFromJoystick' {$ENDIF} {$ENDIF}; - - {** - * Close a haptic device previously opened with SDL_HapticOpen(). - * - * \param haptic the SDL_Haptic device to close - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticOpen - *} -procedure SDL_HapticClose(haptic: PSDL_Haptic); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticClose' {$ENDIF} {$ENDIF}; - - {** - * Get the number of effects a haptic device can store. - * - * On some platforms this isn't fully supported, and therefore is an - * approximation. Always check to see if your created effect was actually - * created and do not rely solely on SDL_HapticNumEffects(). - * - * \param haptic the SDL_Haptic device to query - * \returns the number of effects the haptic device can store or a negative - * error code on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticNumEffectsPlaying - * \sa SDL_HapticQuery - *} -function SDL_HapticNumEffects(haptic: PSDL_Haptic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticNumEffects' {$ENDIF} {$ENDIF}; - - {** - * Get the number of effects a haptic device can play at the same time. - * - * This is not supported on all platforms, but will always return a value. - * - * \param haptic the SDL_Haptic device to query maximum playing effects - * \returns the number of effects the haptic device can play at the same time - * or a negative error code on failure; call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticNumEffects - * \sa SDL_HapticQuery - *} -function SDL_HapticNumEffectsPlaying(haptic: PSDL_Haptic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticNumEffectsPlaying' {$ENDIF} {$ENDIF}; - - {** - * Get the haptic device's supported features in bitwise manner. - * - * \param haptic the SDL_Haptic device to query - * \returns a list of supported haptic features in bitwise manner (OR'd), or 0 - * on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticEffectSupported - * \sa SDL_HapticNumEffects - *} -function SDL_HapticQuery(haptic: PSDL_Haptic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticQuery' {$ENDIF} {$ENDIF}; - - {** - * Get the number of haptic axes the device has. - * - * The number of haptic axes might be useful if working with the - * SDL_HapticDirection effect. - * - * \param haptic the SDL_Haptic device to query - * \returns the number of axes on success or a negative error code on failure; - * call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *} -function SDL_HapticNumAxes(haptic: PSDL_Haptic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticNumAxes' {$ENDIF} {$ENDIF}; - - {** - * Check to see if an effect is supported by a haptic device. - * - * \param haptic the SDL_Haptic device to query - * \param effect the desired effect to query - * \returns SDL_TRUE if effect is supported, SDL_FALSE if it isn't, or a - * negative error code on failure; call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticNewEffect - * \sa SDL_HapticQuery - *} -function SDL_HapticEffectSupported(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticEffectSupported' {$ENDIF} {$ENDIF}; - - {** - * Create a new haptic effect on a specified device. - * - * \param haptic an SDL_Haptic device to create the effect on - * \param effect an SDL_HapticEffect structure containing the properties of - * the effect to create - * \returns the ID of the effect on success or a negative error code on - * failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticDestroyEffect - * \sa SDL_HapticRunEffect - * \sa SDL_HapticUpdateEffect - *} -function SDL_HapticNewEffect(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticNewEffect' {$ENDIF} {$ENDIF}; - - {** - * Update the properties of an effect. - * - * Can be used dynamically, although behavior when dynamically changing - * direction may be strange. Specifically the effect may re-upload itself and - * start playing from the start. You also cannot change the type either when - * running SDL_HapticUpdateEffect(). - * - * \param haptic the SDL_Haptic device that has the effect - * \param effect the identifier of the effect to update - * \param data an SDL_HapticEffect structure containing the new effect - * properties to use - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticDestroyEffect - * \sa SDL_HapticNewEffect - * \sa SDL_HapticRunEffect - *} -function SDL_HapticUpdateEffect(haptic: PSDL_Haptic; effect: cint; data: PSDL_HapticEffect): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticUpdateEffect' {$ENDIF} {$ENDIF}; - - {** - * Run the haptic effect on its associated haptic device. - * - * To repeat the effect over and over indefinitely, set `iterations` to - * `SDL_HAPTIC_INFINITY`. (Repeats the envelope - attack and fade.) To make - * one instance of the effect last indefinitely (so the effect does not fade), - * set the effect's `length` in its structure/union to `SDL_HAPTIC_INFINITY` - * instead. - * - * \param haptic the SDL_Haptic device to run the effect on - * \param effect the ID of the haptic effect to run - * \param iterations the number of iterations to run the effect; use - * `SDL_HAPTIC_INFINITY` to repeat forever - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticDestroyEffect - * \sa SDL_HapticGetEffectStatus - * \sa SDL_HapticStopEffect - *} -function SDL_HapticRunEffect(haptic: PSDL_Haptic; effect: cint; iterations: cuint32): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticRunEffect' {$ENDIF} {$ENDIF}; - - {** - * Stop the haptic effect on its associated haptic device. - * - * * - * - * \param haptic the SDL_Haptic device to stop the effect on - * \param effect the ID of the haptic effect to stop - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticDestroyEffect - * \sa SDL_HapticRunEffect - *} -function SDL_HapticStopEffect(haptic: PSDL_Haptic; effect: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticStopEffect' {$ENDIF} {$ENDIF}; - - {** - * Destroy a haptic effect on the device. - * - * This will stop the effect if it's running. Effects are automatically - * destroyed when the device is closed. - * - * \param haptic the SDL_Haptic device to destroy the effect on - * \param effect the ID of the haptic effect to destroy - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticNewEffect - *} -procedure SDL_HapticDestroyEffect(haptic: PSDL_Haptic; effect: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticDestroyEffect' {$ENDIF} {$ENDIF}; - - {** - * Get the status of the current effect on the specified haptic device. - * - * Device must support the SDL_HAPTIC_STATUS feature. - * - * \param haptic the SDL_Haptic device to query for the effect status on - * \param effect the ID of the haptic effect to query its status - * \returns 0 if it isn't playing, 1 if it is playing, or a negative error - * code on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticRunEffect - * \sa SDL_HapticStopEffect - *} -function SDL_HapticGetEffectStatus(haptic: PSDL_Haptic; effect: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticGetEffectStatus' {$ENDIF} {$ENDIF}; - - {** - * Set the global gain of the specified haptic device. - * - * Device must support the SDL_HAPTIC_GAIN feature. - * - * The user may specify the maximum gain by setting the environment variable - * `SDL_HAPTIC_GAIN_MAX` which should be between 0 and 100. All calls to - * SDL_HapticSetGain() will scale linearly using `SDL_HAPTIC_GAIN_MAX` as the - * maximum. - * - * \param haptic the SDL_Haptic device to set the gain on - * \param gain value to set the gain to, should be between 0 and 100 (0 - 100) - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticQuery - *} -function SDL_HapticSetGain(haptic: PSDL_Haptic; gain: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticSetGain' {$ENDIF} {$ENDIF}; - - {** - * Set the global autocenter of the device. - * - * Autocenter should be between 0 and 100. Setting it to 0 will disable - * autocentering. - * - * Device must support the SDL_HAPTIC_AUTOCENTER feature. - * - * \param haptic the SDL_Haptic device to set autocentering on - * \param autocenter value to set autocenter to (0-100) - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticQuery - *} -function SDL_HapticSetAutocenter(haptic: PSDL_Haptic; autocenter: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticSetAutocenter' {$ENDIF} {$ENDIF}; - - {** - * Pause a haptic device. - * - * Device must support the `SDL_HAPTIC_PAUSE` feature. Call - * SDL_HapticUnpause() to resume playback. - * - * Do not modify the effects nor add new ones while the device is paused. That - * can cause all sorts of weird errors. - * - * \param haptic the SDL_Haptic device to pause - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticUnpause - *} -function SDL_HapticPause(haptic: PSDL_Haptic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticPause' {$ENDIF} {$ENDIF}; - - {** - * Unpause a haptic device. - * - * Call to unpause after SDL_HapticPause(). - * - * \param haptic the SDL_Haptic device to unpause - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticPause - *} -function SDL_HapticUnpause(haptic: PSDL_Haptic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticUnPause' {$ENDIF} {$ENDIF}; - - {** - * Stop all the currently playing effects on a haptic device. - * - * \param haptic the SDL_Haptic device to stop - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *} -function SDL_HapticStopAll(haptic: PSDL_Haptic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticStopAll' {$ENDIF} {$ENDIF}; - - {** - * Check whether rumble is supported on a haptic device. - * - * \param haptic haptic device to check for rumble support - * \returns SDL_TRUE if effect is supported, SDL_FALSE if it isn't, or a - * negative error code on failure; call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticRumbleInit - * \sa SDL_HapticRumblePlay - * \sa SDL_HapticRumbleStop - *} -function SDL_HapticRumbleSupported(haptic: PSDL_Haptic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticRumbleSupported' {$ENDIF} {$ENDIF}; - - {** - * Initialize a haptic device for simple rumble playback. - * - * \param haptic the haptic device to initialize for simple rumble playback - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticOpen - * \sa SDL_HapticRumblePlay - * \sa SDL_HapticRumbleStop - * \sa SDL_HapticRumbleSupported - *} -function SDL_HapticRumbleInit(haptic: PSDL_Haptic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticRumbleInit' {$ENDIF} {$ENDIF}; - - {** - * Run a simple rumble effect on a haptic device. - * - * \param haptic the haptic device to play the rumble effect on - * \param strength strength of the rumble to play as a 0-1 float value - * \param length length of the rumble to play in milliseconds - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticRumbleInit - * \sa SDL_HapticRumbleStop - * \sa SDL_HapticRumbleSupported - *} -function SDL_HapticRumblePlay(haptic: PSDL_Haptic; strength: cfloat; length: cuint32): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticRumblePlay' {$ENDIF} {$ENDIF}; - - {** - * Stop the simple rumble on a haptic device. - * - * \param haptic the haptic device to stop the rumble effect on - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticRumbleInit - * \sa SDL_HapticRumblePlay - * \sa SDL_HapticRumbleSupported - *} -function SDL_HapticRumbleStop(haptic: PSDL_Haptic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticRumbleStop' {$ENDIF} {$ENDIF}; - +//from "sdl_haptic.h" + +{** + * + * The SDL Haptic subsystem allows you to control haptic (force feedback) + * devices. + * + * The basic usage is as follows: + * - Initialize the Subsystem (::SDL_INIT_HAPTIC). + * - Open a Haptic Device. + * - SDL_HapticOpen() to open from index. + * - SDL_HapticOpenFromJoystick() to open from an existing joystick. + * - Create an effect (::SDL_HapticEffect). + * - Upload the effect with SDL_HapticNewEffect(). + * - Run the effect with SDL_HapticRunEffect(). + * - (optional) Free the effect with SDL_HapticDestroyEffect(). + * - Close the haptic device with SDL_HapticClose(). + * + * Simple rumble example: + * + * SDL_Haptic *haptic; + * + * // Open the device + * haptic = SDL_HapticOpen( 0 ); + * if (haptic == NULL) + * return -1; + * + * // Initialize simple rumble + * if (SDL_HapticRumbleInit( haptic ) != 0) + * return -1; + * + * // Play effect at 50% strength for 2 seconds + * if (SDL_HapticRumblePlay( haptic, 0.5, 2000 ) != 0) + * return -1; + * SDL_Delay( 2000 ); + * + * // Clean up + * SDL_HapticClose( haptic ); + * + * + * Complete example: + * + * int test_haptic( SDL_Joystick * joystick ) + * SDL_Haptic *haptic; + * SDL_HapticEffect effect; + * int effect_id; + * + * // Open the device + * haptic = SDL_HapticOpenFromJoystick( joystick ); + * if (haptic == NULL) return -1; // Most likely joystick isn't haptic + * + * // See if it can do sine waves + * if ((SDL_HapticQuery(haptic) & SDL_HAPTIC_SINE)==0) + * SDL_HapticClose(haptic); // No sine effect + * return -1; + * + * + * // Create the effect + * memset( &effect, 0, sizeof(SDL_HapticEffect) ); // 0 is safe default + * effect.type = SDL_HAPTIC_SINE; + * effect.periodic.direction.type = SDL_HAPTIC_POLAR; // Polar coordinates + * effect.periodic.direction.dir[0] = 18000; // Force comes from south + * effect.periodic.period = 1000; // 1000 ms + * effect.periodic.magnitude = 20000; // 20000/32767 strength + * effect.periodic.length = 5000; // 5 seconds long + * effect.periodic.attack_length = 1000; // Takes 1 second to get max strength + * effect.periodic.fade_length = 1000; // Takes 1 second to fade away + * + * // Upload the effect + * effect_id = SDL_HapticNewEffect( haptic, &effect ); + * + * // Test the effect + * SDL_HapticRunEffect( haptic, effect_id, 1 ); + * SDL_Delay( 5000); // Wait for the effect to finish + * + * // We destroy the effect, although closing the device also does this + * SDL_HapticDestroyEffect( haptic, effect_id ); + * + * // Close the device + * SDL_HapticClose(haptic); + * + * return 0; // Success + *} + + {** + * SDL_Haptic + * + * The haptic structure used to identify an SDL haptic. + * + * SDL_HapticOpen + * SDL_HapticOpenFromJoystick + * SDL_HapticClose + *} +type + PPSDL_Haptic = ^PSDL_Haptic; + PSDL_Haptic = type Pointer; + + {** + * Haptic features + * + * Different haptic features a device can have. + *} + + {** + * Haptic effects + *} + + {** + * Constant effect supported. + * + * Constant haptic effect. + * + * SDL_HapticCondition + *} +const + SDL_HAPTIC_CONSTANT = (1 shl 0); + + {** + * Sine wave effect supported. + * + * Periodic haptic effect that simulates sine waves. + * + * SDL_HapticPeriodic + *} +const + SDL_HAPTIC_SINE = (1 shl 1); + + {** + * Square wave effect supported. + * + * Periodic haptic effect that simulates square waves. + * + * SDL_HapticPeriodic + *} +const + SDL_HAPTIC_LEFTRIGHT = (1 shl 2); + + { !!! FIXME: put this back when we have more bits in 2.1 } + { #define SDL_HAPTIC_SQUARE (1<<2) } + SDL_HAPTIC_SQUARE = (1 shl 2); // SDL2-For-Pascal: Out-commented in C code. + // Why not keeping it for + // compatibility here? + + {** + * Triangle wave effect supported. + * + * Periodic haptic effect that simulates triangular waves. + * + * SDL_HapticPeriodic + *} +const + SDL_HAPTIC_TRIANGLE = (1 shl 3); + + {** + * Sawtoothup wave effect supported. + * + * Periodic haptic effect that simulates saw tooth up waves. + * + * SDL_HapticPeriodic + *} +const + SDL_HAPTIC_SAWTOOTHUP = (1 shl 4); + + {** + * Sawtoothdown wave effect supported. + * + * Periodic haptic effect that simulates saw tooth down waves. + * + * SDL_HapticPeriodic + *} +const + SDL_HAPTIC_SAWTOOTHDOWN = (1 shl 5); + + {** + * Ramp effect supported. + * + * Ramp haptic effect. + * + * SDL_HapticRamp + *} +const + SDL_HAPTIC_RAMP = (1 shl 6); + + {** + * Spring effect supported - uses axes position. + * + * Condition haptic effect that simulates a spring. Effect is based on the + * axes position. + * + * SDL_HapticCondition + *} +const + SDL_HAPTIC_SPRING = (1 shl 7); + + {** + * Damper effect supported - uses axes velocity. + * + * Condition haptic effect that simulates dampening. Effect is based on the + * axes velocity. + * + * SDL_HapticCondition + *} +const + SDL_HAPTIC_DAMPER = (1 shl 8); + + {** + * Inertia effect supported - uses axes acceleration. + * + * Condition haptic effect that simulates inertia. Effect is based on the axes + * acceleration. + * + * SDL_HapticCondition + *} +const + SDL_HAPTIC_INERTIA = (1 shl 9); + + {** + * Friction effect supported - uses axes movement. + * + * Condition haptic effect that simulates friction. Effect is based on the + * axes movement. + * + * SDL_HapticCondition + *} +const + SDL_HAPTIC_FRICTION = (1 shl 10); + + {** + * Custom effect is supported. + * + * User defined custom haptic effect. + *} +const + SDL_HAPTIC_CUSTOM = (1 shl 11); + + {*Haptic effects*} + + {* These last few are features the device has, not effects *} + + {** + * Device can set global gain. + * + * Device supports setting the global gain. + * + * SDL_HapticSetGain + *} +const + SDL_HAPTIC_GAIN = (1 shl 12); + + {** + * Device can set autocenter. + * + * Device supports setting autocenter. + * + * SDL_HapticSetAutocenter + *} +const + SDL_HAPTIC_AUTOCENTER = (1 shl 13); + + {** + * Device can be queried for effect status. + * + * Device can be queried for effect status. + * + * SDL_HapticGetEffectStatus + *} +const + SDL_HAPTIC_STATUS = (1 shl 14); + + {** + * Device can be paused. + * + * SDL_HapticPause + * SDL_HapticUnpause + *} +const + SDL_HAPTIC_PAUSE = (1 shl 15); + + {** + * Direction encodings + *} + + {** + * Uses polar coordinates for the direction. + * + * SDL_HapticDirection + *} +const + SDL_HAPTIC_POLAR = 0; + + {** + * Uses cartesian coordinates for the direction. + * + * SDL_HapticDirection + *} +const + SDL_HAPTIC_CARTESIAN = 1; + + {** + * Uses spherical coordinates for the direction. + * + * SDL_HapticDirection + *} +const + SDL_HAPTIC_SPHERICAL = 2; + + {** + * \brief Use this value to play an effect on the steering wheel axis. This + * provides better compatibility across platforms and devices as SDL will guess + * the correct axis. + * \sa SDL_HapticDirection + *} +const + SDL_HAPTIC_STEERING_AXIS = 3; + + {* + * Misc defines. + *} + + {** + * Used to play a device an infinite number of times. + * + * SDL_HapticRunEffect + *} +const + SDL_HAPTIC_INFINITY = 4294967295; // C: 4294967295U + + {** + * Structure that represents a haptic direction. + * + * Directions can be specified by: + * - SDL_HAPTIC_POLAR : Specified by polar coordinates. + * - SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates. + * - SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates. + * + * Cardinal directions of the haptic device are relative to the positioning + * of the device. North is considered to be away from the user. + * + * The following diagram represents the cardinal directions: + * + .--. + |__| .-------. + |=.| |.-----.| + |--| || || + | | |'-----'| + |__|~')_____(' + [ COMPUTER ] + + + North (0,-1) + ^ + | + | + (1,0) West <----[ HAPTIC ]----> East (-1,0) + | + | + v + South (0,1) + + + [ USER ] + \|||/ + (o o) + ---ooO-(_)-Ooo--- + + * + * If type is SDL_HAPTIC_POLAR, direction is encoded by hundredths of a + * degree starting north and turning clockwise. ::SDL_HAPTIC_POLAR only uses + * the first dir parameter. The cardinal directions would be: + * - North: 0 (0 degrees) + * - East: 9000 (90 degrees) + * - South: 18000 (180 degrees) + * - West: 27000 (270 degrees) + * + * If type is SDL_HAPTIC_CARTESIAN, direction is encoded by three positions + * (X axis, Y axis and Z axis (with 3 axes)). ::SDL_HAPTIC_CARTESIAN uses + * the first three dir parameters. The cardinal directions would be: + * - North: 0,-1, 0 + * - East: -1, 0, 0 + * - South: 0, 1, 0 + * - West: 1, 0, 0 + * + * The Z axis represents the height of the effect if supported, otherwise + * it's unused. In cartesian encoding (1, 2) would be the same as (2, 4), you + * can use any multiple you want, only the direction matters. + * + * If type is SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations. + * The first two dir parameters are used. The dir parameters are as + * follows (all values are in hundredths of degrees): + * - Degrees from (1, 0) rotated towards (0, 1). + * - Degrees towards (0, 0, 1) (device needs at least 3 axes). + * + * + * Example of force coming from the south with all encodings (force coming + * from the south means the user will have to pull the stick to counteract): + * + * SDL_HapticDirection direction; + * + * // Cartesian directions + * direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding. + * direction.dir[0] = 0; // X position + * direction.dir[1] = 1; // Y position + * // Assuming the device has 2 axes, we don't need to specify third parameter. + * + * // Polar directions + * direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding. + * direction.dir[0] = 18000; // Polar only uses first parameter + * + * // Spherical coordinates + * direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding + * direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters. + * + * + * SDL_HAPTIC_POLAR + * SDL_HAPTIC_CARTESIAN + * SDL_HAPTIC_SPHERICAL + * SDL_HapticEffect + * SDL_HapticNumAxes + *} +type + PPSDL_HapticDirection = ^PSDL_HapticDirection; + PSDL_HapticDirection = ^TSDL_HapticDirection; + TSDL_HapticDirection = record + type_: cuint8; {**< The type of encoding. *} + dir: array[0..2] of cint32; {**< The encoded direction. *} + end; + + {** + * A structure containing a template for a Constant effect. + * + * The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect. + * + * A constant effect applies a constant force in the specified direction + * to the joystick. + * + * SDL_HAPTIC_CONSTANT + * SDL_HapticEffect + *} +type + PPSDL_HapticConstant = ^PSDL_HapticConstant; + PSDL_HapticConstant = ^TSDL_HapticConstant; + TSDL_HapticConstant = record + {* Header *} + type_: cuint16; {**< SDL_HAPTIC_CONSTANT *} + direction: TSDL_HapticDirection; {**< Direction of the effect. *} + + {* Replay *} + length: cuint32; {**< Duration of the effect. *} + delay: cuint16; {**< Delay before starting the effect. *} + + {* Trigger *} + button: cuint16; {**< Button that triggers the effect. *} + interval: cuint16; {**< How soon it can be triggered again after button. *} + + {* Constant *} + level: cint16; {**< Strength of the constant effect. *} + + {* Envelope *} + attack_length: cuint16; {**< Duration of the attack. *} + attack_level: cuint16; {**< Level at the start of the attack. *} + fade_length: cuint16; {**< Duration of the fade. *} + fade_level: cuint16; {**< Level at the end of the fade. *} + end; + + {** + * A structure containing a template for a Periodic effect. + * + * The struct handles the following effects: + * - SDL_HAPTIC_SINE + * - SDL_HAPTIC_SQUARE + * - SDL_HAPTIC_TRIANGLE + * - SDL_HAPTIC_SAWTOOTHUP + * - SDL_HAPTIC_SAWTOOTHDOWN + * + * A periodic effect consists in a wave-shaped effect that repeats itself + * over time. The type determines the shape of the wave and the parameters + * determine the dimensions of the wave. + * + * Phase is given by hundredth of a cycle meaning that giving the phase a value + * of 9000 will displace it 25% of its period. Here are sample values: + * - 0: No phase displacement. + * - 9000: Displaced 25% of its period. + * - 18000: Displaced 50% of its period. + * - 27000: Displaced 75% of its period. + * - 36000: Displaced 100% of its period, same as 0, but 0 is preferred. + * + * Examples: + * + SDL_HAPTIC_SINE + __ __ __ __ + / \ / \ / \ / + / \__/ \__/ \__/ + + SDL_HAPTIC_SQUARE + __ __ __ __ __ + | | | | | | | | | | + | |__| |__| |__| |__| | + + SDL_HAPTIC_TRIANGLE + /\ /\ /\ /\ /\ + / \ / \ / \ / \ / + / \/ \/ \/ \/ + + SDL_HAPTIC_SAWTOOTHUP + /| /| /| /| /| /| /| + / | / | / | / | / | / | / | + / |/ |/ |/ |/ |/ |/ | + + SDL_HAPTIC_SAWTOOTHDOWN + \ |\ |\ |\ |\ |\ |\ | + \ | \ | \ | \ | \ | \ | \ | + \| \| \| \| \| \| \| + + * + * SDL_HAPTIC_SINE + * SDL_HAPTIC_SQUARE + * SDL_HAPTIC_TRIANGLE + * SDL_HAPTIC_SAWTOOTHUP + * SDL_HAPTIC_SAWTOOTHDOWN + * SDL_HapticEffect + *} +type + PPSDL_HapticPeriodic = ^PSDL_HapticPeriodic; + PSDL_HapticPeriodic = ^TSDL_HapticPeriodic; + TSDL_HapticPeriodic = record + { Header *} + type_: cuint16; {**< SDL_HAPTIC_SINE, SDL_HAPTIC_SQUARE, + SDL_HAPTIC_TRIANGLE, SDL_HAPTIC_SAWTOOTHUP or + SDL_HAPTIC_SAWTOOTHDOWN *} + direction: TSDL_HapticDirection; {**< Direction of the effect. *} + + {* Replay *} + length: cuint32; {**< Duration of the effect. *} + delay: cuint16; {**< Delay before starting the effect. *} + + {* Trigger *} + button: cuint16; {**< Button that triggers the effect. *} + interval: cuint16; {**< How soon it can be triggered again after button. *} + + {* Periodic *} + period: cuint16; {**< Period of the wave. *} + magnitude: cint16; {**< Peak value. *} + offset: cint16; {**< Mean value of the wave. *} + phase: cuint16; {**< Horizontal shift given by hundredth of a cycle. *} + + {* Envelope *} + attack_length: cuint16; {**< Duration of the attack. *} + attack_level: cuint16; {**< Level at the start of the attack. *} + fade_length: cuint16; {**< Duration of the fade. *} + fade_level: cuint16; {**< Level at the end of the fade. *} + end; + + {** + * A structure containing a template for a Condition effect. + * + * The struct handles the following effects: + * - SDL_HAPTIC_SPRING: Effect based on axes position. + * - SDL_HAPTIC_DAMPER: Effect based on axes velocity. + * - SDL_HAPTIC_INERTIA: Effect based on axes acceleration. + * - SDL_HAPTIC_FRICTION: Effect based on axes movement. + * + * Direction is handled by condition internals instead of a direction member. + * The condition effect specific members have three parameters. The first + * refers to the X axis, the second refers to the Y axis and the third + * refers to the Z axis. The right terms refer to the positive side of the + * axis and the left terms refer to the negative side of the axis. Please + * refer to the ::SDL_HapticDirection diagram for which side is positive and + * which is negative. + * + * SDL_HapticDirection + * SDL_HAPTIC_SPRING + * SDL_HAPTIC_DAMPER + * SDL_HAPTIC_INERTIA + * SDL_HAPTIC_FRICTION + * SDL_HapticEffect + *} +type + PPSDL_HapticCondition = ^PSDL_HapticCondition; + PSDL_HapticCondition = ^TSDL_HapticCondition; + TSDL_HapticCondition = record + {* Header *} + type_: cuint16; {**< SDL_HAPTIC_SPRING, SDL_HAPTIC_DAMPER, + SDL_HAPTIC_INERTIA or SDL_HAPTIC_FRICTION *} + direction: TSDL_HapticDirection; {**< Direction of the effect - Not used ATM. *} + + {* Replay *} + length: cuint32; {**< Duration of the effect. *} + delay: cuint16; {**< Delay before starting the effect. *} + + {* Trigger *} + button: cuint16; {**< Button that triggers the effect. *} + interval: cuint16; {**< How soon it can be triggered again after button. *} + + {* Condition *} + right_sat: array[0..2] of cuint16; {**< Level when joystick is to the positive side. *} + left_sat: array[0..2] of cuint16; {**< Level when joystick is to the negative side. *} + right_coeff: array[0..2] of cint16;{**< How fast to increase the force towards the positive side. *} + left_coeff: array[0..2] of cint16; {**< How fast to increase the force towards the negative side. *} + deadband: array[0..2] of cuint16; {**< Size of the dead zone. *} + center: array[0..2] of cint16; {**< Position of the dead zone. *} + end; + + {** + * A structure containing a template for a Ramp effect. + * + * This struct is exclusively for the ::SDL_HAPTIC_RAMP effect. + * + * The ramp effect starts at start strength and ends at end strength. + * It augments in linear fashion. If you use attack and fade with a ramp + * the effects get added to the ramp effect making the effect become + * quadratic instead of linear. + * + * SDL_HAPTIC_RAMP + * SDL_HapticEffect + *} +type + PPSDL_HapticRamp = ^PSDL_HapticRamp; + PSDL_HapticRamp = ^TSDL_HapticRamp; + TSDL_HapticRamp = record + {* Header *} + type_: cuint16; {**< SDL_HAPTIC_RAMP *} + direction: TSDL_HapticDirection; {**< Direction of the effect. *} + + {* Replay *} + length: cuint32; {**< Duration of the effect. *} + delay: cuint16; {**< Delay before starting the effect. *} + + {* Trigger *} + button: cuint16; {**< Button that triggers the effect. *} + interval: cuint16; {**< How soon it can be triggered again after button. *} + + {* Ramp *} + start: cint16; {**< Beginning strength level. *} + end_: cint16; {**< Ending strength level. *} + + {* Envelope *} + attack_length: cuint16; {**< Duration of the attack. *} + attack_level: cuint16; {**< Level at the start of the attack. *} + fade_length: cuint16; {**< Duration of the fade. *} + fade_level: cuint16; {**< Level at the end of the fade. *} + end; + + {** + * \brief A structure containing a template for a Left/Right effect. + * + * This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect. + * + * The Left/Right effect is used to explicitly control the large and small + * motors, commonly found in modern game controllers. The small (right) motor + * is high frequency, and the large (left) motor is low frequency. + * + * \sa SDL_HAPTIC_LEFTRIGHT + * \sa SDL_HapticEffect + *} +type + TSDL_HapticLeftRight = record + {* Header *} + type_: cuint16; {**< ::SDL_HAPTIC_LEFTRIGHT *} + + {* Replay *} + length: cuint32; {**< Duration of the effect in milliseconds. *} + + {* Rumble *} + large_magnitude: cuint16; {**< Control of the large controller motor. *} + small_magnitude: cuint16; {**< Control of the small controller motor. *} + end; + + {** + * A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect. + * + * A custom force feedback effect is much like a periodic effect, where the + * application can define its exact shape. You will have to allocate the + * data yourself. Data should consist of channels * samples Uint16 samples. + * + * If channels is one, the effect is rotated using the defined direction. + * Otherwise it uses the samples in data for the different axes. + * + * SDL_HAPTIC_CUSTOM + * SDL_HapticEffect + *} +type + PPSDL_HapticCustom = ^PSDL_HapticCustom; + PSDL_HapticCustom = ^TSDL_HapticCustom; + TSDL_HapticCustom = record + {* Header *} + type_: cuint16; {**< SDL_HAPTIC_CUSTOM *} + direction: TSDL_HapticDirection; {**< Direction of the effect. *} + + {* Replay *} + length: cuint32; {**< Duration of the effect. *} + delay: cuint16; {**< Delay before starting the effect. *} + + {* Trigger *} + button: cuint16; {**< Button that triggers the effect. *} + interval: cuint16; {**< How soon it can be triggered again after button. *} + + {* Custom *} + channels: cuint8; {**< Axes to use, minimum of one. *} + period: cuint16; {**< Sample periods. *} + samples: cuint16; {**< Amount of samples. *} + data: pcuint16; {**< Should contain channels*samples items. *} + + {* Envelope *} + attack_length: cuint16; {**< Duration of the attack. *} + attack_level: cuint16; {**< Level at the start of the attack. *} + fade_length: cuint16; {**< Duration of the fade. *} + fade_level: cuint16; {**< Level at the end of the fade. *} + end; + + {** + * The generic template for any haptic effect. + * + * All values max at 32767 (0x7FFF). Signed values also can be negative. + * Time values unless specified otherwise are in milliseconds. + * + * You can also pass SDL_HAPTIC_INFINITY to length instead of a 0-32767 + * value. Neither delay, interval, attack_length nor fade_length support + * SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends. + * + * Additionally, the SDL_HAPTIC_RAMP effect does not support a duration of + * SDL_HAPTIC_INFINITY. + * + * Button triggers may not be supported on all devices, it is advised to not + * use them if possible. Buttons start at index 1 instead of index 0 like + * the joystick. + * + * If both attack_length and fade_level are 0, the envelope is not used, + * otherwise both values are used. + * + * Common parts: + * + * // Replay - All effects have this + * Uint32 length; // Duration of effect (ms). + * Uint16 delay; // Delay before starting effect. + * + * // Trigger - All effects have this + * Uint16 button; // Button that triggers effect. + * Uint16 interval; // How soon before effect can be triggered again. + * + * // Envelope - All effects except condition effects have this + * Uint16 attack_length; // Duration of the attack (ms). + * Uint16 attack_level; // Level at the start of the attack. + * Uint16 fade_length; // Duration of the fade out (ms). + * Uint16 fade_level; // Level at the end of the fade. + * + * + * + * Here we have an example of a constant effect evolution in time: + * + Strength + ^ + | + | effect level --> _________________ + | / \ + | / \ + | / \ + | / \ + | attack_level --> | \ + | | | <--- fade_level + | + +--------------------------------------------------> Time + [--] [---] + attack_length fade_length + + [------------------][-----------------------] + delay length + + * + * Note either the attack_level or the fade_level may be above the actual + * effect level. + * + * SDL_HapticConstant + * SDL_HapticPeriodic + * SDL_HapticCondition + * SDL_HapticRamp + * SDL_HapticCustom + *} +type + PPSDL_HapticEffect = ^PSDL_HapticEffect; + PSDL_HapticEffect = ^TSDL_HapticEffect; + TSDL_HapticEffect = record + case cint of + {* Common for all force feedback effects *} + 0: (type_: cuint16); {**< Effect type. *} + 1: (constant: TSDL_HapticConstant;); {**< Constant effect. *} + 2: (periodic: TSDL_HapticPeriodic;); {**< Periodic effect. *} + 3: (condition: TSDL_HapticCondition;); {**< Condition effect. *} + 4: (ramp: TSDL_HapticRamp;); {**< Ramp effect. *} + 5: (leftright: TSDL_HapticLeftRight;); {**< Custom effect. *} + 6: (custom: TSDL_HapticCustom;); {**< Custom effect. *} + end; + + {* Function prototypes *} + + {** + * Count the number of haptic devices attached to the system. + * + * \returns the number of haptic devices detected on the system or a negative + * error code on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticName + *} +function SDL_NumHaptics: cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_NumHaptics' {$ENDIF} {$ENDIF}; + + {** + * Get the implementation dependent name of a haptic device. + * + * This can be called before any joysticks are opened. If no name can be + * found, this function returns NULL. + * + * \param device_index index of the device to query. + * \returns the name of the device or NULL on failure; call SDL_GetError() for + * more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_NumHaptics + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticName_fun = function(device_index: cint): PAnsiChar; cdecl; +Var + SDL_HapticName : TSDL_HapticName_fun = Nil; +{$else} + +function SDL_HapticName(device_index: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticName' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Open a haptic device for use. + * + * The index passed as an argument refers to the N'th haptic device on this + * system. + * + * When opening a haptic device, its gain will be set to maximum and + * autocenter will be disabled. To modify these values use SDL_HapticSetGain() + * and SDL_HapticSetAutocenter(). + * + * \param device_index index of the device to open + * \returns the device identifier or NULL on failure; call SDL_GetError() for + * more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticClose + * \sa SDL_HapticIndex + * \sa SDL_HapticOpenFromJoystick + * \sa SDL_HapticOpenFromMouse + * \sa SDL_HapticPause + * \sa SDL_HapticSetAutocenter + * \sa SDL_HapticSetGain + * \sa SDL_HapticStopAll + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticOpen_fun = function(device_index: cint): PSDL_Haptic; cdecl; +Var + SDL_HapticOpen : TSDL_HapticOpen_fun = Nil; +{$else} + +function SDL_HapticOpen(device_index: cint): PSDL_Haptic; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticOpen' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Check if the haptic device at the designated index has been opened. + * + * \param device_index the index of the device to query + * \returns 1 if it has been opened, 0 if it hasn't or on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticIndex + * \sa SDL_HapticOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticOpened_fun = function(device_index: cint): cint; cdecl; +Var + SDL_HapticOpened : TSDL_HapticOpened_fun = Nil; +{$else} + +function SDL_HapticOpened(device_index: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticOpened' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the index of a haptic device. + * + * \param haptic the SDL_Haptic device to query + * \returns the index of the specified haptic device or a negative error code + * on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticOpen + * \sa SDL_HapticOpened + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticIndex_fun = function(haptic: PSDL_Haptic): cint; cdecl; +Var + SDL_HapticIndex : TSDL_HapticIndex_fun = Nil; +{$else} + +function SDL_HapticIndex(haptic: PSDL_Haptic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticIndex' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Query whether or not the current mouse has haptic capabilities. + * + * \returns SDL_TRUE if the mouse is haptic or SDL_FALSE if it isn't. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticOpenFromMouse + *} +function SDL_MouseIsHaptic: cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MouseInHaptic' {$ENDIF} {$ENDIF}; + + {** + * Try to open a haptic device from the current mouse. + * + * \returns the haptic device identifier or NULL on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticOpen + * \sa SDL_MouseIsHaptic + *} +function SDL_HapticOpenFromMouse: PSDL_Haptic; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticOpenFromMouse' {$ENDIF} {$ENDIF}; + + {** + * Query if a joystick has haptic features. + * + * \param joystick the SDL_Joystick to test for haptic capabilities + * \returns SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't, or a + * negative error code on failure; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticOpenFromJoystick + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickIsHaptic_fun = function(joystick: PSDL_Joystick): cint; cdecl; +Var + SDL_JoystickIsHaptic : TSDL_JoystickIsHaptic_fun = Nil; +{$else} + +function SDL_JoystickIsHaptic(joystick: PSDL_Joystick): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickIsHaptic' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Open a haptic device for use from a joystick device. + * + * You must still close the haptic device separately. It will not be closed + * with the joystick. + * + * When opened from a joystick you should first close the haptic device before + * closing the joystick device. If not, on some implementations the haptic + * device will also get unallocated and you'll be unable to use force feedback + * on that device. + * + * \param joystick the SDL_Joystick to create a haptic device from + * \returns a valid haptic device identifier on success or NULL on failure; + * call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticClose + * \sa SDL_HapticOpen + * \sa SDL_JoystickIsHaptic + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticOpenFromJoystick_fun = function(joystick: PSDL_Joystick): PSDL_Haptic; cdecl; +Var + SDL_HapticOpenFromJoystick : TSDL_HapticOpenFromJoystick_fun = Nil; +{$else} + +function SDL_HapticOpenFromJoystick(joystick: PSDL_Joystick): PSDL_Haptic; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticOpenFromJoystick' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Close a haptic device previously opened with SDL_HapticOpen(). + * + * \param haptic the SDL_Haptic device to close + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticClose_proc = procedure(haptic: PSDL_Haptic); cdecl; +Var + SDL_HapticClose : TSDL_HapticClose_proc = Nil; +{$else} + +procedure SDL_HapticClose(haptic: PSDL_Haptic); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticClose' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the number of effects a haptic device can store. + * + * On some platforms this isn't fully supported, and therefore is an + * approximation. Always check to see if your created effect was actually + * created and do not rely solely on SDL_HapticNumEffects(). + * + * \param haptic the SDL_Haptic device to query + * \returns the number of effects the haptic device can store or a negative + * error code on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticNumEffectsPlaying + * \sa SDL_HapticQuery + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticNumEffects_fun = function(haptic: PSDL_Haptic): cint; cdecl; +Var + SDL_HapticNumEffects : TSDL_HapticNumEffects_fun = Nil; +{$else} + +function SDL_HapticNumEffects(haptic: PSDL_Haptic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticNumEffects' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the number of effects a haptic device can play at the same time. + * + * This is not supported on all platforms, but will always return a value. + * + * \param haptic the SDL_Haptic device to query maximum playing effects + * \returns the number of effects the haptic device can play at the same time + * or a negative error code on failure; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticNumEffects + * \sa SDL_HapticQuery + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticNumEffectsPlaying_fun = function(haptic: PSDL_Haptic): cint; cdecl; +Var + SDL_HapticNumEffectsPlaying : TSDL_HapticNumEffectsPlaying_fun = Nil; +{$else} + +function SDL_HapticNumEffectsPlaying(haptic: PSDL_Haptic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticNumEffectsPlaying' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the haptic device's supported features in bitwise manner. + * + * \param haptic the SDL_Haptic device to query + * \returns a list of supported haptic features in bitwise manner (OR'd), or 0 + * on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticEffectSupported + * \sa SDL_HapticNumEffects + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticQuery_fun = function(haptic: PSDL_Haptic): cint; cdecl; +Var + SDL_HapticQuery : TSDL_HapticQuery_fun = Nil; +{$else} + +function SDL_HapticQuery(haptic: PSDL_Haptic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticQuery' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the number of haptic axes the device has. + * + * The number of haptic axes might be useful if working with the + * SDL_HapticDirection effect. + * + * \param haptic the SDL_Haptic device to query + * \returns the number of axes on success or a negative error code on failure; + * call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticNumAxes_fun = function(haptic: PSDL_Haptic): cint; cdecl; +Var + SDL_HapticNumAxes : TSDL_HapticNumAxes_fun = Nil; +{$else} + +function SDL_HapticNumAxes(haptic: PSDL_Haptic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticNumAxes' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Check to see if an effect is supported by a haptic device. + * + * \param haptic the SDL_Haptic device to query + * \param effect the desired effect to query + * \returns SDL_TRUE if effect is supported, SDL_FALSE if it isn't, or a + * negative error code on failure; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticNewEffect + * \sa SDL_HapticQuery + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticEffectSupported_fun = function(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): cint; cdecl; +Var + SDL_HapticEffectSupported : TSDL_HapticEffectSupported_fun = Nil; +{$else} + +function SDL_HapticEffectSupported(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticEffectSupported' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Create a new haptic effect on a specified device. + * + * \param haptic an SDL_Haptic device to create the effect on + * \param effect an SDL_HapticEffect structure containing the properties of + * the effect to create + * \returns the ID of the effect on success or a negative error code on + * failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticDestroyEffect + * \sa SDL_HapticRunEffect + * \sa SDL_HapticUpdateEffect + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticNewEffect_fun = function(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): cint; cdecl; +Var + SDL_HapticNewEffect : TSDL_HapticNewEffect_fun = Nil; +{$else} + +function SDL_HapticNewEffect(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticNewEffect' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Update the properties of an effect. + * + * Can be used dynamically, although behavior when dynamically changing + * direction may be strange. Specifically the effect may re-upload itself and + * start playing from the start. You also cannot change the type either when + * running SDL_HapticUpdateEffect(). + * + * \param haptic the SDL_Haptic device that has the effect + * \param effect the identifier of the effect to update + * \param data an SDL_HapticEffect structure containing the new effect + * properties to use + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticDestroyEffect + * \sa SDL_HapticNewEffect + * \sa SDL_HapticRunEffect + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticUpdateEffect_fun = function(haptic: PSDL_Haptic; effect: cint; data: PSDL_HapticEffect): cint; cdecl; +Var + SDL_HapticUpdateEffect : TSDL_HapticUpdateEffect_fun = Nil; +{$else} + +function SDL_HapticUpdateEffect(haptic: PSDL_Haptic; effect: cint; data: PSDL_HapticEffect): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticUpdateEffect' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Run the haptic effect on its associated haptic device. + * + * To repeat the effect over and over indefinitely, set `iterations` to + * `SDL_HAPTIC_INFINITY`. (Repeats the envelope - attack and fade.) To make + * one instance of the effect last indefinitely (so the effect does not fade), + * set the effect's `length` in its structure/union to `SDL_HAPTIC_INFINITY` + * instead. + * + * \param haptic the SDL_Haptic device to run the effect on + * \param effect the ID of the haptic effect to run + * \param iterations the number of iterations to run the effect; use + * `SDL_HAPTIC_INFINITY` to repeat forever + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticDestroyEffect + * \sa SDL_HapticGetEffectStatus + * \sa SDL_HapticStopEffect + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticRunEffect_fun = function(haptic: PSDL_Haptic; effect: cint; iterations: cuint32): cint; cdecl; +Var + SDL_HapticRunEffect : TSDL_HapticRunEffect_fun = Nil; +{$else} + +function SDL_HapticRunEffect(haptic: PSDL_Haptic; effect: cint; iterations: cuint32): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticRunEffect' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Stop the haptic effect on its associated haptic device. + * + * * + * + * \param haptic the SDL_Haptic device to stop the effect on + * \param effect the ID of the haptic effect to stop + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticDestroyEffect + * \sa SDL_HapticRunEffect + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticStopEffect_fun = function(haptic: PSDL_Haptic; effect: cint): cint; cdecl; +Var + SDL_HapticStopEffect : TSDL_HapticStopEffect_fun = Nil; +{$else} + +function SDL_HapticStopEffect(haptic: PSDL_Haptic; effect: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticStopEffect' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Destroy a haptic effect on the device. + * + * This will stop the effect if it's running. Effects are automatically + * destroyed when the device is closed. + * + * \param haptic the SDL_Haptic device to destroy the effect on + * \param effect the ID of the haptic effect to destroy + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticNewEffect + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticDestroyEffect_proc = procedure(haptic: PSDL_Haptic; effect: cint); cdecl; +Var + SDL_HapticDestroyEffect : TSDL_HapticDestroyEffect_proc = Nil; +{$else} + +procedure SDL_HapticDestroyEffect(haptic: PSDL_Haptic; effect: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticDestroyEffect' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the status of the current effect on the specified haptic device. + * + * Device must support the SDL_HAPTIC_STATUS feature. + * + * \param haptic the SDL_Haptic device to query for the effect status on + * \param effect the ID of the haptic effect to query its status + * \returns 0 if it isn't playing, 1 if it is playing, or a negative error + * code on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticRunEffect + * \sa SDL_HapticStopEffect + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticGetEffectStatus_fun = function(haptic: PSDL_Haptic; effect: cint): cint; cdecl; +Var + SDL_HapticGetEffectStatus : TSDL_HapticGetEffectStatus_fun = Nil; +{$else} + +function SDL_HapticGetEffectStatus(haptic: PSDL_Haptic; effect: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticGetEffectStatus' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the global gain of the specified haptic device. + * + * Device must support the SDL_HAPTIC_GAIN feature. + * + * The user may specify the maximum gain by setting the environment variable + * `SDL_HAPTIC_GAIN_MAX` which should be between 0 and 100. All calls to + * SDL_HapticSetGain() will scale linearly using `SDL_HAPTIC_GAIN_MAX` as the + * maximum. + * + * \param haptic the SDL_Haptic device to set the gain on + * \param gain value to set the gain to, should be between 0 and 100 (0 - 100) + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticQuery + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticSetGain_fun = function(haptic: PSDL_Haptic; gain: cint): cint; cdecl; +Var + SDL_HapticSetGain : TSDL_HapticSetGain_fun = Nil; +{$else} + +function SDL_HapticSetGain(haptic: PSDL_Haptic; gain: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticSetGain' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the global autocenter of the device. + * + * Autocenter should be between 0 and 100. Setting it to 0 will disable + * autocentering. + * + * Device must support the SDL_HAPTIC_AUTOCENTER feature. + * + * \param haptic the SDL_Haptic device to set autocentering on + * \param autocenter value to set autocenter to (0-100) + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticQuery + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticSetAutocenter_fun = function(haptic: PSDL_Haptic; autocenter: cint): cint; cdecl; +Var + SDL_HapticSetAutocenter : TSDL_HapticSetAutocenter_fun = Nil; +{$else} + +function SDL_HapticSetAutocenter(haptic: PSDL_Haptic; autocenter: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticSetAutocenter' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Pause a haptic device. + * + * Device must support the `SDL_HAPTIC_PAUSE` feature. Call + * SDL_HapticUnpause() to resume playback. + * + * Do not modify the effects nor add new ones while the device is paused. That + * can cause all sorts of weird errors. + * + * \param haptic the SDL_Haptic device to pause + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticUnpause + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticPause_fun = function(haptic: PSDL_Haptic): cint; cdecl; +Var + SDL_HapticPause : TSDL_HapticPause_fun = Nil; +{$else} + +function SDL_HapticPause(haptic: PSDL_Haptic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticPause' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Unpause a haptic device. + * + * Call to unpause after SDL_HapticPause(). + * + * \param haptic the SDL_Haptic device to unpause + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticPause + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticUnpause_fun = function(haptic: PSDL_Haptic): cint; cdecl; +Var + SDL_HapticUnpause : TSDL_HapticUnpause_fun = Nil; +{$else} + +function SDL_HapticUnpause(haptic: PSDL_Haptic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticUnPause' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Stop all the currently playing effects on a haptic device. + * + * \param haptic the SDL_Haptic device to stop + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticStopAll_fun = function(haptic: PSDL_Haptic): cint; cdecl; +Var + SDL_HapticStopAll : TSDL_HapticStopAll_fun = Nil; +{$else} + +function SDL_HapticStopAll(haptic: PSDL_Haptic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticStopAll' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Check whether rumble is supported on a haptic device. + * + * \param haptic haptic device to check for rumble support + * \returns SDL_TRUE if effect is supported, SDL_FALSE if it isn't, or a + * negative error code on failure; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticRumbleInit + * \sa SDL_HapticRumblePlay + * \sa SDL_HapticRumbleStop + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticRumbleSupported_fun = function(haptic: PSDL_Haptic): cint; cdecl; +Var + SDL_HapticRumbleSupported : TSDL_HapticRumbleSupported_fun = Nil; +{$else} + +function SDL_HapticRumbleSupported(haptic: PSDL_Haptic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticRumbleSupported' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Initialize a haptic device for simple rumble playback. + * + * \param haptic the haptic device to initialize for simple rumble playback + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticOpen + * \sa SDL_HapticRumblePlay + * \sa SDL_HapticRumbleStop + * \sa SDL_HapticRumbleSupported + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticRumbleInit_fun = function(haptic: PSDL_Haptic): cint; cdecl; +Var + SDL_HapticRumbleInit : TSDL_HapticRumbleInit_fun = Nil; +{$else} + +function SDL_HapticRumbleInit(haptic: PSDL_Haptic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticRumbleInit' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Run a simple rumble effect on a haptic device. + * + * \param haptic the haptic device to play the rumble effect on + * \param strength strength of the rumble to play as a 0-1 float value + * \param length length of the rumble to play in milliseconds + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticRumbleInit + * \sa SDL_HapticRumbleStop + * \sa SDL_HapticRumbleSupported + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticRumblePlay_fun = function(haptic: PSDL_Haptic; strength: cfloat; length: cuint32): cint; cdecl; +Var + SDL_HapticRumblePlay : TSDL_HapticRumblePlay_fun = Nil; +{$else} + +function SDL_HapticRumblePlay(haptic: PSDL_Haptic; strength: cfloat; length: cuint32): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticRumblePlay' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Stop the simple rumble on a haptic device. + * + * \param haptic the haptic device to stop the rumble effect on + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticRumbleInit + * \sa SDL_HapticRumblePlay + * \sa SDL_HapticRumbleSupported + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticRumbleStop_fun = function(haptic: PSDL_Haptic): cint; cdecl; +Var + SDL_HapticRumbleStop : TSDL_HapticRumbleStop_fun = Nil; +{$else} + +function SDL_HapticRumbleStop(haptic: PSDL_Haptic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticRumbleStop' {$ENDIF} {$ENDIF}; +{$endif} + diff --git a/units/sdlhidapi.inc b/units/sdlhidapi.inc index 570d2c70..314ac651 100644 --- a/units/sdlhidapi.inc +++ b/units/sdlhidapi.inc @@ -1,426 +1,426 @@ -// from SDL_hidapi.h - -(** - * Header file for SDL HIDAPI functions. - * - * This is an adaptation of the original HIDAPI interface by Alan Ott, - * and includes source code licensed under the following BSD license: - * - Copyright (c) 2010, Alan Ott, Signal 11 Software - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of Signal 11 Software nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - * - * If you would like a version of SDL without this code, you can build SDL - * with SDL_HIDAPI_DISABLED defined to 1. You might want to do this for example - * on iOS or tvOS to avoid a dependency on the CoreBluetooth framework. - *) - -type - (** - * \brief A handle representing an open HID device. - *) - PSDL_hid_device = type Pointer; - - PSDL_hid_device_info = ^TSDL_hid_device_info; - - (** - * \brief Information about a connected HID device - *) - TSDL_hid_device_info = record - (** Platform-specific device path *) - path: PAnsiChar; - (** Device Vendor ID *) - vendor_id: pcushort; - (** Device Product ID *) - product_id: pcushort; - (** Serial Number *) - serial_number: pcwchar_t; - (** Device Release Number in binary-coded decimal, also known as Device Version Number *) - release_number: cushort; - (** Manufacturer String *) - manufacturer_string: pcwchar_t; - (** Product string *) - product_string: pcwchar_t; - (** Usage Page for this Device/Interface (Windows/Mac only). *) - usage_page: cushort; - (** Usage for this Device/Interface (Windows/Mac only). *) - usage: cushort; - (** - * The USB interface which this logical device represents. - * Valid on both Linux implementations in all cases. - * Valid on the Windows implementation only if the device - * contains more than one interface. - *) - interface_number: cint; - - (** - * Additional information about the USB interface. - * Valid on libusb and Android implementations. - *) - interface_class: cint; - interface_subclass: cint; - interface_protocol: cint; - - (** Pointer to the next device *) - next: PSDL_hid_device_info; - end; - -(** - * Initialize the HIDAPI library. - * - * This function initializes the HIDAPI library. Calling it is not strictly - * necessary, as it will be called automatically by SDL_hid_enumerate() and - * any of the SDL_hid_open_*() functions if it is needed. This function should - * be called at the beginning of execution however, if there is a chance of - * HIDAPI handles being opened by different threads simultaneously. - * - * Each call to this function should have a matching call to SDL_hid_exit() - * - * \returns 0 on success and -1 on error. - * - * \since This function is available since SDL 2.0.18. - * - * \sa SDL_hid_exit - *) -function SDL_hid_init(): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_init' {$ENDIF} {$ENDIF}; - -(** - * Finalize the HIDAPI library. - * - * This function frees all of the static data associated with HIDAPI. It - * should be called at the end of execution to avoid memory leaks. - * - * \returns 0 on success and -1 on error. - * - * \since This function is available since SDL 2.0.18. - * - * \sa SDL_hid_init - *) -function SDL_hid_exit(): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_exit' {$ENDIF} {$ENDIF}; - -(** - * Check to see if devices may have been added or removed. - * - * Enumerating the HID devices is an expensive operation, so you can call this - * to see if there have been any system device changes since the last call to - * this function. A change in the counter returned doesn't necessarily mean - * that anything has changed, but you can call SDL_hid_enumerate() to get an - * updated device list. - * - * Calling this function for the first time may cause a thread or other system - * resource to be allocated to track device change notifications. - * - * \returns a change counter that is incremented with each potential device - * change, or 0 if device change detection isn't available. - * - * \since This function is available since SDL 2.0.18. - * - * \sa SDL_hid_enumerate - *) -function SDL_hid_device_change_count(): cUint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_device_change_count' {$ENDIF} {$ENDIF}; - -(** - * Enumerate the HID Devices. - * - * This function returns a linked list of all the HID devices attached to the - * system which match vendor_id and product_id. If `vendor_id` is set to 0 - * then any vendor matches. If `product_id` is set to 0 then any product - * matches. If `vendor_id` and `product_id` are both set to 0, then all HID - * devices will be returned. - * - * \param vendor_id The Vendor ID (VID) of the types of device to open. - * \param product_id The Product ID (PID) of the types of device to open. - * \returns a pointer to a linked list of type SDL_hid_device_info, containing - * information about the HID devices attached to the system, or NIL - * in the case of failure. Free this linked list by calling - * SDL_hid_free_enumeration(). - * - * \since This function is available since SDL 2.0.18. - * - * \sa SDL_hid_device_change_count - *) -function SDL_hid_enumerate(vendor_id, product_id: cushort): PSDL_hid_device_info; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_enumerate' {$ENDIF} {$ENDIF}; - -(** - * Free an enumeration Linked List - * - * This function frees a linked list created by SDL_hid_enumerate(). - * - * \param devs Pointer to a list of struct_device returned from - * SDL_hid_enumerate(). - * - * \since This function is available since SDL 2.0.18. - *) -procedure SDL_hid_free_enumeration(devs: PSDL_hid_device_info); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_free_enumeration' {$ENDIF} {$ENDIF}; - -(** - * Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally - * a serial number. - * - * If `serial_number` is NULL, the first device with the specified VID and PID - * is opened. - * - * \param vendor_id The Vendor ID (VID) of the device to open. - * \param product_id The Product ID (PID) of the device to open. - * \param serial_number The Serial Number of the device to open - * (optionally NIL). - * \returns a pointer to a SDL_hid_device object on success or NIL on - * failure. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_open(vendor_id, product_id: cushort; serial_number: pcwchar_t): PSDL_hid_device; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_open' {$ENDIF} {$ENDIF}; - -(** - * Open a HID device by its path name. - * - * The path name be determined by calling SDL_hid_enumerate(), or a - * platform-specific path name can be used (eg: /dev/hidraw0 on Linux). - * - * \param path The path name of the device to open - * \returns a pointer to a SDL_hid_device object on success - * or NIL on failure. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_open_path(path: PAnsiChar; bExclusive: cuint): PSDL_hid_device; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_open_path' {$ENDIF} {$ENDIF}; - -(** - * Write an Output report to a HID device. - * - * The first byte of `data` must contain the Report ID. For devices which only - * support a single report, this must be set to 0x0. The remaining bytes - * contain the report data. Since the Report ID is mandatory, calls to - * SDL_hid_write() will always contain one more byte than the report contains. - * For example, if a hid report is 16 bytes long, 17 bytes must be passed to - * SDL_hid_write(), the Report ID (or 0x0, for devices with a single report), - * followed by the report data (16 bytes). In this example, the length passed - * in would be 17. - * - * SDL_hid_write() will send the data on the first OUT endpoint, if one - * exists. If it does not, it will send the data through the Control Endpoint - * (Endpoint 0). - * - * \param dev A device handle returned from SDL_hid_open(). - * \param data The data to send, including the report number as the first - * byte. - * \param length The length in bytes of the data to send. - * \returns the actual number of bytes written and -1 on error. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_write(dev: PSDL_hid_device; data: pcUint8; length: csize_t): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_write' {$ENDIF} {$ENDIF}; - -(** - * Read an Input report from a HID device with timeout. - * - * Input reports are returned to the host through the INTERRUPT IN endpoint. - * The first byte will contain the Report number if the device uses numbered - * reports. - * - * \param dev A device handle returned from SDL_hid_open(). - * \param data A buffer to put the read data into. - * \param length The number of bytes to read. For devices with multiple - * reports, make sure to read an extra byte for the report - * number. - * \param milliseconds timeout in milliseconds or -1 for blocking wait. - * \returns the actual number of bytes read and -1 on error. If no packet was - * available to be read within the timeout period, this function - * returns 0. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_read_timeout(dev: PSDL_hid_device; data: pcUint8; length: csize_t; milliseconds: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_read_timeout' {$ENDIF} {$ENDIF}; - -(** - * Read an Input report from a HID device. - * - * Input reports are returned to the host through the INTERRUPT IN endpoint. - * The first byte will contain the Report number if the device uses numbered - * reports. - * - * \param dev A device handle returned from SDL_hid_open(). - * \param data A buffer to put the read data into. - * \param length The number of bytes to read. For devices with multiple - * reports, make sure to read an extra byte for the report - * number. - * \returns the actual number of bytes read and -1 on error. If no packet was - * available to be read and the handle is in non-blocking mode, this - * function returns 0. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_read(dev: PSDL_hid_device; data: pcUint8; length: csize_t): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_read' {$ENDIF} {$ENDIF}; - -(** - * Set the device handle to be non-blocking. - * - * In non-blocking mode calls to SDL_hid_read() will return immediately with a - * value of 0 if there is no data to be read. In blocking mode, SDL_hid_read() - * will wait (block) until there is data to read before returning. - * - * Nonblocking can be turned on and off at any time. - * - * \param dev A device handle returned from SDL_hid_open(). - * \param nonblock enable or not the nonblocking reads - 1 to enable - * nonblocking - 0 to disable nonblocking. - * \returns 0 on success and -1 on error. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_set_nonblocking(dev: PSDL_hid_device; nonblock: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_set_nonblocking' {$ENDIF} {$ENDIF}; - -(** - * Send a Feature report to the device. - * - * Feature reports are sent over the Control endpoint as a Set_Report - * transfer. The first byte of `data` must contain the Report ID. For devices - * which only support a single report, this must be set to 0x0. The remaining - * bytes contain the report data. Since the Report ID is mandatory, calls to - * SDL_hid_send_feature_report() will always contain one more byte than the - * report contains. For example, if a hid report is 16 bytes long, 17 bytes - * must be passed to SDL_hid_send_feature_report(): the Report ID (or 0x0, for - * devices which do not use numbered reports), followed by the report data (16 - * bytes). In this example, the length passed in would be 17. - * - * \param dev A device handle returned from SDL_hid_open(). - * \param data The data to send, including the report number as the first - * byte. - * \param length The length in bytes of the data to send, including the report - * number. - * \returns the actual number of bytes written and -1 on error. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_send_feature_report(dev: PSDL_hid_device; data: pcUint8; length: csize_t): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_send_feature_report' {$ENDIF} {$ENDIF}; - -(** - * Get a feature report from a HID device. - * - * Set the first byte of `data` to the Report ID of the report to be read. - * Make sure to allow space for this extra byte in `data`. Upon return, the - * first byte will still contain the Report ID, and the report data will start - * in data[1]. - * - * \param dev A device handle returned from SDL_hid_open(). - * \param data A buffer to put the read data into, including the Report ID. - * Set the first byte of `data` to the Report ID of the report to - * be read, or set it to zero if your device does not use numbered - * reports. - * \param length The number of bytes to read, including an extra byte for the - * report ID. The buffer can be longer than the actual report. - * \returns the number of bytes read plus one for the report ID (which is - * still in the first byte), or -1 on error. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_get_feature_report(dev: PSDL_hid_device; data: pcUint8; length: csize_t): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_get_feature_report' {$ENDIF} {$ENDIF}; - -(** - * Close a HID device. - * - * \param dev A device handle returned from SDL_hid_open(). - * - * \since This function is available since SDL 2.0.18. - *) -procedure SDL_hid_close(dev: PSDL_hid_device); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_close' {$ENDIF} {$ENDIF}; - -(** - * Get The Manufacturer String from a HID device. - * - * \param dev A device handle returned from SDL_hid_open(). - * \param string A wide string buffer to put the data into. - * \param maxlen The length of the buffer in multiples of wchar_t. - * \returns 0 on success and -1 on error. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_get_manufacturer_string(dev: PSDL_hid_device; str: pcwchar_t; maxlen: csize_t): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_get_manufacturer_string' {$ENDIF} {$ENDIF}; - -(** - * Get The Product String from a HID device. - * - * \param dev A device handle returned from SDL_hid_open(). - * \param string A wide string buffer to put the data into. - * \param maxlen The length of the buffer in multiples of wchar_t. - * \returns 0 on success and -1 on error. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_get_product_string(dev: PSDL_hid_device; str: pcwchar_t; maxlen: csize_t): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_get_product_string' {$ENDIF} {$ENDIF}; - -(** - * Get The Serial Number String from a HID device. - * - * \param dev A device handle returned from SDL_hid_open(). - * \param string A wide string buffer to put the data into. - * \param maxlen The length of the buffer in multiples of wchar_t. - * \returns 0 on success and -1 on error. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_get_serial_number_string(dev: PSDL_hid_device; str: pcwchar_t; maxlen: csize_t): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_get_serial_number_string' {$ENDIF} {$ENDIF}; - -(** - * Get a string from a HID device, based on its string index. - * - * \param dev A device handle returned from SDL_hid_open(). - * \param string_index The index of the string to get. - * \param string A wide string buffer to put the data into. - * \param maxlen The length of the buffer in multiples of wchar_t. - * \returns 0 on success and -1 on error. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_get_indexed_string(dev: PSDL_hid_device; string_index: cint; str: pcwchar_t; maxlen: csize_t): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_get_indexed_string' {$ENDIF} {$ENDIF}; - -(** - * Start or stop a BLE scan on iOS and tvOS to pair Steam Controllers - * - * \param active SDL_TRUE to start the scan, SDL_FALSE to stop the scan - * - * \since This function is available since SDL 2.0.18. - *) -procedure SDL_hid_ble_scan(active: TSDL_bool); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_ble_scan' {$ENDIF} {$ENDIF}; +// from SDL_hidapi.h + +(** + * Header file for SDL HIDAPI functions. + * + * This is an adaptation of the original HIDAPI interface by Alan Ott, + * and includes source code licensed under the following BSD license: + * + Copyright (c) 2010, Alan Ott, Signal 11 Software + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Signal 11 Software nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + * + * If you would like a version of SDL without this code, you can build SDL + * with SDL_HIDAPI_DISABLED defined to 1. You might want to do this for example + * on iOS or tvOS to avoid a dependency on the CoreBluetooth framework. + *) + +type + (** + * \brief A handle representing an open HID device. + *) + PSDL_hid_device = type Pointer; + + PSDL_hid_device_info = ^TSDL_hid_device_info; + + (** + * \brief Information about a connected HID device + *) + TSDL_hid_device_info = record + (** Platform-specific device path *) + path: PAnsiChar; + (** Device Vendor ID *) + vendor_id: pcushort; + (** Device Product ID *) + product_id: pcushort; + (** Serial Number *) + serial_number: pcwchar_t; + (** Device Release Number in binary-coded decimal, also known as Device Version Number *) + release_number: cushort; + (** Manufacturer String *) + manufacturer_string: pcwchar_t; + (** Product string *) + product_string: pcwchar_t; + (** Usage Page for this Device/Interface (Windows/Mac only). *) + usage_page: cushort; + (** Usage for this Device/Interface (Windows/Mac only). *) + usage: cushort; + (** + * The USB interface which this logical device represents. + * Valid on both Linux implementations in all cases. + * Valid on the Windows implementation only if the device + * contains more than one interface. + *) + interface_number: cint; + + (** + * Additional information about the USB interface. + * Valid on libusb and Android implementations. + *) + interface_class: cint; + interface_subclass: cint; + interface_protocol: cint; + + (** Pointer to the next device *) + next: PSDL_hid_device_info; + end; + +(** + * Initialize the HIDAPI library. + * + * This function initializes the HIDAPI library. Calling it is not strictly + * necessary, as it will be called automatically by SDL_hid_enumerate() and + * any of the SDL_hid_open_*() functions if it is needed. This function should + * be called at the beginning of execution however, if there is a chance of + * HIDAPI handles being opened by different threads simultaneously. + * + * Each call to this function should have a matching call to SDL_hid_exit() + * + * \returns 0 on success and -1 on error. + * + * \since This function is available since SDL 2.0.18. + * + * \sa SDL_hid_exit + *) +function SDL_hid_init(): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_init' {$ENDIF} {$ENDIF}; + +(** + * Finalize the HIDAPI library. + * + * This function frees all of the static data associated with HIDAPI. It + * should be called at the end of execution to avoid memory leaks. + * + * \returns 0 on success and -1 on error. + * + * \since This function is available since SDL 2.0.18. + * + * \sa SDL_hid_init + *) +function SDL_hid_exit(): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_exit' {$ENDIF} {$ENDIF}; + +(** + * Check to see if devices may have been added or removed. + * + * Enumerating the HID devices is an expensive operation, so you can call this + * to see if there have been any system device changes since the last call to + * this function. A change in the counter returned doesn't necessarily mean + * that anything has changed, but you can call SDL_hid_enumerate() to get an + * updated device list. + * + * Calling this function for the first time may cause a thread or other system + * resource to be allocated to track device change notifications. + * + * \returns a change counter that is incremented with each potential device + * change, or 0 if device change detection isn't available. + * + * \since This function is available since SDL 2.0.18. + * + * \sa SDL_hid_enumerate + *) +function SDL_hid_device_change_count(): cUint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_device_change_count' {$ENDIF} {$ENDIF}; + +(** + * Enumerate the HID Devices. + * + * This function returns a linked list of all the HID devices attached to the + * system which match vendor_id and product_id. If `vendor_id` is set to 0 + * then any vendor matches. If `product_id` is set to 0 then any product + * matches. If `vendor_id` and `product_id` are both set to 0, then all HID + * devices will be returned. + * + * \param vendor_id The Vendor ID (VID) of the types of device to open. + * \param product_id The Product ID (PID) of the types of device to open. + * \returns a pointer to a linked list of type SDL_hid_device_info, containing + * information about the HID devices attached to the system, or NIL + * in the case of failure. Free this linked list by calling + * SDL_hid_free_enumeration(). + * + * \since This function is available since SDL 2.0.18. + * + * \sa SDL_hid_device_change_count + *) +function SDL_hid_enumerate(vendor_id, product_id: cushort): PSDL_hid_device_info; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_enumerate' {$ENDIF} {$ENDIF}; + +(** + * Free an enumeration Linked List + * + * This function frees a linked list created by SDL_hid_enumerate(). + * + * \param devs Pointer to a list of struct_device returned from + * SDL_hid_enumerate(). + * + * \since This function is available since SDL 2.0.18. + *) +procedure SDL_hid_free_enumeration(devs: PSDL_hid_device_info); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_free_enumeration' {$ENDIF} {$ENDIF}; + +(** + * Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally + * a serial number. + * + * If `serial_number` is NULL, the first device with the specified VID and PID + * is opened. + * + * \param vendor_id The Vendor ID (VID) of the device to open. + * \param product_id The Product ID (PID) of the device to open. + * \param serial_number The Serial Number of the device to open + * (optionally NIL). + * \returns a pointer to a SDL_hid_device object on success or NIL on + * failure. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_open(vendor_id, product_id: cushort; serial_number: pcwchar_t): PSDL_hid_device; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_open' {$ENDIF} {$ENDIF}; + +(** + * Open a HID device by its path name. + * + * The path name be determined by calling SDL_hid_enumerate(), or a + * platform-specific path name can be used (eg: /dev/hidraw0 on Linux). + * + * \param path The path name of the device to open + * \returns a pointer to a SDL_hid_device object on success + * or NIL on failure. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_open_path(path: PAnsiChar; bExclusive: cuint): PSDL_hid_device; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_open_path' {$ENDIF} {$ENDIF}; + +(** + * Write an Output report to a HID device. + * + * The first byte of `data` must contain the Report ID. For devices which only + * support a single report, this must be set to 0x0. The remaining bytes + * contain the report data. Since the Report ID is mandatory, calls to + * SDL_hid_write() will always contain one more byte than the report contains. + * For example, if a hid report is 16 bytes long, 17 bytes must be passed to + * SDL_hid_write(), the Report ID (or 0x0, for devices with a single report), + * followed by the report data (16 bytes). In this example, the length passed + * in would be 17. + * + * SDL_hid_write() will send the data on the first OUT endpoint, if one + * exists. If it does not, it will send the data through the Control Endpoint + * (Endpoint 0). + * + * \param dev A device handle returned from SDL_hid_open(). + * \param data The data to send, including the report number as the first + * byte. + * \param length The length in bytes of the data to send. + * \returns the actual number of bytes written and -1 on error. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_write(dev: PSDL_hid_device; data: pcUint8; length: csize_t): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_write' {$ENDIF} {$ENDIF}; + +(** + * Read an Input report from a HID device with timeout. + * + * Input reports are returned to the host through the INTERRUPT IN endpoint. + * The first byte will contain the Report number if the device uses numbered + * reports. + * + * \param dev A device handle returned from SDL_hid_open(). + * \param data A buffer to put the read data into. + * \param length The number of bytes to read. For devices with multiple + * reports, make sure to read an extra byte for the report + * number. + * \param milliseconds timeout in milliseconds or -1 for blocking wait. + * \returns the actual number of bytes read and -1 on error. If no packet was + * available to be read within the timeout period, this function + * returns 0. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_read_timeout(dev: PSDL_hid_device; data: pcUint8; length: csize_t; milliseconds: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_read_timeout' {$ENDIF} {$ENDIF}; + +(** + * Read an Input report from a HID device. + * + * Input reports are returned to the host through the INTERRUPT IN endpoint. + * The first byte will contain the Report number if the device uses numbered + * reports. + * + * \param dev A device handle returned from SDL_hid_open(). + * \param data A buffer to put the read data into. + * \param length The number of bytes to read. For devices with multiple + * reports, make sure to read an extra byte for the report + * number. + * \returns the actual number of bytes read and -1 on error. If no packet was + * available to be read and the handle is in non-blocking mode, this + * function returns 0. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_read(dev: PSDL_hid_device; data: pcUint8; length: csize_t): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_read' {$ENDIF} {$ENDIF}; + +(** + * Set the device handle to be non-blocking. + * + * In non-blocking mode calls to SDL_hid_read() will return immediately with a + * value of 0 if there is no data to be read. In blocking mode, SDL_hid_read() + * will wait (block) until there is data to read before returning. + * + * Nonblocking can be turned on and off at any time. + * + * \param dev A device handle returned from SDL_hid_open(). + * \param nonblock enable or not the nonblocking reads - 1 to enable + * nonblocking - 0 to disable nonblocking. + * \returns 0 on success and -1 on error. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_set_nonblocking(dev: PSDL_hid_device; nonblock: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_set_nonblocking' {$ENDIF} {$ENDIF}; + +(** + * Send a Feature report to the device. + * + * Feature reports are sent over the Control endpoint as a Set_Report + * transfer. The first byte of `data` must contain the Report ID. For devices + * which only support a single report, this must be set to 0x0. The remaining + * bytes contain the report data. Since the Report ID is mandatory, calls to + * SDL_hid_send_feature_report() will always contain one more byte than the + * report contains. For example, if a hid report is 16 bytes long, 17 bytes + * must be passed to SDL_hid_send_feature_report(): the Report ID (or 0x0, for + * devices which do not use numbered reports), followed by the report data (16 + * bytes). In this example, the length passed in would be 17. + * + * \param dev A device handle returned from SDL_hid_open(). + * \param data The data to send, including the report number as the first + * byte. + * \param length The length in bytes of the data to send, including the report + * number. + * \returns the actual number of bytes written and -1 on error. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_send_feature_report(dev: PSDL_hid_device; data: pcUint8; length: csize_t): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_send_feature_report' {$ENDIF} {$ENDIF}; + +(** + * Get a feature report from a HID device. + * + * Set the first byte of `data` to the Report ID of the report to be read. + * Make sure to allow space for this extra byte in `data`. Upon return, the + * first byte will still contain the Report ID, and the report data will start + * in data[1]. + * + * \param dev A device handle returned from SDL_hid_open(). + * \param data A buffer to put the read data into, including the Report ID. + * Set the first byte of `data` to the Report ID of the report to + * be read, or set it to zero if your device does not use numbered + * reports. + * \param length The number of bytes to read, including an extra byte for the + * report ID. The buffer can be longer than the actual report. + * \returns the number of bytes read plus one for the report ID (which is + * still in the first byte), or -1 on error. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_get_feature_report(dev: PSDL_hid_device; data: pcUint8; length: csize_t): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_get_feature_report' {$ENDIF} {$ENDIF}; + +(** + * Close a HID device. + * + * \param dev A device handle returned from SDL_hid_open(). + * + * \since This function is available since SDL 2.0.18. + *) +procedure SDL_hid_close(dev: PSDL_hid_device); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_close' {$ENDIF} {$ENDIF}; + +(** + * Get The Manufacturer String from a HID device. + * + * \param dev A device handle returned from SDL_hid_open(). + * \param string A wide string buffer to put the data into. + * \param maxlen The length of the buffer in multiples of wchar_t. + * \returns 0 on success and -1 on error. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_get_manufacturer_string(dev: PSDL_hid_device; str: pcwchar_t; maxlen: csize_t): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_get_manufacturer_string' {$ENDIF} {$ENDIF}; + +(** + * Get The Product String from a HID device. + * + * \param dev A device handle returned from SDL_hid_open(). + * \param string A wide string buffer to put the data into. + * \param maxlen The length of the buffer in multiples of wchar_t. + * \returns 0 on success and -1 on error. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_get_product_string(dev: PSDL_hid_device; str: pcwchar_t; maxlen: csize_t): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_get_product_string' {$ENDIF} {$ENDIF}; + +(** + * Get The Serial Number String from a HID device. + * + * \param dev A device handle returned from SDL_hid_open(). + * \param string A wide string buffer to put the data into. + * \param maxlen The length of the buffer in multiples of wchar_t. + * \returns 0 on success and -1 on error. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_get_serial_number_string(dev: PSDL_hid_device; str: pcwchar_t; maxlen: csize_t): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_get_serial_number_string' {$ENDIF} {$ENDIF}; + +(** + * Get a string from a HID device, based on its string index. + * + * \param dev A device handle returned from SDL_hid_open(). + * \param string_index The index of the string to get. + * \param string A wide string buffer to put the data into. + * \param maxlen The length of the buffer in multiples of wchar_t. + * \returns 0 on success and -1 on error. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_get_indexed_string(dev: PSDL_hid_device; string_index: cint; str: pcwchar_t; maxlen: csize_t): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_get_indexed_string' {$ENDIF} {$ENDIF}; + +(** + * Start or stop a BLE scan on iOS and tvOS to pair Steam Controllers + * + * \param active SDL_TRUE to start the scan, SDL_FALSE to stop the scan + * + * \since This function is available since SDL 2.0.18. + *) +procedure SDL_hid_ble_scan(active: TSDL_bool); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_ble_scan' {$ENDIF} {$ENDIF}; diff --git a/units/sdlhints.inc b/units/sdlhints.inc index 32d60caf..e0747c58 100644 --- a/units/sdlhints.inc +++ b/units/sdlhints.inc @@ -1,2516 +1,2588 @@ -// from "SDL_hints.h" - -{** - * \file SDL_hints.h - * - * Official documentation for SDL configuration variables - * - * This file contains functions to set and get configuration hints, - * as well as listing each of them alphabetically. - * - * The convention for naming hints is SDL_HINT_X, where "SDL_X" is - * the environment variable that can be used to override the default. - * - * In general these hints are just that - they may or may not be - * supported or applicable on any given platform, but they provide - * a way for an application or user to give the library a hint as - * to how they would like the library to work. - *} - -const - -{/** - * \brief Override for SDL_GetDisplayUsableBounds() - * - * If set, this hint will override the expected results for - * SDL_GetDisplayUsableBounds() for display index 0. Generally you don't want - * to do this, but this allows an embedded system to request that some of the - * screen be reserved for other uses when paired with a well-behaved - * application. - * - * The contents of this hint must be 4 comma-separated integers, the first - * is the bounds x, then y, width and height, in that order. - */} -SDL_HINT_DISPLAY_USABLE_BOUNDS = 'SDL_DISPLAY_USABLE_BOUNDS'; - -{/** - * \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs - * - * The variable can be set to the following values: - * "0" - Do not scan for Steam Controllers - * "1" - Scan for Steam Controllers (the default) - * - * The default value is "1". This hint must be set before initializing the joystick subsystem. - */} -SDL_HINT_ENABLE_STEAM_CONTROLLERS = 'SDL_ENABLE_STEAM_CONTROLLERS'; - -{/** - * \brief A variable controlling whether SDL logs all events pushed onto its internal queue. - * - * This variable can be set to the following values: - * - * "0" - Don't log any events (default) - * "1" - Log all events except mouse and finger motion, which are pretty spammy. - * "2" - Log all events. - * - * This is generally meant to be used to debug SDL itself, but can be useful - * for application developers that need better visibility into what is going - * on in the event queue. Logged events are sent through SDL_Log(), which - * means by default they appear on stdout on most platforms or maybe - * OutputDebugString() on Windows, and can be funneled by the app with - * SDL_LogSetOutputFunction(), etc. - * - * This hint can be toggled on and off at runtime, if you only need to log - * events for a small subset of program execution. - */} -SDL_HINT_EVENT_LOGGING = 'SDL_EVENT_LOGGING'; - -{** - * \brief A variable controlling whether raising the window should be done more forcefully - * - * This variable can be set to the following values: - * "0" - No forcing (the default) - * "1" - Extra level of forcing - * - * At present, this is only an issue under MS Windows, which makes it nearly impossible to - * programmatically move a window to the foreground, for "security" reasons. See - * http://stackoverflow.com/a/34414846 for a discussion. - *} -SDL_HINT_FORCE_RAISEWINDOW = 'SDL_HINT_FORCE_RAISEWINDOW'; - -{/** - * \brief A variable controlling how 3D acceleration is used to accelerate the SDL screen surface. - * - * SDL can try to accelerate the SDL screen surface by using streaming - * textures with a 3D rendering engine. This variable controls whether and - * how this is done. - * - * This variable can be set to the following values: - * "0" - Disable 3D acceleration - * "1" - Enable 3D acceleration, using the default renderer. - * "X" - Enable 3D acceleration, using X where X is one of the valid rendering drivers. (e.g. "direct3d", "opengl", etc.) - * - * By default SDL tries to make a best guess for each platform whether - * to use acceleration or not. - */} -SDL_HINT_FRAMEBUFFER_ACCELERATION = 'SDL_FRAMEBUFFER_ACCELERATION'; - -{/** - * \brief Determines whether SDL enforces that DRM master is required in order - * to initialize the KMSDRM video backend. - * - * The DRM subsystem has a concept of a "DRM master" which is a DRM client that - * has the ability to set planes, set cursor, etc. When SDL is DRM master, it - * can draw to the screen using the SDL rendering APIs. Without DRM master, SDL - * is still able to process input and query attributes of attached displays, - * but it cannot change display state or draw to the screen directly. - * - * In some cases, it can be useful to have the KMSDRM backend even if it cannot - * be used for rendering. An app may want to use SDL for input processing while - * using another rendering API (such as an MMAL overlay on Raspberry Pi) or - * using its own code to render to DRM overlays that SDL doesn't support. - * - * This hint must be set before initializing the video subsystem. - * - * This variable can be set to the following values: - * "0" - SDL will allow usage of the KMSDRM backend without DRM master - * "1" - SDL will require DRM master to use the KMSDRM backend (default) - */} -SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER = 'SDL_KMSDRM_REQUIRE_DRM_MASTER'; - -{/** - * \brief A variable controlling whether the 2D render API is compatible or efficient. - * - * This variable can be set to the following values: - * - * "0" - Don't use batching to make rendering more efficient. - * "1" - Use batching, but might cause problems if app makes its own direct OpenGL calls. - * - * Up to SDL 2.0.9, the render API would draw immediately when requested. Now - * it batches up draw requests and sends them all to the GPU only when forced - * to (during SDL_RenderPresent, when changing render targets, by updating a - * texture that the batch needs, etc). This is significantly more efficient, - * but it can cause problems for apps that expect to render on top of the - * render API's output. As such, SDL will disable batching if a specific - * render backend is requested (since this might indicate that the app is - * planning to use the underlying graphics API directly). This hint can - * be used to explicitly request batching in this instance. It is a contract - * that you will either never use the underlying graphics API directly, or - * if you do, you will call SDL_RenderFlush() before you do so any current - * batch goes to the GPU before your work begins. Not following this contract - * will result in undefined behavior. - */} -SDL_HINT_RENDER_BATCHING = 'SDL_RENDER_BATCHING'; - -{/** - * \brief A variable specifying which render driver to use. - * - * If the application doesn't pick a specific renderer to use, this variable - * specifies the name of the preferred renderer. If the preferred renderer - * can't be initialized, the normal default renderer is used. - * - * This variable is case insensitive and can be set to the following values: - * "direct3d" - * "opengl" - * "opengles2" - * "opengles" - * "software" - * - * The default varies by platform, but it's the first one in the list that - * is available on the current platform. - */} -SDL_HINT_RENDER_DRIVER = 'SDL_RENDER_DRIVER'; - -{/** - * \brief A variable controlling how the 2D render API renders lines - * - * This variable can be set to the following values: - * "0" - Use the default line drawing method (Bresenham's line algorithm as of SDL 2.0.20) - * "1" - Use the driver point API using Bresenham's line algorithm (correct, draws many points) - * "2" - Use the driver line API (occasionally misses line endpoints based on hardware driver quirks, was the default before 2.0.20) - * "3" - Use the driver geometry API (correct, draws thicker diagonal lines) - * - * This variable should be set when the renderer is created. - */} -SDL_HINT_RENDER_LINE_METHOD = 'SDL_RENDER_LINE_METHOD'; - -{/** - * \brief A variable controlling the scaling policy for SDL_RenderSetLogicalSize. - * - * This variable can be set to the following values: - * "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen - * "1" or "overscan" - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen - * - * By default letterbox is used - */} -SDL_HINT_RENDER_LOGICAL_SIZE_MODE = 'SDL_RENDER_LOGICAL_SIZE_MODE'; - -{/** - * \brief A variable controlling whether the OpenGL render driver uses shaders if they are available. - * - * This variable can be set to the following values: - * "0" - Disable shaders - * "1" - Enable shaders - * - * By default shaders are used if OpenGL supports them. - */} -SDL_HINT_RENDER_OPENGL_SHADERS = 'SDL_RENDER_OPENGL_SHADERS'; - -{/** - * \brief A variable controlling whether the Direct3D device is initialized for thread-safe operations. - * - * This variable can be set to the following values: - * "0" - Thread-safety is not enabled (faster) - * "1" - Thread-safety is enabled - * - * By default the Direct3D device is created with thread-safety disabled. - */} -SDL_HINT_RENDER_DIRECT3D_THREADSAFE = 'SDL_RENDER_DIRECT3D_THREADSAFE'; - -{/** - * \brief A variable controlling whether to enable Direct3D 11+'s Debug Layer. - * - * This variable does not have any effect on the Direct3D 9 based renderer. - * - * This variable can be set to the following values: - * "0" - Disable Debug Layer use - * "1" - Enable Debug Layer use - * - * By default, SDL does not use Direct3D Debug Layer. - */} -SDL_HINT_RENDER_DIRECT3D11_DEBUG = 'SDL_RENDER_DIRECT3D11_DEBUG'; - -{/** - * \brief A variable controlling the scaling quality - * - * This variable can be set to the following values: - * "0" or "nearest" - Nearest pixel sampling - * "1" or "linear" - Linear filtering (supported by OpenGL and Direct3D) - * "2" or "best" - Currently this is the same as "linear" - * - * By default nearest pixel sampling is used - */} -SDL_HINT_RENDER_SCALE_QUALITY = 'SDL_RENDER_SCALE_QUALITY'; - -{/** - * \brief A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing. - * - * This variable can be set to the following values: - * "0" - Disable vsync - * "1" - Enable vsync - * - * By default SDL does not sync screen surface updates with vertical refresh. - */} -SDL_HINT_RENDER_VSYNC = 'SDL_RENDER_VSYNC'; - -{** - * \brief A variable controlling if VSYNC is automatically disable if doesn't reach the enough FPS - * - * This variable can be set to the following values: - * "0" - It will be using VSYNC as defined in the main flag. Default - * "1" - If VSYNC was previously enabled, then it will disable VSYNC if doesn't reach enough speed - * - * By default SDL does not enable the automatic VSYNC - *} -SDL_HINT_PS2_DYNAMIC_VSYNC = 'SDL_PS2_DYNAMIC_VSYNC'; - -{/** - * \brief A variable controlling whether the screensaver is enabled. - * - * This variable can be set to the following values: - * "0" - Disable screensaver - * "1" - Enable screensaver - * - * By default SDL will disable the screensaver. - */} -SDL_HINT_VIDEO_ALLOW_SCREENSAVER = 'SDL_VIDEO_ALLOW_SCREENSAVER'; - -{/** - * \brief Tell the video driver that we only want a double buffer. - * - * By default, most lowlevel 2D APIs will use a triple buffer scheme that - * wastes no CPU time on waiting for vsync after issuing a flip, but - * introduces a frame of latency. On the other hand, using a double buffer - * scheme instead is recommended for cases where low latency is an important - * factor because we save a whole frame of latency. - * We do so by waiting for vsync immediately after issuing a flip, usually just - * after eglSwapBuffers call in the backend's *_SwapWindow function. - * - * Since it's driver-specific, it's only supported where possible and - * implemented. Currently supported the following drivers: - * - * - KMSDRM (kmsdrm) - * - Raspberry Pi (raspberrypi) - */} -SDL_HINT_VIDEO_DOUBLE_BUFFER = 'SDL_VIDEO_DOUBLE_BUFFER'; - -{/** - * \brief A variable controlling whether the EGL window is allowed to be - * composited as transparent, rather than opaque. - * - * Most window systems will always render windows opaque, even if the surface - * format has an alpha channel. This is not always true, however, so by default - * SDL will try to enforce opaque composition. To override this behavior, you - * can set this hint to "1". - */} -SDL_HINT_VIDEO_EGL_ALLOW_TRANSPARENCY = 'SDL_VIDEO_EGL_ALLOW_TRANSPARENCY'; - -{/** - * \brief A variable controlling whether the graphics context is externally managed. - * - * This variable can be set to the following values: - * "0" - SDL will manage graphics contexts that are attached to windows. - * "1" - Disable graphics context management on windows. - * - * By default SDL will manage OpenGL contexts in certain situations. For example, on Android the - * context will be automatically saved and restored when pausing the application. Additionally, some - * platforms will assume usage of OpenGL if Vulkan isn't used. Setting this to "1" will prevent this - * behavior, which is desireable when the application manages the graphics context, such as - * an externally managed OpenGL context or attaching a Vulkan surface to the window. - */} -SDL_HINT_VIDEO_EXTERNAL_CONTEXT = 'SDL_VIDEO_EXTERNAL_CONTEXT'; - -{/** - * \brief A variable controlling whether the libdecor Wayland backend is allowed to be used. - * - * This variable can be set to the following values: - * "0" - libdecor use is disabled. - * "1" - libdecor use is enabled (default). - * - * libdecor is used over xdg-shell when xdg-decoration protocol is unavailable. - */} -SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR = 'SDL_VIDEO_WAYLAND_ALLOW_LIBDECOR'; - -{** - * \brief A variable controlling whether the libdecor Wayland backend is preferred over native decrations. - * - * When this hint is set, libdecor will be used to provide window decorations, even if xdg-decoration is - * available. (Note that, by default, libdecor will use xdg-decoration itself if available). - * - * This variable can be set to the following values: - * "0" - libdecor is enabled only if server-side decorations are unavailable. - * "1" - libdecor is always enabled if available. - * - * libdecor is used over xdg-shell when xdg-decoration protocol is unavailable. - *} -SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR = 'SDL_VIDEO_WAYLAND_PREFER_LIBDECOR'; - -{** - * \brief A variable controlling whether video mode emulation is enabled under Wayland. - * - * When this hint is set, a standard set of emulated CVT video modes will be exposed for use by the application. - * If it is disabled, the only modes exposed will be the logical desktop size and, in the case of a scaled - * desktop, the native display resolution. - * - * This variable can be set to the following values: - * "0" - Video mode emulation is disabled. - * "1" - Video mode emulation is enabled. - * - * By default video mode emulation is enabled. - *} -SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION = 'SDL_VIDEO_WAYLAND_MODE_EMULATION'; - -{** - * \brief Enable or disable mouse pointer warp emulation, needed by some older games. - * - * When this hint is set, any SDL will emulate mouse warps using relative mouse mode. - * This is required for some older games (such as Source engine games), which warp the - * mouse to the centre of the screen rather than using relative mouse motion. Note that - * relative mouse mode may have different mouse acceleration behaviour than pointer warps. - * - * This variable can be set to the following values: - * "0" - All mouse warps fail, as mouse warping is not available under Wayland. - * "1" - Some mouse warps will be emulated by forcing relative mouse mode. - * - * If not set, this is automatically enabled unless an application uses - * relative mouse mode directly. - * - * This hint is available since SDL 2.26.0. - *} -SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP = 'SDL_VIDEO_WAYLAND_EMULATE_MOUSE_WARP'; - -{/** - * \brief Specify an "activity name" for screensaver inhibition. - * - * Some platforms, notably Linux desktops, list the applications which are - * inhibiting the screensaver or other power-saving features. - * - * This hint lets you specify the "activity name" sent to the OS when - * SDL_DisableScreenSaver() is used (or the screensaver is automatically - * disabled). The contents of this hint are used when the screensaver is - * disabled. You should use a string that describes what your program is doing - * (and, therefore, why the screensaver is disabled). For example, "Playing a - * game" or "Watching a video". - * - * Setting this to "" or leaving it unset will have SDL use a reasonable - * default: "Playing a game" or something similar. - * - * On targets where this is not supported, this hint does nothing. - */} -SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME = 'SDL_SCREENSAVER_INHIBIT_ACTIVITY_NAME'; - -{/** - * \brief A variable controlling whether X11 should use GLX or EGL by default - * - * This variable can be set to the following values: - * "0" - Use GLX - * "1" - Use EGL - * - * By default SDL will use GLX when both are present. - */} -SDL_HINT_VIDEO_X11_FORCE_EGL = 'SDL_VIDEO_X11_FORCE_EGL'; - -{/** - * \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used. - * - * This variable can be set to the following values: - * "0" - Disable _NET_WM_BYPASS_COMPOSITOR - * "1" - Enable _NET_WM_BYPASS_COMPOSITOR - * - * By default SDL will use _NET_WM_BYPASS_COMPOSITOR - * - */} -SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR = 'SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR'; - -{/** - * \brief A variable forcing the visual ID chosen for new X11 windows - * - */} -SDL_HINT_VIDEO_X11_WINDOW_VISUALID = 'SDL_VIDEO_X11_WINDOW_VISUALID'; - -{/** - * \brief A variable controlling whether the X11 VidMode extension should be used. - * - * This variable can be set to the following values: - * "0" - Disable XVidMode - * "1" - Enable XVidMode - * - * By default SDL will use XVidMode if it is available. - */} -SDL_HINT_VIDEO_X11_XVIDMODE = 'SDL_VIDEO_X11_XVIDMODE'; - -{/** - * \brief A variable controlling whether the X11 Xinerama extension should be used. - * - * This variable can be set to the following values: - * "0" - Disable Xinerama - * "1" - Enable Xinerama - * - * By default SDL will use Xinerama if it is available. - */} -SDL_HINT_VIDEO_X11_XINERAMA = 'SDL_VIDEO_X11_XINERAMA'; - -{/** - * \brief A variable controlling whether the X11 XRandR extension should be used. - * - * This variable can be set to the following values: - * "0" - Disable XRandR - * "1" - Enable XRandR - * - * By default SDL will not use XRandR because of window manager issues. - */} -SDL_HINT_VIDEO_X11_XRANDR = 'SDL_VIDEO_X11_XRANDR'; - -{/** - * \brief A variable controlling whether the X11 _NET_WM_PING protocol should be supported. - * - * This variable can be set to the following values: - * "0" - Disable _NET_WM_PING - * "1" - Enable _NET_WM_PING - * - * By default SDL will use _NET_WM_PING, but for applications that know they - * will not always be able to respond to ping requests in a timely manner they can - * turn it off to avoid the window manager thinking the app is hung. - * The hint is checked in CreateWindow. - */} -SDL_HINT_VIDEO_X11_NET_WM_PING = 'SDL_VIDEO_X11_NET_WM_PING'; - -{/** - * \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden - * - * This variable can be set to the following values: - * "0" - The window frame is not interactive when the cursor is hidden (no move, resize, etc) - * "1" - The window frame is interactive when the cursor is hidden - * - * By default SDL will allow interaction with the window frame when the cursor is hidden - */} -SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN = 'SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN'; - -{/** -* \brief A variable controlling whether the window is activated when the SDL_ShowWindow function is called -* -* This variable can be set to the following values: -* "0" - The window is activated when the SDL_ShowWindow function is called -* "1" - The window is not activated when the SDL_ShowWindow function is called -* -* By default SDL will activate the window when the SDL_ShowWindow function is called -*/} -SDL_HINT_WINDOW_NO_ACTIVATION_WHEN_SHOWN = 'SDL_WINDOW_NO_ACTIVATION_WHEN_SHOWN'; - -{/** - * \brief A variable controlling whether the windows message loop is processed by SDL - * - * This variable can be set to the following values: - * "0" - The window message loop is not run - * "1" - The window message loop is processed in SDL_PumpEvents() - * - * By default SDL will process the windows message loop - */} -SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP = 'SDL_WINDOWS_ENABLE_MESSAGELOOP'; - -{/** - * \brief Force SDL to use Critical Sections for mutexes on Windows. - * On Windows 7 and newer, Slim Reader/Writer Locks are available. - * They offer better performance, allocate no kernel ressources and - * use less memory. SDL will fall back to Critical Sections on older - * OS versions or if forced to by this hint. - * - * This variable can be set to the following values: - * "0" - Use SRW Locks when available. If not, fall back to Critical Sections. (default) - * "1" - Force the use of Critical Sections in all cases. - * - */} -SDL_HINT_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS = 'SDL_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS'; - -{/** - * \brief Force SDL to use Kernel Semaphores on Windows. - * Kernel Semaphores are inter-process and require a context - * switch on every interaction. On Windows 8 and newer, the - * WaitOnAddress API is available. Using that and atomics to - * implement semaphores increases performance. - * SDL will fall back to Kernel Objects on older OS versions - * or if forced to by this hint. - * - * This variable can be set to the following values: - * "0" - Use Atomics and WaitOnAddress API when available. If not, fall back to Kernel Objects. (default) - * "1" - Force the use of Kernel Objects in all cases. - * - */} -SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL = 'SDL_WINDOWS_FORCE_SEMAPHORE_KERNEL'; - -{/** - * \brief A variable to specify custom icon resource id from RC file on Windows platform - */} -SDL_HINT_WINDOWS_INTRESOURCE_ICON = 'SDL_WINDOWS_INTRESOURCE_ICON'; -SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL = 'SDL_WINDOWS_INTRESOURCE_ICON_SMALL'; - -{/** - * \brief Use the D3D9Ex API introduced in Windows Vista, instead of normal D3D9. - * Direct3D 9Ex contains changes to state management that can eliminate device - * loss errors during scenarios like Alt+Tab or UAC prompts. D3D9Ex may require - * some changes to your application to cope with the new behavior, so this - * is disabled by default. - * - * This hint must be set before initializing the video subsystem. - * - * For more information on Direct3D 9Ex, see: - * - https://docs.microsoft.com/en-us/windows/win32/direct3darticles/graphics-apis-in-windows-vista#direct3d-9ex - * - https://docs.microsoft.com/en-us/windows/win32/direct3darticles/direct3d-9ex-improvements - * - * This variable can be set to the following values: - * "0" - Use the original Direct3D 9 API (default) - * "1" - Use the Direct3D 9Ex API on Vista and later (and fall back if D3D9Ex is unavailable) - * - */} -SDL_HINT_WINDOWS_USE_D3D9EX = 'SDL_WINDOWS_USE_D3D9EX'; - -{** - * \brief Controls whether SDL will declare the process to be DPI aware. - * - * This hint must be set before initializing the video subsystem. - * - * The main purpose of declaring DPI awareness is to disable OS bitmap scaling of SDL windows on monitors with - * a DPI scale factor. - * - * This hint is equivalent to requesting DPI awareness via external means (e.g. calling SetProcessDpiAwarenessContext) - * and does not cause SDL to use a virtualized coordinate system, so it will generally give you 1 SDL coordinate = 1 pixel - * even on high-DPI displays. - * - * For more information, see: - * https://docs.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows - * - * This variable can be set to the following values: - * "" - Do not change the DPI awareness (default). - * "unaware" - Declare the process as DPI unaware. (Windows 8.1 and later). - * "system" - Request system DPI awareness. (Vista and later). - * "permonitor" - Request per-monitor DPI awareness. (Windows 8.1 and later). - * "permonitorv2" - Request per-monitor V2 DPI awareness. (Windows 10, version 1607 and later). - * The most visible difference from "permonitor" is that window title bar will be scaled - * to the visually correct size when dragging between monitors with different scale factors. - * This is the preferred DPI awareness level. - * - * If the requested DPI awareness is not available on the currently running OS, SDL will try to request the best - * available match. - *} -SDL_HINT_WINDOWS_DPI_AWARENESS = 'SDL_WINDOWS_DPI_AWARENESS'; - -{** - * \brief Uses DPI-scaled points as the SDL coordinate system on Windows. - * - * This changes the SDL coordinate system units to be DPI-scaled points, rather than pixels everywhere. - * This means windows will be appropriately sized, even when created on high-DPI displays with scaling. - * - * e.g. requesting a 640x480 window from SDL, on a display with 125% scaling in Windows display settings, - * will create a window with an 800x600 client area (in pixels). - * - * Setting this to "1" implicitly requests process DPI awareness (setting SDL_WINDOWS_DPI_AWARENESS is unnecessary), - * and forces SDL_WINDOW_ALLOW_HIGHDPI on all windows. - * - * This variable can be set to the following values: - * "0" - SDL coordinates equal Windows coordinates. No automatic window resizing when dragging - * between monitors with different scale factors (unless this is performed by - * Windows itself, which is the case when the process is DPI unaware). - * "1" - SDL coordinates are in DPI-scaled points. Automatically resize windows as needed on - * displays with non-100% scale factors. - *} -SDL_HINT_WINDOWS_DPI_SCALING = 'SDL_WINDOWS_DPI_SCALING'; - -{/** - * \brief A variable controlling whether grabbing input grabs the keyboard - * - * This variable can be set to the following values: - * "0" - Grab will affect only the mouse - * "1" - Grab will affect mouse and keyboard - * - * By default SDL will not grab the keyboard so system shortcuts still work. - */} -SDL_HINT_GRAB_KEYBOARD = 'SDL_GRAB_KEYBOARD'; - -{** - * \brief A variable containing a list of devices to ignore in SDL_hid_enumerate() - * - * For example, to ignore the Shanwan DS3 controller and any Valve controller, you might - * have the string "0x2563/0x0523,0x28de/0x0000". - * - * This hint is available since SDL 2.26.0. - *} -SDL_HINT_HIDAPI_IGNORE_DEVICES = 'SDL_HIDAPI_IGNORE_DEVICES'; - -{** - * \brief A variable controlling whether the mouse is captured while mouse buttons are pressed - * - * This variable can be set to the following values: - * "0" - The mouse is not captured while mouse buttons are pressed - * "1" - The mouse is captured while mouse buttons are pressed - * - * By default the mouse is captured while mouse buttons are pressed so if the mouse is dragged - * outside the window, the application continues to receive mouse events until the button is - * released. - *} -SDL_HINT_MOUSE_AUTO_CAPTURE = 'SDL_MOUSE_AUTO_CAPTURE'; - -{/** - * \brief A variable setting the double click radius, in pixels. - */} -SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS = 'SDL_MOUSE_DOUBLE_CLICK_RADIUS'; - -{/** - * \brief A variable setting the double click time, in milliseconds. - */} -SDL_HINT_MOUSE_DOUBLE_CLICK_TIME = 'SDL_MOUSE_DOUBLE_CLICK_TIME'; - -{/** - * \brief Allow mouse click events when clicking to focus an SDL window - * - * This variable can be set to the following values: - * "0" - Ignore mouse clicks that activate a window - * "1" - Generate events for mouse clicks that activate a window - * - * By default SDL will ignore mouse clicks that activate a window - */} -SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH = 'SDL_MOUSE_FOCUS_CLICKTHROUGH'; - -{/** - * \brief A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode - */} -SDL_HINT_MOUSE_NORMAL_SPEED_SCALE = 'SDL_MOUSE_NORMAL_SPEED_SCALE'; - -{** - * \brief A variable controlling whether relative mouse mode constrains the mouse to the center of the window - * - * This variable can be set to the following values: - * "0" - Relative mouse mode constrains the mouse to the window - * "1" - Relative mouse mode constrains the mouse to the center of the window - * - * Constraining to the center of the window works better for FPS games and when the - * application is running over RDP. Constraining to the whole window works better - * for 2D games and increases the chance that the mouse will be in the correct - * position when using high DPI mice. - * - * By default SDL will constrain the mouse to the center of the window - *} -SDL_HINT_MOUSE_RELATIVE_MODE_CENTER = 'SDL_MOUSE_RELATIVE_MODE_CENTER'; - -{/** - * \brief A variable controlling whether relative mouse mode is implemented using mouse warping - * - * This variable can be set to the following values: - * "0" - Relative mouse mode uses raw input - * "1" - Relative mouse mode uses mouse warping - * - * By default SDL will use raw input for relative mouse mode - */} -SDL_HINT_MOUSE_RELATIVE_MODE_WARP = 'SDL_MOUSE_RELATIVE_MODE_WARP'; - -{/** - * \brief A variable controlling whether relative mouse motion is affected by renderer scaling - * - * This variable can be set to the following values: - * "0" - Relative motion is unaffected by DPI or renderer's logical size - * "1" - Relative motion is scaled according to DPI scaling and logical size - * - * By default relative mouse deltas are affected by DPI and renderer scaling - */} -SDL_HINT_MOUSE_RELATIVE_SCALING = 'SDL_MOUSE_RELATIVE_SCALING'; - -{/** - * \brief A variable setting the scale for mouse motion, in floating point, when the mouse is in relative mode - */} -SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE = 'SDL_MOUSE_RELATIVE_SPEED_SCALE'; - -{** - * \brief A variable controlling whether the system mouse acceleration curve is used for relative mouse motion. - * - * This variable can be set to the following values: - * "0" - Relative mouse motion will be unscaled (the default) - * "1" - Relative mouse motion will be scaled using the system mouse acceleration curve. - * - * If SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE is set, that will override the system speed scale. - * - * This hint is available since SDL 2.26.0. - *} -SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE = 'SDL_MOUSE_RELATIVE_SYSTEM_SCALE'; - -{** - * \brief A variable controlling whether a motion event should be generated for mouse warping in relative mode. - * - * This variable can be set to the following values: - * "0" - Warping the mouse will not generate a motion event in relative mode - * "1" - Warping the mouse will generate a motion event in relative mode - * - * By default warping the mouse will not generate motion events in relative mode. This avoids the application having to filter out large relative motion due to warping. - *} -SDL_HINT_MOUSE_RELATIVE_WARP_MOTION = 'SDL_MOUSE_RELATIVE_WARP_MOTION'; - -{/** - * \brief A variable controlling whether mouse events should generate synthetic touch events - * - * This variable can be set to the following values: - * "0" - Mouse events will not generate touch events (default for desktop platforms) - * "1" - Mouse events will generate touch events (default for mobile platforms, such as Android and iOS) - */} -SDL_HINT_MOUSE_TOUCH_EVENTS = 'SDL_MOUSE_TOUCH_EVENTS'; - -{/** - * \brief Controls how the fact chunk affects the loading of a WAVE file. - * - * The fact chunk stores information about the number of samples of a WAVE - * file. The Standards Update from Microsoft notes that this value can be used - * to 'determine the length of the data in seconds'. This is especially useful - * for compressed formats (for which this is a mandatory chunk) if they produce - * multiple sample frames per block and truncating the block is not allowed. - * The fact chunk can exactly specify how many sample frames there should be - * in this case. - * - * Unfortunately, most application seem to ignore the fact chunk and so SDL - * ignores it by default as well. - * - * This variable can be set to the following values: - * - * "truncate" - Use the number of samples to truncate the wave data if - * the fact chunk is present and valid - * "strict" - Like "truncate", but raise an error if the fact chunk - * is invalid, not present for non-PCM formats, or if the - * data chunk doesn't have that many samples - * "ignorezero" - Like "truncate", but ignore fact chunk if the number of - * samples is zero - * "ignore" - Ignore fact chunk entirely (default) - */} -SDL_HINT_WAVE_FACT_CHUNK = 'SDL_WAVE_FACT_CHUNK'; - -{/** - * \brief Controls how the size of the RIFF chunk affects the loading of a WAVE file. - * - * The size of the RIFF chunk (which includes all the sub-chunks of the WAVE - * file) is not always reliable. In case the size is wrong, it's possible to - * just ignore it and step through the chunks until a fixed limit is reached. - * - * Note that files that have trailing data unrelated to the WAVE file or - * corrupt files may slow down the loading process without a reliable boundary. - * By default, SDL stops after 10000 chunks to prevent wasting time. Use the - * environment variable SDL_WAVE_CHUNK_LIMIT to adjust this value. - * - * This variable can be set to the following values: - * - * "force" - Always use the RIFF chunk size as a boundary for the chunk search - * "ignorezero" - Like "force", but a zero size searches up to 4 GiB (default) - * "ignore" - Ignore the RIFF chunk size and always search up to 4 GiB - * "maximum" - Search for chunks until the end of file (not recommended) - */} -SDL_HINT_WAVE_RIFF_CHUNK_SIZE = 'SDL_WAVE_RIFF_CHUNK_SIZE'; - -{/** - * \brief Controls how a truncated WAVE file is handled. - * - * A WAVE file is considered truncated if any of the chunks are incomplete or - * the data chunk size is not a multiple of the block size. By default, SDL - * decodes until the first incomplete block, as most applications seem to do. - * - * This variable can be set to the following values: - * - * "verystrict" - Raise an error if the file is truncated - * "strict" - Like "verystrict", but the size of the RIFF chunk is ignored - * "dropframe" - Decode until the first incomplete sample frame - * "dropblock" - Decode until the first incomplete block (default) - */} -SDL_HINT_WAVE_TRUNCATION = 'SDL_WAVE_TRUNCATION'; - -{/** - * \brief Minimize your SDL_Window if it loses key focus when in Fullscreen mode. Defaults to true. - * - */} -SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS = 'SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS'; - -{/** - * \brief A variable controlling whether the idle timer is disabled on iOS. - * - * When an iOS app does not receive touches for some time, the screen is - * dimmed automatically. For games where the accelerometer is the only input - * this is problematic. This functionality can be disabled by setting this - * hint. - * - * As of SDL 2.0.4, SDL_EnableScreenSaver() and SDL_DisableScreenSaver() - * accomplish the same thing on iOS. They should be preferred over this hint. - * - * This variable can be set to the following values: - * "0" - Enable idle timer - * "1" - Disable idle timer - */} -SDL_HINT_IDLE_TIMER_DISABLED = 'SDL_IOS_IDLE_TIMER_DISABLED'; - -{/** - * \brief A variable controlling what driver to use for OpenGL ES contexts. - * - * On some platforms, currently Windows and X11, OpenGL drivers may support - * creating contexts with an OpenGL ES profile. By default SDL uses these - * profiles, when available, otherwise it attempts to load an OpenGL ES - * library, e.g. that provided by the ANGLE project. This variable controls - * whether SDL follows this default behaviour or will always load an - * OpenGL ES library. - * - * Circumstances where this is useful include - * - Testing an app with a particular OpenGL ES implementation, e.g ANGLE, - * or emulator, e.g. those from ARM, Imagination or Qualcomm. - * - Resolving OpenGL ES function addresses at link time by linking with - * the OpenGL ES library instead of querying them at run time with - * SDL_GL_GetProcAddress(). - * - * Caution: for an application to work with the default behaviour across - * different OpenGL drivers it must query the OpenGL ES function - * addresses at run time using SDL_GL_GetProcAddress(). - * - * This variable is ignored on most platforms because OpenGL ES is native - * or not supported. - * - * This variable can be set to the following values: - * "0" - Use ES profile of OpenGL, if available. (Default when not set.) - * "1" - Load OpenGL ES library using the default library names. - * - */} -SDL_HINT_OPENGL_ES_DRIVER = 'SDL_OPENGL_ES_DRIVER'; - -{/** - * \brief A variable controlling which orientations are allowed on iOS. - * - * In some circumstances it is necessary to be able to explicitly control - * which UI orientations are allowed. - * - * This variable is a space delimited list of the following values: - * "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown" - */} -SDL_HINT_ORIENTATIONS = 'SDL_IOS_ORIENTATIONS'; - -{/** - * \brief A variable controlling the use of a sentinel event when polling the event queue - * - * This variable can be set to the following values: - * "0" - Disable poll sentinels - * "1" - Enable poll sentinels - * - * When polling for events, SDL_PumpEvents is used to gather new events from devices. - * If a device keeps producing new events between calls to SDL_PumpEvents, a poll loop will - * become stuck until the new events stop. - * This is most noticable when moving a high frequency mouse. - * - * By default, poll sentinels are enabled. - */} -SDL_HINT_POLL_SENTINEL = 'SDL_POLL_SENTINEL'; - -{/** - * \brief Override for SDL_GetPreferredLocales() - * - * If set, this will be favored over anything the OS might report for the - * user's preferred locales. Changing this hint at runtime will not generate - * a SDL_LOCALECHANGED event (but if you can change the hint, you can push - * your own event, if you want). - * - * The format of this hint is a comma-separated list of language and locale, - * combined with an underscore, as is a common format: "en_GB". Locale is - * optional: "en". So you might have a list like this: "en_GB,jp,es_PT" - */} -SDL_HINT_PREFERRED_LOCALES = 'SDL_PREFERRED_LOCALES'; - -{/** - * \brief A variable describing the content orientation on QtWayland-based platforms. - * - * On QtWayland platforms, windows are rotated client-side to allow for custom - * transitions. In order to correctly position overlays (e.g. volume bar) and - * gestures (e.g. events view, close/minimize gestures), the system needs to - * know in which orientation the application is currently drawing its contents. - * - * This does not cause the window to be rotated or resized, the application - * needs to take care of drawing the content in the right orientation (the - * framebuffer is always in portrait mode). - * - * This variable can be one of the following values: - * "primary" (default), "portrait", "landscape", "inverted-portrait", "inverted-landscape" - */} -SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION = 'SDL_QTWAYLAND_CONTENT_ORIENTATION'; - -{/** - * \brief Flags to set on QtWayland windows to integrate with the native window manager. - * - * On QtWayland platforms, this hint controls the flags to set on the windows. - * For example, on Sailfish OS "OverridesSystemGestures" disables swipe gestures. - * - * This variable is a space-separated list of the following values (empty = no flags): - * "OverridesSystemGestures", "StaysOnTop", "BypassWindowManager" - */} -SDL_HINT_QTWAYLAND_WINDOW_FLAGS = 'SDL_QTWAYLAND_WINDOW_FLAGS'; - -{** - * \brief Specify an application name. - * - * This hint lets you specify the application name sent to the OS when - * required. For example, this will often appear in volume control applets for - * audio streams, and in lists of applications which are inhibiting the - * screensaver. You should use a string that describes your program ("My Game - * 2: The Revenge") - * - * Setting this to "" or leaving it unset will have SDL use a reasonable - * default: probably the application's name or "SDL Application" if SDL - * doesn't have any better information. - * - * Note that, for audio streams, this can be overridden with - * SDL_HINT_AUDIO_DEVICE_APP_NAME. - * - * On targets where this is not supported, this hint does nothing. - *} -SDL_HINT_APP_NAME = 'SDL_APP_NAME'; - -{/** - * \brief A variable controlling whether controllers used with the Apple TV - * generate UI events. - * - * When UI events are generated by controller input, the app will be - * backgrounded when the Apple TV remote's menu button is pressed, and when the - * pause or B buttons on gamepads are pressed. - * - * More information about properly making use of controllers for the Apple TV - * can be found here: - * https://developer.apple.com/tvos/human-interface-guidelines/remote-and-controllers/ - * - * This variable can be set to the following values: - * "0" - Controller input does not generate UI events (the default). - * "1" - Controller input generates UI events. - */} -SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS = 'SDL_APPLE_TV_CONTROLLER_UI_EVENTS'; - -{/** - * \brief A variable controlling whether the Apple TV remote's joystick axes - * will automatically match the rotation of the remote. - * - * This variable can be set to the following values: - * "0" - Remote orientation does not affect joystick axes (the default). - * "1" - Joystick axes are based on the orientation of the remote. - */} -SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION = 'SDL_APPLE_TV_REMOTE_ALLOW_ROTATION'; - -{/** - * \brief A variable controlling whether the Android / iOS built-in - * accelerometer should be listed as a joystick device, rather than listing - * actual joysticks only. - * - * This variable can be set to the following values: - * "0" - List only real joysticks and accept input from them - * "1" - List real joysticks along with the accelerometer as if it were a 3 axis joystick (the default). - */} -SDL_HINT_ACCELEROMETER_AS_JOYSTICK = 'SDL_ACCELEROMETER_AS_JOYSTICK'; - -{/** - * \brief Specify the behavior of Alt+Tab while the keyboard is grabbed. - * - * By default, SDL emulates Alt+Tab functionality while the keyboard is grabbed - * and your window is full-screen. This prevents the user from getting stuck in - * your application if you've enabled keyboard grab. - * - * The variable can be set to the following values: - * "0" - SDL will not handle Alt+Tab. Your application is responsible - for handling Alt+Tab while the keyboard is grabbed. - * "1" - SDL will minimize your window when Alt+Tab is pressed (default) -*/} -SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED = 'SDL_ALLOW_ALT_TAB_WHILE_GRABBED'; - -{/** - * \brief A variable controlling the audio category on iOS and Mac OS X - * - * This variable can be set to the following values: - * - * "ambient" - Use the AVAudioSessionCategoryAmbient audio category, will be muted by the phone mute switch (default) - * "playback" - Use the AVAudioSessionCategoryPlayback category - * - * For more information, see Apple's documentation: - * https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategoriesandModes/AudioSessionCategoriesandModes.html - */} -SDL_HINT_AUDIO_CATEGORY = 'SDL_AUDIO_CATEGORY'; - -{/** - * \brief Specify an application name for an audio device. - * - * Some audio backends (such as PulseAudio) allow you to describe your audio - * stream. Among other things, this description might show up in a system - * control panel that lets the user adjust the volume on specific audio - * streams instead of using one giant master volume slider. - * - * This hints lets you transmit that information to the OS. The contents of - * this hint are used while opening an audio device. You should use a string - * that describes your program ("My Game 2: The Revenge") - * - * Setting this to "" or leaving it unset will have SDL use a reasonable - * default: this will be the name set with SDL_HINT_APP_NAME, if that hint is - * set. Otherwise, it'll probably the application's name or "SDL Application" - * if SDL doesn't have any better information. - * - * On targets where this is not supported, this hint does nothing. - *} -SDL_HINT_AUDIO_DEVICE_APP_NAME = 'SDL_AUDIO_DEVICE_APP_NAME'; - -{/** - * \brief Specify an application name for an audio device. - * - * Some audio backends (such as PulseAudio) allow you to describe your audio - * stream. Among other things, this description might show up in a system - * control panel that lets the user adjust the volume on specific audio - * streams instead of using one giant master volume slider. - * - * This hints lets you transmit that information to the OS. The contents of - * this hint are used while opening an audio device. You should use a string - * that describes your what your program is playing ("audio stream" is - * probably sufficient in many cases, but this could be useful for something - * like "team chat" if you have a headset playing VoIP audio separately). - * - * Setting this to "" or leaving it unset will have SDL use a reasonable - * default: "audio stream" or something similar. - * - * On targets where this is not supported, this hint does nothing. - */} -SDL_HINT_AUDIO_DEVICE_STREAM_NAME = 'SDL_AUDIO_DEVICE_STREAM_NAME'; - -{/** - * \brief Specify an application role for an audio device. - * - * Some audio backends (such as Pipewire) allow you to describe the role of - * your audio stream. Among other things, this description might show up in - * a system control panel or software for displaying and manipulating media - * playback/capture graphs. - * - * This hints lets you transmit that information to the OS. The contents of - * this hint are used while opening an audio device. You should use a string - * that describes your what your program is playing (Game, Music, Movie, - * etc...). - * - * Setting this to "" or leaving it unset will have SDL use a reasonable - * default: "Game" or something similar. - * - * On targets where this is not supported, this hint does nothing. - */} -SDL_HINT_AUDIO_DEVICE_STREAM_ROLE = 'SDL_AUDIO_DEVICE_STREAM_ROLE'; - -{/** - * \brief A variable that causes SDL to not ignore audio "monitors" - * - * This is currently only used for PulseAudio and ignored elsewhere. - * - * By default, SDL ignores audio devices that aren't associated with physical - * hardware. Changing this hint to "1" will expose anything SDL sees that - * appears to be an audio source or sink. This will add "devices" to the list - * that the user probably doesn't want or need, but it can be useful in - * scenarios where you want to hook up SDL to some sort of virtual device, - * etc. - * - * The default value is "0". This hint must be set before SDL_Init(). - * - * This hint is available since SDL 2.0.16. Before then, virtual devices are - * always ignored. - */} -SDL_HINT_AUDIO_INCLUDE_MONITORS = 'SDL_AUDIO_INCLUDE_MONITORS'; - -{/** - * \brief A variable controlling speed/quality tradeoff of audio resampling. - * - * If available, SDL can use libsamplerate ( http://www.mega-nerd.com/SRC/ ) - * to handle audio resampling. There are different resampling modes available - * that produce different levels of quality, using more CPU. - * - * If this hint isn't specified to a valid setting, or libsamplerate isn't - * available, SDL will use the default, internal resampling algorithm. - * - * Note that this is currently only applicable to resampling audio that is - * being written to a device for playback or audio being read from a device - * for capture. SDL_AudioCVT always uses the default resampler (although this - * might change for SDL 2.1). - * - * This hint is currently only checked at audio subsystem initialization. - * - * This variable can be set to the following values: - * - * "0" or "default" - Use SDL's internal resampling (Default when not set - low quality, fast) - * "1" or "fast" - Use fast, slightly higher quality resampling, if available - * "2" or "medium" - Use medium quality resampling, if available - * "3" or "best" - Use high quality resampling, if available - */} -SDL_HINT_AUDIO_RESAMPLING_MODE = 'SDL_AUDIO_RESAMPLING_MODE'; - -{** - * \brief A variable controlling whether SDL updates joystick state when getting input events - * - * This variable can be set to the following values: - * - * "0" - You'll call SDL_JoystickUpdate() manually - * "1" - SDL will automatically call SDL_JoystickUpdate() (default) - * - * This hint can be toggled on and off at runtime. - */} -SDL_HINT_AUTO_UPDATE_JOYSTICKS = 'SDL_AUTO_UPDATE_JOYSTICKS'; - -{/** - * \brief A variable controlling whether SDL updates sensor state when getting input events - * - * This variable can be set to the following values: - * - * "0" - You'll call SDL_SensorUpdate() manually - * "1" - SDL will automatically call SDL_SensorUpdate() (default) - * - * This hint can be toggled on and off at runtime. - */} -SDL_HINT_AUTO_UPDATE_SENSORS = 'SDL_AUTO_UPDATE_SENSORS'; - -{/** - * \brief Mark X11 windows as override-redirect. - * - * If set, this _might_ increase framerate at the expense of the desktop - * not working as expected. Override-redirect windows aren't noticed by the - * window manager at all. - * - * You should probably only use this for fullscreen windows, and you probably - * shouldn't even use it for that. But it's here if you want to try! - */} -SDL_HINT_X11_FORCE_OVERRIDE_REDIRECT = 'SDL_X11_FORCE_OVERRIDE_REDIRECT'; - -{** - * \brief A variable that forces X11 windows to create as a custom type. - * - * This is currently only used for X11 and ignored elsewhere. - * - * During SDL_CreateWindow, SDL uses the _NET_WM_WINDOW_TYPE X11 property - * to report to the window manager the type of window it wants to create. - * This might be set to various things if SDL_WINDOW_TOOLTIP or - * SDL_WINDOW_POPUP_MENU, etc, were specified. For "normal" windows that - * haven't set a specific type, this hint can be used to specify a custom - * type. For example, a dock window might set this to - * "_NET_WM_WINDOW_TYPE_DOCK". - * - * If not set or set to "", this hint is ignored. This hint must be set - * before the SDL_CreateWindow() call that it is intended to affect. - * - *} -SDL_HINT_X11_WINDOW_TYPE = 'SDL_X11_WINDOW_TYPE'; - -{/** - * \brief A variable that lets you disable the detection and use of Xinput gamepad devices - * - * The variable can be set to the following values: - * "0" - Disable XInput timer (only uses direct input) - * "1" - Enable XInput timer (the default) - */} -SDL_HINT_XINPUT_ENABLED = 'SDL_XINPUT_ENABLED'; - -{** - * \brief A variable that lets you disable the detection and use of DirectInput gamepad devices - * - * The variable can be set to the following values: - * "0" - Disable DirectInput detection (only uses XInput) - * "1" - Enable DirectInput detection (the default) - *} -SDL_HINT_DIRECTINPUT_ENABLED = 'SDL_DIRECTINPUT_ENABLED'; - -{** - * \brief A variable that causes SDL to use the old axis and button mapping for XInput devices. - * - * This hint is for backwards compatibility only and will be removed in SDL 2.1 - * - * The default value is "0". This hint must be set before SDL_Init() - *} -SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING = 'SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING'; - -{/** - * \brief A variable that lets you manually hint extra gamecontroller db entries - * - * The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h - * - * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) - * You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping() - */} -SDL_HINT_GAMECONTROLLERCONFIG = 'SDL_GAMECONTROLLERCONFIG'; - -{/** - * \brief A variable that lets you provide a file with extra gamecontroller db entries. - * - * The file should contain lines of gamecontroller config data, see SDL_gamecontroller.h - * - * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) - * You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping() - */} -SDL_HINT_GAMECONTROLLERCONFIG_FILE = 'SDL_GAMECONTROLLERCONFIG_FILE'; - -{/** - * \brief A variable that overrides the automatic controller type detection - * - * The variable should be comma separated entries, in the form: VID/PID=type - * - * The VID and PID should be hexadecimal with exactly 4 digits, e.g. 0x00fd - * - * The type should be one of: - * Xbox360 - * XboxOne - * PS3 - * PS4 - * PS5 - * SwitchPro - * - * This hint affects what driver is used, and must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) - */} -SDL_HINT_GAMECONTROLLERTYPE = 'SDL_GAMECONTROLLERTYPE'; - -{/** - * \brief A variable containing a list of devices to skip when scanning for game controllers. - * - * The format of the string is a comma separated list of USB VID/PID pairs - * in hexadecimal form, e.g. - * - * 0xAAAA/0xBBBB,0xCCCC/0xDDDD - * - * The variable can also take the form of @file, in which case the named - * file will be loaded and interpreted as the value of the variable. - */} -SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES = 'SDL_GAMECONTROLLER_IGNORE_DEVICES'; - -{/** - * \brief If set, all devices will be skipped when scanning for game controllers except for the ones listed in this variable. - * - * The format of the string is a comma separated list of USB VID/PID pairs - * in hexadecimal form, e.g. - * - * 0xAAAA/0xBBBB,0xCCCC/0xDDDD - * - * The variable can also take the form of @file, in which case the named - * file will be loaded and interpreted as the value of the variable. - */} -SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT = 'SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT'; - -{/** - * \brief If set, game controller face buttons report their values according to their labels instead of their positional layout. - * - * For example, on Nintendo Switch controllers, normally you'd get: - * - * (Y) - * (X) (B) - * (A) - * - * but if this hint is set, you'll get: - * - * (X) - * (Y) (A) - * (B) - * - * The variable can be set to the following values: - * "0" - Report the face buttons by position, as though they were on an Xbox controller. - * "1" - Report the face buttons by label instead of position - * - * The default value is "1". This hint may be set at any time. - */} -SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS = 'SDL_GAMECONTROLLER_USE_BUTTON_LABELS'; - -{/** - * \brief A variable controlling whether the home indicator bar on iPhone X - * should be hidden. - * - * This variable can be set to the following values: - * "0" - The indicator bar is not hidden (default for windowed applications) - * "1" - The indicator bar is hidden and is shown when the screen is touched (useful for movie playback applications) - * "2" - The indicator bar is dim and the first swipe makes it visible and the second swipe performs the "home" action (default for fullscreen applications) - */} -SDL_HINT_IOS_HIDE_HOME_INDICATOR = 'SDL_IOS_HIDE_HOME_INDICATOR'; - -{/** - * \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background. - * - * The variable can be set to the following values: - * "0" - Disable joystick & gamecontroller input events when the - * application is in the background. - * "1" - Enable joystick & gamecontroller input events when the - * application is in the backgroumd. - * - * The default value is "0". This hint may be set at any time. - */} -SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS = 'SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS'; - -{/** - * \brief A comma separated list of devices to open as joysticks - * - * This variable is currently only used by the Linux joystick driver. - *} -SDL_HINT_JOYSTICK_DEVICE = 'SDL_JOYSTICK_DEVICE'; - -{** - * \brief A variable controlling whether "low_frequency_rumble" and "high_frequency_rumble" is used to implement - * the GameCube controller's 3 rumble modes, Stop(0), Rumble(1), and StopHard(2) - * this is useful for applications that need full compatibility for things like ADSR envelopes. - * Stop is implemented by setting "low_frequency_rumble" to "0" and "high_frequency_rumble" ">0" - * Rumble is both at any arbitrary value, - * StopHard is implemented by setting both "low_frequency_rumble" and "high_frequency_rumble" to "0" - * - * This variable can be set to the following values: - * "0" - Normal rumble behavior is behavior is used (default) - * "1" - Proper GameCube controller rumble behavior is used - * - *} -SDL_HINT_JOYSTICK_GAMECUBE_RUMBLE_BRAKE = 'SDL_JOYSTICK_GAMECUBE_RUMBLE_BRAKE'; - -{/** - * \brief A variable controlling whether the HIDAPI joystick drivers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI drivers are not used - * "1" - HIDAPI drivers are used (the default) - * - * This variable is the default for all drivers, but can be overridden by the hints for specific drivers below. - */} -SDL_HINT_JOYSTICK_HIDAPI = 'SDL_JOYSTICK_HIDAPI'; - -{/** - * \brief A variable controlling whether the HIDAPI driver for Nintendo GameCube controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI - */} -SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE = 'SDL_JOYSTICK_HIDAPI_GAMECUBE'; - -{/** - * \brief A variable controlling whether Switch Joy-Cons should be treated the same as Switch Pro Controllers when using the HIDAPI driver. - * - * This variable can be set to the following values: - * "0" - basic Joy-Con support with no analog input (the default) - * "1" - Joy-Cons treated as half full Pro Controllers with analog inputs and sensors - * - * This does not combine Joy-Cons into a single controller. That's up to the user. - */} -SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS = 'SDL_JOYSTICK_HIDAPI_JOY_CONS'; - -{** - * \brief A variable controlling whether Nintendo Switch Joy-Con controllers will be combined into a single Pro-like controller when using the HIDAPI driver - * - * This variable can be set to the following values: - * "0" - Left and right Joy-Con controllers will not be combined and each will be a mini-gamepad - * "1" - Left and right Joy-Con controllers will be combined into a single controller (the default) - *} -SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS = 'SDL_JOYSTICK_HIDAPI_COMBINE_JOY_CONS'; - -{** - * \brief A variable controlling whether Nintendo Switch Joy-Con controllers will be in vertical mode when using the HIDAPI driver - * - * This variable can be set to the following values: - * "0" - Left and right Joy-Con controllers will not be in vertical mode (the default) - * "1" - Left and right Joy-Con controllers will be in vertical mode - * - * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER). - * - * This hint is available since SDL 2.26.0. - *} -SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS = 'SDL_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS'; - -{/** - * \brief A variable controlling whether the HIDAPI driver for Amazon Luna controllers connected via Bluetooth should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI - */} -SDL_HINT_JOYSTICK_HIDAPI_LUNA = 'SDL_JOYSTICK_HIDAPI_LUNA'; - -{** - * \brief A variable controlling whether the HIDAPI driver for Nintendo Online classic controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI - *} -SDL_HINT_JOYSTICK_HIDAPI_NINTENDO_CLASSIC = 'SDL_JOYSTICK_HIDAPI_NINTENDO_CLASSIC'; - -{** - * \brief A variable controlling whether the HIDAPI driver for NVIDIA SHIELD controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI - *} -SDL_HINT_JOYSTICK_HIDAPI_SHIELD = 'SDL_JOYSTICK_HIDAPI_SHIELD'; - -{** - * \brief A variable controlling whether the HIDAPI driver for PS3 controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI on macOS, and "0" on other platforms. - * - * It is not possible to use this driver on Windows, due to limitations in the default drivers - * installed. See https://github.com/ViGEm/DsHidMini for an alternative driver on Windows. - * - * This hint is available since SDL 2.26.0. - *} -SDL_HINT_JOYSTICK_HIDAPI_PS3 = 'SDL_JOYSTICK_HIDAPI_PS3'; - -{/** - * \brief A variable controlling whether the HIDAPI driver for PS4 controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI - */} -SDL_HINT_JOYSTICK_HIDAPI_PS4 = 'SDL_JOYSTICK_HIDAPI_PS4'; - -{/** - * \brief A variable controlling whether extended input reports should be used for PS4 controllers when using the HIDAPI driver. - * - * This variable can be set to the following values: - * "0" - extended reports are not enabled (the default) - * "1" - extended reports - * - * Extended input reports allow rumble on Bluetooth PS4 controllers, but - * break DirectInput handling for applications that don't use SDL. - * - * Once extended reports are enabled, they can not be disabled without - * power cycling the controller. - * - * For compatibility with applications written for versions of SDL prior - * to the introduction of PS5 controller support, this value will also - * control the state of extended reports on PS5 controllers when the - * SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE hint is not explicitly set. - */} -SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE = 'SDL_JOYSTICK_HIDAPI_PS4_RUMBLE'; - -{/** - * \brief A variable controlling whether the HIDAPI driver for PS5 controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI - */} -SDL_HINT_JOYSTICK_HIDAPI_PS5 = 'SDL_JOYSTICK_HIDAPI_PS5'; - -{/** - * \brief A variable controlling whether the player LEDs should be lit to indicate which player is associated with a PS5 controller. - * - * This variable can be set to the following values: - * "0" - player LEDs are not enabled - * "1" - player LEDs are enabled (the default) - */} -SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED = 'SDL_JOYSTICK_HIDAPI_PS5_PLAYER_LED'; - -{/** - * \brief A variable controlling whether extended input reports should be used for PS5 controllers when using the HIDAPI driver. - * - * This variable can be set to the following values: - * "0" - extended reports are not enabled (the default) - * "1" - extended reports - * - * Extended input reports allow rumble on Bluetooth PS5 controllers, but - * break DirectInput handling for applications that don't use SDL. - * - * Once extended reports are enabled, they can not be disabled without - * power cycling the controller. - * - * For compatibility with applications written for versions of SDL prior - * to the introduction of PS5 controller support, this value defaults to - * the value of SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE. - */} -SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE = 'SDL_JOYSTICK_HIDAPI_PS5_RUMBLE'; - -{/** - * \brief A variable controlling whether the HIDAPI driver for Google Stadia controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI - */} -SDL_HINT_JOYSTICK_HIDAPI_STADIA = 'SDL_JOYSTICK_HIDAPI_STADIA'; - -{/** - * \brief A variable controlling whether the HIDAPI driver for Steam Controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used for Steam Controllers, which requires Bluetooth access - * and may prompt the user for permission on iOS and Android. - * - * The default is "0" - */} -SDL_HINT_JOYSTICK_HIDAPI_STEAM = 'SDL_JOYSTICK_HIDAPI_STEAM'; - -{/** - * \brief A variable controlling whether the HIDAPI driver for Nintendo Switch controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI - */} -SDL_HINT_JOYSTICK_HIDAPI_SWITCH = 'SDL_JOYSTICK_HIDAPI_SWITCH'; - -{/** - * \brief A variable controlling whether the Home button LED should be turned on when a Nintendo Switch controller is opened - * - * This variable can be set to the following values: - * "0" - home button LED is turned off - * "1" - home button LED is turned on - * - * By default the Home button LED state is not changed. - */} -SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED = 'SDL_JOYSTICK_HIDAPI_SWITCH_HOME_LED'; - -{** - * \brief A variable controlling whether the Home button LED should be turned on when a Nintendo Switch Joy-Con controller is opened - * - * This variable can be set to the following values: - * "0" - home button LED is turned off - * "1" - home button LED is turned on - * - * By default the Home button LED state is not changed. This hint can also be set to a floating point value between 0.0 and 1.0 which controls the brightness of the Home button LED. - *} -SDL_HINT_JOYSTICK_HIDAPI_JOYCON_HOME_LED = 'SDL_JOYSTICK_HIDAPI_JOYCON_HOME_LED'; - -{** - * \brief A variable controlling whether the player LEDs should be lit to indicate which player is associated with a Nintendo Switch controller. - * - * This variable can be set to the following values: - * "0" - player LEDs are not enabled - * "1" - player LEDs are enabled (the default) - *} -SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED = 'SDL_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED'; - -{** - * \brief A variable controlling whether the HIDAPI driver for Nintendo Wii and Wii U controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * This driver doesn't work with the dolphinbar, so the default is SDL_FALSE for now. - * - * This hint is available since SDL 2.26.0. - *} -SDL_HINT_JOYSTICK_HIDAPI_WII = 'SDL_JOYSTICK_HIDAPI_WII'; - -{** - * \brief A variable controlling whether the player LEDs should be lit to indicate which player is associated with a Wii controller. - * - * This variable can be set to the following values: - * "0" - player LEDs are not enabled - * "1" - player LEDs are enabled (the default) - * - * This hiny is available since SDL 2.26.0. - *} -SDL_HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED = 'SDL_JOYSTICK_HIDAPI_WII_PLAYER_LED'; - -{/** - * \brief A variable controlling whether the HIDAPI driver for XBox controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is "0" on Windows, otherwise the value of SDL_HINT_JOYSTICK_HIDAPI - */} -SDL_HINT_JOYSTICK_HIDAPI_XBOX = 'SDL_JOYSTICK_HIDAPI_XBOX'; - -{** - * \brief A variable controlling whether the HIDAPI driver for XBox 360 controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI_XBOX. - * - * This hint is available since SDL 2.26.0. - *} -SDL_HINT_JOYSTICK_HIDAPI_XBOX_360 = 'SDL_JOYSTICK_HIDAPI_XBOX_360'; - -{** - * \brief A variable controlling whether the player LEDs should be lit to indicate which player is associated with an Xbox 360 controller. - * - * This variable can be set to the following values: - * "0" - player LEDs are not enabled - * "1" - player LEDs are enabled (the default) - * - * This hint is available since SDL 2.26.0. - *} -SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED = 'SDL_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED'; - -{** - * \brief A variable controlling whether the HIDAPI driver for XBox 360 wireless controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI_XBOX_360. - * - * This hint is available since SDL 2.26.0. - *} -SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS = 'SDL_JOYSTICK_HIDAPI_XBOX_360_WIRELESS'; - -{** - * \brief A variable controlling whether the HIDAPI driver for XBox One controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI_XBOX. - * - * This hint is available since SDL 2.26.0. - *} -SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE = 'SDL_JOYSTICK_HIDAPI_XBOX_ONE'; - -{** - * \brief A variable controlling whether the Home button LED should be turned on when an Xbox One controller is opened - * - * This variable can be set to the following values: - * "0" - home button LED is turned off - * "1" - home button LED is turned on - * - * By default the Home button LED state is not changed. This hint can also - * be set to a floating point value between 0.0 and 1.0 which controls - * the brightness of the Home button LED. The default brightness is 0.4. - * - * This hint is available since SDL 2.26.0. - *} -SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED = 'SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED'; - -{/** - * \brief A variable controlling whether the RAWINPUT joystick drivers should be used for better handling XInput-capable devices. - * - * This variable can be set to the following values: - * "0" - RAWINPUT drivers are not used - * "1" - RAWINPUT drivers are used (the default) - * - */} -SDL_HINT_JOYSTICK_RAWINPUT = 'SDL_JOYSTICK_RAWINPUT'; - -{/** - * \brief A variable controlling whether the RAWINPUT driver should pull correlated data from XInput. - * - * This variable can be set to the following values: - * "0" - RAWINPUT driver will only use data from raw input APIs - * "1" - RAWINPUT driver will also pull data from XInput, providing - * better trigger axes, guide button presses, and rumble support - * for Xbox controllers - * - * The default is "1". This hint applies to any joysticks opened after setting the hint. - */} -SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT = 'SDL_JOYSTICK_RAWINPUT_CORRELATE_XINPUT'; - -{** - * \brief A variable controlling whether the ROG Chakram mice should show up as joysticks - * - * This variable can be set to the following values: - * "0" - ROG Chakram mice do not show up as joysticks (the default) - * "1" - ROG Chakram mice show up as joysticks - *} -SDL_HINT_JOYSTICK_ROG_CHAKRAM = 'SDL_JOYSTICK_ROG_CHAKRAM'; - -{/** - * \brief A variable controlling whether a separate thread should be used - * for handling joystick detection and raw input messages on Windows - * - * This variable can be set to the following values: - * "0" - A separate thread is not used (the default) - * "1" - A separate thread is used for handling raw input messages - * - */} -SDL_HINT_JOYSTICK_THREAD = 'SDL_JOYSTICK_THREAD'; - -{/** - * \brief If set to 0 then never set the top most bit on a SDL Window, even if the video mode expects it. - * This is a debugging aid for developers and not expected to be used by end users. The default is "1" - * - * This variable can be set to the following values: - * "0" - don't allow topmost - * "1" - allow topmost - */} -SDL_HINT_ALLOW_TOPMOST = 'SDL_ALLOW_TOPMOST'; - -{/** - * \brief A variable that controls the timer resolution, in milliseconds. - * - * The higher resolution the timer, the more frequently the CPU services - * timer interrupts, and the more precise delays are, but this takes up - * power and CPU time. This hint is only used on Windows 7 and earlier. - * - * See this blog post for more information: - * http://randomascii.wordpress.com/2013/07/08/windows-timer-resolution-megawatts-wasted/ - * - * If this variable is set to "0", the system timer resolution is not set. - * - * The default value is "1". This hint may be set at any time. - */} -SDL_HINT_TIMER_RESOLUTION = 'SDL_TIMER_RESOLUTION'; - -{/** - * \brief Specifies whether SDL_THREAD_PRIORITY_TIME_CRITICAL should be treated as realtime. - * - * On some platforms, like Linux, a realtime priority thread may be subject to restrictions - * that require special handling by the application. This hint exists to let SDL know that - * the app is prepared to handle said restrictions. - * - * On Linux, SDL will apply the following configuration to any thread that becomes realtime: - * * The SCHED_RESET_ON_FORK bit will be set on the scheduling policy, - * * An RLIMIT_RTTIME budget will be configured to the rtkit specified limit. - * * Exceeding this limit will result in the kernel sending SIGKILL to the app, - * * Refer to the man pages for more information. - * - * This variable can be set to the following values: - * "0" - default platform specific behaviour - * "1" - Force SDL_THREAD_PRIORITY_TIME_CRITICAL to a realtime scheduling policy - */} -SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL = 'SDL_THREAD_FORCE_REALTIME_TIME_CRITICAL'; - -{/** -* \brief A string specifying additional information to use with SDL_SetThreadPriority. -* -* By default SDL_SetThreadPriority will make appropriate system changes in order to -* apply a thread priority. For example on systems using pthreads the scheduler policy -* is changed automatically to a policy that works well with a given priority. -* Code which has specific requirements can override SDL's default behavior with this hint. -* -* pthread hint values are "current", "other", "fifo" and "rr". -* Currently no other platform hint values are defined but may be in the future. -* -* \note On Linux, the kernel may send SIGKILL to realtime tasks which exceed the distro -* configured execution budget for rtkit. This budget can be queried through RLIMIT_RTTIME -* after calling SDL_SetThreadPriority(). -*/} -SDL_HINT_THREAD_PRIORITY_POLICY = 'SDL_THREAD_PRIORITY_POLICY'; - -{/** - * \brief A string specifying SDL's threads stack size in bytes or "0" for the backend's default size - * - * Use this hint in case you need to set SDL's threads stack size to other than the default. - * This is specially useful if you build SDL against a non glibc libc library (such as musl) which - * provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses). - * Support for this hint is currently available only in the pthread, Windows, and PSP backend. - */} -SDL_HINT_THREAD_STACK_SIZE = 'SDL_THREAD_STACK_SIZE'; - -{/** - * \brief A variable controlling whether touch events should generate synthetic mouse events - * - * This variable can be set to the following values: - * "0" - Touch events will not generate mouse events - * "1" - Touch events will generate mouse events - * - * By default SDL will generate mouse events for touch events - */} -SDL_HINT_TOUCH_MOUSE_EVENTS = 'SDL_TOUCH_MOUSE_EVENTS'; - -{** - * \brief A variable controlling which touchpad should generate synthetic mouse events - * - * This variable can be set to the following values: - * "0" - Only front touchpad should generate mouse events. Default - * "1" - Only back touchpad should generate mouse events. - * "2" - Both touchpads should generate mouse events. - * - * By default SDL will generate mouse events for all touch devices - *} -SDL_HINT_VITA_TOUCH_MOUSE_DEVICE = 'SDL_HINT_VITA_TOUCH_MOUSE_DEVICE'; - -{/** - * \brief A variable controlling whether the Android / tvOS remotes - * should be listed as joystick devices, instead of sending keyboard events. - * - * This variable can be set to the following values: - * "0" - Remotes send enter/escape/arrow key events - * "1" - Remotes are available as 2 axis, 2 button joysticks (the default). - */} -SDL_HINT_TV_REMOTE_AS_JOYSTICK = 'SDL_TV_REMOTE_AS_JOYSTICK'; - -{/** - * \brief If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and iOS) - */} -SDL_HINT_VIDEO_HIGHDPI_DISABLED = 'SDL_VIDEO_HIGHDPI_DISABLED'; - -{** - * \brief A variable controlling whether joysticks on Linux will always treat 'hat' axis inputs (ABS_HAT0X - ABS_HAT3Y) as 8-way digital hats without checking whether they may be analog. - * - * This variable can be set to the following values: - * "0" - Only map hat axis inputs to digital hat outputs if the input axes appear to actually be digital (the default) - * "1" - Always handle the input axes numbered ABS_HAT0X to ABS_HAT3Y as digital hats - *} -SDL_HINT_LINUX_DIGITAL_HATS = 'SDL_LINUX_DIGITAL_HATS'; - -{** - * \brief A variable controlling whether digital hats on Linux will apply deadzones to their underlying input axes or use unfiltered values. - * - * This variable can be set to the following values: - * "0" - Return digital hat values based on unfiltered input axis values - * "1" - Return digital hat values with deadzones on the input axes taken into account (the default) - *} -SDL_HINT_LINUX_HAT_DEADZONES = 'SDL_LINUX_HAT_DEADZONES'; - -{/** - * \brief A variable controlling whether to use the classic /dev/input/js* joystick interface or the newer /dev/input/event* joystick interface on Linux - * - * This variable can be set to the following values: - * "0" - Use /dev/input/event* - * "1" - Use /dev/input/js* - * - * By default the /dev/input/event* interfaces are used - */} -SDL_HINT_LINUX_JOYSTICK_CLASSIC = 'SDL_LINUX_JOYSTICK_CLASSIC'; - -{/** - * \brief A variable controlling whether joysticks on Linux adhere to their HID-defined deadzones or return unfiltered values. - * - * This variable can be set to the following values: - * "0" - Return unfiltered joystick axis values (the default) - * "1" - Return axis values with deadzones taken into account - */} -SDL_HINT_LINUX_JOYSTICK_DEADZONES = 'SDL_LINUX_JOYSTICK_DEADZONES'; - -{/** - * \brief A variable that determines whether ctrl+click should generate a right-click event on Mac - * - * If present, holding ctrl while left clicking will generate a right click - * event when on Mac. - */} -SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK = 'SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK'; - -{** - * \brief A variable controlling whether dispatching OpenGL context updates should block the dispatching thread until the main thread finishes processing - * - * This variable can be set to the following values: - * "0" - Dispatching OpenGL context updates will block the dispatching thread until the main thread finishes processing (default). - * "1" - Dispatching OpenGL context updates will allow the dispatching thread to continue execution. - * - * Generally you want the default, but if you have OpenGL code in a background thread on a Mac, and the main thread - * hangs because it's waiting for that background thread, but that background thread is also hanging because it's - * waiting for the main thread to do an update, this might fix your issue. - * - * This hint only applies to macOS. - * - * This hint is available since SDL 2.24.0. - *} -SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH = 'SDL_MAC_OPENGL_ASYNC_DISPATCH'; - -{/** - * \brief A variable specifying which shader compiler to preload when using the Chrome ANGLE binaries - * - * SDL has EGL and OpenGL ES2 support on Windows via the ANGLE project. It - * can use two different sets of binaries, those compiled by the user from source - * or those provided by the Chrome browser. In the later case, these binaries require - * that SDL loads a DLL providing the shader compiler. - * - * This variable can be set to the following values: - * "d3dcompiler_46.dll" - default, best for Vista or later. - * "d3dcompiler_43.dll" - for XP support. - * "none" - do not load any library, useful if you compiled ANGLE from source and included the compiler in your binaries. - * - */} -SDL_HINT_VIDEO_WIN_D3DCOMPILER = 'SDL_VIDEO_WIN_D3DCOMPILER'; - -{/** - * \brief A variable that is the address of another SDL_Window* (as a hex string formatted with "%p"). - * - * If this hint is set before SDL_CreateWindowFrom() and the SDL_Window* it is set to has - * SDL_WINDOW_OPENGL set (and running on WGL only, currently), then two things will occur on the newly - * created SDL_Window: - * - * 1. Its pixel format will be set to the same pixel format as this SDL_Window. This is - * needed for example when sharing an OpenGL context across multiple windows. - * - * 2. The flag SDL_WINDOW_OPENGL will be set on the new window so it can be used for - * OpenGL rendering. - * - * This variable can be set to the following values: - * The address (as a string "%p") of the SDL_Window* that new windows created with SDL_CreateWindowFrom() should - * share a pixel format with. - */} -SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT = 'SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT'; - -{** - * \brief When calling SDL_CreateWindowFrom(), make the window compatible with OpenGL. - * - * This variable can be set to the following values: - * "0" - Don't add any graphics flags to the SDL_WindowFlags - * "1" - Add SDL_WINDOW_OPENGL to the SDL_WindowFlags - * - * By default SDL will not make the foreign window compatible with OpenGL. - *} -SDL_HINT_VIDEO_FOREIGN_WINDOW_OPENGL = 'SDL_VIDEO_FOREIGN_WINDOW_OPENGL'; - -{** - * \brief When calling SDL_CreateWindowFrom(), make the window compatible with Vulkan. - * - * This variable can be set to the following values: - * "0" - Don't add any graphics flags to the SDL_WindowFlags - * "1" - Add SDL_WINDOW_VULKAN to the SDL_WindowFlags - * - * By default SDL will not make the foreign window compatible with Vulkan. - *} -SDL_HINT_VIDEO_FOREIGN_WINDOW_VULKAN = 'SDL_VIDEO_FOREIGN_WINDOW_VULKAN'; - -{/** - * \brief A URL to a WinRT app's privacy policy - * - * All network-enabled WinRT apps must make a privacy policy available to its - * users. On Windows 8, 8.1, and RT, Microsoft mandates that this policy be - * be available in the Windows Settings charm, as accessed from within the app. - * SDL provides code to add a URL-based link there, which can point to the app's - * privacy policy. - * - * To setup a URL to an app's privacy policy, set SDL_HINT_WINRT_PRIVACY_POLICY_URL - * before calling any SDL_Init() functions. The contents of the hint should - * be a valid URL. For example, "http://www.example.com". - * - * The default value is "", which will prevent SDL from adding a privacy policy - * link to the Settings charm. This hint should only be set during app init. - * - * The label text of an app's "Privacy Policy" link may be customized via another - * hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL. - * - * Please note that on Windows Phone, Microsoft does not provide standard UI - * for displaying a privacy policy link, and as such, SDL_HINT_WINRT_PRIVACY_POLICY_URL - * will not get used on that platform. Network-enabled phone apps should display - * their privacy policy through some other, in-app means. - */} -SDL_HINT_WINRT_PRIVACY_POLICY_URL = 'SDL_WINRT_PRIVACY_POLICY_URL'; - -{/** - * \brief Label text for a WinRT app's privacy policy link - * - * Network-enabled WinRT apps must include a privacy policy. On Windows 8, 8.1, and RT, - * Microsoft mandates that this policy be available via the Windows Settings charm. - * SDL provides code to add a link there, with its label text being set via the - * optional hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL. - * - * Please note that a privacy policy's contents are not set via this hint. A separate - * hint, SDL_HINT_WINRT_PRIVACY_POLICY_URL, is used to link to the actual text of the - * policy. - * - * The contents of this hint should be encoded as a UTF8 string. - * - * The default value is "Privacy Policy". This hint should only be set during app - * initialization, preferably before any calls to SDL_Init(). - * - * For additional information on linking to a privacy policy, see the documentation for - * SDL_HINT_WINRT_PRIVACY_POLICY_URL. - */} -SDL_HINT_WINRT_PRIVACY_POLICY_LABEL = 'SDL_WINRT_PRIVACY_POLICY_LABEL'; - -{/** - * \brief Allows back-button-press events on Windows Phone to be marked as handled - * - * Windows Phone devices typically feature a Back button. When pressed, - * the OS will emit back-button-press events, which apps are expected to - * handle in an appropriate manner. If apps do not explicitly mark these - * events as 'Handled', then the OS will invoke its default behavior for - * unhandled back-button-press events, which on Windows Phone 8 and 8.1 is to - * terminate the app (and attempt to switch to the previous app, or to the - * device's home screen). - * - * Setting the SDL_HINT_WINRT_HANDLE_BACK_BUTTON hint to "1" will cause SDL - * to mark back-button-press events as Handled, if and when one is sent to - * the app. - * - * Internally, Windows Phone sends back button events as parameters to - * special back-button-press callback functions. Apps that need to respond - * to back-button-press events are expected to register one or more - * callback functions for such, shortly after being launched (during the - * app's initialization phase). After the back button is pressed, the OS - * will invoke these callbacks. If the app's callback(s) do not explicitly - * mark the event as handled by the time they return, or if the app never - * registers one of these callback, the OS will consider the event - * un-handled, and it will apply its default back button behavior (terminate - * the app). - * - * SDL registers its own back-button-press callback with the Windows Phone - * OS. This callback will emit a pair of SDL key-press events (SDL_KEYDOWN - * and SDL_KEYUP), each with a scancode of SDL_SCANCODE_AC_BACK, after which - * it will check the contents of the hint, SDL_HINT_WINRT_HANDLE_BACK_BUTTON. - * If the hint's value is set to "1", the back button event's Handled - * property will get set to 'true'. If the hint's value is set to something - * else, or if it is unset, SDL will leave the event's Handled property - * alone. (By default, the OS sets this property to 'false', to note.) - * - * SDL apps can either set SDL_HINT_WINRT_HANDLE_BACK_BUTTON well before a - * back button is pressed, or can set it in direct-response to a back button - * being pressed. - * - * In order to get notified when a back button is pressed, SDL apps should - * register a callback function with SDL_AddEventWatch(), and have it listen - * for SDL_KEYDOWN events that have a scancode of SDL_SCANCODE_AC_BACK. - * (Alternatively, SDL_KEYUP events can be listened-for. Listening for - * either event type is suitable.) Any value of SDL_HINT_WINRT_HANDLE_BACK_BUTTON - * set by such a callback, will be applied to the OS' current - * back-button-press event. - * - * More details on back button behavior in Windows Phone apps can be found - * at the following page, on Microsoft's developer site: - * http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx - */} -SDL_HINT_WINRT_HANDLE_BACK_BUTTON = 'SDL_WINRT_HANDLE_BACK_BUTTON'; - -{/** - * \brief A variable that dictates policy for fullscreen Spaces on Mac OS X. - * - * This hint only applies to Mac OS X. - * - * The variable can be set to the following values: - * "0" - Disable Spaces support (FULLSCREEN_DESKTOP won't use them and - * SDL_WINDOW_RESIZABLE windows won't offer the "fullscreen" - * button on their titlebars). - * "1" - Enable Spaces support (FULLSCREEN_DESKTOP will use them and - * SDL_WINDOW_RESIZABLE windows will offer the "fullscreen" - * button on their titlebars). - * - * The default value is "1". Spaces are disabled regardless of this hint if - * the OS isn't at least Mac OS X Lion (10.7). This hint must be set before - * any windows are created. - */} -SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES = 'SDL_VIDEO_MAC_FULLSCREEN_SPACES'; - -{/** - * \brief When set don't force the SDL app to become a foreground process - * - * This hint only applies to Mac OS X. - * - */} -SDL_HINT_MAC_BACKGROUND_APP = 'SDL_MAC_BACKGROUND_APP'; - -{/** - * \brief Android APK expansion main file version. Should be a string number like "1", "2" etc. - * - * Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION. - * - * If both hints were set then SDL_RWFromFile() will look into expansion files - * after a given relative path was not found in the internal storage and assets. - * - * By default this hint is not set and the APK expansion files are not searched. - */} -SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION = 'SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION'; - -{/** - * \brief Android APK expansion patch file version. Should be a string number like "1", "2" etc. - * - * Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION. - * - * If both hints were set then SDL_RWFromFile() will look into expansion files - * after a given relative path was not found in the internal storage and assets. - * - * By default this hint is not set and the APK expansion files are not searched. - */} -SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION = 'SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION'; - -{/** - * \brief A variable to control whether the event loop will block itself when the app is paused. - * - * The variable can be set to the following values: - * "0" - Non blocking. - * "1" - Blocking. (default) - * - * The value should be set before SDL is initialized. - */} -SDL_HINT_ANDROID_BLOCK_ON_PAUSE = 'SDL_ANDROID_BLOCK_ON_PAUSE'; - -{/** - * \brief A variable to control whether SDL will pause audio in background - * (Requires SDL_ANDROID_BLOCK_ON_PAUSE as "Non blocking") - * - * The variable can be set to the following values: - * "0" - Non paused. - * "1" - Paused. (default) - * - * The value should be set before SDL is initialized. - */} -SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO = 'SDL_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO'; - -{/** - * \brief A variable to control whether we trap the Android back button to handle it manually. - * This is necessary for the right mouse button to work on some Android devices, or - * to be able to trap the back button for use in your code reliably. If set to true, - * the back button will show up as an SDL_KEYDOWN / SDL_KEYUP pair with a keycode of - * SDL_SCANCODE_AC_BACK. - * - * The variable can be set to the following values: - * "0" - Back button will be handled as usual for system. (default) - * "1" - Back button will be trapped, allowing you to handle the key press - * manually. (This will also let right mouse click work on systems - * where the right mouse button functions as back.) - * - * The value of this hint is used at runtime, so it can be changed at any time. - */} -SDL_HINT_ANDROID_TRAP_BACK_BUTTON = 'SDL_ANDROID_TRAP_BACK_BUTTON'; - -{/** - * \brief A variable to control whether certain IMEs should handle text editing internally instead of sending SDL_TEXTEDITING events. - * - * The variable can be set to the following values: - * "0" - SDL_TEXTEDITING events are sent, and it is the application's - * responsibility to render the text from these events and - * differentiate it somehow from committed text. (default) - * "1" - If supported by the IME then SDL_TEXTEDITING events are not sent, - * and text that is being composed will be rendered in its own UI. - */} -SDL_HINT_IME_INTERNAL_EDITING = 'SDL_IME_INTERNAL_EDITING'; - -{/** - * \brief A variable to control whether certain IMEs should show native UI components (such as the Candidate List) instead of suppressing them. - * - * The variable can be set to the following values: - * "0" - Native UI components are not display. (default) - * "1" - Native UI components are displayed. - */} -SDL_HINT_IME_SHOW_UI = 'SDL_IME_SHOW_UI'; - -{** - * \brief A variable to control if extended IME text support is enabled. - * If enabled then SDL_TextEditingExtEvent will be issued if the text would be truncated otherwise. - * Additionally SDL_TextInputEvent will be dispatched multiple times so that it is not truncated. - * - * The variable can be set to the following values: - * "0" - Legacy behavior. Text can be truncated, no heap allocations. (default) - * "1" - Modern behavior. - *} -SDL_HINT_IME_SUPPORT_EXTENDED_TEXT = 'SDL_IME_SUPPORT_EXTENDED_TEXT'; - -{/** - * \brief A variable to control whether mouse and touch events are to be treated together or separately - * - * The variable can be set to the following values: - * "0" - Mouse events will be handled as touch events, and touch will raise fake mouse - * events. This is the behaviour of SDL <= 2.0.3. (default) - * "1" - Mouse events will be handled separately from pure touch events. - * - * NOTE: This hint is no longer supported on SDL >= 2.0.10. - * Use SDL_HINT_MOUSE_TOUCH_EVENTS and SDL_HINT_TOUCH_MOUSE_EVENTS - * for generating synthetic touch/mouse events. - */} -SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH = 'SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH' - deprecated 'This hint is no longer supported on SDL >= 2.0.10. Use SDL_HINT_MOUSE_TOUCH_EVENTS and SDL_HINT_TOUCH_MOUSE_EVENTS instead.'; - -{/** - * \brief Disable giving back control to the browser automatically - * when running with asyncify - * - * With -s ASYNCIFY, SDL2 calls emscripten_sleep during operations - * such as refreshing the screen or polling events. - * - * This hint only applies to the emscripten platform - * - * The variable can be set to the following values: - * "0" - Disable emscripten_sleep calls (if you give back browser control manually or use asyncify for other purposes) - * "1" - Enable emscripten_sleep calls (the default) - */} -SDL_HINT_EMSCRIPTEN_ASYNCIFY = 'SDL_EMSCRIPTEN_ASYNCIFY'; - -{/** - * \brief override the binding element for keyboard inputs for Emscripten builds - * - * This hint only applies to the emscripten platform - * - * The variable can be one of - * "#window" - The javascript window object (this is the default) - * "#document" - The javascript document object - * "#screen" - the javascript window.screen object - * "#canvas" - the WebGL canvas element - * any other string without a leading # sign applies to the element on the page with that ID. - */} -SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT = 'SDL_EMSCRIPTEN_KEYBOARD_ELEMENT'; - -{/** - * \brief Tell SDL not to catch the SIGINT or SIGTERM signals. - * - * This hint only applies to Unix-like platforms. - * - * The variable can be set to the following values: - * "0" - SDL will install a SIGINT and SIGTERM handler, and when it - * catches a signal, convert it into an SDL_QUIT event. - * "1" - SDL will not install a signal handler at all. - */} -SDL_HINT_NO_SIGNAL_HANDLERS = 'SDL_NO_SIGNAL_HANDLERS'; - -{** - * \brief A variable that decides whether to send SDL_QUIT when closing the final window. - * - * By default, SDL sends an SDL_QUIT event when there is only one window - * and it receives an SDL_WINDOWEVENT_CLOSE event, under the assumption most - * apps would also take the loss of this window as a signal to terminate the - * program. - * - * However, it's not unreasonable in some cases to have the program continue - * to live on, perhaps to create new windows later. - * - * Changing this hint to "0" will cause SDL to not send an SDL_QUIT event - * when the final window is requesting to close. Note that in this case, - * there are still other legitimate reasons one might get an SDL_QUIT - * event: choosing "Quit" from the macOS menu bar, sending a SIGINT (ctrl-c) - * on Unix, etc. - * - * The default value is "1". This hint can be changed at any time. - * - * This hint is available since SDL 2.0.22. Before then, you always get - * an SDL_QUIT event when closing the final window. - *} -SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE = 'SDL_QUIT_ON_LAST_WINDOW_CLOSE'; - -{/** - * \brief Tell SDL not to generate window-close events for Alt+F4 on Windows. - * - * The variable can be set to the following values: - * "0" - SDL will generate a window-close event when it sees Alt+F4. - * "1" - SDL will only do normal key handling for Alt+F4. - */} -SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 = 'SDL_WINDOWS_NO_CLOSE_ON_ALT_F4'; - -{/** - * \brief Prevent SDL from using version 4 of the bitmap header when saving BMPs. - * - * The bitmap header version 4 is required for proper alpha channel support and - * SDL will use it when required. Should this not be desired, this hint can - * force the use of the 40 byte header version which is supported everywhere. - * - * The variable can be set to the following values: - * "0" - Surfaces with a colorkey or an alpha channel are saved to a - * 32-bit BMP file with an alpha mask. SDL will use the bitmap - * header version 4 and set the alpha mask accordingly. - * "1" - Surfaces with a colorkey or an alpha channel are saved to a - * 32-bit BMP file without an alpha mask. The alpha channel data - * will be in the file, but applications are going to ignore it. - * - * The default value is "0". - */} -SDL_HINT_BMP_SAVE_LEGACY_FORMAT = 'SDL_BMP_SAVE_LEGACY_FORMAT'; - -{/** - * \brief Tell SDL not to name threads on Windows. - * - * The variable can be set to the following values: - * "0" - SDL will raise the 0x406D1388 Exception to name threads. - * This is the default behavior of SDL <= 2.0.4. (default) - * "1" - SDL will not raise this exception, and threads will be unnamed. - * For .NET languages this is required when running under a debugger. - */} -SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING = 'SDL_WINDOWS_DISABLE_THREAD_NAMING'; - -{/** - * \brief A variable to control whether the return key on the soft keyboard - * should hide the soft keyboard on Android and iOS. - * - * The variable can be set to the following values: - * "0" - The return key will be handled as a key event. This is the behaviour of SDL <= 2.0.3. (default) - * "1" - The return key will hide the keyboard. - * - * The value of this hint is used at runtime, so it can be changed at any time. - */} -SDL_HINT_RETURN_KEY_HIDES_IME = 'SDL_RETURN_KEY_HIDES_IME'; - -{/** - * \brief Tell SDL which Dispmanx layer to use on a Raspberry PI - * - * Also known as Z-order. The variable can take a negative or positive value. - * The default is 10000. - */} -SDL_HINT_RPI_VIDEO_LAYER = 'SDL_RPI_VIDEO_LAYER'; - -{** - * \brief A variable that decides what audio backend to use. - * - * By default, SDL will try all available audio backends in a reasonable - * order until it finds one that can work, but this hint allows the app - * or user to force a specific target, such as "alsa" if, say, you are - * on PulseAudio but want to try talking to the lower level instead. - * - * This functionality has existed since SDL 2.0.0 (indeed, before that) - * but before 2.0.22 this was an environment variable only. In 2.0.22, - * it was upgraded to a full SDL hint, so you can set the environment - * variable as usual or programatically set the hint with SDL_SetHint, - * which won't propagate to child processes. - * - * The default value is unset, in which case SDL will try to figure out - * the best audio backend on your behalf. This hint needs to be set - * before SDL_Init() is called to be useful. - * - * This hint is available since SDL 2.0.22. Before then, you could set - * the environment variable to get the same effect. - *} -SDL_HINT_AUDIODRIVER = 'SDL_AUDIODRIVER'; - -{** - * \brief A variable that decides what video backend to use. - * - * By default, SDL will try all available video backends in a reasonable - * order until it finds one that can work, but this hint allows the app - * or user to force a specific target, such as "x11" if, say, you are - * on Wayland but want to try talking to the X server instead. - * - * This functionality has existed since SDL 2.0.0 (indeed, before that) - * but before 2.0.22 this was an environment variable only. In 2.0.22, - * it was upgraded to a full SDL hint, so you can set the environment - * variable as usual or programatically set the hint with SDL_SetHint, - * which won't propagate to child processes. - * - * The default value is unset, in which case SDL will try to figure out - * the best video backend on your behalf. This hint needs to be set - * before SDL_Init() is called to be useful. - * - * This hint is available since SDL 2.0.22. Before then, you could set - * the environment variable to get the same effect. - *} -SDL_HINT_VIDEODRIVER = 'SDL_VIDEODRIVER'; - -{** - * \brief A variable that decides what KMSDRM device to use. - * - * Internally, SDL might open something like "/dev/dri/cardNN" to - * access KMSDRM functionality, where "NN" is a device index number. - * - * SDL makes a guess at the best index to use (usually zero), but the - * app or user can set this hint to a number between 0 and 99 to - * force selection. - * - * This hint is available since SDL 2.24.0. - *} -SDL_HINT_KMSDRM_DEVICE_INDEX = 'SDL_KMSDRM_DEVICE_INDEX'; - -{** - * \brief A variable that treats trackpads as touch devices. - * - * On macOS (and possibly other platforms in the future), SDL will report - * touches on a trackpad as mouse input, which is generally what users - * expect from this device; however, these are often actually full - * multitouch-capable touch devices, so it might be preferable to some apps - * to treat them as such. - * - * Setting this hint to true will make the trackpad input report as a - * multitouch device instead of a mouse. The default is false. - * - * Note that most platforms don't support this hint. As of 2.24.0, it - * only supports MacBooks' trackpads on macOS. Others may follow later. - * - * This hint is checked during SDL_Init and can not be changed after. - * - * This hint is available since SDL 2.24.0. - *} -SDL_HINT_TRACKPAD_IS_TOUCH_ONLY = 'SDL_TRACKPAD_IS_TOUCH_ONLY'; - -{/** - * \brief An enumeration of hint priorities - */} -type - PPSDL_HintPriority = ^PSDL_HintPriority; - PSDL_HintPriority = ^TSDL_HintPriority; - TSDL_HintPriority = type Integer; - -const - SDL_HINT_DEFAULT = TSDL_HintPriority(0); - SDL_HINT_NORMAL = TSDL_HintPriority(1); - SDL_HINT_OVERRIDE = TSDL_HintPriority(2); - -{/** - * \brief Set a hint with a specific priority - * - * The priority controls the behavior when setting a hint that already - * has a value. Hints will replace existing hints of their priority and - * lower. Environment variables are considered to have override priority. - * - * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise - */} -function SDL_SetHintWithPriority(const name: PAnsiChar; const value: PAnsiChar; priority: TSDL_HintPriority): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetHintWithPriority' {$ENDIF} {$ENDIF}; - -{/** - * \brief Set a hint with normal priority - * - * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise - */} -function SDL_SetHint(const name: PAnsiChar; const value: PAnsiChar): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetHint' {$ENDIF} {$ENDIF}; - -{** - * Reset a hint to the default value. - * - * This will reset a hint to the value of the environment variable, - * or NIL if the environment isn't set. Callbacks will be called normally - * with this change. - * - * \param name the hint to set - * \returns SDL_TRUE if the hint was set, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.24.0. - *} -function SDL_ResetHint(const name: PAnsiChar): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ResetHint' {$ENDIF} {$ENDIF}; - -{** - * Reset all hints to the default values. - * - * This will reset all hints to the value of the associated environment - * variable, or NIL if the environment isn't set. Callbacks will be called - * normally with this change. - * - * \since This function is available since SDL 2.26.0. - * - * \sa SDL_GetHint - * \sa SDL_SetHint - * \sa SDL_ResetHint - *} -procedure SDL_ResetHints(); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ResetHints' {$ENDIF} {$ENDIF}; - -{/** - * \brief Get a hint - * - * \return The string value of a hint variable. - */} -function SDL_GetHint(const name: PAnsiChar): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetHint' {$ENDIF} {$ENDIF}; - -{/** - * \brief Get a hint - * - * \return The boolean value of a hint variable. - */} -function SDL_GetHintBoolean(const name: PAnsiChar; default_value: TSDL_Bool): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetHintBoolean' {$ENDIF} {$ENDIF}; - -{/** - * \brief Add a function to watch a particular hint - * - * \param name The hint to watch - * \param callback The function to call when the hint value changes - * \param userdata A pointer to pass to the callback function - */} -type - PPSDL_HintCallback = ^PSDL_HintCallback; - PSDL_HintCallback = ^TSDL_HintCallback; - TSDL_HintCallback = procedure(userdata: Pointer; const name: PAnsiChar; const oldValue: PAnsiChar; const newValue: PAnsiChar); cdecl; - -procedure SDL_AddHintCallback(const name: PAnsiChar; callback: TSDL_HintCallback; userdata: Pointer); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AddHintCallback' {$ENDIF} {$ENDIF}; - -{/** - * \brief Remove a function watching a particular hint - * - * \param name The hint being watched - * \param callback The function being called when the hint value changes - * \param userdata A pointer being passed to the callback function - */} -procedure SDL_DelHintCallback(const name: PAnsiChar; callback: TSDL_HintCallback; userdata: Pointer); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DelHintCallback' {$ENDIF} {$ENDIF}; - -{** - * Clear all hints. - * - * This function is automatically called during SDL_Quit(), and deletes all - * callbacks without calling them and frees all memory associated with hints. - * If you're calling this from application code you probably want to call - * SDL_ResetHints() instead. - * - * This function will be removed from the API the next time we rev the ABI. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_ResetHints - *} -procedure SDL_ClearHints(); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ClearHints' {$ENDIF} {$ENDIF}; +// from "SDL_hints.h" + +{** + * \file SDL_hints.h + * + * Official documentation for SDL configuration variables + * + * This file contains functions to set and get configuration hints, + * as well as listing each of them alphabetically. + * + * The convention for naming hints is SDL_HINT_X, where "SDL_X" is + * the environment variable that can be used to override the default. + * + * In general these hints are just that - they may or may not be + * supported or applicable on any given platform, but they provide + * a way for an application or user to give the library a hint as + * to how they would like the library to work. + *} + +const + +{/** + * \brief Override for SDL_GetDisplayUsableBounds() + * + * If set, this hint will override the expected results for + * SDL_GetDisplayUsableBounds() for display index 0. Generally you don't want + * to do this, but this allows an embedded system to request that some of the + * screen be reserved for other uses when paired with a well-behaved + * application. + * + * The contents of this hint must be 4 comma-separated integers, the first + * is the bounds x, then y, width and height, in that order. + */} +SDL_HINT_DISPLAY_USABLE_BOUNDS = 'SDL_DISPLAY_USABLE_BOUNDS'; + +{/** + * \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs + * + * The variable can be set to the following values: + * "0" - Do not scan for Steam Controllers + * "1" - Scan for Steam Controllers (the default) + * + * The default value is "1". This hint must be set before initializing the joystick subsystem. + */} +SDL_HINT_ENABLE_STEAM_CONTROLLERS = 'SDL_ENABLE_STEAM_CONTROLLERS'; + +{/** + * \brief A variable controlling whether SDL logs all events pushed onto its internal queue. + * + * This variable can be set to the following values: + * + * "0" - Don't log any events (default) + * "1" - Log all events except mouse and finger motion, which are pretty spammy. + * "2" - Log all events. + * + * This is generally meant to be used to debug SDL itself, but can be useful + * for application developers that need better visibility into what is going + * on in the event queue. Logged events are sent through SDL_Log(), which + * means by default they appear on stdout on most platforms or maybe + * OutputDebugString() on Windows, and can be funneled by the app with + * SDL_LogSetOutputFunction(), etc. + * + * This hint can be toggled on and off at runtime, if you only need to log + * events for a small subset of program execution. + */} +SDL_HINT_EVENT_LOGGING = 'SDL_EVENT_LOGGING'; + +{** + * \brief A variable controlling whether raising the window should be done more forcefully + * + * This variable can be set to the following values: + * "0" - No forcing (the default) + * "1" - Extra level of forcing + * + * At present, this is only an issue under MS Windows, which makes it nearly impossible to + * programmatically move a window to the foreground, for "security" reasons. See + * http://stackoverflow.com/a/34414846 for a discussion. + *} +SDL_HINT_FORCE_RAISEWINDOW = 'SDL_HINT_FORCE_RAISEWINDOW'; + +{/** + * \brief A variable controlling how 3D acceleration is used to accelerate the SDL screen surface. + * + * SDL can try to accelerate the SDL screen surface by using streaming + * textures with a 3D rendering engine. This variable controls whether and + * how this is done. + * + * This variable can be set to the following values: + * "0" - Disable 3D acceleration + * "1" - Enable 3D acceleration, using the default renderer. + * "X" - Enable 3D acceleration, using X where X is one of the valid rendering drivers. (e.g. "direct3d", "opengl", etc.) + * + * By default SDL tries to make a best guess for each platform whether + * to use acceleration or not. + */} +SDL_HINT_FRAMEBUFFER_ACCELERATION = 'SDL_FRAMEBUFFER_ACCELERATION'; + +{/** + * \brief Determines whether SDL enforces that DRM master is required in order + * to initialize the KMSDRM video backend. + * + * The DRM subsystem has a concept of a "DRM master" which is a DRM client that + * has the ability to set planes, set cursor, etc. When SDL is DRM master, it + * can draw to the screen using the SDL rendering APIs. Without DRM master, SDL + * is still able to process input and query attributes of attached displays, + * but it cannot change display state or draw to the screen directly. + * + * In some cases, it can be useful to have the KMSDRM backend even if it cannot + * be used for rendering. An app may want to use SDL for input processing while + * using another rendering API (such as an MMAL overlay on Raspberry Pi) or + * using its own code to render to DRM overlays that SDL doesn't support. + * + * This hint must be set before initializing the video subsystem. + * + * This variable can be set to the following values: + * "0" - SDL will allow usage of the KMSDRM backend without DRM master + * "1" - SDL will require DRM master to use the KMSDRM backend (default) + */} +SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER = 'SDL_KMSDRM_REQUIRE_DRM_MASTER'; + +{/** + * \brief A variable controlling whether the 2D render API is compatible or efficient. + * + * This variable can be set to the following values: + * + * "0" - Don't use batching to make rendering more efficient. + * "1" - Use batching, but might cause problems if app makes its own direct OpenGL calls. + * + * Up to SDL 2.0.9, the render API would draw immediately when requested. Now + * it batches up draw requests and sends them all to the GPU only when forced + * to (during SDL_RenderPresent, when changing render targets, by updating a + * texture that the batch needs, etc). This is significantly more efficient, + * but it can cause problems for apps that expect to render on top of the + * render API's output. As such, SDL will disable batching if a specific + * render backend is requested (since this might indicate that the app is + * planning to use the underlying graphics API directly). This hint can + * be used to explicitly request batching in this instance. It is a contract + * that you will either never use the underlying graphics API directly, or + * if you do, you will call SDL_RenderFlush() before you do so any current + * batch goes to the GPU before your work begins. Not following this contract + * will result in undefined behavior. + */} +SDL_HINT_RENDER_BATCHING = 'SDL_RENDER_BATCHING'; + +{/** + * \brief A variable specifying which render driver to use. + * + * If the application doesn't pick a specific renderer to use, this variable + * specifies the name of the preferred renderer. If the preferred renderer + * can't be initialized, the normal default renderer is used. + * + * This variable is case insensitive and can be set to the following values: + * "direct3d" + * "opengl" + * "opengles2" + * "opengles" + * "software" + * + * The default varies by platform, but it's the first one in the list that + * is available on the current platform. + */} +SDL_HINT_RENDER_DRIVER = 'SDL_RENDER_DRIVER'; + +{/** + * \brief A variable controlling how the 2D render API renders lines + * + * This variable can be set to the following values: + * "0" - Use the default line drawing method (Bresenham's line algorithm as of SDL 2.0.20) + * "1" - Use the driver point API using Bresenham's line algorithm (correct, draws many points) + * "2" - Use the driver line API (occasionally misses line endpoints based on hardware driver quirks, was the default before 2.0.20) + * "3" - Use the driver geometry API (correct, draws thicker diagonal lines) + * + * This variable should be set when the renderer is created. + */} +SDL_HINT_RENDER_LINE_METHOD = 'SDL_RENDER_LINE_METHOD'; + +{/** + * \brief A variable controlling the scaling policy for SDL_RenderSetLogicalSize. + * + * This variable can be set to the following values: + * "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen + * "1" or "overscan" - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen + * + * By default letterbox is used + */} +SDL_HINT_RENDER_LOGICAL_SIZE_MODE = 'SDL_RENDER_LOGICAL_SIZE_MODE'; + +{/** + * \brief A variable controlling whether the OpenGL render driver uses shaders if they are available. + * + * This variable can be set to the following values: + * "0" - Disable shaders + * "1" - Enable shaders + * + * By default shaders are used if OpenGL supports them. + */} +SDL_HINT_RENDER_OPENGL_SHADERS = 'SDL_RENDER_OPENGL_SHADERS'; + +{/** + * \brief A variable controlling whether the Direct3D device is initialized for thread-safe operations. + * + * This variable can be set to the following values: + * "0" - Thread-safety is not enabled (faster) + * "1" - Thread-safety is enabled + * + * By default the Direct3D device is created with thread-safety disabled. + */} +SDL_HINT_RENDER_DIRECT3D_THREADSAFE = 'SDL_RENDER_DIRECT3D_THREADSAFE'; + +{/** + * \brief A variable controlling whether to enable Direct3D 11+'s Debug Layer. + * + * This variable does not have any effect on the Direct3D 9 based renderer. + * + * This variable can be set to the following values: + * "0" - Disable Debug Layer use + * "1" - Enable Debug Layer use + * + * By default, SDL does not use Direct3D Debug Layer. + */} +SDL_HINT_RENDER_DIRECT3D11_DEBUG = 'SDL_RENDER_DIRECT3D11_DEBUG'; + +{/** + * \brief A variable controlling the scaling quality + * + * This variable can be set to the following values: + * "0" or "nearest" - Nearest pixel sampling + * "1" or "linear" - Linear filtering (supported by OpenGL and Direct3D) + * "2" or "best" - Currently this is the same as "linear" + * + * By default nearest pixel sampling is used + */} +SDL_HINT_RENDER_SCALE_QUALITY = 'SDL_RENDER_SCALE_QUALITY'; + +{/** + * \brief A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing. + * + * This variable can be set to the following values: + * "0" - Disable vsync + * "1" - Enable vsync + * + * By default SDL does not sync screen surface updates with vertical refresh. + */} +SDL_HINT_RENDER_VSYNC = 'SDL_RENDER_VSYNC'; + +{** + * \brief A variable controlling if VSYNC is automatically disable if doesn't reach the enough FPS + * + * This variable can be set to the following values: + * "0" - It will be using VSYNC as defined in the main flag. Default + * "1" - If VSYNC was previously enabled, then it will disable VSYNC if doesn't reach enough speed + * + * By default SDL does not enable the automatic VSYNC + *} +SDL_HINT_PS2_DYNAMIC_VSYNC = 'SDL_PS2_DYNAMIC_VSYNC'; + +{/** + * \brief A variable controlling whether the screensaver is enabled. + * + * This variable can be set to the following values: + * "0" - Disable screensaver + * "1" - Enable screensaver + * + * By default SDL will disable the screensaver. + */} +SDL_HINT_VIDEO_ALLOW_SCREENSAVER = 'SDL_VIDEO_ALLOW_SCREENSAVER'; + +{/** + * \brief Tell the video driver that we only want a double buffer. + * + * By default, most lowlevel 2D APIs will use a triple buffer scheme that + * wastes no CPU time on waiting for vsync after issuing a flip, but + * introduces a frame of latency. On the other hand, using a double buffer + * scheme instead is recommended for cases where low latency is an important + * factor because we save a whole frame of latency. + * We do so by waiting for vsync immediately after issuing a flip, usually just + * after eglSwapBuffers call in the backend's *_SwapWindow function. + * + * Since it's driver-specific, it's only supported where possible and + * implemented. Currently supported the following drivers: + * + * - KMSDRM (kmsdrm) + * - Raspberry Pi (raspberrypi) + */} +SDL_HINT_VIDEO_DOUBLE_BUFFER = 'SDL_VIDEO_DOUBLE_BUFFER'; + +{/** + * \brief A variable controlling whether the EGL window is allowed to be + * composited as transparent, rather than opaque. + * + * Most window systems will always render windows opaque, even if the surface + * format has an alpha channel. This is not always true, however, so by default + * SDL will try to enforce opaque composition. To override this behavior, you + * can set this hint to "1". + */} +SDL_HINT_VIDEO_EGL_ALLOW_TRANSPARENCY = 'SDL_VIDEO_EGL_ALLOW_TRANSPARENCY'; + +{/** + * \brief A variable controlling whether the graphics context is externally managed. + * + * This variable can be set to the following values: + * "0" - SDL will manage graphics contexts that are attached to windows. + * "1" - Disable graphics context management on windows. + * + * By default SDL will manage OpenGL contexts in certain situations. For example, on Android the + * context will be automatically saved and restored when pausing the application. Additionally, some + * platforms will assume usage of OpenGL if Vulkan isn't used. Setting this to "1" will prevent this + * behavior, which is desireable when the application manages the graphics context, such as + * an externally managed OpenGL context or attaching a Vulkan surface to the window. + */} +SDL_HINT_VIDEO_EXTERNAL_CONTEXT = 'SDL_VIDEO_EXTERNAL_CONTEXT'; + +{/** + * \brief A variable controlling whether the libdecor Wayland backend is allowed to be used. + * + * This variable can be set to the following values: + * "0" - libdecor use is disabled. + * "1" - libdecor use is enabled (default). + * + * libdecor is used over xdg-shell when xdg-decoration protocol is unavailable. + */} +SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR = 'SDL_VIDEO_WAYLAND_ALLOW_LIBDECOR'; + +{** + * \brief A variable controlling whether the libdecor Wayland backend is preferred over native decrations. + * + * When this hint is set, libdecor will be used to provide window decorations, even if xdg-decoration is + * available. (Note that, by default, libdecor will use xdg-decoration itself if available). + * + * This variable can be set to the following values: + * "0" - libdecor is enabled only if server-side decorations are unavailable. + * "1" - libdecor is always enabled if available. + * + * libdecor is used over xdg-shell when xdg-decoration protocol is unavailable. + *} +SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR = 'SDL_VIDEO_WAYLAND_PREFER_LIBDECOR'; + +{** + * \brief A variable controlling whether video mode emulation is enabled under Wayland. + * + * When this hint is set, a standard set of emulated CVT video modes will be exposed for use by the application. + * If it is disabled, the only modes exposed will be the logical desktop size and, in the case of a scaled + * desktop, the native display resolution. + * + * This variable can be set to the following values: + * "0" - Video mode emulation is disabled. + * "1" - Video mode emulation is enabled. + * + * By default video mode emulation is enabled. + *} +SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION = 'SDL_VIDEO_WAYLAND_MODE_EMULATION'; + +{** + * \brief Enable or disable mouse pointer warp emulation, needed by some older games. + * + * When this hint is set, any SDL will emulate mouse warps using relative mouse mode. + * This is required for some older games (such as Source engine games), which warp the + * mouse to the centre of the screen rather than using relative mouse motion. Note that + * relative mouse mode may have different mouse acceleration behaviour than pointer warps. + * + * This variable can be set to the following values: + * "0" - All mouse warps fail, as mouse warping is not available under Wayland. + * "1" - Some mouse warps will be emulated by forcing relative mouse mode. + * + * If not set, this is automatically enabled unless an application uses + * relative mouse mode directly. + * + * This hint is available since SDL 2.26.0. + *} +SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP = 'SDL_VIDEO_WAYLAND_EMULATE_MOUSE_WARP'; + +{/** + * \brief Specify an "activity name" for screensaver inhibition. + * + * Some platforms, notably Linux desktops, list the applications which are + * inhibiting the screensaver or other power-saving features. + * + * This hint lets you specify the "activity name" sent to the OS when + * SDL_DisableScreenSaver() is used (or the screensaver is automatically + * disabled). The contents of this hint are used when the screensaver is + * disabled. You should use a string that describes what your program is doing + * (and, therefore, why the screensaver is disabled). For example, "Playing a + * game" or "Watching a video". + * + * Setting this to "" or leaving it unset will have SDL use a reasonable + * default: "Playing a game" or something similar. + * + * On targets where this is not supported, this hint does nothing. + */} +SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME = 'SDL_SCREENSAVER_INHIBIT_ACTIVITY_NAME'; + +{/** + * \brief A variable controlling whether X11 should use GLX or EGL by default + * + * This variable can be set to the following values: + * "0" - Use GLX + * "1" - Use EGL + * + * By default SDL will use GLX when both are present. + */} +SDL_HINT_VIDEO_X11_FORCE_EGL = 'SDL_VIDEO_X11_FORCE_EGL'; + +{/** + * \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used. + * + * This variable can be set to the following values: + * "0" - Disable _NET_WM_BYPASS_COMPOSITOR + * "1" - Enable _NET_WM_BYPASS_COMPOSITOR + * + * By default SDL will use _NET_WM_BYPASS_COMPOSITOR + * + */} +SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR = 'SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR'; + +{/** + * \brief A variable forcing the visual ID chosen for new X11 windows + * + */} +SDL_HINT_VIDEO_X11_WINDOW_VISUALID = 'SDL_VIDEO_X11_WINDOW_VISUALID'; + +{/** + * \brief A variable controlling whether the X11 VidMode extension should be used. + * + * This variable can be set to the following values: + * "0" - Disable XVidMode + * "1" - Enable XVidMode + * + * By default SDL will use XVidMode if it is available. + */} +SDL_HINT_VIDEO_X11_XVIDMODE = 'SDL_VIDEO_X11_XVIDMODE'; + +{/** + * \brief A variable controlling whether the X11 Xinerama extension should be used. + * + * This variable can be set to the following values: + * "0" - Disable Xinerama + * "1" - Enable Xinerama + * + * By default SDL will use Xinerama if it is available. + */} +SDL_HINT_VIDEO_X11_XINERAMA = 'SDL_VIDEO_X11_XINERAMA'; + +{/** + * \brief A variable controlling whether the X11 XRandR extension should be used. + * + * This variable can be set to the following values: + * "0" - Disable XRandR + * "1" - Enable XRandR + * + * By default SDL will not use XRandR because of window manager issues. + */} +SDL_HINT_VIDEO_X11_XRANDR = 'SDL_VIDEO_X11_XRANDR'; + +{/** + * \brief A variable controlling whether the X11 _NET_WM_PING protocol should be supported. + * + * This variable can be set to the following values: + * "0" - Disable _NET_WM_PING + * "1" - Enable _NET_WM_PING + * + * By default SDL will use _NET_WM_PING, but for applications that know they + * will not always be able to respond to ping requests in a timely manner they can + * turn it off to avoid the window manager thinking the app is hung. + * The hint is checked in CreateWindow. + */} +SDL_HINT_VIDEO_X11_NET_WM_PING = 'SDL_VIDEO_X11_NET_WM_PING'; + +{/** + * \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden + * + * This variable can be set to the following values: + * "0" - The window frame is not interactive when the cursor is hidden (no move, resize, etc) + * "1" - The window frame is interactive when the cursor is hidden + * + * By default SDL will allow interaction with the window frame when the cursor is hidden + */} +SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN = 'SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN'; + +{/** +* \brief A variable controlling whether the window is activated when the SDL_ShowWindow function is called +* +* This variable can be set to the following values: +* "0" - The window is activated when the SDL_ShowWindow function is called +* "1" - The window is not activated when the SDL_ShowWindow function is called +* +* By default SDL will activate the window when the SDL_ShowWindow function is called +*/} +SDL_HINT_WINDOW_NO_ACTIVATION_WHEN_SHOWN = 'SDL_WINDOW_NO_ACTIVATION_WHEN_SHOWN'; + +{/** + * \brief A variable controlling whether the windows message loop is processed by SDL + * + * This variable can be set to the following values: + * "0" - The window message loop is not run + * "1" - The window message loop is processed in SDL_PumpEvents() + * + * By default SDL will process the windows message loop + */} +SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP = 'SDL_WINDOWS_ENABLE_MESSAGELOOP'; + +{/** + * \brief Force SDL to use Critical Sections for mutexes on Windows. + * On Windows 7 and newer, Slim Reader/Writer Locks are available. + * They offer better performance, allocate no kernel ressources and + * use less memory. SDL will fall back to Critical Sections on older + * OS versions or if forced to by this hint. + * + * This variable can be set to the following values: + * "0" - Use SRW Locks when available. If not, fall back to Critical Sections. (default) + * "1" - Force the use of Critical Sections in all cases. + * + */} +SDL_HINT_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS = 'SDL_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS'; + +{/** + * \brief Force SDL to use Kernel Semaphores on Windows. + * Kernel Semaphores are inter-process and require a context + * switch on every interaction. On Windows 8 and newer, the + * WaitOnAddress API is available. Using that and atomics to + * implement semaphores increases performance. + * SDL will fall back to Kernel Objects on older OS versions + * or if forced to by this hint. + * + * This variable can be set to the following values: + * "0" - Use Atomics and WaitOnAddress API when available. If not, fall back to Kernel Objects. (default) + * "1" - Force the use of Kernel Objects in all cases. + * + */} +SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL = 'SDL_WINDOWS_FORCE_SEMAPHORE_KERNEL'; + +{/** + * \brief A variable to specify custom icon resource id from RC file on Windows platform + */} +SDL_HINT_WINDOWS_INTRESOURCE_ICON = 'SDL_WINDOWS_INTRESOURCE_ICON'; +SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL = 'SDL_WINDOWS_INTRESOURCE_ICON_SMALL'; + +{/** + * \brief Use the D3D9Ex API introduced in Windows Vista, instead of normal D3D9. + * Direct3D 9Ex contains changes to state management that can eliminate device + * loss errors during scenarios like Alt+Tab or UAC prompts. D3D9Ex may require + * some changes to your application to cope with the new behavior, so this + * is disabled by default. + * + * This hint must be set before initializing the video subsystem. + * + * For more information on Direct3D 9Ex, see: + * - https://docs.microsoft.com/en-us/windows/win32/direct3darticles/graphics-apis-in-windows-vista#direct3d-9ex + * - https://docs.microsoft.com/en-us/windows/win32/direct3darticles/direct3d-9ex-improvements + * + * This variable can be set to the following values: + * "0" - Use the original Direct3D 9 API (default) + * "1" - Use the Direct3D 9Ex API on Vista and later (and fall back if D3D9Ex is unavailable) + * + */} +SDL_HINT_WINDOWS_USE_D3D9EX = 'SDL_WINDOWS_USE_D3D9EX'; + +{** + * \brief Controls whether SDL will declare the process to be DPI aware. + * + * This hint must be set before initializing the video subsystem. + * + * The main purpose of declaring DPI awareness is to disable OS bitmap scaling of SDL windows on monitors with + * a DPI scale factor. + * + * This hint is equivalent to requesting DPI awareness via external means (e.g. calling SetProcessDpiAwarenessContext) + * and does not cause SDL to use a virtualized coordinate system, so it will generally give you 1 SDL coordinate = 1 pixel + * even on high-DPI displays. + * + * For more information, see: + * https://docs.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows + * + * This variable can be set to the following values: + * "" - Do not change the DPI awareness (default). + * "unaware" - Declare the process as DPI unaware. (Windows 8.1 and later). + * "system" - Request system DPI awareness. (Vista and later). + * "permonitor" - Request per-monitor DPI awareness. (Windows 8.1 and later). + * "permonitorv2" - Request per-monitor V2 DPI awareness. (Windows 10, version 1607 and later). + * The most visible difference from "permonitor" is that window title bar will be scaled + * to the visually correct size when dragging between monitors with different scale factors. + * This is the preferred DPI awareness level. + * + * If the requested DPI awareness is not available on the currently running OS, SDL will try to request the best + * available match. + *} +SDL_HINT_WINDOWS_DPI_AWARENESS = 'SDL_WINDOWS_DPI_AWARENESS'; + +{** + * \brief Uses DPI-scaled points as the SDL coordinate system on Windows. + * + * This changes the SDL coordinate system units to be DPI-scaled points, rather than pixels everywhere. + * This means windows will be appropriately sized, even when created on high-DPI displays with scaling. + * + * e.g. requesting a 640x480 window from SDL, on a display with 125% scaling in Windows display settings, + * will create a window with an 800x600 client area (in pixels). + * + * Setting this to "1" implicitly requests process DPI awareness (setting SDL_WINDOWS_DPI_AWARENESS is unnecessary), + * and forces SDL_WINDOW_ALLOW_HIGHDPI on all windows. + * + * This variable can be set to the following values: + * "0" - SDL coordinates equal Windows coordinates. No automatic window resizing when dragging + * between monitors with different scale factors (unless this is performed by + * Windows itself, which is the case when the process is DPI unaware). + * "1" - SDL coordinates are in DPI-scaled points. Automatically resize windows as needed on + * displays with non-100% scale factors. + *} +SDL_HINT_WINDOWS_DPI_SCALING = 'SDL_WINDOWS_DPI_SCALING'; + +{/** + * \brief A variable controlling whether grabbing input grabs the keyboard + * + * This variable can be set to the following values: + * "0" - Grab will affect only the mouse + * "1" - Grab will affect mouse and keyboard + * + * By default SDL will not grab the keyboard so system shortcuts still work. + */} +SDL_HINT_GRAB_KEYBOARD = 'SDL_GRAB_KEYBOARD'; + +{** + * \brief A variable containing a list of devices to ignore in SDL_hid_enumerate() + * + * For example, to ignore the Shanwan DS3 controller and any Valve controller, you might + * have the string "0x2563/0x0523,0x28de/0x0000". + * + * This hint is available since SDL 2.26.0. + *} +SDL_HINT_HIDAPI_IGNORE_DEVICES = 'SDL_HIDAPI_IGNORE_DEVICES'; + +{** + * \brief A variable controlling whether the mouse is captured while mouse buttons are pressed + * + * This variable can be set to the following values: + * "0" - The mouse is not captured while mouse buttons are pressed + * "1" - The mouse is captured while mouse buttons are pressed + * + * By default the mouse is captured while mouse buttons are pressed so if the mouse is dragged + * outside the window, the application continues to receive mouse events until the button is + * released. + *} +SDL_HINT_MOUSE_AUTO_CAPTURE = 'SDL_MOUSE_AUTO_CAPTURE'; + +{/** + * \brief A variable setting the double click radius, in pixels. + */} +SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS = 'SDL_MOUSE_DOUBLE_CLICK_RADIUS'; + +{/** + * \brief A variable setting the double click time, in milliseconds. + */} +SDL_HINT_MOUSE_DOUBLE_CLICK_TIME = 'SDL_MOUSE_DOUBLE_CLICK_TIME'; + +{/** + * \brief Allow mouse click events when clicking to focus an SDL window + * + * This variable can be set to the following values: + * "0" - Ignore mouse clicks that activate a window + * "1" - Generate events for mouse clicks that activate a window + * + * By default SDL will ignore mouse clicks that activate a window + */} +SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH = 'SDL_MOUSE_FOCUS_CLICKTHROUGH'; + +{/** + * \brief A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode + */} +SDL_HINT_MOUSE_NORMAL_SPEED_SCALE = 'SDL_MOUSE_NORMAL_SPEED_SCALE'; + +{** + * \brief A variable controlling whether relative mouse mode constrains the mouse to the center of the window + * + * This variable can be set to the following values: + * "0" - Relative mouse mode constrains the mouse to the window + * "1" - Relative mouse mode constrains the mouse to the center of the window + * + * Constraining to the center of the window works better for FPS games and when the + * application is running over RDP. Constraining to the whole window works better + * for 2D games and increases the chance that the mouse will be in the correct + * position when using high DPI mice. + * + * By default SDL will constrain the mouse to the center of the window + *} +SDL_HINT_MOUSE_RELATIVE_MODE_CENTER = 'SDL_MOUSE_RELATIVE_MODE_CENTER'; + +{/** + * \brief A variable controlling whether relative mouse mode is implemented using mouse warping + * + * This variable can be set to the following values: + * "0" - Relative mouse mode uses raw input + * "1" - Relative mouse mode uses mouse warping + * + * By default SDL will use raw input for relative mouse mode + */} +SDL_HINT_MOUSE_RELATIVE_MODE_WARP = 'SDL_MOUSE_RELATIVE_MODE_WARP'; + +{/** + * \brief A variable controlling whether relative mouse motion is affected by renderer scaling + * + * This variable can be set to the following values: + * "0" - Relative motion is unaffected by DPI or renderer's logical size + * "1" - Relative motion is scaled according to DPI scaling and logical size + * + * By default relative mouse deltas are affected by DPI and renderer scaling + */} +SDL_HINT_MOUSE_RELATIVE_SCALING = 'SDL_MOUSE_RELATIVE_SCALING'; + +{/** + * \brief A variable setting the scale for mouse motion, in floating point, when the mouse is in relative mode + */} +SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE = 'SDL_MOUSE_RELATIVE_SPEED_SCALE'; + +{** + * \brief A variable controlling whether the system mouse acceleration curve is used for relative mouse motion. + * + * This variable can be set to the following values: + * "0" - Relative mouse motion will be unscaled (the default) + * "1" - Relative mouse motion will be scaled using the system mouse acceleration curve. + * + * If SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE is set, that will override the system speed scale. + * + * This hint is available since SDL 2.26.0. + *} +SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE = 'SDL_MOUSE_RELATIVE_SYSTEM_SCALE'; + +{** + * \brief A variable controlling whether a motion event should be generated for mouse warping in relative mode. + * + * This variable can be set to the following values: + * "0" - Warping the mouse will not generate a motion event in relative mode + * "1" - Warping the mouse will generate a motion event in relative mode + * + * By default warping the mouse will not generate motion events in relative mode. This avoids the application having to filter out large relative motion due to warping. + *} +SDL_HINT_MOUSE_RELATIVE_WARP_MOTION = 'SDL_MOUSE_RELATIVE_WARP_MOTION'; + +{/** + * \brief A variable controlling whether mouse events should generate synthetic touch events + * + * This variable can be set to the following values: + * "0" - Mouse events will not generate touch events (default for desktop platforms) + * "1" - Mouse events will generate touch events (default for mobile platforms, such as Android and iOS) + */} +SDL_HINT_MOUSE_TOUCH_EVENTS = 'SDL_MOUSE_TOUCH_EVENTS'; + +{/** + * \brief Controls how the fact chunk affects the loading of a WAVE file. + * + * The fact chunk stores information about the number of samples of a WAVE + * file. The Standards Update from Microsoft notes that this value can be used + * to 'determine the length of the data in seconds'. This is especially useful + * for compressed formats (for which this is a mandatory chunk) if they produce + * multiple sample frames per block and truncating the block is not allowed. + * The fact chunk can exactly specify how many sample frames there should be + * in this case. + * + * Unfortunately, most application seem to ignore the fact chunk and so SDL + * ignores it by default as well. + * + * This variable can be set to the following values: + * + * "truncate" - Use the number of samples to truncate the wave data if + * the fact chunk is present and valid + * "strict" - Like "truncate", but raise an error if the fact chunk + * is invalid, not present for non-PCM formats, or if the + * data chunk doesn't have that many samples + * "ignorezero" - Like "truncate", but ignore fact chunk if the number of + * samples is zero + * "ignore" - Ignore fact chunk entirely (default) + */} +SDL_HINT_WAVE_FACT_CHUNK = 'SDL_WAVE_FACT_CHUNK'; + +{/** + * \brief Controls how the size of the RIFF chunk affects the loading of a WAVE file. + * + * The size of the RIFF chunk (which includes all the sub-chunks of the WAVE + * file) is not always reliable. In case the size is wrong, it's possible to + * just ignore it and step through the chunks until a fixed limit is reached. + * + * Note that files that have trailing data unrelated to the WAVE file or + * corrupt files may slow down the loading process without a reliable boundary. + * By default, SDL stops after 10000 chunks to prevent wasting time. Use the + * environment variable SDL_WAVE_CHUNK_LIMIT to adjust this value. + * + * This variable can be set to the following values: + * + * "force" - Always use the RIFF chunk size as a boundary for the chunk search + * "ignorezero" - Like "force", but a zero size searches up to 4 GiB (default) + * "ignore" - Ignore the RIFF chunk size and always search up to 4 GiB + * "maximum" - Search for chunks until the end of file (not recommended) + */} +SDL_HINT_WAVE_RIFF_CHUNK_SIZE = 'SDL_WAVE_RIFF_CHUNK_SIZE'; + +{/** + * \brief Controls how a truncated WAVE file is handled. + * + * A WAVE file is considered truncated if any of the chunks are incomplete or + * the data chunk size is not a multiple of the block size. By default, SDL + * decodes until the first incomplete block, as most applications seem to do. + * + * This variable can be set to the following values: + * + * "verystrict" - Raise an error if the file is truncated + * "strict" - Like "verystrict", but the size of the RIFF chunk is ignored + * "dropframe" - Decode until the first incomplete sample frame + * "dropblock" - Decode until the first incomplete block (default) + */} +SDL_HINT_WAVE_TRUNCATION = 'SDL_WAVE_TRUNCATION'; + +{/** + * \brief Minimize your SDL_Window if it loses key focus when in Fullscreen mode. Defaults to true. + * + */} +SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS = 'SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS'; + +{/** + * \brief A variable controlling whether the idle timer is disabled on iOS. + * + * When an iOS app does not receive touches for some time, the screen is + * dimmed automatically. For games where the accelerometer is the only input + * this is problematic. This functionality can be disabled by setting this + * hint. + * + * As of SDL 2.0.4, SDL_EnableScreenSaver() and SDL_DisableScreenSaver() + * accomplish the same thing on iOS. They should be preferred over this hint. + * + * This variable can be set to the following values: + * "0" - Enable idle timer + * "1" - Disable idle timer + */} +SDL_HINT_IDLE_TIMER_DISABLED = 'SDL_IOS_IDLE_TIMER_DISABLED'; + +{/** + * \brief A variable controlling what driver to use for OpenGL ES contexts. + * + * On some platforms, currently Windows and X11, OpenGL drivers may support + * creating contexts with an OpenGL ES profile. By default SDL uses these + * profiles, when available, otherwise it attempts to load an OpenGL ES + * library, e.g. that provided by the ANGLE project. This variable controls + * whether SDL follows this default behaviour or will always load an + * OpenGL ES library. + * + * Circumstances where this is useful include + * - Testing an app with a particular OpenGL ES implementation, e.g ANGLE, + * or emulator, e.g. those from ARM, Imagination or Qualcomm. + * - Resolving OpenGL ES function addresses at link time by linking with + * the OpenGL ES library instead of querying them at run time with + * SDL_GL_GetProcAddress(). + * + * Caution: for an application to work with the default behaviour across + * different OpenGL drivers it must query the OpenGL ES function + * addresses at run time using SDL_GL_GetProcAddress(). + * + * This variable is ignored on most platforms because OpenGL ES is native + * or not supported. + * + * This variable can be set to the following values: + * "0" - Use ES profile of OpenGL, if available. (Default when not set.) + * "1" - Load OpenGL ES library using the default library names. + * + */} +SDL_HINT_OPENGL_ES_DRIVER = 'SDL_OPENGL_ES_DRIVER'; + +{/** + * \brief A variable controlling which orientations are allowed on iOS. + * + * In some circumstances it is necessary to be able to explicitly control + * which UI orientations are allowed. + * + * This variable is a space delimited list of the following values: + * "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown" + */} +SDL_HINT_ORIENTATIONS = 'SDL_IOS_ORIENTATIONS'; + +{/** + * \brief A variable controlling the use of a sentinel event when polling the event queue + * + * This variable can be set to the following values: + * "0" - Disable poll sentinels + * "1" - Enable poll sentinels + * + * When polling for events, SDL_PumpEvents is used to gather new events from devices. + * If a device keeps producing new events between calls to SDL_PumpEvents, a poll loop will + * become stuck until the new events stop. + * This is most noticable when moving a high frequency mouse. + * + * By default, poll sentinels are enabled. + */} +SDL_HINT_POLL_SENTINEL = 'SDL_POLL_SENTINEL'; + +{/** + * \brief Override for SDL_GetPreferredLocales() + * + * If set, this will be favored over anything the OS might report for the + * user's preferred locales. Changing this hint at runtime will not generate + * a SDL_LOCALECHANGED event (but if you can change the hint, you can push + * your own event, if you want). + * + * The format of this hint is a comma-separated list of language and locale, + * combined with an underscore, as is a common format: "en_GB". Locale is + * optional: "en". So you might have a list like this: "en_GB,jp,es_PT" + */} +SDL_HINT_PREFERRED_LOCALES = 'SDL_PREFERRED_LOCALES'; + +{/** + * \brief A variable describing the content orientation on QtWayland-based platforms. + * + * On QtWayland platforms, windows are rotated client-side to allow for custom + * transitions. In order to correctly position overlays (e.g. volume bar) and + * gestures (e.g. events view, close/minimize gestures), the system needs to + * know in which orientation the application is currently drawing its contents. + * + * This does not cause the window to be rotated or resized, the application + * needs to take care of drawing the content in the right orientation (the + * framebuffer is always in portrait mode). + * + * This variable can be one of the following values: + * "primary" (default), "portrait", "landscape", "inverted-portrait", "inverted-landscape" + */} +SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION = 'SDL_QTWAYLAND_CONTENT_ORIENTATION'; + +{/** + * \brief Flags to set on QtWayland windows to integrate with the native window manager. + * + * On QtWayland platforms, this hint controls the flags to set on the windows. + * For example, on Sailfish OS "OverridesSystemGestures" disables swipe gestures. + * + * This variable is a space-separated list of the following values (empty = no flags): + * "OverridesSystemGestures", "StaysOnTop", "BypassWindowManager" + */} +SDL_HINT_QTWAYLAND_WINDOW_FLAGS = 'SDL_QTWAYLAND_WINDOW_FLAGS'; + +{** + * \brief Specify an application name. + * + * This hint lets you specify the application name sent to the OS when + * required. For example, this will often appear in volume control applets for + * audio streams, and in lists of applications which are inhibiting the + * screensaver. You should use a string that describes your program ("My Game + * 2: The Revenge") + * + * Setting this to "" or leaving it unset will have SDL use a reasonable + * default: probably the application's name or "SDL Application" if SDL + * doesn't have any better information. + * + * Note that, for audio streams, this can be overridden with + * SDL_HINT_AUDIO_DEVICE_APP_NAME. + * + * On targets where this is not supported, this hint does nothing. + *} +SDL_HINT_APP_NAME = 'SDL_APP_NAME'; + +{/** + * \brief A variable controlling whether controllers used with the Apple TV + * generate UI events. + * + * When UI events are generated by controller input, the app will be + * backgrounded when the Apple TV remote's menu button is pressed, and when the + * pause or B buttons on gamepads are pressed. + * + * More information about properly making use of controllers for the Apple TV + * can be found here: + * https://developer.apple.com/tvos/human-interface-guidelines/remote-and-controllers/ + * + * This variable can be set to the following values: + * "0" - Controller input does not generate UI events (the default). + * "1" - Controller input generates UI events. + */} +SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS = 'SDL_APPLE_TV_CONTROLLER_UI_EVENTS'; + +{/** + * \brief A variable controlling whether the Apple TV remote's joystick axes + * will automatically match the rotation of the remote. + * + * This variable can be set to the following values: + * "0" - Remote orientation does not affect joystick axes (the default). + * "1" - Joystick axes are based on the orientation of the remote. + */} +SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION = 'SDL_APPLE_TV_REMOTE_ALLOW_ROTATION'; + +{/** + * \brief A variable controlling whether the Android / iOS built-in + * accelerometer should be listed as a joystick device, rather than listing + * actual joysticks only. + * + * This variable can be set to the following values: + * "0" - List only real joysticks and accept input from them + * "1" - List real joysticks along with the accelerometer as if it were a 3 axis joystick (the default). + */} +SDL_HINT_ACCELEROMETER_AS_JOYSTICK = 'SDL_ACCELEROMETER_AS_JOYSTICK'; + +{/** + * \brief Specify the behavior of Alt+Tab while the keyboard is grabbed. + * + * By default, SDL emulates Alt+Tab functionality while the keyboard is grabbed + * and your window is full-screen. This prevents the user from getting stuck in + * your application if you've enabled keyboard grab. + * + * The variable can be set to the following values: + * "0" - SDL will not handle Alt+Tab. Your application is responsible + for handling Alt+Tab while the keyboard is grabbed. + * "1" - SDL will minimize your window when Alt+Tab is pressed (default) +*/} +SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED = 'SDL_ALLOW_ALT_TAB_WHILE_GRABBED'; + +{/** + * \brief A variable controlling the audio category on iOS and Mac OS X + * + * This variable can be set to the following values: + * + * "ambient" - Use the AVAudioSessionCategoryAmbient audio category, will be muted by the phone mute switch (default) + * "playback" - Use the AVAudioSessionCategoryPlayback category + * + * For more information, see Apple's documentation: + * https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategoriesandModes/AudioSessionCategoriesandModes.html + */} +SDL_HINT_AUDIO_CATEGORY = 'SDL_AUDIO_CATEGORY'; + +{/** + * \brief Specify an application name for an audio device. + * + * Some audio backends (such as PulseAudio) allow you to describe your audio + * stream. Among other things, this description might show up in a system + * control panel that lets the user adjust the volume on specific audio + * streams instead of using one giant master volume slider. + * + * This hints lets you transmit that information to the OS. The contents of + * this hint are used while opening an audio device. You should use a string + * that describes your program ("My Game 2: The Revenge") + * + * Setting this to "" or leaving it unset will have SDL use a reasonable + * default: this will be the name set with SDL_HINT_APP_NAME, if that hint is + * set. Otherwise, it'll probably the application's name or "SDL Application" + * if SDL doesn't have any better information. + * + * On targets where this is not supported, this hint does nothing. + *} +SDL_HINT_AUDIO_DEVICE_APP_NAME = 'SDL_AUDIO_DEVICE_APP_NAME'; + +{/** + * \brief Specify an application name for an audio device. + * + * Some audio backends (such as PulseAudio) allow you to describe your audio + * stream. Among other things, this description might show up in a system + * control panel that lets the user adjust the volume on specific audio + * streams instead of using one giant master volume slider. + * + * This hints lets you transmit that information to the OS. The contents of + * this hint are used while opening an audio device. You should use a string + * that describes your what your program is playing ("audio stream" is + * probably sufficient in many cases, but this could be useful for something + * like "team chat" if you have a headset playing VoIP audio separately). + * + * Setting this to "" or leaving it unset will have SDL use a reasonable + * default: "audio stream" or something similar. + * + * On targets where this is not supported, this hint does nothing. + */} +SDL_HINT_AUDIO_DEVICE_STREAM_NAME = 'SDL_AUDIO_DEVICE_STREAM_NAME'; + +{/** + * \brief Specify an application role for an audio device. + * + * Some audio backends (such as Pipewire) allow you to describe the role of + * your audio stream. Among other things, this description might show up in + * a system control panel or software for displaying and manipulating media + * playback/capture graphs. + * + * This hints lets you transmit that information to the OS. The contents of + * this hint are used while opening an audio device. You should use a string + * that describes your what your program is playing (Game, Music, Movie, + * etc...). + * + * Setting this to "" or leaving it unset will have SDL use a reasonable + * default: "Game" or something similar. + * + * On targets where this is not supported, this hint does nothing. + */} +SDL_HINT_AUDIO_DEVICE_STREAM_ROLE = 'SDL_AUDIO_DEVICE_STREAM_ROLE'; + +{/** + * \brief A variable that causes SDL to not ignore audio "monitors" + * + * This is currently only used for PulseAudio and ignored elsewhere. + * + * By default, SDL ignores audio devices that aren't associated with physical + * hardware. Changing this hint to "1" will expose anything SDL sees that + * appears to be an audio source or sink. This will add "devices" to the list + * that the user probably doesn't want or need, but it can be useful in + * scenarios where you want to hook up SDL to some sort of virtual device, + * etc. + * + * The default value is "0". This hint must be set before SDL_Init(). + * + * This hint is available since SDL 2.0.16. Before then, virtual devices are + * always ignored. + */} +SDL_HINT_AUDIO_INCLUDE_MONITORS = 'SDL_AUDIO_INCLUDE_MONITORS'; + +{/** + * \brief A variable controlling speed/quality tradeoff of audio resampling. + * + * If available, SDL can use libsamplerate ( http://www.mega-nerd.com/SRC/ ) + * to handle audio resampling. There are different resampling modes available + * that produce different levels of quality, using more CPU. + * + * If this hint isn't specified to a valid setting, or libsamplerate isn't + * available, SDL will use the default, internal resampling algorithm. + * + * Note that this is currently only applicable to resampling audio that is + * being written to a device for playback or audio being read from a device + * for capture. SDL_AudioCVT always uses the default resampler (although this + * might change for SDL 2.1). + * + * This hint is currently only checked at audio subsystem initialization. + * + * This variable can be set to the following values: + * + * "0" or "default" - Use SDL's internal resampling (Default when not set - low quality, fast) + * "1" or "fast" - Use fast, slightly higher quality resampling, if available + * "2" or "medium" - Use medium quality resampling, if available + * "3" or "best" - Use high quality resampling, if available + */} +SDL_HINT_AUDIO_RESAMPLING_MODE = 'SDL_AUDIO_RESAMPLING_MODE'; + +{** + * \brief A variable controlling whether SDL updates joystick state when getting input events + * + * This variable can be set to the following values: + * + * "0" - You'll call SDL_JoystickUpdate() manually + * "1" - SDL will automatically call SDL_JoystickUpdate() (default) + * + * This hint can be toggled on and off at runtime. + */} +SDL_HINT_AUTO_UPDATE_JOYSTICKS = 'SDL_AUTO_UPDATE_JOYSTICKS'; + +{/** + * \brief A variable controlling whether SDL updates sensor state when getting input events + * + * This variable can be set to the following values: + * + * "0" - You'll call SDL_SensorUpdate() manually + * "1" - SDL will automatically call SDL_SensorUpdate() (default) + * + * This hint can be toggled on and off at runtime. + */} +SDL_HINT_AUTO_UPDATE_SENSORS = 'SDL_AUTO_UPDATE_SENSORS'; + +{/** + * \brief Mark X11 windows as override-redirect. + * + * If set, this _might_ increase framerate at the expense of the desktop + * not working as expected. Override-redirect windows aren't noticed by the + * window manager at all. + * + * You should probably only use this for fullscreen windows, and you probably + * shouldn't even use it for that. But it's here if you want to try! + */} +SDL_HINT_X11_FORCE_OVERRIDE_REDIRECT = 'SDL_X11_FORCE_OVERRIDE_REDIRECT'; + +{** + * \brief A variable that forces X11 windows to create as a custom type. + * + * This is currently only used for X11 and ignored elsewhere. + * + * During SDL_CreateWindow, SDL uses the _NET_WM_WINDOW_TYPE X11 property + * to report to the window manager the type of window it wants to create. + * This might be set to various things if SDL_WINDOW_TOOLTIP or + * SDL_WINDOW_POPUP_MENU, etc, were specified. For "normal" windows that + * haven't set a specific type, this hint can be used to specify a custom + * type. For example, a dock window might set this to + * "_NET_WM_WINDOW_TYPE_DOCK". + * + * If not set or set to "", this hint is ignored. This hint must be set + * before the SDL_CreateWindow() call that it is intended to affect. + * + *} +SDL_HINT_X11_WINDOW_TYPE = 'SDL_X11_WINDOW_TYPE'; + +{/** + * \brief A variable that lets you disable the detection and use of Xinput gamepad devices + * + * The variable can be set to the following values: + * "0" - Disable XInput timer (only uses direct input) + * "1" - Enable XInput timer (the default) + */} +SDL_HINT_XINPUT_ENABLED = 'SDL_XINPUT_ENABLED'; + +{** + * \brief A variable that lets you disable the detection and use of DirectInput gamepad devices + * + * The variable can be set to the following values: + * "0" - Disable DirectInput detection (only uses XInput) + * "1" - Enable DirectInput detection (the default) + *} +SDL_HINT_DIRECTINPUT_ENABLED = 'SDL_DIRECTINPUT_ENABLED'; + +{** + * \brief A variable that causes SDL to use the old axis and button mapping for XInput devices. + * + * This hint is for backwards compatibility only and will be removed in SDL 2.1 + * + * The default value is "0". This hint must be set before SDL_Init() + *} +SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING = 'SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING'; + +{/** + * \brief A variable that lets you manually hint extra gamecontroller db entries + * + * The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h + * + * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) + * You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping() + */} +SDL_HINT_GAMECONTROLLERCONFIG = 'SDL_GAMECONTROLLERCONFIG'; + +{/** + * \brief A variable that lets you provide a file with extra gamecontroller db entries. + * + * The file should contain lines of gamecontroller config data, see SDL_gamecontroller.h + * + * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) + * You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping() + */} +SDL_HINT_GAMECONTROLLERCONFIG_FILE = 'SDL_GAMECONTROLLERCONFIG_FILE'; + +{/** + * \brief A variable that overrides the automatic controller type detection + * + * The variable should be comma separated entries, in the form: VID/PID=type + * + * The VID and PID should be hexadecimal with exactly 4 digits, e.g. 0x00fd + * + * The type should be one of: + * Xbox360 + * XboxOne + * PS3 + * PS4 + * PS5 + * SwitchPro + * + * This hint affects what driver is used, and must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) + */} +SDL_HINT_GAMECONTROLLERTYPE = 'SDL_GAMECONTROLLERTYPE'; + +{/** + * \brief A variable containing a list of devices to skip when scanning for game controllers. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */} +SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES = 'SDL_GAMECONTROLLER_IGNORE_DEVICES'; + +{/** + * \brief If set, all devices will be skipped when scanning for game controllers except for the ones listed in this variable. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */} +SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT = 'SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT'; + +{/** + * \brief If set, game controller face buttons report their values according to their labels instead of their positional layout. + * + * For example, on Nintendo Switch controllers, normally you'd get: + * + * (Y) + * (X) (B) + * (A) + * + * but if this hint is set, you'll get: + * + * (X) + * (Y) (A) + * (B) + * + * The variable can be set to the following values: + * "0" - Report the face buttons by position, as though they were on an Xbox controller. + * "1" - Report the face buttons by label instead of position + * + * The default value is "1". This hint may be set at any time. + */} +SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS = 'SDL_GAMECONTROLLER_USE_BUTTON_LABELS'; + +{/** + * \brief A variable controlling whether the home indicator bar on iPhone X + * should be hidden. + * + * This variable can be set to the following values: + * "0" - The indicator bar is not hidden (default for windowed applications) + * "1" - The indicator bar is hidden and is shown when the screen is touched (useful for movie playback applications) + * "2" - The indicator bar is dim and the first swipe makes it visible and the second swipe performs the "home" action (default for fullscreen applications) + */} +SDL_HINT_IOS_HIDE_HOME_INDICATOR = 'SDL_IOS_HIDE_HOME_INDICATOR'; + +{/** + * \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background. + * + * The variable can be set to the following values: + * "0" - Disable joystick & gamecontroller input events when the + * application is in the background. + * "1" - Enable joystick & gamecontroller input events when the + * application is in the backgroumd. + * + * The default value is "0". This hint may be set at any time. + */} +SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS = 'SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS'; + +{/** + * \brief A comma separated list of devices to open as joysticks + * + * This variable is currently only used by the Linux joystick driver. + *} +SDL_HINT_JOYSTICK_DEVICE = 'SDL_JOYSTICK_DEVICE'; + +{** + * \brief A variable controlling whether "low_frequency_rumble" and "high_frequency_rumble" is used to implement + * the GameCube controller's 3 rumble modes, Stop(0), Rumble(1), and StopHard(2) + * this is useful for applications that need full compatibility for things like ADSR envelopes. + * Stop is implemented by setting "low_frequency_rumble" to "0" and "high_frequency_rumble" ">0" + * Rumble is both at any arbitrary value, + * StopHard is implemented by setting both "low_frequency_rumble" and "high_frequency_rumble" to "0" + * + * This variable can be set to the following values: + * "0" - Normal rumble behavior is behavior is used (default) + * "1" - Proper GameCube controller rumble behavior is used + * + *} +SDL_HINT_JOYSTICK_GAMECUBE_RUMBLE_BRAKE = 'SDL_JOYSTICK_GAMECUBE_RUMBLE_BRAKE'; + +{/** + * \brief A variable controlling whether the HIDAPI joystick drivers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI drivers are not used + * "1" - HIDAPI drivers are used (the default) + * + * This variable is the default for all drivers, but can be overridden by the hints for specific drivers below. + */} +SDL_HINT_JOYSTICK_HIDAPI = 'SDL_JOYSTICK_HIDAPI'; + +{/** + * \brief A variable controlling whether the HIDAPI driver for Nintendo GameCube controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */} +SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE = 'SDL_JOYSTICK_HIDAPI_GAMECUBE'; + +{/** + * \brief A variable controlling whether Switch Joy-Cons should be treated the same as Switch Pro Controllers when using the HIDAPI driver. + * + * This variable can be set to the following values: + * "0" - basic Joy-Con support with no analog input (the default) + * "1" - Joy-Cons treated as half full Pro Controllers with analog inputs and sensors + * + * This does not combine Joy-Cons into a single controller. That's up to the user. + */} +SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS = 'SDL_JOYSTICK_HIDAPI_JOY_CONS'; + +{** + * \brief A variable controlling whether Nintendo Switch Joy-Con controllers will be combined into a single Pro-like controller when using the HIDAPI driver + * + * This variable can be set to the following values: + * "0" - Left and right Joy-Con controllers will not be combined and each will be a mini-gamepad + * "1" - Left and right Joy-Con controllers will be combined into a single controller (the default) + *} +SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS = 'SDL_JOYSTICK_HIDAPI_COMBINE_JOY_CONS'; + +{** + * \brief A variable controlling whether Nintendo Switch Joy-Con controllers will be in vertical mode when using the HIDAPI driver + * + * This variable can be set to the following values: + * "0" - Left and right Joy-Con controllers will not be in vertical mode (the default) + * "1" - Left and right Joy-Con controllers will be in vertical mode + * + * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER). + * + * This hint is available since SDL 2.26.0. + *} +SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS = 'SDL_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS'; + +{/** + * \brief A variable controlling whether the HIDAPI driver for Amazon Luna controllers connected via Bluetooth should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */} +SDL_HINT_JOYSTICK_HIDAPI_LUNA = 'SDL_JOYSTICK_HIDAPI_LUNA'; + +{** + * \brief A variable controlling whether the HIDAPI driver for Nintendo Online classic controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + *} +SDL_HINT_JOYSTICK_HIDAPI_NINTENDO_CLASSIC = 'SDL_JOYSTICK_HIDAPI_NINTENDO_CLASSIC'; + +{** + * \brief A variable controlling whether the HIDAPI driver for NVIDIA SHIELD controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + *} +SDL_HINT_JOYSTICK_HIDAPI_SHIELD = 'SDL_JOYSTICK_HIDAPI_SHIELD'; + +{** + * \brief A variable controlling whether the HIDAPI driver for PS3 controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI on macOS, and "0" on other platforms. + * + * It is not possible to use this driver on Windows, due to limitations in the default drivers + * installed. See https://github.com/ViGEm/DsHidMini for an alternative driver on Windows. + * + * This hint is available since SDL 2.26.0. + *} +SDL_HINT_JOYSTICK_HIDAPI_PS3 = 'SDL_JOYSTICK_HIDAPI_PS3'; + +{/** + * \brief A variable controlling whether the HIDAPI driver for PS4 controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */} +SDL_HINT_JOYSTICK_HIDAPI_PS4 = 'SDL_JOYSTICK_HIDAPI_PS4'; + +{/** + * \brief A variable controlling whether extended input reports should be used for PS4 controllers when using the HIDAPI driver. + * + * This variable can be set to the following values: + * "0" - extended reports are not enabled (the default) + * "1" - extended reports + * + * Extended input reports allow rumble on Bluetooth PS4 controllers, but + * break DirectInput handling for applications that don't use SDL. + * + * Once extended reports are enabled, they can not be disabled without + * power cycling the controller. + * + * For compatibility with applications written for versions of SDL prior + * to the introduction of PS5 controller support, this value will also + * control the state of extended reports on PS5 controllers when the + * SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE hint is not explicitly set. + */} +SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE = 'SDL_JOYSTICK_HIDAPI_PS4_RUMBLE'; + +{/** + * \brief A variable controlling whether the HIDAPI driver for PS5 controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */} +SDL_HINT_JOYSTICK_HIDAPI_PS5 = 'SDL_JOYSTICK_HIDAPI_PS5'; + +{/** + * \brief A variable controlling whether the player LEDs should be lit to indicate which player is associated with a PS5 controller. + * + * This variable can be set to the following values: + * "0" - player LEDs are not enabled + * "1" - player LEDs are enabled (the default) + */} +SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED = 'SDL_JOYSTICK_HIDAPI_PS5_PLAYER_LED'; + +{/** + * \brief A variable controlling whether extended input reports should be used for PS5 controllers when using the HIDAPI driver. + * + * This variable can be set to the following values: + * "0" - extended reports are not enabled (the default) + * "1" - extended reports + * + * Extended input reports allow rumble on Bluetooth PS5 controllers, but + * break DirectInput handling for applications that don't use SDL. + * + * Once extended reports are enabled, they can not be disabled without + * power cycling the controller. + * + * For compatibility with applications written for versions of SDL prior + * to the introduction of PS5 controller support, this value defaults to + * the value of SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE. + */} +SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE = 'SDL_JOYSTICK_HIDAPI_PS5_RUMBLE'; + +{/** + * \brief A variable controlling whether the HIDAPI driver for Google Stadia controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */} +SDL_HINT_JOYSTICK_HIDAPI_STADIA = 'SDL_JOYSTICK_HIDAPI_STADIA'; + +{/** + * \brief A variable controlling whether the HIDAPI driver for Steam Controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used for Steam Controllers, which requires Bluetooth access + * and may prompt the user for permission on iOS and Android. + * + * The default is "0" + */} +SDL_HINT_JOYSTICK_HIDAPI_STEAM = 'SDL_JOYSTICK_HIDAPI_STEAM'; + +{/** + * \brief A variable controlling whether the HIDAPI driver for Nintendo Switch controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */} +SDL_HINT_JOYSTICK_HIDAPI_SWITCH = 'SDL_JOYSTICK_HIDAPI_SWITCH'; + +{/** + * \brief A variable controlling whether the Home button LED should be turned on when a Nintendo Switch controller is opened + * + * This variable can be set to the following values: + * "0" - home button LED is turned off + * "1" - home button LED is turned on + * + * By default the Home button LED state is not changed. + */} +SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED = 'SDL_JOYSTICK_HIDAPI_SWITCH_HOME_LED'; + +{** + * \brief A variable controlling whether the Home button LED should be turned on when a Nintendo Switch Joy-Con controller is opened + * + * This variable can be set to the following values: + * "0" - home button LED is turned off + * "1" - home button LED is turned on + * + * By default the Home button LED state is not changed. This hint can also be set to a floating point value between 0.0 and 1.0 which controls the brightness of the Home button LED. + *} +SDL_HINT_JOYSTICK_HIDAPI_JOYCON_HOME_LED = 'SDL_JOYSTICK_HIDAPI_JOYCON_HOME_LED'; + +{** + * \brief A variable controlling whether the player LEDs should be lit to indicate which player is associated with a Nintendo Switch controller. + * + * This variable can be set to the following values: + * "0" - player LEDs are not enabled + * "1" - player LEDs are enabled (the default) + *} +SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED = 'SDL_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED'; + +{** + * \brief A variable controlling whether the HIDAPI driver for Nintendo Wii and Wii U controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * This driver doesn't work with the dolphinbar, so the default is SDL_FALSE for now. + * + * This hint is available since SDL 2.26.0. + *} +SDL_HINT_JOYSTICK_HIDAPI_WII = 'SDL_JOYSTICK_HIDAPI_WII'; + +{** + * \brief A variable controlling whether the player LEDs should be lit to indicate which player is associated with a Wii controller. + * + * This variable can be set to the following values: + * "0" - player LEDs are not enabled + * "1" - player LEDs are enabled (the default) + * + * This hiny is available since SDL 2.26.0. + *} +SDL_HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED = 'SDL_JOYSTICK_HIDAPI_WII_PLAYER_LED'; + +{/** + * \brief A variable controlling whether the HIDAPI driver for XBox controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is "0" on Windows, otherwise the value of SDL_HINT_JOYSTICK_HIDAPI + */} +SDL_HINT_JOYSTICK_HIDAPI_XBOX = 'SDL_JOYSTICK_HIDAPI_XBOX'; + +{** + * \brief A variable controlling whether the HIDAPI driver for XBox 360 controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI_XBOX. + * + * This hint is available since SDL 2.26.0. + *} +SDL_HINT_JOYSTICK_HIDAPI_XBOX_360 = 'SDL_JOYSTICK_HIDAPI_XBOX_360'; + +{** + * \brief A variable controlling whether the player LEDs should be lit to indicate which player is associated with an Xbox 360 controller. + * + * This variable can be set to the following values: + * "0" - player LEDs are not enabled + * "1" - player LEDs are enabled (the default) + * + * This hint is available since SDL 2.26.0. + *} +SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED = 'SDL_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED'; + +{** + * \brief A variable controlling whether the HIDAPI driver for XBox 360 wireless controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI_XBOX_360. + * + * This hint is available since SDL 2.26.0. + *} +SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS = 'SDL_JOYSTICK_HIDAPI_XBOX_360_WIRELESS'; + +{** + * \brief A variable controlling whether the HIDAPI driver for XBox One controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI_XBOX. + * + * This hint is available since SDL 2.26.0. + *} +SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE = 'SDL_JOYSTICK_HIDAPI_XBOX_ONE'; + +{** + * \brief A variable controlling whether the Home button LED should be turned on when an Xbox One controller is opened + * + * This variable can be set to the following values: + * "0" - home button LED is turned off + * "1" - home button LED is turned on + * + * By default the Home button LED state is not changed. This hint can also + * be set to a floating point value between 0.0 and 1.0 which controls + * the brightness of the Home button LED. The default brightness is 0.4. + * + * This hint is available since SDL 2.26.0. + *} +SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED = 'SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED'; + +{/** + * \brief A variable controlling whether the RAWINPUT joystick drivers should be used for better handling XInput-capable devices. + * + * This variable can be set to the following values: + * "0" - RAWINPUT drivers are not used + * "1" - RAWINPUT drivers are used (the default) + * + */} +SDL_HINT_JOYSTICK_RAWINPUT = 'SDL_JOYSTICK_RAWINPUT'; + +{/** + * \brief A variable controlling whether the RAWINPUT driver should pull correlated data from XInput. + * + * This variable can be set to the following values: + * "0" - RAWINPUT driver will only use data from raw input APIs + * "1" - RAWINPUT driver will also pull data from XInput, providing + * better trigger axes, guide button presses, and rumble support + * for Xbox controllers + * + * The default is "1". This hint applies to any joysticks opened after setting the hint. + */} +SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT = 'SDL_JOYSTICK_RAWINPUT_CORRELATE_XINPUT'; + +{** + * \brief A variable controlling whether the ROG Chakram mice should show up as joysticks + * + * This variable can be set to the following values: + * "0" - ROG Chakram mice do not show up as joysticks (the default) + * "1" - ROG Chakram mice show up as joysticks + *} +SDL_HINT_JOYSTICK_ROG_CHAKRAM = 'SDL_JOYSTICK_ROG_CHAKRAM'; + +{/** + * \brief A variable controlling whether a separate thread should be used + * for handling joystick detection and raw input messages on Windows + * + * This variable can be set to the following values: + * "0" - A separate thread is not used (the default) + * "1" - A separate thread is used for handling raw input messages + * + */} +SDL_HINT_JOYSTICK_THREAD = 'SDL_JOYSTICK_THREAD'; + +{/** + * \brief If set to 0 then never set the top most bit on a SDL Window, even if the video mode expects it. + * This is a debugging aid for developers and not expected to be used by end users. The default is "1" + * + * This variable can be set to the following values: + * "0" - don't allow topmost + * "1" - allow topmost + */} +SDL_HINT_ALLOW_TOPMOST = 'SDL_ALLOW_TOPMOST'; + +{/** + * \brief A variable that controls the timer resolution, in milliseconds. + * + * The higher resolution the timer, the more frequently the CPU services + * timer interrupts, and the more precise delays are, but this takes up + * power and CPU time. This hint is only used on Windows 7 and earlier. + * + * See this blog post for more information: + * http://randomascii.wordpress.com/2013/07/08/windows-timer-resolution-megawatts-wasted/ + * + * If this variable is set to "0", the system timer resolution is not set. + * + * The default value is "1". This hint may be set at any time. + */} +SDL_HINT_TIMER_RESOLUTION = 'SDL_TIMER_RESOLUTION'; + +{/** + * \brief Specifies whether SDL_THREAD_PRIORITY_TIME_CRITICAL should be treated as realtime. + * + * On some platforms, like Linux, a realtime priority thread may be subject to restrictions + * that require special handling by the application. This hint exists to let SDL know that + * the app is prepared to handle said restrictions. + * + * On Linux, SDL will apply the following configuration to any thread that becomes realtime: + * * The SCHED_RESET_ON_FORK bit will be set on the scheduling policy, + * * An RLIMIT_RTTIME budget will be configured to the rtkit specified limit. + * * Exceeding this limit will result in the kernel sending SIGKILL to the app, + * * Refer to the man pages for more information. + * + * This variable can be set to the following values: + * "0" - default platform specific behaviour + * "1" - Force SDL_THREAD_PRIORITY_TIME_CRITICAL to a realtime scheduling policy + */} +SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL = 'SDL_THREAD_FORCE_REALTIME_TIME_CRITICAL'; + +{/** +* \brief A string specifying additional information to use with SDL_SetThreadPriority. +* +* By default SDL_SetThreadPriority will make appropriate system changes in order to +* apply a thread priority. For example on systems using pthreads the scheduler policy +* is changed automatically to a policy that works well with a given priority. +* Code which has specific requirements can override SDL's default behavior with this hint. +* +* pthread hint values are "current", "other", "fifo" and "rr". +* Currently no other platform hint values are defined but may be in the future. +* +* \note On Linux, the kernel may send SIGKILL to realtime tasks which exceed the distro +* configured execution budget for rtkit. This budget can be queried through RLIMIT_RTTIME +* after calling SDL_SetThreadPriority(). +*/} +SDL_HINT_THREAD_PRIORITY_POLICY = 'SDL_THREAD_PRIORITY_POLICY'; + +{/** + * \brief A string specifying SDL's threads stack size in bytes or "0" for the backend's default size + * + * Use this hint in case you need to set SDL's threads stack size to other than the default. + * This is specially useful if you build SDL against a non glibc libc library (such as musl) which + * provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses). + * Support for this hint is currently available only in the pthread, Windows, and PSP backend. + */} +SDL_HINT_THREAD_STACK_SIZE = 'SDL_THREAD_STACK_SIZE'; + +{/** + * \brief A variable controlling whether touch events should generate synthetic mouse events + * + * This variable can be set to the following values: + * "0" - Touch events will not generate mouse events + * "1" - Touch events will generate mouse events + * + * By default SDL will generate mouse events for touch events + */} +SDL_HINT_TOUCH_MOUSE_EVENTS = 'SDL_TOUCH_MOUSE_EVENTS'; + +{** + * \brief A variable controlling which touchpad should generate synthetic mouse events + * + * This variable can be set to the following values: + * "0" - Only front touchpad should generate mouse events. Default + * "1" - Only back touchpad should generate mouse events. + * "2" - Both touchpads should generate mouse events. + * + * By default SDL will generate mouse events for all touch devices + *} +SDL_HINT_VITA_TOUCH_MOUSE_DEVICE = 'SDL_HINT_VITA_TOUCH_MOUSE_DEVICE'; + +{/** + * \brief A variable controlling whether the Android / tvOS remotes + * should be listed as joystick devices, instead of sending keyboard events. + * + * This variable can be set to the following values: + * "0" - Remotes send enter/escape/arrow key events + * "1" - Remotes are available as 2 axis, 2 button joysticks (the default). + */} +SDL_HINT_TV_REMOTE_AS_JOYSTICK = 'SDL_TV_REMOTE_AS_JOYSTICK'; + +{/** + * \brief If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and iOS) + */} +SDL_HINT_VIDEO_HIGHDPI_DISABLED = 'SDL_VIDEO_HIGHDPI_DISABLED'; + +{** + * \brief A variable controlling whether joysticks on Linux will always treat 'hat' axis inputs (ABS_HAT0X - ABS_HAT3Y) as 8-way digital hats without checking whether they may be analog. + * + * This variable can be set to the following values: + * "0" - Only map hat axis inputs to digital hat outputs if the input axes appear to actually be digital (the default) + * "1" - Always handle the input axes numbered ABS_HAT0X to ABS_HAT3Y as digital hats + *} +SDL_HINT_LINUX_DIGITAL_HATS = 'SDL_LINUX_DIGITAL_HATS'; + +{** + * \brief A variable controlling whether digital hats on Linux will apply deadzones to their underlying input axes or use unfiltered values. + * + * This variable can be set to the following values: + * "0" - Return digital hat values based on unfiltered input axis values + * "1" - Return digital hat values with deadzones on the input axes taken into account (the default) + *} +SDL_HINT_LINUX_HAT_DEADZONES = 'SDL_LINUX_HAT_DEADZONES'; + +{/** + * \brief A variable controlling whether to use the classic /dev/input/js* joystick interface or the newer /dev/input/event* joystick interface on Linux + * + * This variable can be set to the following values: + * "0" - Use /dev/input/event* + * "1" - Use /dev/input/js* + * + * By default the /dev/input/event* interfaces are used + */} +SDL_HINT_LINUX_JOYSTICK_CLASSIC = 'SDL_LINUX_JOYSTICK_CLASSIC'; + +{/** + * \brief A variable controlling whether joysticks on Linux adhere to their HID-defined deadzones or return unfiltered values. + * + * This variable can be set to the following values: + * "0" - Return unfiltered joystick axis values (the default) + * "1" - Return axis values with deadzones taken into account + */} +SDL_HINT_LINUX_JOYSTICK_DEADZONES = 'SDL_LINUX_JOYSTICK_DEADZONES'; + +{/** + * \brief A variable that determines whether ctrl+click should generate a right-click event on Mac + * + * If present, holding ctrl while left clicking will generate a right click + * event when on Mac. + */} +SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK = 'SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK'; + +{** + * \brief A variable controlling whether dispatching OpenGL context updates should block the dispatching thread until the main thread finishes processing + * + * This variable can be set to the following values: + * "0" - Dispatching OpenGL context updates will block the dispatching thread until the main thread finishes processing (default). + * "1" - Dispatching OpenGL context updates will allow the dispatching thread to continue execution. + * + * Generally you want the default, but if you have OpenGL code in a background thread on a Mac, and the main thread + * hangs because it's waiting for that background thread, but that background thread is also hanging because it's + * waiting for the main thread to do an update, this might fix your issue. + * + * This hint only applies to macOS. + * + * This hint is available since SDL 2.24.0. + *} +SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH = 'SDL_MAC_OPENGL_ASYNC_DISPATCH'; + +{/** + * \brief A variable specifying which shader compiler to preload when using the Chrome ANGLE binaries + * + * SDL has EGL and OpenGL ES2 support on Windows via the ANGLE project. It + * can use two different sets of binaries, those compiled by the user from source + * or those provided by the Chrome browser. In the later case, these binaries require + * that SDL loads a DLL providing the shader compiler. + * + * This variable can be set to the following values: + * "d3dcompiler_46.dll" - default, best for Vista or later. + * "d3dcompiler_43.dll" - for XP support. + * "none" - do not load any library, useful if you compiled ANGLE from source and included the compiler in your binaries. + * + */} +SDL_HINT_VIDEO_WIN_D3DCOMPILER = 'SDL_VIDEO_WIN_D3DCOMPILER'; + +{/** + * \brief A variable that is the address of another SDL_Window* (as a hex string formatted with "%p"). + * + * If this hint is set before SDL_CreateWindowFrom() and the SDL_Window* it is set to has + * SDL_WINDOW_OPENGL set (and running on WGL only, currently), then two things will occur on the newly + * created SDL_Window: + * + * 1. Its pixel format will be set to the same pixel format as this SDL_Window. This is + * needed for example when sharing an OpenGL context across multiple windows. + * + * 2. The flag SDL_WINDOW_OPENGL will be set on the new window so it can be used for + * OpenGL rendering. + * + * This variable can be set to the following values: + * The address (as a string "%p") of the SDL_Window* that new windows created with SDL_CreateWindowFrom() should + * share a pixel format with. + */} +SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT = 'SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT'; + +{** + * \brief When calling SDL_CreateWindowFrom(), make the window compatible with OpenGL. + * + * This variable can be set to the following values: + * "0" - Don't add any graphics flags to the SDL_WindowFlags + * "1" - Add SDL_WINDOW_OPENGL to the SDL_WindowFlags + * + * By default SDL will not make the foreign window compatible with OpenGL. + *} +SDL_HINT_VIDEO_FOREIGN_WINDOW_OPENGL = 'SDL_VIDEO_FOREIGN_WINDOW_OPENGL'; + +{** + * \brief When calling SDL_CreateWindowFrom(), make the window compatible with Vulkan. + * + * This variable can be set to the following values: + * "0" - Don't add any graphics flags to the SDL_WindowFlags + * "1" - Add SDL_WINDOW_VULKAN to the SDL_WindowFlags + * + * By default SDL will not make the foreign window compatible with Vulkan. + *} +SDL_HINT_VIDEO_FOREIGN_WINDOW_VULKAN = 'SDL_VIDEO_FOREIGN_WINDOW_VULKAN'; + +{/** + * \brief A URL to a WinRT app's privacy policy + * + * All network-enabled WinRT apps must make a privacy policy available to its + * users. On Windows 8, 8.1, and RT, Microsoft mandates that this policy be + * be available in the Windows Settings charm, as accessed from within the app. + * SDL provides code to add a URL-based link there, which can point to the app's + * privacy policy. + * + * To setup a URL to an app's privacy policy, set SDL_HINT_WINRT_PRIVACY_POLICY_URL + * before calling any SDL_Init() functions. The contents of the hint should + * be a valid URL. For example, "http://www.example.com". + * + * The default value is "", which will prevent SDL from adding a privacy policy + * link to the Settings charm. This hint should only be set during app init. + * + * The label text of an app's "Privacy Policy" link may be customized via another + * hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL. + * + * Please note that on Windows Phone, Microsoft does not provide standard UI + * for displaying a privacy policy link, and as such, SDL_HINT_WINRT_PRIVACY_POLICY_URL + * will not get used on that platform. Network-enabled phone apps should display + * their privacy policy through some other, in-app means. + */} +SDL_HINT_WINRT_PRIVACY_POLICY_URL = 'SDL_WINRT_PRIVACY_POLICY_URL'; + +{/** + * \brief Label text for a WinRT app's privacy policy link + * + * Network-enabled WinRT apps must include a privacy policy. On Windows 8, 8.1, and RT, + * Microsoft mandates that this policy be available via the Windows Settings charm. + * SDL provides code to add a link there, with its label text being set via the + * optional hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL. + * + * Please note that a privacy policy's contents are not set via this hint. A separate + * hint, SDL_HINT_WINRT_PRIVACY_POLICY_URL, is used to link to the actual text of the + * policy. + * + * The contents of this hint should be encoded as a UTF8 string. + * + * The default value is "Privacy Policy". This hint should only be set during app + * initialization, preferably before any calls to SDL_Init(). + * + * For additional information on linking to a privacy policy, see the documentation for + * SDL_HINT_WINRT_PRIVACY_POLICY_URL. + */} +SDL_HINT_WINRT_PRIVACY_POLICY_LABEL = 'SDL_WINRT_PRIVACY_POLICY_LABEL'; + +{/** + * \brief Allows back-button-press events on Windows Phone to be marked as handled + * + * Windows Phone devices typically feature a Back button. When pressed, + * the OS will emit back-button-press events, which apps are expected to + * handle in an appropriate manner. If apps do not explicitly mark these + * events as 'Handled', then the OS will invoke its default behavior for + * unhandled back-button-press events, which on Windows Phone 8 and 8.1 is to + * terminate the app (and attempt to switch to the previous app, or to the + * device's home screen). + * + * Setting the SDL_HINT_WINRT_HANDLE_BACK_BUTTON hint to "1" will cause SDL + * to mark back-button-press events as Handled, if and when one is sent to + * the app. + * + * Internally, Windows Phone sends back button events as parameters to + * special back-button-press callback functions. Apps that need to respond + * to back-button-press events are expected to register one or more + * callback functions for such, shortly after being launched (during the + * app's initialization phase). After the back button is pressed, the OS + * will invoke these callbacks. If the app's callback(s) do not explicitly + * mark the event as handled by the time they return, or if the app never + * registers one of these callback, the OS will consider the event + * un-handled, and it will apply its default back button behavior (terminate + * the app). + * + * SDL registers its own back-button-press callback with the Windows Phone + * OS. This callback will emit a pair of SDL key-press events (SDL_KEYDOWN + * and SDL_KEYUP), each with a scancode of SDL_SCANCODE_AC_BACK, after which + * it will check the contents of the hint, SDL_HINT_WINRT_HANDLE_BACK_BUTTON. + * If the hint's value is set to "1", the back button event's Handled + * property will get set to 'true'. If the hint's value is set to something + * else, or if it is unset, SDL will leave the event's Handled property + * alone. (By default, the OS sets this property to 'false', to note.) + * + * SDL apps can either set SDL_HINT_WINRT_HANDLE_BACK_BUTTON well before a + * back button is pressed, or can set it in direct-response to a back button + * being pressed. + * + * In order to get notified when a back button is pressed, SDL apps should + * register a callback function with SDL_AddEventWatch(), and have it listen + * for SDL_KEYDOWN events that have a scancode of SDL_SCANCODE_AC_BACK. + * (Alternatively, SDL_KEYUP events can be listened-for. Listening for + * either event type is suitable.) Any value of SDL_HINT_WINRT_HANDLE_BACK_BUTTON + * set by such a callback, will be applied to the OS' current + * back-button-press event. + * + * More details on back button behavior in Windows Phone apps can be found + * at the following page, on Microsoft's developer site: + * http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx + */} +SDL_HINT_WINRT_HANDLE_BACK_BUTTON = 'SDL_WINRT_HANDLE_BACK_BUTTON'; + +{/** + * \brief A variable that dictates policy for fullscreen Spaces on Mac OS X. + * + * This hint only applies to Mac OS X. + * + * The variable can be set to the following values: + * "0" - Disable Spaces support (FULLSCREEN_DESKTOP won't use them and + * SDL_WINDOW_RESIZABLE windows won't offer the "fullscreen" + * button on their titlebars). + * "1" - Enable Spaces support (FULLSCREEN_DESKTOP will use them and + * SDL_WINDOW_RESIZABLE windows will offer the "fullscreen" + * button on their titlebars). + * + * The default value is "1". Spaces are disabled regardless of this hint if + * the OS isn't at least Mac OS X Lion (10.7). This hint must be set before + * any windows are created. + */} +SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES = 'SDL_VIDEO_MAC_FULLSCREEN_SPACES'; + +{/** + * \brief When set don't force the SDL app to become a foreground process + * + * This hint only applies to Mac OS X. + * + */} +SDL_HINT_MAC_BACKGROUND_APP = 'SDL_MAC_BACKGROUND_APP'; + +{/** + * \brief Android APK expansion main file version. Should be a string number like "1", "2" etc. + * + * Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION. + * + * If both hints were set then SDL_RWFromFile() will look into expansion files + * after a given relative path was not found in the internal storage and assets. + * + * By default this hint is not set and the APK expansion files are not searched. + */} +SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION = 'SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION'; + +{/** + * \brief Android APK expansion patch file version. Should be a string number like "1", "2" etc. + * + * Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION. + * + * If both hints were set then SDL_RWFromFile() will look into expansion files + * after a given relative path was not found in the internal storage and assets. + * + * By default this hint is not set and the APK expansion files are not searched. + */} +SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION = 'SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION'; + +{/** + * \brief A variable to control whether the event loop will block itself when the app is paused. + * + * The variable can be set to the following values: + * "0" - Non blocking. + * "1" - Blocking. (default) + * + * The value should be set before SDL is initialized. + */} +SDL_HINT_ANDROID_BLOCK_ON_PAUSE = 'SDL_ANDROID_BLOCK_ON_PAUSE'; + +{/** + * \brief A variable to control whether SDL will pause audio in background + * (Requires SDL_ANDROID_BLOCK_ON_PAUSE as "Non blocking") + * + * The variable can be set to the following values: + * "0" - Non paused. + * "1" - Paused. (default) + * + * The value should be set before SDL is initialized. + */} +SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO = 'SDL_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO'; + +{/** + * \brief A variable to control whether we trap the Android back button to handle it manually. + * This is necessary for the right mouse button to work on some Android devices, or + * to be able to trap the back button for use in your code reliably. If set to true, + * the back button will show up as an SDL_KEYDOWN / SDL_KEYUP pair with a keycode of + * SDL_SCANCODE_AC_BACK. + * + * The variable can be set to the following values: + * "0" - Back button will be handled as usual for system. (default) + * "1" - Back button will be trapped, allowing you to handle the key press + * manually. (This will also let right mouse click work on systems + * where the right mouse button functions as back.) + * + * The value of this hint is used at runtime, so it can be changed at any time. + */} +SDL_HINT_ANDROID_TRAP_BACK_BUTTON = 'SDL_ANDROID_TRAP_BACK_BUTTON'; + +{/** + * \brief A variable to control whether certain IMEs should handle text editing internally instead of sending SDL_TEXTEDITING events. + * + * The variable can be set to the following values: + * "0" - SDL_TEXTEDITING events are sent, and it is the application's + * responsibility to render the text from these events and + * differentiate it somehow from committed text. (default) + * "1" - If supported by the IME then SDL_TEXTEDITING events are not sent, + * and text that is being composed will be rendered in its own UI. + */} +SDL_HINT_IME_INTERNAL_EDITING = 'SDL_IME_INTERNAL_EDITING'; + +{/** + * \brief A variable to control whether certain IMEs should show native UI components (such as the Candidate List) instead of suppressing them. + * + * The variable can be set to the following values: + * "0" - Native UI components are not display. (default) + * "1" - Native UI components are displayed. + */} +SDL_HINT_IME_SHOW_UI = 'SDL_IME_SHOW_UI'; + +{** + * \brief A variable to control if extended IME text support is enabled. + * If enabled then SDL_TextEditingExtEvent will be issued if the text would be truncated otherwise. + * Additionally SDL_TextInputEvent will be dispatched multiple times so that it is not truncated. + * + * The variable can be set to the following values: + * "0" - Legacy behavior. Text can be truncated, no heap allocations. (default) + * "1" - Modern behavior. + *} +SDL_HINT_IME_SUPPORT_EXTENDED_TEXT = 'SDL_IME_SUPPORT_EXTENDED_TEXT'; + +{/** + * \brief A variable to control whether mouse and touch events are to be treated together or separately + * + * The variable can be set to the following values: + * "0" - Mouse events will be handled as touch events, and touch will raise fake mouse + * events. This is the behaviour of SDL <= 2.0.3. (default) + * "1" - Mouse events will be handled separately from pure touch events. + * + * NOTE: This hint is no longer supported on SDL >= 2.0.10. + * Use SDL_HINT_MOUSE_TOUCH_EVENTS and SDL_HINT_TOUCH_MOUSE_EVENTS + * for generating synthetic touch/mouse events. + */} +SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH = 'SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH' + deprecated 'This hint is no longer supported on SDL >= 2.0.10. Use SDL_HINT_MOUSE_TOUCH_EVENTS and SDL_HINT_TOUCH_MOUSE_EVENTS instead.'; + +{/** + * \brief Disable giving back control to the browser automatically + * when running with asyncify + * + * With -s ASYNCIFY, SDL2 calls emscripten_sleep during operations + * such as refreshing the screen or polling events. + * + * This hint only applies to the emscripten platform + * + * The variable can be set to the following values: + * "0" - Disable emscripten_sleep calls (if you give back browser control manually or use asyncify for other purposes) + * "1" - Enable emscripten_sleep calls (the default) + */} +SDL_HINT_EMSCRIPTEN_ASYNCIFY = 'SDL_EMSCRIPTEN_ASYNCIFY'; + +{/** + * \brief override the binding element for keyboard inputs for Emscripten builds + * + * This hint only applies to the emscripten platform + * + * The variable can be one of + * "#window" - The javascript window object (this is the default) + * "#document" - The javascript document object + * "#screen" - the javascript window.screen object + * "#canvas" - the WebGL canvas element + * any other string without a leading # sign applies to the element on the page with that ID. + */} +SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT = 'SDL_EMSCRIPTEN_KEYBOARD_ELEMENT'; + +{/** + * \brief Tell SDL not to catch the SIGINT or SIGTERM signals. + * + * This hint only applies to Unix-like platforms. + * + * The variable can be set to the following values: + * "0" - SDL will install a SIGINT and SIGTERM handler, and when it + * catches a signal, convert it into an SDL_QUIT event. + * "1" - SDL will not install a signal handler at all. + */} +SDL_HINT_NO_SIGNAL_HANDLERS = 'SDL_NO_SIGNAL_HANDLERS'; + +{** + * \brief A variable that decides whether to send SDL_QUIT when closing the final window. + * + * By default, SDL sends an SDL_QUIT event when there is only one window + * and it receives an SDL_WINDOWEVENT_CLOSE event, under the assumption most + * apps would also take the loss of this window as a signal to terminate the + * program. + * + * However, it's not unreasonable in some cases to have the program continue + * to live on, perhaps to create new windows later. + * + * Changing this hint to "0" will cause SDL to not send an SDL_QUIT event + * when the final window is requesting to close. Note that in this case, + * there are still other legitimate reasons one might get an SDL_QUIT + * event: choosing "Quit" from the macOS menu bar, sending a SIGINT (ctrl-c) + * on Unix, etc. + * + * The default value is "1". This hint can be changed at any time. + * + * This hint is available since SDL 2.0.22. Before then, you always get + * an SDL_QUIT event when closing the final window. + *} +SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE = 'SDL_QUIT_ON_LAST_WINDOW_CLOSE'; + +{/** + * \brief Tell SDL not to generate window-close events for Alt+F4 on Windows. + * + * The variable can be set to the following values: + * "0" - SDL will generate a window-close event when it sees Alt+F4. + * "1" - SDL will only do normal key handling for Alt+F4. + */} +SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 = 'SDL_WINDOWS_NO_CLOSE_ON_ALT_F4'; + +{/** + * \brief Prevent SDL from using version 4 of the bitmap header when saving BMPs. + * + * The bitmap header version 4 is required for proper alpha channel support and + * SDL will use it when required. Should this not be desired, this hint can + * force the use of the 40 byte header version which is supported everywhere. + * + * The variable can be set to the following values: + * "0" - Surfaces with a colorkey or an alpha channel are saved to a + * 32-bit BMP file with an alpha mask. SDL will use the bitmap + * header version 4 and set the alpha mask accordingly. + * "1" - Surfaces with a colorkey or an alpha channel are saved to a + * 32-bit BMP file without an alpha mask. The alpha channel data + * will be in the file, but applications are going to ignore it. + * + * The default value is "0". + */} +SDL_HINT_BMP_SAVE_LEGACY_FORMAT = 'SDL_BMP_SAVE_LEGACY_FORMAT'; + +{/** + * \brief Tell SDL not to name threads on Windows. + * + * The variable can be set to the following values: + * "0" - SDL will raise the 0x406D1388 Exception to name threads. + * This is the default behavior of SDL <= 2.0.4. (default) + * "1" - SDL will not raise this exception, and threads will be unnamed. + * For .NET languages this is required when running under a debugger. + */} +SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING = 'SDL_WINDOWS_DISABLE_THREAD_NAMING'; + +{/** + * \brief A variable to control whether the return key on the soft keyboard + * should hide the soft keyboard on Android and iOS. + * + * The variable can be set to the following values: + * "0" - The return key will be handled as a key event. This is the behaviour of SDL <= 2.0.3. (default) + * "1" - The return key will hide the keyboard. + * + * The value of this hint is used at runtime, so it can be changed at any time. + */} +SDL_HINT_RETURN_KEY_HIDES_IME = 'SDL_RETURN_KEY_HIDES_IME'; + +{/** + * \brief Tell SDL which Dispmanx layer to use on a Raspberry PI + * + * Also known as Z-order. The variable can take a negative or positive value. + * The default is 10000. + */} +SDL_HINT_RPI_VIDEO_LAYER = 'SDL_RPI_VIDEO_LAYER'; + +{** + * \brief A variable that decides what audio backend to use. + * + * By default, SDL will try all available audio backends in a reasonable + * order until it finds one that can work, but this hint allows the app + * or user to force a specific target, such as "alsa" if, say, you are + * on PulseAudio but want to try talking to the lower level instead. + * + * This functionality has existed since SDL 2.0.0 (indeed, before that) + * but before 2.0.22 this was an environment variable only. In 2.0.22, + * it was upgraded to a full SDL hint, so you can set the environment + * variable as usual or programatically set the hint with SDL_SetHint, + * which won't propagate to child processes. + * + * The default value is unset, in which case SDL will try to figure out + * the best audio backend on your behalf. This hint needs to be set + * before SDL_Init() is called to be useful. + * + * This hint is available since SDL 2.0.22. Before then, you could set + * the environment variable to get the same effect. + *} +SDL_HINT_AUDIODRIVER = 'SDL_AUDIODRIVER'; + +{** + * \brief A variable that decides what video backend to use. + * + * By default, SDL will try all available video backends in a reasonable + * order until it finds one that can work, but this hint allows the app + * or user to force a specific target, such as "x11" if, say, you are + * on Wayland but want to try talking to the X server instead. + * + * This functionality has existed since SDL 2.0.0 (indeed, before that) + * but before 2.0.22 this was an environment variable only. In 2.0.22, + * it was upgraded to a full SDL hint, so you can set the environment + * variable as usual or programatically set the hint with SDL_SetHint, + * which won't propagate to child processes. + * + * The default value is unset, in which case SDL will try to figure out + * the best video backend on your behalf. This hint needs to be set + * before SDL_Init() is called to be useful. + * + * This hint is available since SDL 2.0.22. Before then, you could set + * the environment variable to get the same effect. + *} +SDL_HINT_VIDEODRIVER = 'SDL_VIDEODRIVER'; + +{** + * \brief A variable that decides what KMSDRM device to use. + * + * Internally, SDL might open something like "/dev/dri/cardNN" to + * access KMSDRM functionality, where "NN" is a device index number. + * + * SDL makes a guess at the best index to use (usually zero), but the + * app or user can set this hint to a number between 0 and 99 to + * force selection. + * + * This hint is available since SDL 2.24.0. + *} +SDL_HINT_KMSDRM_DEVICE_INDEX = 'SDL_KMSDRM_DEVICE_INDEX'; + +{** + * \brief A variable that treats trackpads as touch devices. + * + * On macOS (and possibly other platforms in the future), SDL will report + * touches on a trackpad as mouse input, which is generally what users + * expect from this device; however, these are often actually full + * multitouch-capable touch devices, so it might be preferable to some apps + * to treat them as such. + * + * Setting this hint to true will make the trackpad input report as a + * multitouch device instead of a mouse. The default is false. + * + * Note that most platforms don't support this hint. As of 2.24.0, it + * only supports MacBooks' trackpads on macOS. Others may follow later. + * + * This hint is checked during SDL_Init and can not be changed after. + * + * This hint is available since SDL 2.24.0. + *} +SDL_HINT_TRACKPAD_IS_TOUCH_ONLY = 'SDL_TRACKPAD_IS_TOUCH_ONLY'; + +{/** + * \brief An enumeration of hint priorities + */} +type + PPSDL_HintPriority = ^PSDL_HintPriority; + PSDL_HintPriority = ^TSDL_HintPriority; + TSDL_HintPriority = type Integer; + +const + SDL_HINT_DEFAULT = TSDL_HintPriority(0); + SDL_HINT_NORMAL = TSDL_HintPriority(1); + SDL_HINT_OVERRIDE = TSDL_HintPriority(2); + +{/** + * \brief Set a hint with a specific priority + * + * The priority controls the behavior when setting a hint that already + * has a value. Hints will replace existing hints of their priority and + * lower. Environment variables are considered to have override priority. + * + * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise + */} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetHintWithPriority_fun = function(const name: PAnsiChar; const value: PAnsiChar; priority: TSDL_HintPriority): TSDL_Bool; cdecl; +Var + SDL_SetHintWithPriority : TSDL_SetHintWithPriority_fun = Nil; +{$else} + +function SDL_SetHintWithPriority(const name: PAnsiChar; const value: PAnsiChar; priority: TSDL_HintPriority): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetHintWithPriority' {$ENDIF} {$ENDIF}; +{$endif} + +{/** + * \brief Set a hint with normal priority + * + * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise + */} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetHint_fun = function(const name: PAnsiChar; const value: PAnsiChar): TSDL_Bool; cdecl; +Var + SDL_SetHint : TSDL_SetHint_fun = Nil; +{$else} + +function SDL_SetHint(const name: PAnsiChar; const value: PAnsiChar): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetHint' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Reset a hint to the default value. + * + * This will reset a hint to the value of the environment variable, + * or NIL if the environment isn't set. Callbacks will be called normally + * with this change. + * + * \param name the hint to set + * \returns SDL_TRUE if the hint was set, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.24.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ResetHint_fun = function(const name: PAnsiChar): TSDL_Bool; cdecl; +Var + SDL_ResetHint : TSDL_ResetHint_fun = Nil; +{$else} + +function SDL_ResetHint(const name: PAnsiChar): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ResetHint' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Reset all hints to the default values. + * + * This will reset all hints to the value of the associated environment + * variable, or NIL if the environment isn't set. Callbacks will be called + * normally with this change. + * + * \since This function is available since SDL 2.26.0. + * + * \sa SDL_GetHint + * \sa SDL_SetHint + * \sa SDL_ResetHint + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ResetHints_proc = procedure(); cdecl; +Var + SDL_ResetHints : TSDL_ResetHints_proc = Nil; +{$else} + +procedure SDL_ResetHints(); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ResetHints' {$ENDIF} {$ENDIF}; +{$endif} + +{/** + * \brief Get a hint + * + * \return The string value of a hint variable. + */} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetHint_fun = function(const name: PAnsiChar): PAnsiChar; cdecl; +Var + SDL_GetHint : TSDL_GetHint_fun = Nil; +{$else} + +function SDL_GetHint(const name: PAnsiChar): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetHint' {$ENDIF} {$ENDIF}; +{$endif} + +{/** + * \brief Get a hint + * + * \return The boolean value of a hint variable. + */} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetHintBoolean_fun = function(const name: PAnsiChar; default_value: TSDL_Bool): TSDL_Bool; cdecl; +Var + SDL_GetHintBoolean : TSDL_GetHintBoolean_fun = Nil; +{$else} + +function SDL_GetHintBoolean(const name: PAnsiChar; default_value: TSDL_Bool): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetHintBoolean' {$ENDIF} {$ENDIF}; +{$endif} + +{/** + * \brief Add a function to watch a particular hint + * + * \param name The hint to watch + * \param callback The function to call when the hint value changes + * \param userdata A pointer to pass to the callback function + */} +type + PPSDL_HintCallback = ^PSDL_HintCallback; + PSDL_HintCallback = ^TSDL_HintCallback; + TSDL_HintCallback = procedure(userdata: Pointer; const name: PAnsiChar; const oldValue: PAnsiChar; const newValue: PAnsiChar); cdecl; + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AddHintCallback_proc = procedure(const name: PAnsiChar; callback: TSDL_HintCallback; userdata: Pointer); cdecl; +Var + SDL_AddHintCallback : TSDL_AddHintCallback_proc = Nil; +{$else} + +procedure SDL_AddHintCallback(const name: PAnsiChar; callback: TSDL_HintCallback; userdata: Pointer); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AddHintCallback' {$ENDIF} {$ENDIF}; +{$endif} + +{/** + * \brief Remove a function watching a particular hint + * + * \param name The hint being watched + * \param callback The function being called when the hint value changes + * \param userdata A pointer being passed to the callback function + */} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_DelHintCallback_proc = procedure(const name: PAnsiChar; callback: TSDL_HintCallback; userdata: Pointer); cdecl; +Var + SDL_DelHintCallback : TSDL_DelHintCallback_proc = Nil; +{$else} + +procedure SDL_DelHintCallback(const name: PAnsiChar; callback: TSDL_HintCallback; userdata: Pointer); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DelHintCallback' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Clear all hints. + * + * This function is automatically called during SDL_Quit(), and deletes all + * callbacks without calling them and frees all memory associated with hints. + * If you're calling this from application code you probably want to call + * SDL_ResetHints() instead. + * + * This function will be removed from the API the next time we rev the ABI. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_ResetHints + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ClearHints_proc = procedure(); cdecl; +Var + SDL_ClearHints : TSDL_ClearHints_proc = Nil; +{$else} + +procedure SDL_ClearHints(); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ClearHints' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdljoystick.inc b/units/sdljoystick.inc index c507b078..94cea724 100644 --- a/units/sdljoystick.inc +++ b/units/sdljoystick.inc @@ -1,1076 +1,1541 @@ -{** - * \file SDL_joystick.h - * - * Include file for SDL joystick event handling - * - * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks(), with the exact joystick - * behind a device_index changing as joysticks are plugged and unplugged. - * - * The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted - * then it will get a new instance_id, instance_id's are monotonically increasing identifiers of a joystick plugged in. - * - * The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of - * the device (a X360 wired controller for example). This identifier is platform dependent. - * - * - *} - - {** - * \file SDL_joystick.h - * - * In order to use these functions, SDL_Init() must have been called - * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system - * for joysticks, and load appropriate drivers. - * - * If you would like to receive joystick updates while the application - * is in the background, you should set the following hint before calling - * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS - *} - -type - {* The joystick structure used to identify an SDL joystick *} - PPSDL_Joystick = ^PSDL_Joystick; - PSDL_Joystick = type Pointer; - - {* A structure that encodes the stable unique id for a joystick device *} - PPSDL_JoystickGUID = ^PSDL_JoystickGUID; - PSDL_JoystickGUID = ^TSDL_JoystickGUID; - TSDL_JoystickGUID = type TSDL_GUID; - - {** - * This is a unique ID for a joystick for the time it is connected to the system, - * and is never reused for the lifetime of the application. If the joystick is - * disconnected and reconnected, it will get a new ID. - * - * The ID value starts at 0 and increments from there. The value -1 is an invalid ID. - *} - PPSDL_JoystickID = ^PSDL_JoystickID; - PSDL_JoystickID = ^TSDL_JoystickID; - TSDL_JoystickID = type cint32; - -type - PPSDL_JoystickType = ^PSDL_JoystickType; - PSDL_JoystickType = ^TSDL_JoystickType; - TSDL_JoystickType = type Integer; - -const - SDL_JOYSTICK_TYPE_UNKNOWN = TSDL_JoystickType(0); - SDL_JOYSTICK_TYPE_GAMECONTROLLER = TSDL_JoystickType(1); - SDL_JOYSTICK_TYPE_WHEEL = TSDL_JoystickType(2); - SDL_JOYSTICK_TYPE_ARCADE_STICK = TSDL_JoystickType(3); - SDL_JOYSTICK_TYPE_FLIGHT_STICK = TSDL_JoystickType(4); - SDL_JOYSTICK_TYPE_DANCE_PAD = TSDL_JoystickType(5); - SDL_JOYSTICK_TYPE_GUITAR = TSDL_JoystickType(6); - SDL_JOYSTICK_TYPE_DRUM_KIT = TSDL_JoystickType(7); - SDL_JOYSTICK_TYPE_ARCADE_PAD = TSDL_JoystickType(8); - SDL_JOYSTICK_TYPE_THROTTLE = TSDL_JoystickType(9); - -type - PPSDL_JoystickPowerLevel = ^PSDL_JoystickPowerLevel; - PSDL_JoystickPowerLevel = ^TSDL_JoystickPowerLevel; - TSDL_JoystickPowerLevel = type Integer; - -const - SDL_JOYSTICK_POWER_UNKNOWN = TSDL_JoystickPowerLevel(-1); - SDL_JOYSTICK_POWER_EMPTY = TSDL_JoystickPowerLevel(0); {* <= 5% *} - SDL_JOYSTICK_POWER_LOW = TSDL_JoystickPowerLevel(1); {* <= 20% *} - SDL_JOYSTICK_POWER_MEDIUM = TSDL_JoystickPowerLevel(2); {* <= 70% *} - SDL_JOYSTICK_POWER_FULL = TSDL_JoystickPowerLevel(3); {* <= 100% *} - SDL_JOYSTICK_POWER_WIRED = TSDL_JoystickPowerLevel(4); - SDL_JOYSTICK_POWER_MAX = TSDL_JoystickPowerLevel(5); - - {* Set max recognized G-force from accelerometer - See src/joystick/uikit/SDL_sysjoystick.m for notes on why this is needed - *} -const - SDL_IPHONE_MAX_GFORCE = 5.0; - -{* Function prototypes *} - -{** - * Locking for multi-threaded access to the joystick API - * - * If you are using the joystick API or handling events from multiple threads - * you should use these locking functions to protect access to the joysticks. - * - * In particular, you are guaranteed that the joystick list won't change, so - * the API functions that take a joystick index will be valid, and joystick - * and game controller events will not be delivered. - * - * As of SDL 2.26.0, you can take the joystick lock around reinitializing the - * joystick subsystem, to prevent other threads from seeing joysticks in an - * uninitialized state. However, all open joysticks will be closed and SDL - * functions called with them will fail. - * - * \since This function is available since SDL 2.0.7. - *} -procedure SDL_LockJoysticks(); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockJoysticks' {$ENDIF} {$ENDIF}; - -{** - * Unlocking for multi-threaded access to the joystick API - * - * If you are using the joystick API or handling events from multiple threads - * you should use these locking functions to protect access to the joysticks. - * - * In particular, you are guaranteed that the joystick list won't change, so - * the API functions that take a joystick index will be valid, and joystick - * and game controller events will not be delivered. - * - * \since This function is available since SDL 2.0.7. - *} -procedure SDL_UnlockJoysticks(); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnlockJoysticks' {$ENDIF} {$ENDIF}; - -{** - * Count the number of joysticks attached to the system. - * - * \returns the number of attached joysticks on success or a negative error - * code on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickName - * \sa SDL_JoystickPath - * \sa SDL_JoystickOpen - *} -function SDL_NumJoysticks(): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_NumJoysticks' {$ENDIF} {$ENDIF}; - -{** - * Get the implementation dependent name of a joystick. - * - * This can be called before any joysticks are opened. - * - * \param device_index the index of the joystick to query (the N'th joystick - * on the system) - * \returns the name of the selected joystick. If no name can be found, this - * function returns NULL; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickName - * \sa SDL_JoystickOpen - *} -function SDL_JoystickNameForIndex(device_index: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickNameForIndex' {$ENDIF} {$ENDIF}; - -{** - * Get the implementation dependent path of a joystick. - * - * This can be called before any joysticks are opened. - * - * \param device_index the index of the joystick to query (the N'th joystick - * on the system) - * \returns the path of the selected joystick. If no path can be found, this - * function returns NULL; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_JoystickPath - * \sa SDL_JoystickOpen - *} -function SDL_JoystickPathForIndex(device_index: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickPathForIndex' {$ENDIF} {$ENDIF}; - -{** - * Get the player index of a joystick, or -1 if it's not available This can be - * called before any joysticks are opened. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_JoystickGetDevicePlayerIndex(device_index: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDevicePlayerIndex' {$ENDIF} {$ENDIF}; - -{** - * Return the GUID for the joystick at this index - * This can be called before any joysticks are opened. - *} -function SDL_JoystickGetDeviceGUID(device_index: cint): TSDL_JoystickGUID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceGUID' {$ENDIF} {$ENDIF}; - -{** - * Get the USB vendor ID of a joystick, if available. - * - * This can be called before any joysticks are opened. If the vendor ID isn't - * available this function returns 0. - * - * \param device_index the index of the joystick to query (the N'th joystick - * on the system - * \returns the USB vendor ID of the selected joystick. If called on an - * invalid index, this function returns zero - * - * \since This function is available since SDL 2.0.6. - *} -function SDL_JoystickGetDeviceVendor(device_index: cint): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceVendor' {$ENDIF} {$ENDIF}; - -{** - * Get the USB product ID of a joystick, if available. - * - * This can be called before any joysticks are opened. If the product ID isn't - * available this function returns 0. - * - * \param device_index the index of the joystick to query (the N'th joystick - * on the system - * \returns the USB product ID of the selected joystick. If called on an - * invalid index, this function returns zero - * - * \since This function is available since SDL 2.0.6. - *} -function SDL_JoystickGetDeviceProduct(device_index: cint): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceProduct' {$ENDIF} {$ENDIF}; - -{** - * Get the product version of a joystick, if available. - * - * This can be called before any joysticks are opened. If the product version - * isn't available this function returns 0. - * - * \param device_index the index of the joystick to query (the N'th joystick - * on the system - * \returns the product version of the selected joystick. If called on an - * invalid index, this function returns zero - * - * \since This function is available since SDL 2.0.6. - *} -function SDL_JoystickGetDeviceProductVersion(device_index: cint): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceProductVersion' {$ENDIF} {$ENDIF}; - -{** - * Get the type of a joystick, if available. - * - * This can be called before any joysticks are opened. - * - * \param device_index the index of the joystick to query (the N'th joystick - * on the system - * \returns the SDL_JoystickType of the selected joystick. If called on an - * invalid index, this function returns `SDL_JOYSTICK_TYPE_UNKNOWN` - * - * \since This function is available since SDL 2.0.6. - *} -function SDL_JoystickGetDeviceType(device_index: cint): TSDL_JoystickType; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceType' {$ENDIF} {$ENDIF}; - -{** - * Get the instance ID of a joystick. - * - * This can be called before any joysticks are opened. If the index is out of - * range, this function will return -1. - * - * \param device_index the index of the joystick to query (the N'th joystick - * on the system - * \returns the instance id of the selected joystick. If called on an invalid - * index, this function returns zero - * - * \since This function is available since SDL 2.0.6. - *} -function SDL_JoystickGetDeviceInstanceID(device_index: cint): TSDL_JoystickID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceInstanceID' {$ENDIF} {$ENDIF}; - -{** - * Open a joystick for use. - * - * The `device_index` argument refers to the N'th joystick presently - * recognized by SDL on the system. It is **NOT** the same as the instance ID - * used to identify the joystick in future events. See - * SDL_JoystickInstanceID() for more details about instance IDs. - * - * The joystick subsystem must be initialized before a joystick can be opened - * for use. - * - * \param device_index the index of the joystick to query - * \returns a joystick identifier or NULL if an error occurred; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickClose - * \sa SDL_JoystickInstanceID - *} -function SDL_JoystickOpen(device_index: cint): PSDL_Joystick; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickOpen' {$ENDIF} {$ENDIF}; - -{** - * Get the SDL_Joystick associated with an instance id. - * - * \param instance_id the instance id to get the SDL_Joystick for - * \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError() - * for more information. - * - * \since This function is available since SDL 2.0.4. - *} -function SDL_JoystickFromInstanceID(instance_id: TSDL_JoystickID): PSDL_Joystick; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickFromInstanceID' {$ENDIF} {$ENDIF}; - -{** - * Get the SDL_Joystick associated with a player index. - * - * \param player_index the player index to get the SDL_Joystick for - * \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError() - * for more information. - * - * \since This function is available since SDL 2.0.12. - *} -function SDL_JoystickFromPlayerIndex(player_index: cint): PSDL_Joystick; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickFromPlayerIndex' {$ENDIF} {$ENDIF}; - -{** - * Attach a new virtual joystick. - * - * \returns the joystick's device index, or -1 if an error occurred. - * - * \since This function is available since SDL 2.0.14. - *} -function SDL_JoystickAttachVirtual(type_: TSDL_JoystickType; naxes: cint; nbuttons: cint; nhats: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickAttachVirtual' {$ENDIF} {$ENDIF}; - -type - {** - * The structure that defines an extended virtual joystick description - * - * The caller must zero the structure and then initialize the version with `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` before passing it to SDL_JoystickAttachVirtualEx() - * All other elements of this structure are optional and can be left 0. - * - * \sa SDL_JoystickAttachVirtualEx - *} - TUpdateProc = procedure(userdata: Pointer); cdecl; - TSetPlayerIndexProc = procedure(userdata: Pointer; player_index: cint); cdecl; - TRumbleFunc = function(userdata: Pointer; low_frequency_rumble: cuint16; high_frequency_rumble: cuint16): cint; cdecl; - TRumbleTriggersFunc = function(userdata: Pointer; left_rumble: cuint16; right_rumble: cuint16): cint; cdecl; - TSetLEDFunc = function(userdata: Pointer; red: cuint8; green: cuint8; blue: cuint8): cint; cdecl; - TSendEffectFunc = function(userdata: Pointer; const data: Pointer; size: cint): cint; cdecl; - - PPSDL_VirtualJoystickDesc = ^PSDL_VirtualJoystickDesc; - PSDL_VirtualJoystickDesc = ^TSDL_VirtualJoystickDesc; - TSDL_VirtualJoystickDesc = record - version: cuint16; {**< `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` *} - type_: cuint16; {**< `SDL_JoystickType` } - naxes: cuint16; {**< the number of axes on this joystick *} - nbuttons: cuint16; {**< the number of buttons on this joystick *} - nhats: cuint16; {**< the number of hats on this joystick *} - vendor_id: cuint16; {**< the USB vendor ID of this joystick *} - product_id: cuint16; {**< the USB product ID of this joystick *} - padding: cuint16; {**< unused *} - button_mask: cuint16; {**< A mask of which buttons are valid for this controller - e.g. (1 << SDL_CONTROLLER_BUTTON_A) *} - axis_mask: cuint32; {**< A mask of which axes are valid for this controller - e.g. (1 << SDL_CONTROLLER_AXIS_LEFTX) *} - name: PAnsiChar; {**< the name of the joystick *} - - userdata: Pointer; {**< User data pointer passed to callbacks *} - Update: TUpdateProc; {**< Called when the joystick state should be updated *} - SetPlayerIndex: TSetPlayerIndexProc; {**< Called when the player index is set *} - Rumble: TRumbleFunc; {**< Implements SDL_JoystickRumble() *} - RumbleTriggers: TRumbleTriggersFunc; {**< Implements SDL_JoystickRumbleTriggers() *} - SetLED: TSetLEDFunc; {**< Implements SDL_JoystickSetLED() *} - SendEffect: TSendEffectFunc; {**< Implements SDL_JoystickSendEffect() *} - end; - -{** - * \brief The current version of the SDL_VirtualJoystickDesc structure - *} -const - SDL_VIRTUAL_JOYSTICK_DESC_VERSION = 1; - -{/** - * Attach a new virtual joystick with extended properties. - * - * \returns the joystick's device index, or -1 if an error occurred. - * - * \since This function is available since SDL 2.24.0. - */} -function SDL_JoystickAttachVirtualEx(const desc: PSDL_VirtualJoystickDesc): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickAttachVirtualEx' {$ENDIF} {$ENDIF}; - -{** - * Detach a virtual joystick. - * - * \param device_index a value previously returned from - * SDL_JoystickAttachVirtual() - * \returns 0 on success, or -1 if an error occurred. - * - * \since This function is available since SDL 2.0.14. - *} -function SDL_JoystickDetachVirtual(device_index: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickDetachVirtual' {$ENDIF} {$ENDIF}; - -{** - * Query whether or not the joystick at a given device index is virtual. - * - * \param device_index a joystick device index. - * \returns SDL_TRUE if the joystick is virtual, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.14. - *} -function SDL_JoystickIsVirtual(device_index: cint): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickIsVirtual' {$ENDIF} {$ENDIF}; - -{** - * Set values on an opened, virtual-joystick's axis. - * - * Please note that values set here will not be applied until the next call to - * SDL_JoystickUpdate, which can either be called directly, or can be called - * indirectly through various other SDL APIs, including, but not limited to - * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, - * SDL_WaitEvent. - * - * Note that when sending trigger axes, you should scale the value to the full - * range of Sint16. For example, a trigger at rest would have the value of - * `SDL_JOYSTICK_AXIS_MIN`. - * - * \param joystick the virtual joystick on which to set state. - * \param axis the specific axis on the virtual joystick to set. - * \param value the new value for the specified axis. - * \returns 0 on success, -1 on error. - * - * \since This function is available since SDL 2.0.14. - *} -function SDL_JoystickSetVirtualAxis(joystick: PSDL_Joystick; axis: cint; value: cint16): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSetVirtualAxis' {$ENDIF} {$ENDIF}; - -{** - * Set values on an opened, virtual-joystick's button. - * - * Please note that values set here will not be applied until the next call to - * SDL_JoystickUpdate, which can either be called directly, or can be called - * indirectly through various other SDL APIs, including, but not limited to - * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, - * SDL_WaitEvent. - * - * \param joystick the virtual joystick on which to set state. - * \param button the specific button on the virtual joystick to set. - * \param value the new value for the specified button. - * \returns 0 on success, -1 on error. - * - * \since This function is available since SDL 2.0.14. - *} -function SDL_JoystickSetVirtualButton(joystick: PSDL_Joystick; button: cint; value: cuint8): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSetVirtualButton' {$ENDIF} {$ENDIF}; - -{** - * Set values on an opened, virtual-joystick's hat. - * - * Please note that values set here will not be applied until the next call to - * SDL_JoystickUpdate, which can either be called directly, or can be called - * indirectly through various other SDL APIs, including, but not limited to - * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, - * SDL_WaitEvent. - * - * \param joystick the virtual joystick on which to set state. - * \param hat the specific hat on the virtual joystick to set. - * \param value the new value for the specified hat. - * \returns 0 on success, -1 on error. - * - * \since This function is available since SDL 2.0.14. - *} -function SDL_JoystickSetVirtualHat(joystick: PSDL_Joystick; hat: cint; value: cuint8): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSetVirtualHat' {$ENDIF} {$ENDIF}; - -{** - * Get the implementation dependent name of a joystick. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \returns the name of the selected joystick. If no name can be found, this - * function returns NULL; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickNameForIndex - * \sa SDL_JoystickOpen - *} -function SDL_JoystickName(joystick: PSDL_Joystick): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickName' {$ENDIF} {$ENDIF}; - -{** - * Get the implementation dependent path of a joystick. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \returns the path of the selected joystick. If no path can be found, this - * function returns NULL; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_JoystickPathForIndex - *} -function SDL_JoystickPath(joystick: PSDL_Joystick): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickPath' {$ENDIF} {$ENDIF}; - -{** - * Get the player index of an opened joystick. - * - * For XInput controllers this returns the XInput user index. Many joysticks - * will not be able to supply this information. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \returns the player index, or -1 if it's not available. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_JoystickGetPlayerIndex(joystick: PSDL_Joystick): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetPlayerIndex' {$ENDIF} {$ENDIF}; - -{** - * Set the player index of an opened joystick. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \param player_index Player index to assign to this joystick, or -1 to clear - * the player index and turn off player LEDs. - * - * \since This function is available since SDL 2.0.12. - *} -procedure SDL_JoystickSetPlayerIndex(joystick: PSDL_Joystick; player_index: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSetPlayerIndex' {$ENDIF} {$ENDIF}; - -{** - * Get the implementation-dependent GUID for the joystick. - * - * This function requires an open joystick. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \returns the GUID of the given joystick. If called on an invalid index, - * this function returns a zero GUID; call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickGetDeviceGUID - * \sa SDL_JoystickGetGUIDString - *} -function SDL_JoystickGetGUID(joystick: PSDL_Joystick): TSDL_JoystickGUID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetGUID' {$ENDIF} {$ENDIF}; - -{** - * Get the USB vendor ID of an opened joystick, if available. - * - * If the vendor ID isn't available this function returns 0. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \returns the USB vendor ID of the selected joystick, or 0 if unavailable. - * - * \since This function is available since SDL 2.0.6. - *} -function SDL_JoystickGetVendor(joystick: PSDL_Joystick): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetVendor' {$ENDIF} {$ENDIF}; - -{** - * Get the USB product ID of an opened joystick, if available. - * - * If the product ID isn't available this function returns 0. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \returns the USB product ID of the selected joystick, or 0 if unavailable. - * - * \since This function is available since SDL 2.0.6. - *} -function SDL_JoystickGetProduct(joystick: PSDL_Joystick): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetProduct' {$ENDIF} {$ENDIF}; - -{** - * Get the product version of an opened joystick, if available. - * - * If the product version isn't available this function returns 0. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \returns the product version of the selected joystick, or 0 if unavailable. - * - * \since This function is available since SDL 2.0.6. - *} -function SDL_JoystickGetProductVersion(joystick: PSDL_Joystick): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetProductVersion' {$ENDIF} {$ENDIF}; - -{** - * Get the firmware version of an opened joystick, if available. - * - * If the firmware version isn't available this function returns 0. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \returns the firmware version of the selected joystick, or 0 if - * unavailable. - * - * \since This function is available since SDL 2.24.0. - *} -function SDL_JoystickGetFirmwareVersion(joystick: PSDL_Joystick): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetFirmwareVersion' {$ENDIF} {$ENDIF}; - -{** - * Get the serial number of an opened joystick, if available. - * - * Returns the serial number of the joystick, or NULL if it is not available. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \returns the serial number of the selected joystick, or NULL if - * unavailable. - * - * \since This function is available since SDL 2.0.14. - *} -function SDL_JoystickGetSerial(joystick: PSDL_Joystick): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetSerial' {$ENDIF} {$ENDIF}; - -{** - * Get the type of an opened joystick. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \returns the SDL_JoystickType of the selected joystick. - * - * \since This function is available since SDL 2.0.6. - *} -function SDL_JoystickGetType(joystick: PSDL_Joystick): TSDL_JoystickType; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetType' {$ENDIF} {$ENDIF}; - -{** - * Get an ASCII string representation for a given SDL_JoystickGUID. - * - * You should supply at least 33 bytes for pszGUID. - * - * \param guid the SDL_JoystickGUID you wish to convert to string - * \param pszGUID buffer in which to write the ASCII string - * \param cbGUID the size of pszGUID - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickGetDeviceGUID - * \sa SDL_JoystickGetGUID - * \sa SDL_JoystickGetGUIDFromString - *} -procedure SDL_JoystickGetGUIDString(guid: TSDL_JoystickGUID; pszGUID: PAnsiChar; cbGUID: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetGUIDString' {$ENDIF} {$ENDIF}; - -{** - * Convert a GUID string into a SDL_JoystickGUID structure. - * - * Performs no error checking. If this function is given a string containing - * an invalid GUID, the function will silently succeed, but the GUID generated - * will not be useful. - * - * \param pchGUID string containing an ASCII representation of a GUID - * \returns a SDL_JoystickGUID structure. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickGetGUIDString - *} -function SDL_JoystickGetGUIDFromString(const pchGUID: PAnsiChar): TSDL_JoystickGUID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetGUIDFromString' {$ENDIF} {$ENDIF}; - -{** - * Get the device information encoded in a SDL_JoystickGUID structure - * - * \param guid the SDL_JoystickGUID you wish to get info about - * \param vendor A pointer filled in with the device VID, or 0 if not - * available - * \param product A pointer filled in with the device PID, or 0 if not - * available - * \param version A pointer filled in with the device version, or 0 if not - * available - * \param crc16 A pointer filled in with a CRC used to distinguish different - * products with the same VID/PID, or 0 if not available - * - * \since This function is available since SDL 2.26.0. - * - * \sa SDL_JoystickGetDeviceGUID - *} -procedure SDL_GetJoystickGUIDInfo(guid: TSDL_JoystickGUID; vendor: pcuint16; product: pcuint16; version: pcuint16; crc16: pcuint16); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetJoystickGUIDInfo' {$ENDIF} {$ENDIF}; - -{** - * Get the status of a specified joystick. - * - * \param joystick the joystick to query - * \returns SDL_TRUE if the joystick has been opened, SDL_FALSE if it has not; - * call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickClose - * \sa SDL_JoystickOpen - *} -function SDL_JoystickGetAttached(joystick: PSDL_Joystick): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetAttached' {$ENDIF} {$ENDIF}; - -{** - * Get the instance ID of an opened joystick. - * - * \param joystick an SDL_Joystick structure containing joystick information - * \returns the instance ID of the specified joystick on success or a negative - * error code on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickOpen - *} -function SDL_JoystickInstanceID(joystick: PSDL_Joystick): TSDL_JoystickID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickInstanceID' {$ENDIF} {$ENDIF}; - -{** - * Get the number of general axis controls on a joystick. - * - * Often, the directional pad on a game controller will either look like 4 - * separate buttons or a POV hat, and not axes, but all of this is up to the - * device and platform. - * - * \param joystick an SDL_Joystick structure containing joystick information - * \returns the number of axis controls/number of axes on success or a - * negative error code on failure; call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickGetAxis - * \sa SDL_JoystickOpen - *} -function SDL_JoystickNumAxes(joystick: PSDL_Joystick): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickNumAxes' {$ENDIF} {$ENDIF}; - -{** - * Get the number of trackballs on a joystick. - * - * Joystick trackballs have only relative motion events associated with them - * and their state cannot be polled. - * - * Most joysticks do not have trackballs. - * - * \param joystick an SDL_Joystick structure containing joystick information - * \returns the number of trackballs on success or a negative error code on - * failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickGetBall - *} -function SDL_JoystickNumBalls(joystick: PSDL_Joystick): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickNumBalls' {$ENDIF} {$ENDIF}; - -{** - * Get the number of POV hats on a joystick. - * - * \param joystick an SDL_Joystick structure containing joystick information - * \returns the number of POV hats on success or a negative error code on - * failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickGetHat - * \sa SDL_JoystickOpen - *} -function SDL_JoystickNumHats(joystick: PSDL_Joystick): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickNumHats' {$ENDIF} {$ENDIF}; - -{** - * Get the number of buttons on a joystick. - * - * \param joystick an SDL_Joystick structure containing joystick information - * \returns the number of buttons on success or a negative error code on - * failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickGetButton - * \sa SDL_JoystickOpen - *} -function SDL_JoystickNumButtons(joystick: PSDL_Joystick): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickNumButtons' {$ENDIF} {$ENDIF}; - -{** - * Update the current state of the open joysticks. - * - * This is called automatically by the event loop if any joystick events are - * enabled. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickEventState - *} -procedure SDL_JoystickUpdate(); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickUpdate' {$ENDIF} {$ENDIF}; - -{** - * Enable/disable joystick event polling. - * - * If joystick events are disabled, you must call SDL_JoystickUpdate() - * yourself and manually check the state of the joystick when you want - * joystick information. - * - * It is recommended that you leave joystick event handling enabled. - * - * **WARNING**: Calling this function may delete all events currently in SDL's - * event queue. - * - * \param state can be one of `SDL_QUERY`, `SDL_IGNORE`, or `SDL_ENABLE` - * \returns 1 if enabled, 0 if disabled, or a negative error code on failure; - * call SDL_GetError() for more information. - * - * If `state` is `SDL_QUERY` then the current state is returned, - * otherwise the new processing state is returned. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GameControllerEventState - *} -function SDL_JoystickEventState(state: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickEventState' {$ENDIF} {$ENDIF}; - -const - SDL_JOYSTICK_AXIS_MAX = 32767; - SDL_JOYSTICK_AXIS_MIN = -32768; - -{** - * Get the current state of an axis control on a joystick. - * - * SDL makes no promises about what part of the joystick any given axis refers - * to. Your game should have some sort of configuration UI to let users - * specify what each axis should be bound to. Alternately, SDL's higher-level - * Game Controller API makes a great effort to apply order to this lower-level - * interface, so you know that a specific axis is the "left thumb stick," etc. - * - * The value returned by SDL_JoystickGetAxis() is a signed integer (-32768 to - * 32767) representing the current position of the axis. It may be necessary - * to impose certain tolerances on these values to account for jitter. - * - * \param joystick an SDL_Joystick structure containing joystick information - * \param axis the axis to query; the axis indices start at index 0 - * \returns a 16-bit signed integer representing the current position of the - * axis or 0 on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickNumAxes - *} -function SDL_JoystickGetAxis(joystick: PSDL_Joystick; axis: cint): cint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetAxis' {$ENDIF} {$ENDIF}; - -{** - * Get the initial state of an axis control on a joystick. - * - * The state is a value ranging from -32768 to 32767. - * - * The axis indices start at index 0. - * - * \param joystick an SDL_Joystick structure containing joystick information - * \param axis the axis to query; the axis indices start at index 0 - * \param state Upon return, the initial value is supplied here. - * \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not. - * - * \since This function is available since SDL 2.0.6. - *} -function SDL_JoystickGetAxisInitialState(joystick: PSDL_Joystick; axis: cint; state: pcint16): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetAxisInitialState' {$ENDIF} {$ENDIF}; - -{** - * Hat positions - *} -const - SDL_HAT_CENTERED = $00; - SDL_HAT_UP = $01; - SDL_HAT_RIGHT = $02; - SDL_HAT_DOWN = $04; - SDL_HAT_LEFT = $08; - SDL_HAT_RIGHTUP = SDL_HAT_RIGHT or SDL_HAT_UP; - SDL_HAT_RIGHTDOWN = SDL_HAT_RIGHT or SDL_HAT_DOWN; - SDL_HAT_LEFTUP = SDL_HAT_LEFT or SDL_HAT_UP; - SDL_HAT_LEFTDOWN = SDL_HAT_LEFT or SDL_HAT_DOWN; - -{** - * Get the current state of a POV hat on a joystick. - * - * The returned value will be one of the following positions: - * - * - `SDL_HAT_CENTERED` - * - `SDL_HAT_UP` - * - `SDL_HAT_RIGHT` - * - `SDL_HAT_DOWN` - * - `SDL_HAT_LEFT` - * - `SDL_HAT_RIGHTUP` - * - `SDL_HAT_RIGHTDOWN` - * - `SDL_HAT_LEFTUP` - * - `SDL_HAT_LEFTDOWN` - * - * \param joystick an SDL_Joystick structure containing joystick information - * \param hat the hat index to get the state from; indices start at index 0 - * \returns the current hat position. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickNumHats - *} -function SDL_JoystickGetHat(joystick: PSDL_Joystick; hat: cint): cuint8; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetHat' {$ENDIF} {$ENDIF}; - -{** - * Get the ball axis change since the last poll. - * - * Trackballs can only return relative motion since the last call to - * SDL_JoystickGetBall(), these motion deltas are placed into `dx` and `dy`. - * - * Most joysticks do not have trackballs. - * - * \param joystick the SDL_Joystick to query - * \param ball the ball index to query; ball indices start at index 0 - * \param dx stores the difference in the x axis position since the last poll - * \param dy stores the difference in the y axis position since the last poll - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickNumBalls - *} -function SDL_JoystickGetBall(joystick: PSDL_Joystick; ball: cint; dx: pcint; dy: pcint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetBall' {$ENDIF} {$ENDIF}; - -{** - * Get the current state of a button on a joystick. - * - * \param joystick an SDL_Joystick structure containing joystick information - * \param button the button index to get the state from; indices start at - * index 0 - * \returns 1 if the specified button is pressed, 0 otherwise. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickNumButtons - *} -function SDL_JoystickGetButton(joystick: PSDL_Joystick; button: cint): cuint8; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetButton' {$ENDIF} {$ENDIF}; - -{** - * Start a rumble effect. - * - * Each call to this function cancels any previous rumble effect, and calling - * it with 0 intensity stops any rumbling. - * - * \param joystick The joystick to vibrate - * \param low_frequency_rumble The intensity of the low frequency (left) - * rumble motor, from 0 to 0xFFFF - * \param high_frequency_rumble The intensity of the high frequency (right) - * rumble motor, from 0 to 0xFFFF - * \param duration_ms The duration of the rumble effect, in milliseconds - * \returns 0, or -1 if rumble isn't supported on this joystick - * - * \since This function is available since SDL 2.0.9. - * - * \sa SDL_JoystickHasRumble - *} -function SDL_JoystickRumble(joystick: PSDL_Joystick; low_frequency_rumble: cuint16; high_frequency_rumble: cuint16; duration_ms: cuint32): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickRumble' {$ENDIF} {$ENDIF}; - -{** - * Start a rumble effect in the joystick's triggers - * - * Each call to this function cancels any previous trigger rumble effect, and - * calling it with 0 intensity stops any rumbling. - * - * Note that this is rumbling of the _triggers_ and not the game controller as - * a whole. This is currently only supported on Xbox One controllers. If you - * want the (more common) whole-controller rumble, use SDL_JoystickRumble() - * instead. - * - * \param joystick The joystick to vibrate - * \param left_rumble The intensity of the left trigger rumble motor, from 0 - * to 0xFFFF - * \param right_rumble The intensity of the right trigger rumble motor, from 0 - * to 0xFFFF - * \param duration_ms The duration of the rumble effect, in milliseconds - * \returns 0, or -1 if trigger rumble isn't supported on this joystick - * - * \since This function is available since SDL 2.0.14. - * - * \sa SDL_JoystickHasRumbleTriggers - *} -function SDL_JoystickRumbleTriggers(joystick: PSDL_Joystick; left_rumble: cuint16; right_rumble: cuint16; duration_ms: cuint32): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickRumbleTriggers' {$ENDIF} {$ENDIF}; - -{** - * Query whether a joystick has an LED. - * - * An example of a joystick LED is the light on the back of a PlayStation 4's - * DualShock 4 controller. - * - * \param joystick The joystick to query - * \return SDL_TRUE if the joystick has a modifiable LED, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.14. - *} -function SDL_JoystickHasLED(joystick: PSDL_Joystick): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickHasLED' {$ENDIF} {$ENDIF}; - -{** - * Query whether a joystick has rumble support. - * - * \param joystick The joystick to query - * \return SDL_TRUE if the joystick has rumble, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.18. - * - * \sa SDL_JoystickRumble - *} -function SDL_JoystickHasRumble(joystick: PSDL_Joystick): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickHasRumble' {$ENDIF} {$ENDIF}; - -{** - * Query whether a joystick has rumble support on triggers. - * - * \param joystick The joystick to query - * \return SDL_TRUE if the joystick has trigger rumble, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.18. - * - * \sa SDL_JoystickRumbleTriggers - *} -function SDL_JoystickHasRumbleTriggers(joystick: PSDL_Joystick): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickHasRumbleTriggers' {$ENDIF} {$ENDIF}; - - -{** - * Update a joystick's LED color. - * - * An example of a joystick LED is the light on the back of a PlayStation 4's - * DualShock 4 controller. - * - * \param joystick The joystick to update - * \param red The intensity of the red LED - * \param green The intensity of the green LED - * \param blue The intensity of the blue LED - * \returns 0 on success, -1 if this joystick does not have a modifiable LED - * - * \since This function is available since SDL 2.0.14. - *} -function SDL_JoystickSetLED(joystick: PSDL_Joystick; red: cuint8; green: cuint8; blue: cuint8): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSetLED' {$ENDIF} {$ENDIF}; - -{** - * Send a joystick specific effect packet - * - * \param joystick The joystick to affect - * \param data The data to send to the joystick - * \param size The size of the data to send to the joystick - * \returns 0, or -1 if this joystick or driver doesn't support effect packets - * - * \since This function is available since SDL 2.0.16. - *} -function SDL_JoystickSendEffect(joystick: PSDL_Joystick; const data: Pointer; size: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSendEffect' {$ENDIF} {$ENDIF}; - -{** - * Close a joystick previously opened with SDL_JoystickOpen(). - * - * \param joystick The joystick device to close - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickOpen - *} -procedure SDL_JoystickClose(joystick: PSDL_Joystick); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickClose' {$ENDIF} {$ENDIF}; - -{** - * Get the battery level of a joystick as SDL_JoystickPowerLevel. - * - * \param joystick the SDL_Joystick to query - * \returns the current battery level as SDL_JoystickPowerLevel on success or - * `SDL_JOYSTICK_POWER_UNKNOWN` if it is unknown - * - * \since This function is available since SDL 2.0.4. - *} -function SDL_JoystickCurrentPowerLevel(joystick: PSDL_Joystick): TSDL_JoystickPowerLevel; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickCurrentPowerLevel' {$ENDIF} {$ENDIF}; +{** + * \file SDL_joystick.h + * + * Include file for SDL joystick event handling + * + * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks(), with the exact joystick + * behind a device_index changing as joysticks are plugged and unplugged. + * + * The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted + * then it will get a new instance_id, instance_id's are monotonically increasing identifiers of a joystick plugged in. + * + * The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of + * the device (a X360 wired controller for example). This identifier is platform dependent. + * + * + *} + + {** + * \file SDL_joystick.h + * + * In order to use these functions, SDL_Init() must have been called + * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system + * for joysticks, and load appropriate drivers. + * + * If you would like to receive joystick updates while the application + * is in the background, you should set the following hint before calling + * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS + *} + +type + {* The joystick structure used to identify an SDL joystick *} + PPSDL_Joystick = ^PSDL_Joystick; + PSDL_Joystick = type Pointer; + + {* A structure that encodes the stable unique id for a joystick device *} + PPSDL_JoystickGUID = ^PSDL_JoystickGUID; + PSDL_JoystickGUID = ^TSDL_JoystickGUID; + TSDL_JoystickGUID = type TSDL_GUID; + + {** + * This is a unique ID for a joystick for the time it is connected to the system, + * and is never reused for the lifetime of the application. If the joystick is + * disconnected and reconnected, it will get a new ID. + * + * The ID value starts at 0 and increments from there. The value -1 is an invalid ID. + *} + PPSDL_JoystickID = ^PSDL_JoystickID; + PSDL_JoystickID = ^TSDL_JoystickID; + TSDL_JoystickID = type cint32; + +type + PPSDL_JoystickType = ^PSDL_JoystickType; + PSDL_JoystickType = ^TSDL_JoystickType; + TSDL_JoystickType = type Integer; + +const + SDL_JOYSTICK_TYPE_UNKNOWN = TSDL_JoystickType(0); + SDL_JOYSTICK_TYPE_GAMECONTROLLER = TSDL_JoystickType(1); + SDL_JOYSTICK_TYPE_WHEEL = TSDL_JoystickType(2); + SDL_JOYSTICK_TYPE_ARCADE_STICK = TSDL_JoystickType(3); + SDL_JOYSTICK_TYPE_FLIGHT_STICK = TSDL_JoystickType(4); + SDL_JOYSTICK_TYPE_DANCE_PAD = TSDL_JoystickType(5); + SDL_JOYSTICK_TYPE_GUITAR = TSDL_JoystickType(6); + SDL_JOYSTICK_TYPE_DRUM_KIT = TSDL_JoystickType(7); + SDL_JOYSTICK_TYPE_ARCADE_PAD = TSDL_JoystickType(8); + SDL_JOYSTICK_TYPE_THROTTLE = TSDL_JoystickType(9); + +type + PPSDL_JoystickPowerLevel = ^PSDL_JoystickPowerLevel; + PSDL_JoystickPowerLevel = ^TSDL_JoystickPowerLevel; + TSDL_JoystickPowerLevel = type Integer; + +const + SDL_JOYSTICK_POWER_UNKNOWN = TSDL_JoystickPowerLevel(-1); + SDL_JOYSTICK_POWER_EMPTY = TSDL_JoystickPowerLevel(0); {* <= 5% *} + SDL_JOYSTICK_POWER_LOW = TSDL_JoystickPowerLevel(1); {* <= 20% *} + SDL_JOYSTICK_POWER_MEDIUM = TSDL_JoystickPowerLevel(2); {* <= 70% *} + SDL_JOYSTICK_POWER_FULL = TSDL_JoystickPowerLevel(3); {* <= 100% *} + SDL_JOYSTICK_POWER_WIRED = TSDL_JoystickPowerLevel(4); + SDL_JOYSTICK_POWER_MAX = TSDL_JoystickPowerLevel(5); + + {* Set max recognized G-force from accelerometer + See src/joystick/uikit/SDL_sysjoystick.m for notes on why this is needed + *} +const + SDL_IPHONE_MAX_GFORCE = 5.0; + +{* Function prototypes *} + +{** + * Locking for multi-threaded access to the joystick API + * + * If you are using the joystick API or handling events from multiple threads + * you should use these locking functions to protect access to the joysticks. + * + * In particular, you are guaranteed that the joystick list won't change, so + * the API functions that take a joystick index will be valid, and joystick + * and game controller events will not be delivered. + * + * As of SDL 2.26.0, you can take the joystick lock around reinitializing the + * joystick subsystem, to prevent other threads from seeing joysticks in an + * uninitialized state. However, all open joysticks will be closed and SDL + * functions called with them will fail. + * + * \since This function is available since SDL 2.0.7. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LockJoysticks_proc = procedure(); cdecl; +Var + SDL_LockJoysticks : TSDL_LockJoysticks_proc = Nil; +{$else} + +procedure SDL_LockJoysticks(); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockJoysticks' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Unlocking for multi-threaded access to the joystick API + * + * If you are using the joystick API or handling events from multiple threads + * you should use these locking functions to protect access to the joysticks. + * + * In particular, you are guaranteed that the joystick list won't change, so + * the API functions that take a joystick index will be valid, and joystick + * and game controller events will not be delivered. + * + * \since This function is available since SDL 2.0.7. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UnlockJoysticks_proc = procedure(); cdecl; +Var + SDL_UnlockJoysticks : TSDL_UnlockJoysticks_proc = Nil; +{$else} + +procedure SDL_UnlockJoysticks(); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnlockJoysticks' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Count the number of joysticks attached to the system. + * + * \returns the number of attached joysticks on success or a negative error + * code on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickName + * \sa SDL_JoystickPath + * \sa SDL_JoystickOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_NumJoysticks_fun = function(): cint; cdecl; +Var + SDL_NumJoysticks : TSDL_NumJoysticks_fun = Nil; +{$else} + +function SDL_NumJoysticks(): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_NumJoysticks' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the implementation dependent name of a joystick. + * + * This can be called before any joysticks are opened. + * + * \param device_index the index of the joystick to query (the N'th joystick + * on the system) + * \returns the name of the selected joystick. If no name can be found, this + * function returns NULL; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickName + * \sa SDL_JoystickOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickNameForIndex_fun = function(device_index: cint): PAnsiChar; cdecl; +Var + SDL_JoystickNameForIndex : TSDL_JoystickNameForIndex_fun = Nil; +{$else} + +function SDL_JoystickNameForIndex(device_index: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickNameForIndex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the implementation dependent path of a joystick. + * + * This can be called before any joysticks are opened. + * + * \param device_index the index of the joystick to query (the N'th joystick + * on the system) + * \returns the path of the selected joystick. If no path can be found, this + * function returns NULL; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_JoystickPath + * \sa SDL_JoystickOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickPathForIndex_fun = function(device_index: cint): PAnsiChar; cdecl; +Var + SDL_JoystickPathForIndex : TSDL_JoystickPathForIndex_fun = Nil; +{$else} + +function SDL_JoystickPathForIndex(device_index: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickPathForIndex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the player index of a joystick, or -1 if it's not available This can be + * called before any joysticks are opened. + * + * \since This function is available since SDL 2.0.9. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetDevicePlayerIndex_fun = function(device_index: cint): cint; cdecl; +Var + SDL_JoystickGetDevicePlayerIndex : TSDL_JoystickGetDevicePlayerIndex_fun = Nil; +{$else} + +function SDL_JoystickGetDevicePlayerIndex(device_index: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDevicePlayerIndex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Return the GUID for the joystick at this index + * This can be called before any joysticks are opened. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetDeviceGUID_fun = function(device_index: cint): TSDL_JoystickGUID; cdecl; +Var + SDL_JoystickGetDeviceGUID : TSDL_JoystickGetDeviceGUID_fun = Nil; +{$else} + +function SDL_JoystickGetDeviceGUID(device_index: cint): TSDL_JoystickGUID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceGUID' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the USB vendor ID of a joystick, if available. + * + * This can be called before any joysticks are opened. If the vendor ID isn't + * available this function returns 0. + * + * \param device_index the index of the joystick to query (the N'th joystick + * on the system + * \returns the USB vendor ID of the selected joystick. If called on an + * invalid index, this function returns zero + * + * \since This function is available since SDL 2.0.6. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetDeviceVendor_fun = function(device_index: cint): cuint16; cdecl; +Var + SDL_JoystickGetDeviceVendor : TSDL_JoystickGetDeviceVendor_fun = Nil; +{$else} + +function SDL_JoystickGetDeviceVendor(device_index: cint): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceVendor' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the USB product ID of a joystick, if available. + * + * This can be called before any joysticks are opened. If the product ID isn't + * available this function returns 0. + * + * \param device_index the index of the joystick to query (the N'th joystick + * on the system + * \returns the USB product ID of the selected joystick. If called on an + * invalid index, this function returns zero + * + * \since This function is available since SDL 2.0.6. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetDeviceProduct_fun = function(device_index: cint): cuint16; cdecl; +Var + SDL_JoystickGetDeviceProduct : TSDL_JoystickGetDeviceProduct_fun = Nil; +{$else} + +function SDL_JoystickGetDeviceProduct(device_index: cint): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceProduct' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the product version of a joystick, if available. + * + * This can be called before any joysticks are opened. If the product version + * isn't available this function returns 0. + * + * \param device_index the index of the joystick to query (the N'th joystick + * on the system + * \returns the product version of the selected joystick. If called on an + * invalid index, this function returns zero + * + * \since This function is available since SDL 2.0.6. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetDeviceProductVersion_fun = function(device_index: cint): cuint16; cdecl; +Var + SDL_JoystickGetDeviceProductVersion : TSDL_JoystickGetDeviceProductVersion_fun = Nil; +{$else} + +function SDL_JoystickGetDeviceProductVersion(device_index: cint): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceProductVersion' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the type of a joystick, if available. + * + * This can be called before any joysticks are opened. + * + * \param device_index the index of the joystick to query (the N'th joystick + * on the system + * \returns the SDL_JoystickType of the selected joystick. If called on an + * invalid index, this function returns `SDL_JOYSTICK_TYPE_UNKNOWN` + * + * \since This function is available since SDL 2.0.6. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetDeviceType_fun = function(device_index: cint): TSDL_JoystickType; cdecl; +Var + SDL_JoystickGetDeviceType : TSDL_JoystickGetDeviceType_fun = Nil; +{$else} + +function SDL_JoystickGetDeviceType(device_index: cint): TSDL_JoystickType; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceType' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the instance ID of a joystick. + * + * This can be called before any joysticks are opened. If the index is out of + * range, this function will return -1. + * + * \param device_index the index of the joystick to query (the N'th joystick + * on the system + * \returns the instance id of the selected joystick. If called on an invalid + * index, this function returns zero + * + * \since This function is available since SDL 2.0.6. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetDeviceInstanceID_fun = function(device_index: cint): TSDL_JoystickID; cdecl; +Var + SDL_JoystickGetDeviceInstanceID : TSDL_JoystickGetDeviceInstanceID_fun = Nil; +{$else} + +function SDL_JoystickGetDeviceInstanceID(device_index: cint): TSDL_JoystickID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceInstanceID' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Open a joystick for use. + * + * The `device_index` argument refers to the N'th joystick presently + * recognized by SDL on the system. It is **NOT** the same as the instance ID + * used to identify the joystick in future events. See + * SDL_JoystickInstanceID() for more details about instance IDs. + * + * The joystick subsystem must be initialized before a joystick can be opened + * for use. + * + * \param device_index the index of the joystick to query + * \returns a joystick identifier or NULL if an error occurred; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickClose + * \sa SDL_JoystickInstanceID + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickOpen_fun = function(device_index: cint): PSDL_Joystick; cdecl; + +Var + SDL_JoystickOpen : TSDL_JoystickOpen_fun = Nil; +{$else} + +function SDL_JoystickOpen(device_index: cint): PSDL_Joystick; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickOpen' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the SDL_Joystick associated with an instance id. + * + * \param instance_id the instance id to get the SDL_Joystick for + * \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError() + * for more information. + * + * \since This function is available since SDL 2.0.4. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickFromInstanceID_fun = function(instance_id: TSDL_JoystickID): PSDL_Joystick; cdecl; +Var + SDL_JoystickFromInstanceID : TSDL_JoystickFromInstanceID_fun = Nil; +{$else} + +function SDL_JoystickFromInstanceID(instance_id: TSDL_JoystickID): PSDL_Joystick; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickFromInstanceID' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the SDL_Joystick associated with a player index. + * + * \param player_index the player index to get the SDL_Joystick for + * \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError() + * for more information. + * + * \since This function is available since SDL 2.0.12. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickFromPlayerIndex_fun = function(player_index: cint): PSDL_Joystick; cdecl; +Var + SDL_JoystickFromPlayerIndex : TSDL_JoystickFromPlayerIndex_fun = Nil; +{$else} + +function SDL_JoystickFromPlayerIndex(player_index: cint): PSDL_Joystick; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickFromPlayerIndex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Attach a new virtual joystick. + * + * \returns the joystick's device index, or -1 if an error occurred. + * + * \since This function is available since SDL 2.0.14. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickAttachVirtual_fun = function(type_: TSDL_JoystickType; naxes: cint; nbuttons: cint; nhats: cint): cint; cdecl; +Var + SDL_JoystickAttachVirtual : TSDL_JoystickAttachVirtual_fun = Nil; +{$else} + +function SDL_JoystickAttachVirtual(type_: TSDL_JoystickType; naxes: cint; nbuttons: cint; nhats: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickAttachVirtual' {$ENDIF} {$ENDIF}; +{$endif} + +type + {** + * The structure that defines an extended virtual joystick description + * + * The caller must zero the structure and then initialize the version with `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` before passing it to SDL_JoystickAttachVirtualEx() + * All other elements of this structure are optional and can be left 0. + * + * \sa SDL_JoystickAttachVirtualEx + *} + TUpdateProc = procedure(userdata: Pointer); cdecl; + TSetPlayerIndexProc = procedure(userdata: Pointer; player_index: cint); cdecl; + TRumbleFunc = function(userdata: Pointer; low_frequency_rumble: cuint16; high_frequency_rumble: cuint16): cint; cdecl; + TRumbleTriggersFunc = function(userdata: Pointer; left_rumble: cuint16; right_rumble: cuint16): cint; cdecl; + TSetLEDFunc = function(userdata: Pointer; red: cuint8; green: cuint8; blue: cuint8): cint; cdecl; + TSendEffectFunc = function(userdata: Pointer; const data: Pointer; size: cint): cint; cdecl; + + PPSDL_VirtualJoystickDesc = ^PSDL_VirtualJoystickDesc; + PSDL_VirtualJoystickDesc = ^TSDL_VirtualJoystickDesc; + TSDL_VirtualJoystickDesc = record + version: cuint16; {**< `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` *} + type_: cuint16; {**< `SDL_JoystickType` } + naxes: cuint16; {**< the number of axes on this joystick *} + nbuttons: cuint16; {**< the number of buttons on this joystick *} + nhats: cuint16; {**< the number of hats on this joystick *} + vendor_id: cuint16; {**< the USB vendor ID of this joystick *} + product_id: cuint16; {**< the USB product ID of this joystick *} + padding: cuint16; {**< unused *} + button_mask: cuint16; {**< A mask of which buttons are valid for this controller + e.g. (1 << SDL_CONTROLLER_BUTTON_A) *} + axis_mask: cuint32; {**< A mask of which axes are valid for this controller + e.g. (1 << SDL_CONTROLLER_AXIS_LEFTX) *} + name: PAnsiChar; {**< the name of the joystick *} + + userdata: Pointer; {**< User data pointer passed to callbacks *} + Update: TUpdateProc; {**< Called when the joystick state should be updated *} + SetPlayerIndex: TSetPlayerIndexProc; {**< Called when the player index is set *} + Rumble: TRumbleFunc; {**< Implements SDL_JoystickRumble() *} + RumbleTriggers: TRumbleTriggersFunc; {**< Implements SDL_JoystickRumbleTriggers() *} + SetLED: TSetLEDFunc; {**< Implements SDL_JoystickSetLED() *} + SendEffect: TSendEffectFunc; {**< Implements SDL_JoystickSendEffect() *} + end; + +{** + * \brief The current version of the SDL_VirtualJoystickDesc structure + *} +const + SDL_VIRTUAL_JOYSTICK_DESC_VERSION = 1; + +{/** + * Attach a new virtual joystick with extended properties. + * + * \returns the joystick's device index, or -1 if an error occurred. + * + * \since This function is available since SDL 2.24.0. + */} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickAttachVirtualEx_fun = function(const desc: PSDL_VirtualJoystickDesc): cint; cdecl; +Var + SDL_JoystickAttachVirtualEx : TSDL_JoystickAttachVirtualEx_fun = Nil; +{$else} + +function SDL_JoystickAttachVirtualEx(const desc: PSDL_VirtualJoystickDesc): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickAttachVirtualEx' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Detach a virtual joystick. + * + * \param device_index a value previously returned from + * SDL_JoystickAttachVirtual() + * \returns 0 on success, or -1 if an error occurred. + * + * \since This function is available since SDL 2.0.14. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickDetachVirtual_fun = function(device_index: cint): cint; cdecl; +Var + SDL_JoystickDetachVirtual : TSDL_JoystickDetachVirtual_fun = Nil; +{$else} + +function SDL_JoystickDetachVirtual(device_index: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickDetachVirtual' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Query whether or not the joystick at a given device index is virtual. + * + * \param device_index a joystick device index. + * \returns SDL_TRUE if the joystick is virtual, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.14. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickIsVirtual_fun = function(device_index: cint): TSDL_Bool; cdecl; +Var + SDL_JoystickIsVirtual : TSDL_JoystickIsVirtual_fun = Nil; +{$else} + +function SDL_JoystickIsVirtual(device_index: cint): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickIsVirtual' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Set values on an opened, virtual-joystick's axis. + * + * Please note that values set here will not be applied until the next call to + * SDL_JoystickUpdate, which can either be called directly, or can be called + * indirectly through various other SDL APIs, including, but not limited to + * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, + * SDL_WaitEvent. + * + * Note that when sending trigger axes, you should scale the value to the full + * range of Sint16. For example, a trigger at rest would have the value of + * `SDL_JOYSTICK_AXIS_MIN`. + * + * \param joystick the virtual joystick on which to set state. + * \param axis the specific axis on the virtual joystick to set. + * \param value the new value for the specified axis. + * \returns 0 on success, -1 on error. + * + * \since This function is available since SDL 2.0.14. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickSetVirtualAxis_fun = function(joystick: PSDL_Joystick; axis: cint; value: cint16): cint; cdecl; +Var + SDL_JoystickSetVirtualAxis : TSDL_JoystickSetVirtualAxis_fun = Nil; +{$else} + +function SDL_JoystickSetVirtualAxis(joystick: PSDL_Joystick; axis: cint; value: cint16): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSetVirtualAxis' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Set values on an opened, virtual-joystick's button. + * + * Please note that values set here will not be applied until the next call to + * SDL_JoystickUpdate, which can either be called directly, or can be called + * indirectly through various other SDL APIs, including, but not limited to + * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, + * SDL_WaitEvent. + * + * \param joystick the virtual joystick on which to set state. + * \param button the specific button on the virtual joystick to set. + * \param value the new value for the specified button. + * \returns 0 on success, -1 on error. + * + * \since This function is available since SDL 2.0.14. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickSetVirtualButton_fun = function(joystick: PSDL_Joystick; button: cint; value: cuint8): cint; cdecl; +Var + SDL_JoystickSetVirtualButton : TSDL_JoystickSetVirtualButton_fun = Nil; +{$else} + +function SDL_JoystickSetVirtualButton(joystick: PSDL_Joystick; button: cint; value: cuint8): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSetVirtualButton' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Set values on an opened, virtual-joystick's hat. + * + * Please note that values set here will not be applied until the next call to + * SDL_JoystickUpdate, which can either be called directly, or can be called + * indirectly through various other SDL APIs, including, but not limited to + * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, + * SDL_WaitEvent. + * + * \param joystick the virtual joystick on which to set state. + * \param hat the specific hat on the virtual joystick to set. + * \param value the new value for the specified hat. + * \returns 0 on success, -1 on error. + * + * \since This function is available since SDL 2.0.14. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickSetVirtualHat_fun = function(joystick: PSDL_Joystick; hat: cint; value: cuint8): cint; cdecl; +Var + SDL_JoystickSetVirtualHat : TSDL_JoystickSetVirtualHat_fun = Nil; +{$else} + +function SDL_JoystickSetVirtualHat(joystick: PSDL_Joystick; hat: cint; value: cuint8): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSetVirtualHat' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the implementation dependent name of a joystick. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \returns the name of the selected joystick. If no name can be found, this + * function returns NULL; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickNameForIndex + * \sa SDL_JoystickOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickName_fun = function(joystick: PSDL_Joystick): PAnsiChar; cdecl; +Var + SDL_JoystickName : TSDL_JoystickName_fun = Nil; +{$else} + +function SDL_JoystickName(joystick: PSDL_Joystick): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickName' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the implementation dependent path of a joystick. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \returns the path of the selected joystick. If no path can be found, this + * function returns NULL; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_JoystickPathForIndex + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickPath_fun = function(joystick: PSDL_Joystick): PAnsiChar; cdecl; +Var + SDL_JoystickPath : TSDL_JoystickPath_fun = Nil; +{$else} + +function SDL_JoystickPath(joystick: PSDL_Joystick): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickPath' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the player index of an opened joystick. + * + * For XInput controllers this returns the XInput user index. Many joysticks + * will not be able to supply this information. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \returns the player index, or -1 if it's not available. + * + * \since This function is available since SDL 2.0.9. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetPlayerIndex_fun = function(joystick: PSDL_Joystick): cint; cdecl; +Var + SDL_JoystickGetPlayerIndex : TSDL_JoystickGetPlayerIndex_fun = Nil; +{$else} + +function SDL_JoystickGetPlayerIndex(joystick: PSDL_Joystick): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetPlayerIndex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Set the player index of an opened joystick. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \param player_index Player index to assign to this joystick, or -1 to clear + * the player index and turn off player LEDs. + * + * \since This function is available since SDL 2.0.12. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickSetPlayerIndex_proc = procedure(joystick: PSDL_Joystick; player_index: cint); cdecl; +Var + SDL_JoystickSetPlayerIndex : TSDL_JoystickSetPlayerIndex_proc = Nil; +{$else} + +procedure SDL_JoystickSetPlayerIndex(joystick: PSDL_Joystick; player_index: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSetPlayerIndex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the implementation-dependent GUID for the joystick. + * + * This function requires an open joystick. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \returns the GUID of the given joystick. If called on an invalid index, + * this function returns a zero GUID; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickGetDeviceGUID + * \sa SDL_JoystickGetGUIDString + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetGUID_fun = function(joystick: PSDL_Joystick): TSDL_JoystickGUID; cdecl; +Var + SDL_JoystickGetGUID : TSDL_JoystickGetGUID_fun = Nil; +{$else} + +function SDL_JoystickGetGUID(joystick: PSDL_Joystick): TSDL_JoystickGUID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetGUID' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the USB vendor ID of an opened joystick, if available. + * + * If the vendor ID isn't available this function returns 0. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \returns the USB vendor ID of the selected joystick, or 0 if unavailable. + * + * \since This function is available since SDL 2.0.6. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetVendor_fun = function(joystick: PSDL_Joystick): cuint16; cdecl; +Var + SDL_JoystickGetVendor : TSDL_JoystickGetVendor_fun = Nil; +{$else} + +function SDL_JoystickGetVendor(joystick: PSDL_Joystick): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetVendor' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the USB product ID of an opened joystick, if available. + * + * If the product ID isn't available this function returns 0. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \returns the USB product ID of the selected joystick, or 0 if unavailable. + * + * \since This function is available since SDL 2.0.6. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetProduct_fun = function(joystick: PSDL_Joystick): cuint16; cdecl; +Var + SDL_JoystickGetProduct : TSDL_JoystickGetProduct_fun = Nil; +{$else} + +function SDL_JoystickGetProduct(joystick: PSDL_Joystick): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetProduct' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the product version of an opened joystick, if available. + * + * If the product version isn't available this function returns 0. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \returns the product version of the selected joystick, or 0 if unavailable. + * + * \since This function is available since SDL 2.0.6. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetProductVersion_fun = function(joystick: PSDL_Joystick): cuint16; cdecl; +Var + SDL_JoystickGetProductVersion : TSDL_JoystickGetProductVersion_fun = Nil; +{$else} + +function SDL_JoystickGetProductVersion(joystick: PSDL_Joystick): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetProductVersion' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the firmware version of an opened joystick, if available. + * + * If the firmware version isn't available this function returns 0. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \returns the firmware version of the selected joystick, or 0 if + * unavailable. + * + * \since This function is available since SDL 2.24.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetFirmwareVersion_fun = function(joystick: PSDL_Joystick): cuint16; cdecl; +Var + SDL_JoystickGetFirmwareVersion : TSDL_JoystickGetFirmwareVersion_fun = Nil; +{$else} + +function SDL_JoystickGetFirmwareVersion(joystick: PSDL_Joystick): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetFirmwareVersion' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the serial number of an opened joystick, if available. + * + * Returns the serial number of the joystick, or NULL if it is not available. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \returns the serial number of the selected joystick, or NULL if + * unavailable. + * + * \since This function is available since SDL 2.0.14. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetSerial_fun = function(joystick: PSDL_Joystick): PAnsiChar; cdecl; +Var + SDL_JoystickGetSerial : TSDL_JoystickGetSerial_fun = Nil; +{$else} + +function SDL_JoystickGetSerial(joystick: PSDL_Joystick): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetSerial' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the type of an opened joystick. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \returns the SDL_JoystickType of the selected joystick. + * + * \since This function is available since SDL 2.0.6. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetType_fun = function(joystick: PSDL_Joystick): TSDL_JoystickType; cdecl; +Var + SDL_JoystickGetType : TSDL_JoystickGetType_fun = Nil; +{$else} + +function SDL_JoystickGetType(joystick: PSDL_Joystick): TSDL_JoystickType; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetType' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get an ASCII string representation for a given SDL_JoystickGUID. + * + * You should supply at least 33 bytes for pszGUID. + * + * \param guid the SDL_JoystickGUID you wish to convert to string + * \param pszGUID buffer in which to write the ASCII string + * \param cbGUID the size of pszGUID + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickGetDeviceGUID + * \sa SDL_JoystickGetGUID + * \sa SDL_JoystickGetGUIDFromString + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetGUIDString_proc = procedure(guid: TSDL_JoystickGUID; pszGUID: PAnsiChar; cbGUID: cint); cdecl; +Var + SDL_JoystickGetGUIDString : TSDL_JoystickGetGUIDString_proc = Nil; +{$else} + +procedure SDL_JoystickGetGUIDString(guid: TSDL_JoystickGUID; pszGUID: PAnsiChar; cbGUID: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetGUIDString' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Convert a GUID string into a SDL_JoystickGUID structure. + * + * Performs no error checking. If this function is given a string containing + * an invalid GUID, the function will silently succeed, but the GUID generated + * will not be useful. + * + * \param pchGUID string containing an ASCII representation of a GUID + * \returns a SDL_JoystickGUID structure. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickGetGUIDString + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetGUIDFromString_fun = function(const pchGUID: PAnsiChar): TSDL_JoystickGUID; cdecl; +Var + SDL_JoystickGetGUIDFromString : TSDL_JoystickGetGUIDFromString_fun = Nil; +{$else} + +function SDL_JoystickGetGUIDFromString(const pchGUID: PAnsiChar): TSDL_JoystickGUID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetGUIDFromString' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the device information encoded in a SDL_JoystickGUID structure + * + * \param guid the SDL_JoystickGUID you wish to get info about + * \param vendor A pointer filled in with the device VID, or 0 if not + * available + * \param product A pointer filled in with the device PID, or 0 if not + * available + * \param version A pointer filled in with the device version, or 0 if not + * available + * \param crc16 A pointer filled in with a CRC used to distinguish different + * products with the same VID/PID, or 0 if not available + * + * \since This function is available since SDL 2.26.0. + * + * \sa SDL_JoystickGetDeviceGUID + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetJoystickGUIDInfo_proc = procedure(guid: TSDL_JoystickGUID; vendor: pcuint16; product: pcuint16; version: pcuint16; crc16: pcuint16); cdecl; +Var + SDL_GetJoystickGUIDInfo : TSDL_GetJoystickGUIDInfo_proc = Nil; +{$else} + +procedure SDL_GetJoystickGUIDInfo(guid: TSDL_JoystickGUID; vendor: pcuint16; product: pcuint16; version: pcuint16; crc16: pcuint16); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetJoystickGUIDInfo' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the status of a specified joystick. + * + * \param joystick the joystick to query + * \returns SDL_TRUE if the joystick has been opened, SDL_FALSE if it has not; + * call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickClose + * \sa SDL_JoystickOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetAttached_fun = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; +Var + SDL_JoystickGetAttached : TSDL_JoystickGetAttached_fun = Nil; +{$else} + +function SDL_JoystickGetAttached(joystick: PSDL_Joystick): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetAttached' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the instance ID of an opened joystick. + * + * \param joystick an SDL_Joystick structure containing joystick information + * \returns the instance ID of the specified joystick on success or a negative + * error code on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickInstanceID_fun = function(joystick: PSDL_Joystick): TSDL_JoystickID; cdecl; +Var + SDL_JoystickInstanceID : TSDL_JoystickInstanceID_fun = Nil; +{$else} + +function SDL_JoystickInstanceID(joystick: PSDL_Joystick): TSDL_JoystickID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickInstanceID' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the number of general axis controls on a joystick. + * + * Often, the directional pad on a game controller will either look like 4 + * separate buttons or a POV hat, and not axes, but all of this is up to the + * device and platform. + * + * \param joystick an SDL_Joystick structure containing joystick information + * \returns the number of axis controls/number of axes on success or a + * negative error code on failure; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickGetAxis + * \sa SDL_JoystickOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickNumAxes_fun = function(joystick: PSDL_Joystick): cint; cdecl; +Var + SDL_JoystickNumAxes : TSDL_JoystickNumAxes_fun = Nil; +{$else} + +function SDL_JoystickNumAxes(joystick: PSDL_Joystick): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickNumAxes' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the number of trackballs on a joystick. + * + * Joystick trackballs have only relative motion events associated with them + * and their state cannot be polled. + * + * Most joysticks do not have trackballs. + * + * \param joystick an SDL_Joystick structure containing joystick information + * \returns the number of trackballs on success or a negative error code on + * failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickGetBall + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickNumBalls_fun = function(joystick: PSDL_Joystick): cint; cdecl; +Var + SDL_JoystickNumBalls : TSDL_JoystickNumBalls_fun = Nil; +{$else} + +function SDL_JoystickNumBalls(joystick: PSDL_Joystick): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickNumBalls' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the number of POV hats on a joystick. + * + * \param joystick an SDL_Joystick structure containing joystick information + * \returns the number of POV hats on success or a negative error code on + * failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickGetHat + * \sa SDL_JoystickOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickNumHats_fun = function(joystick: PSDL_Joystick): cint; cdecl; +Var + SDL_JoystickNumHats : TSDL_JoystickNumHats_fun = Nil; +{$else} + +function SDL_JoystickNumHats(joystick: PSDL_Joystick): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickNumHats' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the number of buttons on a joystick. + * + * \param joystick an SDL_Joystick structure containing joystick information + * \returns the number of buttons on success or a negative error code on + * failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickGetButton + * \sa SDL_JoystickOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickNumButtons_fun = function(joystick: PSDL_Joystick): cint; cdecl; +Var + SDL_JoystickNumButtons : TSDL_JoystickNumButtons_fun = Nil; +{$else} + +function SDL_JoystickNumButtons(joystick: PSDL_Joystick): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickNumButtons' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Update the current state of the open joysticks. + * + * This is called automatically by the event loop if any joystick events are + * enabled. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickEventState + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickUpdate_proc = procedure(); cdecl; +Var + SDL_JoystickUpdate : TSDL_JoystickUpdate_proc = Nil; +{$else} + +procedure SDL_JoystickUpdate(); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickUpdate' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Enable/disable joystick event polling. + * + * If joystick events are disabled, you must call SDL_JoystickUpdate() + * yourself and manually check the state of the joystick when you want + * joystick information. + * + * It is recommended that you leave joystick event handling enabled. + * + * **WARNING**: Calling this function may delete all events currently in SDL's + * event queue. + * + * \param state can be one of `SDL_QUERY`, `SDL_IGNORE`, or `SDL_ENABLE` + * \returns 1 if enabled, 0 if disabled, or a negative error code on failure; + * call SDL_GetError() for more information. + * + * If `state` is `SDL_QUERY` then the current state is returned, + * otherwise the new processing state is returned. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GameControllerEventState + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickEventState_fun = function(state: cint): cint; cdecl; +Var + SDL_JoystickEventState : TSDL_JoystickEventState_fun = Nil; +{$else} + +function SDL_JoystickEventState(state: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickEventState' {$ENDIF} {$ENDIF}; +{$endif} + +const + SDL_JOYSTICK_AXIS_MAX = 32767; + SDL_JOYSTICK_AXIS_MIN = -32768; + +{** + * Get the current state of an axis control on a joystick. + * + * SDL makes no promises about what part of the joystick any given axis refers + * to. Your game should have some sort of configuration UI to let users + * specify what each axis should be bound to. Alternately, SDL's higher-level + * Game Controller API makes a great effort to apply order to this lower-level + * interface, so you know that a specific axis is the "left thumb stick," etc. + * + * The value returned by SDL_JoystickGetAxis() is a signed integer (-32768 to + * 32767) representing the current position of the axis. It may be necessary + * to impose certain tolerances on these values to account for jitter. + * + * \param joystick an SDL_Joystick structure containing joystick information + * \param axis the axis to query; the axis indices start at index 0 + * \returns a 16-bit signed integer representing the current position of the + * axis or 0 on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickNumAxes + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetAxis_fun = function(joystick: PSDL_Joystick; axis: cint): cint16; cdecl; +Var + SDL_JoystickGetAxis : TSDL_JoystickGetAxis_fun = Nil; +{$else} + +function SDL_JoystickGetAxis(joystick: PSDL_Joystick; axis: cint): cint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetAxis' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the initial state of an axis control on a joystick. + * + * The state is a value ranging from -32768 to 32767. + * + * The axis indices start at index 0. + * + * \param joystick an SDL_Joystick structure containing joystick information + * \param axis the axis to query; the axis indices start at index 0 + * \param state Upon return, the initial value is supplied here. + * \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not. + * + * \since This function is available since SDL 2.0.6. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetAxisInitialState_fun = function(joystick: PSDL_Joystick; axis: cint; state: pcint16): TSDL_Bool; cdecl; +Var + SDL_JoystickGetAxisInitialState : TSDL_JoystickGetAxisInitialState_fun = Nil; +{$else} + +function SDL_JoystickGetAxisInitialState(joystick: PSDL_Joystick; axis: cint; state: pcint16): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetAxisInitialState' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Hat positions + *} +const + SDL_HAT_CENTERED = $00; + SDL_HAT_UP = $01; + SDL_HAT_RIGHT = $02; + SDL_HAT_DOWN = $04; + SDL_HAT_LEFT = $08; + SDL_HAT_RIGHTUP = SDL_HAT_RIGHT or SDL_HAT_UP; + SDL_HAT_RIGHTDOWN = SDL_HAT_RIGHT or SDL_HAT_DOWN; + SDL_HAT_LEFTUP = SDL_HAT_LEFT or SDL_HAT_UP; + SDL_HAT_LEFTDOWN = SDL_HAT_LEFT or SDL_HAT_DOWN; + +{** + * Get the current state of a POV hat on a joystick. + * + * The returned value will be one of the following positions: + * + * - `SDL_HAT_CENTERED` + * - `SDL_HAT_UP` + * - `SDL_HAT_RIGHT` + * - `SDL_HAT_DOWN` + * - `SDL_HAT_LEFT` + * - `SDL_HAT_RIGHTUP` + * - `SDL_HAT_RIGHTDOWN` + * - `SDL_HAT_LEFTUP` + * - `SDL_HAT_LEFTDOWN` + * + * \param joystick an SDL_Joystick structure containing joystick information + * \param hat the hat index to get the state from; indices start at index 0 + * \returns the current hat position. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickNumHats + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetHat_fun = function(joystick: PSDL_Joystick; hat: cint): cuint8; cdecl; +Var + SDL_JoystickGetHat : TSDL_JoystickGetHat_fun = Nil; +{$else} + +function SDL_JoystickGetHat(joystick: PSDL_Joystick; hat: cint): cuint8; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetHat' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the ball axis change since the last poll. + * + * Trackballs can only return relative motion since the last call to + * SDL_JoystickGetBall(), these motion deltas are placed into `dx` and `dy`. + * + * Most joysticks do not have trackballs. + * + * \param joystick the SDL_Joystick to query + * \param ball the ball index to query; ball indices start at index 0 + * \param dx stores the difference in the x axis position since the last poll + * \param dy stores the difference in the y axis position since the last poll + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickNumBalls + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetBall_fun = function(joystick: PSDL_Joystick; ball: cint; dx: pcint; dy: pcint): cint; cdecl; +Var + SDL_JoystickGetBall : TSDL_JoystickGetBall_fun = Nil; +{$else} + +function SDL_JoystickGetBall(joystick: PSDL_Joystick; ball: cint; dx: pcint; dy: pcint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetBall' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the current state of a button on a joystick. + * + * \param joystick an SDL_Joystick structure containing joystick information + * \param button the button index to get the state from; indices start at + * index 0 + * \returns 1 if the specified button is pressed, 0 otherwise. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickNumButtons + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetButton_fun = function(joystick: PSDL_Joystick; button: cint): cuint8; cdecl; +Var + SDL_JoystickGetButton : TSDL_JoystickGetButton_fun = Nil; +{$else} + +function SDL_JoystickGetButton(joystick: PSDL_Joystick; button: cint): cuint8; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetButton' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Start a rumble effect. + * + * Each call to this function cancels any previous rumble effect, and calling + * it with 0 intensity stops any rumbling. + * + * \param joystick The joystick to vibrate + * \param low_frequency_rumble The intensity of the low frequency (left) + * rumble motor, from 0 to 0xFFFF + * \param high_frequency_rumble The intensity of the high frequency (right) + * rumble motor, from 0 to 0xFFFF + * \param duration_ms The duration of the rumble effect, in milliseconds + * \returns 0, or -1 if rumble isn't supported on this joystick + * + * \since This function is available since SDL 2.0.9. + * + * \sa SDL_JoystickHasRumble + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickRumble_fun = function(joystick: PSDL_Joystick; low_frequency_rumble: cuint16; high_frequency_rumble: cuint16; duration_ms: cuint32): cint; cdecl; +Var + SDL_JoystickRumble : TSDL_JoystickRumble_fun = Nil; +{$else} + +function SDL_JoystickRumble(joystick: PSDL_Joystick; low_frequency_rumble: cuint16; high_frequency_rumble: cuint16; duration_ms: cuint32): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickRumble' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Start a rumble effect in the joystick's triggers + * + * Each call to this function cancels any previous trigger rumble effect, and + * calling it with 0 intensity stops any rumbling. + * + * Note that this is rumbling of the _triggers_ and not the game controller as + * a whole. This is currently only supported on Xbox One controllers. If you + * want the (more common) whole-controller rumble, use SDL_JoystickRumble() + * instead. + * + * \param joystick The joystick to vibrate + * \param left_rumble The intensity of the left trigger rumble motor, from 0 + * to 0xFFFF + * \param right_rumble The intensity of the right trigger rumble motor, from 0 + * to 0xFFFF + * \param duration_ms The duration of the rumble effect, in milliseconds + * \returns 0, or -1 if trigger rumble isn't supported on this joystick + * + * \since This function is available since SDL 2.0.14. + * + * \sa SDL_JoystickHasRumbleTriggers + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickRumbleTriggers_fun = function(joystick: PSDL_Joystick; left_rumble: cuint16; right_rumble: cuint16; duration_ms: cuint32): cint; cdecl; +Var + SDL_JoystickRumbleTriggers : TSDL_JoystickRumbleTriggers_fun = Nil; +{$else} + +function SDL_JoystickRumbleTriggers(joystick: PSDL_Joystick; left_rumble: cuint16; right_rumble: cuint16; duration_ms: cuint32): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickRumbleTriggers' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Query whether a joystick has an LED. + * + * An example of a joystick LED is the light on the back of a PlayStation 4's + * DualShock 4 controller. + * + * \param joystick The joystick to query + * \return SDL_TRUE if the joystick has a modifiable LED, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.14. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickHasLED_fun = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; +Var + SDL_JoystickHasLED : TSDL_JoystickHasLED_fun = Nil; +{$else} + +function SDL_JoystickHasLED(joystick: PSDL_Joystick): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickHasLED' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Query whether a joystick has rumble support. + * + * \param joystick The joystick to query + * \return SDL_TRUE if the joystick has rumble, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.18. + * + * \sa SDL_JoystickRumble + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickHasRumble_fun = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; +Var + SDL_JoystickHasRumble : TSDL_JoystickHasRumble_fun = Nil; +{$else} + +function SDL_JoystickHasRumble(joystick: PSDL_Joystick): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickHasRumble' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Query whether a joystick has rumble support on triggers. + * + * \param joystick The joystick to query + * \return SDL_TRUE if the joystick has trigger rumble, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.18. + * + * \sa SDL_JoystickRumbleTriggers + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickHasRumbleTriggers_fun = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; +Var + SDL_JoystickHasRumbleTriggers : TSDL_JoystickHasRumbleTriggers_fun = Nil; +{$else} + +function SDL_JoystickHasRumbleTriggers(joystick: PSDL_Joystick): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickHasRumbleTriggers' {$ENDIF} {$ENDIF}; +{$endif} + + +{** + * Update a joystick's LED color. + * + * An example of a joystick LED is the light on the back of a PlayStation 4's + * DualShock 4 controller. + * + * \param joystick The joystick to update + * \param red The intensity of the red LED + * \param green The intensity of the green LED + * \param blue The intensity of the blue LED + * \returns 0 on success, -1 if this joystick does not have a modifiable LED + * + * \since This function is available since SDL 2.0.14. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickSetLED_fun = function(joystick: PSDL_Joystick; red: cuint8; green: cuint8; blue: cuint8): cint; cdecl; +Var + SDL_JoystickSetLED : TSDL_JoystickSetLED_fun = Nil; +{$else} + +function SDL_JoystickSetLED(joystick: PSDL_Joystick; red: cuint8; green: cuint8; blue: cuint8): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSetLED' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Send a joystick specific effect packet + * + * \param joystick The joystick to affect + * \param data The data to send to the joystick + * \param size The size of the data to send to the joystick + * \returns 0, or -1 if this joystick or driver doesn't support effect packets + * + * \since This function is available since SDL 2.0.16. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickSendEffect_fun = function(joystick: PSDL_Joystick; const data: Pointer; size: cint): cint; cdecl; +Var + SDL_JoystickSendEffect : TSDL_JoystickSendEffect_fun = Nil; +{$else} + +function SDL_JoystickSendEffect(joystick: PSDL_Joystick; const data: Pointer; size: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSendEffect' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Close a joystick previously opened with SDL_JoystickOpen(). + * + * \param joystick The joystick device to close + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickClose_proc = procedure(joystick: PSDL_Joystick); cdecl; +Var + SDL_JoystickClose : TSDL_JoystickClose_proc = Nil; +{$else} + +procedure SDL_JoystickClose(joystick: PSDL_Joystick); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickClose' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the battery level of a joystick as SDL_JoystickPowerLevel. + * + * \param joystick the SDL_Joystick to query + * \returns the current battery level as SDL_JoystickPowerLevel on success or + * `SDL_JOYSTICK_POWER_UNKNOWN` if it is unknown + * + * \since This function is available since SDL 2.0.4. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickCurrentPowerLevel_fun = function(joystick: PSDL_Joystick): TSDL_JoystickPowerLevel; cdecl; +Var + SDL_JoystickCurrentPowerLevel : TSDL_JoystickCurrentPowerLevel_fun = Nil; +{$else} + +function SDL_JoystickCurrentPowerLevel(joystick: PSDL_Joystick): TSDL_JoystickPowerLevel; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickCurrentPowerLevel' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlkeyboard.inc b/units/sdlkeyboard.inc index c126e8a9..16123940 100644 --- a/units/sdlkeyboard.inc +++ b/units/sdlkeyboard.inc @@ -1,340 +1,420 @@ -//from "sdl_keyboard.h" - -{* - * \file SDL_keyboard.h - * - * Include file for SDL keyboard event handling - } - -type - { SDL2-for-Pascal: - - Is this type used/needed anywhere? - - It doesn't seem to be part of sdl_keyboard.h - - If not, should be commented out or deleted } - PPKeyStateArr = ^PKeyStateArr; - PKeyStateArr = ^TKeyStateArr; - TKeyStateArr = array[0..65000] of cuint8; - - {* - * \brief The SDL keysym structure, used in key events. - * - * \note If you are looking for translated character input, see the:: SDL_TEXTINPUT event. - } - PPSDL_Keysym = ^PSDL_Keysym; - PSDL_Keysym = ^TSDL_Keysym; - TSDL_Keysym = record - scancode: TSDL_ScanCode; // SDL physical key code - see SDL_Scancode for details - sym: TSDL_KeyCode; // SDL virtual key code - see SDL_Keycode for details - mod_: cuint16; // current key modifiers - unicode: cuint32; // (deprecated) use SDL_TextInputEvent instead - end; - -{ Function prototypes } - -{* - * Query the window which currently has keyboard focus. - * - * \returns the window with keyboard focus. - * - * \since This function is available since SDL 2.0.0. - } -function SDL_GetKeyboardFocus: PSDL_Window; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyboardFocus' {$ENDIF} {$ENDIF}; - -{* - * Get a snapshot of the current state of the keyboard. - * - * The pointer returned is a pointer to an internal SDL array. It will be - * valid for the whole lifetime of the application and should not be freed by - * the caller. - * - * A array element with a value of 1 means that the key is pressed and a value - * of 0 means that it is not. Indexes into this array are obtained by using - * SDL_Scancode values. - * - * Use SDL_PumpEvents() to update the state array. - * - * This function gives you the current state after all events have been - * processed, so if a key or button has been pressed and released before you - * process events, then the pressed state will never show up in the - * SDL_GetKeyboardState() calls. - * - * Note: This function doesn't take into account whether shift has been - * pressed or not. - * - * \param numkeys if non-nil, receives the length of the returned array - * \returns a pointer to an array of key states. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_PumpEvents - * \sa SDL_ResetKeyboard - } -function SDL_GetKeyboardState(numkeys: pcint): pcuint8; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyboardState' {$ENDIF} {$ENDIF}; - -{* - * Clear the state of the keyboard - * - * This function will generate key up events for all pressed keys. - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_GetKeyboardState - } -procedure SDL_ResetKeyboard; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ResetKeyboard' {$ENDIF} {$ENDIF}; - -{* - * Get the current key modifier state for the keyboard. - * - * \returns an OR'd combination of the modifier keys for the keyboard. See - * SDL_Keymod for details. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetKeyboardState - * \sa SDL_SetModState - } -function SDL_GetModState: TSDL_Keymod; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetModState' {$ENDIF} {$ENDIF}; - -{* - * Set the current key modifier state for the keyboard. - * - * The inverse of SDL_GetModState(), SDL_SetModState() allows you to impose - * modifier key states on your application. Simply pass your desired modifier - * states into `modstate`. This value may be a bitwise, OR'd combination of - * SDL_Keymod values. - * - * This does not change the keyboard state, only the key modifier flags that - * SDL reports. - * - * \param modstate the desired SDL_Keymod for the keyboard - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetModState - } -procedure SDL_SetModState(modstate: TSDL_Keymod); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetModState' {$ENDIF} {$ENDIF}; - -{* - * Get the key code corresponding to the given scancode according to the - * current keyboard layout. - * - * See SDL_Keycode for details. - * - * \param scancode the desired SDL_Scancode to query - * \returns the SDL_Keycode that corresponds to the given SDL_Scancode. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetKeyName - * \sa SDL_GetScancodeFromKey - } -function SDL_GetKeyFromScancode(scancode: TSDL_Scancode): TSDL_Keycode; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyFromScancode' {$ENDIF} {$ENDIF}; - -{* - * Get the scancode corresponding to the given key code according to the - * current keyboard layout. - * - * See SDL_Scancode for details. - * - * \param key the desired SDL_Keycode to query - * \returns the SDL_Scancode that corresponds to the given SDL_Keycode. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetKeyFromScancode - * \sa SDL_GetScancodeName - } -function SDL_GetScancodeFromKey(key: TSDL_Keycode): TSDL_Scancode; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeFromKey' {$ENDIF} {$ENDIF}; - -{* - * Get a human-readable name for a scancode. - * - * See SDL_Scancode for details. - * - * **Warning**: The returned name is by design not stable across platforms, - * e.g. the name for `SDL_SCANCODE_LGUI` is "Left GUI" under Linux but "Left - * Windows" under Microsoft Windows, and some scancodes like - * `SDL_SCANCODE_NONUSBACKSLASH` don't have any name at all. There are even - * scancodes that share names, e.g. `SDL_SCANCODE_RETURN` and - * `SDL_SCANCODE_RETURN2` (both called "Return"). This function is therefore - * unsuitable for creating a stable cross-platform two-way mapping between - * strings and scancodes. - * - * \param scancode the desired SDL_Scancode to query - * \returns a pointer to the name for the scancode. If the scancode doesn't - * have a name this function returns an empty string (""). - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetScancodeFromKey - * \sa SDL_GetScancodeFromName - } -function SDL_GetScancodeName(scancode: TSDL_Scancode): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeName' {$ENDIF} {$ENDIF}; - -{* - * Get a scancode from a human-readable name. - * - * \param name the human-readable scancode name - * \returns the SDL_Scancode, or `SDL_SCANCODE_UNKNOWN` if the name wasn't - * recognized; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetKeyFromName - * \sa SDL_GetScancodeFromKey - * \sa SDL_GetScancodeName - } -function SDL_GetScancodeFromName(name: PAnsiChar): TSDL_Scancode; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeFromName' {$ENDIF} {$ENDIF}; - -{* - * Get a human-readable name for a key. - * - * See SDL_Scancode and SDL_Keycode for details. - * - * \param key the desired SDL_Keycode to query - * \returns a pointer to a UTF-8 string that stays valid at least until the - * next call to this function. If you need it around any longer, you - * must copy it. If the key doesn't have a name, this function - * returns an empty string (""). - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetKeyFromName - * \sa SDL_GetKeyFromScancode - * \sa SDL_GetScancodeFromKey - } -function SDL_GetKeyName(key: TSDL_Keycode): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyName' {$ENDIF} {$ENDIF}; - -{* - * Get a key code from a human-readable name. - * - * \param name the human-readable key name - * \returns key code, or `SDLK_UNKNOWN` if the name wasn't recognized; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetKeyFromScancode - * \sa SDL_GetKeyName - * \sa SDL_GetScancodeFromName - } -function SDL_GetKeyFromName(name: PAnsiChar): TSDL_Keycode; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyFromName' {$ENDIF} {$ENDIF}; - -{* - * Start accepting Unicode text input events. - * - * This function will start accepting Unicode text input events in the focused - * SDL window, and start emitting SDL_TextInputEvent (SDL_TEXTINPUT) and - * SDL_TextEditingEvent (SDL_TEXTEDITING) events. Please use this function in - * pair with SDL_StopTextInput(). - * - * On some platforms using this function activates the screen keyboard. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_SetTextInputRect - * \sa SDL_StopTextInput - } -procedure SDL_StartTextInput; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_StartTextInput' {$ENDIF} {$ENDIF}; - -{* - * Check whether or not Unicode text input events are enabled. - * - * \returns SDL_TRUE if text input events are enabled else SDL_FALSE. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_StartTextInput - } -function SDL_IsTextInputActive: TSDL_bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsTextInputActive' {$ENDIF} {$ENDIF}; - -{* - * Stop receiving any text input events. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_StartTextInput - } -procedure SDL_StopTextInput; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_StopTextInput' {$ENDIF} {$ENDIF}; - -{* - * Dismiss the composition window/IME without disabling the subsystem. - * - * \since This function is available since SDL 2.0.22. - * - * \sa SDL_StartTextInput - * \sa SDL_StopTextInput - } -procedure SDL_ClearComposition; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ClearComposition' {$ENDIF} {$ENDIF}; - -{* - * Returns if an IME Composite or Candidate window is currently shown. - * - * \since This function is available since SDL 2.0.22. - } -function SDL_IsTextInputShown: TSDL_bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsTextInputShown' {$ENDIF} {$ENDIF}; - -{* - * Set the rectangle used to type Unicode text inputs. - * - * To start text input in a given location, this function is intended to be - * called before SDL_StartTextInput, although some platforms support moving - * the rectangle even while text input (and a composition) is active. - * - * Note: If you want to use the system native IME window, try setting hint - * **SDL_HINT_IME_SHOW_UI** to **1**, otherwise this function won't give you - * any feedback. - * - * \param rect the SDL_Rect structure representing the rectangle to receive - * text (ignored if nil) - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_StartTextInput - } -procedure SDL_SetTextInputRect(rect: PSDL_Rect); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextInputRect' {$ENDIF} {$ENDIF}; - -{* - * Check whether the platform has screen keyboard support. - * - * \returns SDL_TRUE if the platform has some screen keyboard support or - * SDL_FALSE if not. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_StartTextInput - * \sa SDL_IsScreenKeyboardShown - } -function SDL_HasScreenKeyboardSupport: TSDL_bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasScreenKeyboardSupport' {$ENDIF} {$ENDIF}; - -{* - * Check whether the screen keyboard is shown for given window. - * - * \param window the window for which screen keyboard should be queried - * \returns SDL_TRUE if screen keyboard is shown or SDL_FALSE if not. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HasScreenKeyboardSupport - } -function SDL_IsScreenKeyboardShown(window: PSDL_Window): TSDL_bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsScreenKeyboardShown' {$ENDIF} {$ENDIF}; - +//from "sdl_keyboard.h" + +{* + * \file SDL_keyboard.h + * + * Include file for SDL keyboard event handling + } + +type + { SDL2-for-Pascal: + - Is this type used/needed anywhere? + - It doesn't seem to be part of sdl_keyboard.h + - If not, should be commented out or deleted } + PPKeyStateArr = ^PKeyStateArr; + PKeyStateArr = ^TKeyStateArr; + TKeyStateArr = array[0..65000] of cuint8; + + {* + * \brief The SDL keysym structure, used in key events. + * + * \note If you are looking for translated character input, see the:: SDL_TEXTINPUT event. + } + PPSDL_Keysym = ^PSDL_Keysym; + PSDL_Keysym = ^TSDL_Keysym; + TSDL_Keysym = record + scancode: TSDL_ScanCode; // SDL physical key code - see SDL_Scancode for details + sym: TSDL_KeyCode; // SDL virtual key code - see SDL_Keycode for details + mod_: cuint16; // current key modifiers + unicode: cuint32; // (deprecated) use SDL_TextInputEvent instead + end; + +{ Function prototypes } + +{* + * Query the window which currently has keyboard focus. + * + * \returns the window with keyboard focus. + * + * \since This function is available since SDL 2.0.0. + } +function SDL_GetKeyboardFocus: PSDL_Window; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyboardFocus' {$ENDIF} {$ENDIF}; + +{* + * Get a snapshot of the current state of the keyboard. + * + * The pointer returned is a pointer to an internal SDL array. It will be + * valid for the whole lifetime of the application and should not be freed by + * the caller. + * + * A array element with a value of 1 means that the key is pressed and a value + * of 0 means that it is not. Indexes into this array are obtained by using + * SDL_Scancode values. + * + * Use SDL_PumpEvents() to update the state array. + * + * This function gives you the current state after all events have been + * processed, so if a key or button has been pressed and released before you + * process events, then the pressed state will never show up in the + * SDL_GetKeyboardState() calls. + * + * Note: This function doesn't take into account whether shift has been + * pressed or not. + * + * \param numkeys if non-nil, receives the length of the returned array + * \returns a pointer to an array of key states. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_PumpEvents + * \sa SDL_ResetKeyboard + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetKeyboardState_fun = function(numkeys: pcint): pcuint8; cdecl; +Var + SDL_GetKeyboardState : TSDL_GetKeyboardState_fun = Nil; +{$else} + +function SDL_GetKeyboardState(numkeys: pcint): pcuint8; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyboardState' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Clear the state of the keyboard + * + * This function will generate key up events for all pressed keys. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GetKeyboardState + } +procedure SDL_ResetKeyboard; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ResetKeyboard' {$ENDIF} {$ENDIF}; + +{* + * Get the current key modifier state for the keyboard. + * + * \returns an OR'd combination of the modifier keys for the keyboard. See + * SDL_Keymod for details. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetKeyboardState + * \sa SDL_SetModState + } +function SDL_GetModState: TSDL_Keymod; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetModState' {$ENDIF} {$ENDIF}; + +{* + * Set the current key modifier state for the keyboard. + * + * The inverse of SDL_GetModState(), SDL_SetModState() allows you to impose + * modifier key states on your application. Simply pass your desired modifier + * states into `modstate`. This value may be a bitwise, OR'd combination of + * SDL_Keymod values. + * + * This does not change the keyboard state, only the key modifier flags that + * SDL reports. + * + * \param modstate the desired SDL_Keymod for the keyboard + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetModState + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetModState_proc = procedure(modstate: TSDL_Keymod); cdecl; +Var + SDL_SetModState : TSDL_SetModState_proc = Nil; +{$else} + +procedure SDL_SetModState(modstate: TSDL_Keymod); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetModState' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get the key code corresponding to the given scancode according to the + * current keyboard layout. + * + * See SDL_Keycode for details. + * + * \param scancode the desired SDL_Scancode to query + * \returns the SDL_Keycode that corresponds to the given SDL_Scancode. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetKeyName + * \sa SDL_GetScancodeFromKey + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetKeyFromScancode_fun = function(scancode: TSDL_Scancode): TSDL_Keycode; cdecl; +Var + SDL_GetKeyFromScancode : TSDL_GetKeyFromScancode_fun = Nil; +{$else} + +function SDL_GetKeyFromScancode(scancode: TSDL_Scancode): TSDL_Keycode; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyFromScancode' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get the scancode corresponding to the given key code according to the + * current keyboard layout. + * + * See SDL_Scancode for details. + * + * \param key the desired SDL_Keycode to query + * \returns the SDL_Scancode that corresponds to the given SDL_Keycode. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetKeyFromScancode + * \sa SDL_GetScancodeName + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetScancodeFromKey_fun = function(key: TSDL_Keycode): TSDL_Scancode; cdecl; +Var + SDL_GetScancodeFromKey : TSDL_GetScancodeFromKey_fun = Nil; +{$else} + +function SDL_GetScancodeFromKey(key: TSDL_Keycode): TSDL_Scancode; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeFromKey' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get a human-readable name for a scancode. + * + * See SDL_Scancode for details. + * + * **Warning**: The returned name is by design not stable across platforms, + * e.g. the name for `SDL_SCANCODE_LGUI` is "Left GUI" under Linux but "Left + * Windows" under Microsoft Windows, and some scancodes like + * `SDL_SCANCODE_NONUSBACKSLASH` don't have any name at all. There are even + * scancodes that share names, e.g. `SDL_SCANCODE_RETURN` and + * `SDL_SCANCODE_RETURN2` (both called "Return"). This function is therefore + * unsuitable for creating a stable cross-platform two-way mapping between + * strings and scancodes. + * + * \param scancode the desired SDL_Scancode to query + * \returns a pointer to the name for the scancode. If the scancode doesn't + * have a name this function returns an empty string (""). + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetScancodeFromKey + * \sa SDL_GetScancodeFromName + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetScancodeName_fun = function(scancode: TSDL_Scancode): PAnsiChar; cdecl; +Var + SDL_GetScancodeName : TSDL_GetScancodeName_fun = Nil; +{$else} + +function SDL_GetScancodeName(scancode: TSDL_Scancode): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeName' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get a scancode from a human-readable name. + * + * \param name the human-readable scancode name + * \returns the SDL_Scancode, or `SDL_SCANCODE_UNKNOWN` if the name wasn't + * recognized; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetKeyFromName + * \sa SDL_GetScancodeFromKey + * \sa SDL_GetScancodeName + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetScancodeFromName_fun = function(name: PAnsiChar): TSDL_Scancode; cdecl; +Var + SDL_GetScancodeFromName : TSDL_GetScancodeFromName_fun = Nil; +{$else} + +function SDL_GetScancodeFromName(name: PAnsiChar): TSDL_Scancode; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeFromName' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get a human-readable name for a key. + * + * See SDL_Scancode and SDL_Keycode for details. + * + * \param key the desired SDL_Keycode to query + * \returns a pointer to a UTF-8 string that stays valid at least until the + * next call to this function. If you need it around any longer, you + * must copy it. If the key doesn't have a name, this function + * returns an empty string (""). + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetKeyFromName + * \sa SDL_GetKeyFromScancode + * \sa SDL_GetScancodeFromKey + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetKeyName_fun = function(key: TSDL_Keycode): PAnsiChar; cdecl; +Var + SDL_GetKeyName : TSDL_GetKeyName_fun = Nil; +{$else} + +function SDL_GetKeyName(key: TSDL_Keycode): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyName' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get a key code from a human-readable name. + * + * \param name the human-readable key name + * \returns key code, or `SDLK_UNKNOWN` if the name wasn't recognized; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetKeyFromScancode + * \sa SDL_GetKeyName + * \sa SDL_GetScancodeFromName + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetKeyFromName_fun = function(name: PAnsiChar): TSDL_Keycode; cdecl; +Var + SDL_GetKeyFromName : TSDL_GetKeyFromName_fun = Nil; +{$else} + +function SDL_GetKeyFromName(name: PAnsiChar): TSDL_Keycode; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyFromName' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Start accepting Unicode text input events. + * + * This function will start accepting Unicode text input events in the focused + * SDL window, and start emitting SDL_TextInputEvent (SDL_TEXTINPUT) and + * SDL_TextEditingEvent (SDL_TEXTEDITING) events. Please use this function in + * pair with SDL_StopTextInput(). + * + * On some platforms using this function activates the screen keyboard. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_SetTextInputRect + * \sa SDL_StopTextInput + } +procedure SDL_StartTextInput; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_StartTextInput' {$ENDIF} {$ENDIF}; + +{* + * Check whether or not Unicode text input events are enabled. + * + * \returns SDL_TRUE if text input events are enabled else SDL_FALSE. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_StartTextInput + } +function SDL_IsTextInputActive: TSDL_bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsTextInputActive' {$ENDIF} {$ENDIF}; + +{* + * Stop receiving any text input events. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_StartTextInput + } +procedure SDL_StopTextInput; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_StopTextInput' {$ENDIF} {$ENDIF}; + +{* + * Dismiss the composition window/IME without disabling the subsystem. + * + * \since This function is available since SDL 2.0.22. + * + * \sa SDL_StartTextInput + * \sa SDL_StopTextInput + } +procedure SDL_ClearComposition; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ClearComposition' {$ENDIF} {$ENDIF}; + +{* + * Returns if an IME Composite or Candidate window is currently shown. + * + * \since This function is available since SDL 2.0.22. + } +function SDL_IsTextInputShown: TSDL_bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsTextInputShown' {$ENDIF} {$ENDIF}; + +{* + * Set the rectangle used to type Unicode text inputs. + * + * To start text input in a given location, this function is intended to be + * called before SDL_StartTextInput, although some platforms support moving + * the rectangle even while text input (and a composition) is active. + * + * Note: If you want to use the system native IME window, try setting hint + * **SDL_HINT_IME_SHOW_UI** to **1**, otherwise this function won't give you + * any feedback. + * + * \param rect the SDL_Rect structure representing the rectangle to receive + * text (ignored if nil) + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_StartTextInput + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetTextInputRect_proc = procedure(rect: PSDL_Rect); cdecl; +Var + SDL_SetTextInputRect : TSDL_SetTextInputRect_proc = Nil; +{$else} + +procedure SDL_SetTextInputRect(rect: PSDL_Rect); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextInputRect' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Check whether the platform has screen keyboard support. + * + * \returns SDL_TRUE if the platform has some screen keyboard support or + * SDL_FALSE if not. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_StartTextInput + * \sa SDL_IsScreenKeyboardShown + } +function SDL_HasScreenKeyboardSupport: TSDL_bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasScreenKeyboardSupport' {$ENDIF} {$ENDIF}; + +{* + * Check whether the screen keyboard is shown for given window. + * + * \param window the window for which screen keyboard should be queried + * \returns SDL_TRUE if screen keyboard is shown or SDL_FALSE if not. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HasScreenKeyboardSupport + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_IsScreenKeyboardShown_fun = function(window: PSDL_Window): TSDL_bool; cdecl; +Var + SDL_IsScreenKeyboardShown : TSDL_IsScreenKeyboardShown_fun = Nil; +{$else} + +function SDL_IsScreenKeyboardShown(window: PSDL_Window): TSDL_bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsScreenKeyboardShown' {$ENDIF} {$ENDIF}; +{$endif} + diff --git a/units/sdlkeycode.inc b/units/sdlkeycode.inc index 6f676373..f29bf971 100644 --- a/units/sdlkeycode.inc +++ b/units/sdlkeycode.inc @@ -1,320 +1,320 @@ -//from "sdl_keycode.h" - - {** - * The SDL virtual key representation. - * - * Values of this type are used to represent keyboard keys using the current - * layout of the keyboard. These values include Unicode values representing - * the unmodified character that would be generated by pressing the key, or - * an SDLK_* constant for those keys that do not generate characters. - * - * A special exception is the number keys at the top of the keyboard which - * always map to SDLK_0...SDLK_9, regardless of layout. - *} -type - PPSDL_KeyCode = ^PSDL_KeyCode; - PSDL_KeyCode = ^TSDL_KeyCode; - TSDL_KeyCode = type cint32; - -const - SDLK_SCANCODE_MASK = 1 shl 30; - //#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK) - //SDL2-for-Pascal: Not translated, see comment about this macro below. - - SDLK_UNKNOWN = TSDL_KeyCode(0); - - SDLK_RETURN = TSDL_KeyCode(#13); // C: '\r' - SDLK_ESCAPE = TSDL_KeyCode(#27); // C: '\x1B' - SDLK_BACKSPACE = TSDL_KeyCode(#8); // C: '\b' - SDLK_TAB = TSDL_KeyCode(#9); // C: '\t' - SDLK_SPACE = TSDL_KeyCode(' '); - SDLK_EXCLAIM = TSDL_KeyCode('!'); - SDLK_QUOTEDBL = TSDL_KeyCode('"'); - SDLK_HASH = TSDL_KeyCode('#'); - SDLK_PERCENT = TSDL_KeyCode('%'); - SDLK_DOLLAR = TSDL_KeyCode('$'); - SDLK_AMPERSAND = TSDL_KeyCode('&'); - SDLK_QUOTE = TSDL_KeyCode(''''); - SDLK_LEFTPAREN = TSDL_KeyCode('('); - SDLK_RIGHTPAREN = TSDL_KeyCode(')'); - SDLK_ASTERISK = TSDL_KeyCode('*'); - SDLK_PLUS = TSDL_KeyCode('+'); - SDLK_COMMA = TSDL_KeyCode(','); - SDLK_MINUS = TSDL_KeyCode('-'); - SDLK_PERIOD = TSDL_KeyCode('.'); - SDLK_SLASH = TSDL_KeyCode('/'); - SDLK_0 = TSDL_KeyCode('0'); - SDLK_1 = TSDL_KeyCode('1'); - SDLK_2 = TSDL_KeyCode('2'); - SDLK_3 = TSDL_KeyCode('3'); - SDLK_4 = TSDL_KeyCode('4'); - SDLK_5 = TSDL_KeyCode('5'); - SDLK_6 = TSDL_KeyCode('6'); - SDLK_7 = TSDL_KeyCode('7'); - SDLK_8 = TSDL_KeyCode('8'); - SDLK_9 = TSDL_KeyCode('9'); - SDLK_COLON = TSDL_KeyCode(':'); - SDLK_SEMICOLON = TSDL_KeyCode(';'); - SDLK_LESS = TSDL_KeyCode('<'); - SDLK_EQUALS = TSDL_KeyCode('='); - SDLK_GREATER = TSDL_KeyCode('>'); - SDLK_QUESTION = TSDL_KeyCode('?'); - SDLK_AT = TSDL_KeyCode('@'); - {* - Skip uppercase letters - *} - SDLK_LEFTBRACKET = TSDL_KeyCode('['); - SDLK_BACKSLASH = TSDL_KeyCode('\'); // C: '\\' - SDLK_RIGHTBRACKET = TSDL_KeyCode(']'); - SDLK_CARET = TSDL_KeyCode('^'); - SDLK_UNDERSCORE = TSDL_KeyCode('_'); - SDLK_BACKQUOTE = TSDL_KeyCode('`'); - SDLK_a = TSDL_KeyCode('a'); - SDLK_b = TSDL_KeyCode('b'); - SDLK_c = TSDL_KeyCode('c'); - SDLK_d = TSDL_KeyCode('d'); - SDLK_e = TSDL_KeyCode('e'); - SDLK_f = TSDL_KeyCode('f'); - SDLK_g = TSDL_KeyCode('g'); - SDLK_h = TSDL_KeyCode('h'); - SDLK_i = TSDL_KeyCode('i'); - SDLK_j = TSDL_KeyCode('j'); - SDLK_k = TSDL_KeyCode('k'); - SDLK_l = TSDL_KeyCode('l'); - SDLK_m = TSDL_KeyCode('m'); - SDLK_n = TSDL_KeyCode('n'); - SDLK_o = TSDL_KeyCode('o'); - SDLK_p = TSDL_KeyCode('p'); - SDLK_q = TSDL_KeyCode('q'); - SDLK_r = TSDL_KeyCode('r'); - SDLK_s = TSDL_KeyCode('s'); - SDLK_t = TSDL_KeyCode('t'); - SDLK_u = TSDL_KeyCode('u'); - SDLK_v = TSDL_KeyCode('v'); - SDLK_w = TSDL_KeyCode('w'); - SDLK_x = TSDL_KeyCode('x'); - SDLK_y = TSDL_KeyCode('y'); - SDLK_z = TSDL_KeyCode('z'); - - {SDL2-for-Pascal: In C the following scancodes are or'd by a macro: - SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK) - - We convert the scancodes directly by: - TSDL_KeyCode(X or SDLK_SCANCODE_MASK); } - - SDLK_CAPSLOCK = TSDL_KeyCode(SDL_SCANCODE_CAPSLOCK or SDLK_SCANCODE_MASK); - - SDLK_F1 = TSDL_KeyCode(SDL_SCANCODE_F1 or SDLK_SCANCODE_MASK); - SDLK_F2 = TSDL_KeyCode(SDL_SCANCODE_F2 or SDLK_SCANCODE_MASK); - SDLK_F3 = TSDL_KeyCode(SDL_SCANCODE_F3 or SDLK_SCANCODE_MASK); - SDLK_F4 = TSDL_KeyCode(SDL_SCANCODE_F4 or SDLK_SCANCODE_MASK); - SDLK_F5 = TSDL_KeyCode(SDL_SCANCODE_F5 or SDLK_SCANCODE_MASK); - SDLK_F6 = TSDL_KeyCode(SDL_SCANCODE_F6 or SDLK_SCANCODE_MASK); - SDLK_F7 = TSDL_KeyCode(SDL_SCANCODE_F7 or SDLK_SCANCODE_MASK); - SDLK_F8 = TSDL_KeyCode(SDL_SCANCODE_F8 or SDLK_SCANCODE_MASK); - SDLK_F9 = TSDL_KeyCode(SDL_SCANCODE_F9 or SDLK_SCANCODE_MASK); - SDLK_F10 = TSDL_KeyCode(SDL_SCANCODE_F10 or SDLK_SCANCODE_MASK); - SDLK_F11 = TSDL_KeyCode(SDL_SCANCODE_F11 or SDLK_SCANCODE_MASK); - SDLK_F12 = TSDL_KeyCode(SDL_SCANCODE_F12 or SDLK_SCANCODE_MASK); - - SDLK_PRINTSCREEN = TSDL_KeyCode(SDL_SCANCODE_PRINTSCREEN or SDLK_SCANCODE_MASK); - SDLK_SCROLLLOCK = TSDL_KeyCode(SDL_SCANCODE_SCROLLLOCK or SDLK_SCANCODE_MASK); - SDLK_PAUSE = TSDL_KeyCode(SDL_SCANCODE_PAUSE or SDLK_SCANCODE_MASK); - SDLK_INSERT = TSDL_KeyCode(SDL_SCANCODE_INSERT or SDLK_SCANCODE_MASK); - SDLK_HOME = TSDL_KeyCode(SDL_SCANCODE_HOME or SDLK_SCANCODE_MASK); - SDLK_PAGEUP = TSDL_KeyCode(SDL_SCANCODE_PAGEUP or SDLK_SCANCODE_MASK); - SDLK_DELETE = TSDL_KeyCode(#127); // C: '\x7F' - SDLK_END = TSDL_KeyCode(SDL_SCANCODE_END or SDLK_SCANCODE_MASK); - SDLK_PAGEDOWN = TSDL_KeyCode(SDL_SCANCODE_PAGEDOWN or SDLK_SCANCODE_MASK); - SDLK_RIGHT = TSDL_KeyCode(SDL_SCANCODE_RIGHT or SDLK_SCANCODE_MASK); - SDLK_LEFT = TSDL_KeyCode(SDL_SCANCODE_LEFT or SDLK_SCANCODE_MASK); - SDLK_DOWN = TSDL_KeyCode(SDL_SCANCODE_DOWN or SDLK_SCANCODE_MASK); - SDLK_UP = TSDL_KeyCode(SDL_SCANCODE_UP or SDLK_SCANCODE_MASK); - - SDLK_NUMLOCKCLEAR = TSDL_KeyCode(SDL_SCANCODE_NUMLOCKCLEAR or SDLK_SCANCODE_MASK); - SDLK_KP_DIVIDE = TSDL_KeyCode(SDL_SCANCODE_KP_DIVIDE or SDLK_SCANCODE_MASK); - SDLK_KP_MULTIPLY = TSDL_KeyCode(SDL_SCANCODE_KP_MULTIPLY or SDLK_SCANCODE_MASK); - SDLK_KP_MINUS = TSDL_KeyCode(SDL_SCANCODE_KP_MINUS or SDLK_SCANCODE_MASK); - SDLK_KP_PLUS = TSDL_KeyCode(SDL_SCANCODE_KP_PLUS or SDLK_SCANCODE_MASK); - SDLK_KP_ENTER = TSDL_KeyCode(SDL_SCANCODE_KP_ENTER or SDLK_SCANCODE_MASK); - SDLK_KP_1 = TSDL_KeyCode(SDL_SCANCODE_KP_1 or SDLK_SCANCODE_MASK); - SDLK_KP_2 = TSDL_KeyCode(SDL_SCANCODE_KP_2 or SDLK_SCANCODE_MASK); - SDLK_KP_3 = TSDL_KeyCode(SDL_SCANCODE_KP_3 or SDLK_SCANCODE_MASK); - SDLK_KP_4 = TSDL_KeyCode(SDL_SCANCODE_KP_4 or SDLK_SCANCODE_MASK); - SDLK_KP_5 = TSDL_KeyCode(SDL_SCANCODE_KP_5 or SDLK_SCANCODE_MASK); - SDLK_KP_6 = TSDL_KeyCode(SDL_SCANCODE_KP_6 or SDLK_SCANCODE_MASK); - SDLK_KP_7 = TSDL_KeyCode(SDL_SCANCODE_KP_7 or SDLK_SCANCODE_MASK); - SDLK_KP_8 = TSDL_KeyCode(SDL_SCANCODE_KP_8 or SDLK_SCANCODE_MASK); - SDLK_KP_9 = TSDL_KeyCode(SDL_SCANCODE_KP_9 or SDLK_SCANCODE_MASK); - SDLK_KP_0 = TSDL_KeyCode(SDL_SCANCODE_KP_0 or SDLK_SCANCODE_MASK); - SDLK_KP_PERIOD = TSDL_KeyCode(SDL_SCANCODE_KP_PERIOD or SDLK_SCANCODE_MASK); - - SDLK_APPLICATION = TSDL_KeyCode(SDL_SCANCODE_APPLICATION or SDLK_SCANCODE_MASK); - SDLK_POWER = TSDL_KeyCode(SDL_SCANCODE_POWER or SDLK_SCANCODE_MASK); - SDLK_KP_EQUALS = TSDL_KeyCode(SDL_SCANCODE_KP_EQUALS or SDLK_SCANCODE_MASK); - SDLK_F13 = TSDL_KeyCode(SDL_SCANCODE_F13 or SDLK_SCANCODE_MASK); - SDLK_F14 = TSDL_KeyCode(SDL_SCANCODE_F14 or SDLK_SCANCODE_MASK); - SDLK_F15 = TSDL_KeyCode(SDL_SCANCODE_F15 or SDLK_SCANCODE_MASK); - SDLK_F16 = TSDL_KeyCode(SDL_SCANCODE_F16 or SDLK_SCANCODE_MASK); - SDLK_F17 = TSDL_KeyCode(SDL_SCANCODE_F17 or SDLK_SCANCODE_MASK); - SDLK_F18 = TSDL_KeyCode(SDL_SCANCODE_F18 or SDLK_SCANCODE_MASK); - SDLK_F19 = TSDL_KeyCode(SDL_SCANCODE_F19 or SDLK_SCANCODE_MASK); - SDLK_F20 = TSDL_KeyCode(SDL_SCANCODE_F20 or SDLK_SCANCODE_MASK); - SDLK_F21 = TSDL_KeyCode(SDL_SCANCODE_F21 or SDLK_SCANCODE_MASK); - SDLK_F22 = TSDL_KeyCode(SDL_SCANCODE_F22 or SDLK_SCANCODE_MASK); - SDLK_F23 = TSDL_KeyCode(SDL_SCANCODE_F23 or SDLK_SCANCODE_MASK); - SDLK_F24 = TSDL_KeyCode(SDL_SCANCODE_F24 or SDLK_SCANCODE_MASK); - SDLK_EXECUTE = TSDL_KeyCode(SDL_SCANCODE_EXECUTE or SDLK_SCANCODE_MASK); - SDLK_HELP = TSDL_KeyCode(SDL_SCANCODE_HELP or SDLK_SCANCODE_MASK); - SDLK_MENU = TSDL_KeyCode(SDL_SCANCODE_MENU or SDLK_SCANCODE_MASK); - SDLK_SELECT = TSDL_KeyCode(SDL_SCANCODE_SELECT or SDLK_SCANCODE_MASK); - SDLK_STOP = TSDL_KeyCode(SDL_SCANCODE_STOP or SDLK_SCANCODE_MASK); - SDLK_AGAIN = TSDL_KeyCode(SDL_SCANCODE_AGAIN or SDLK_SCANCODE_MASK); - SDLK_UNDO = TSDL_KeyCode(SDL_SCANCODE_UNDO or SDLK_SCANCODE_MASK); - SDLK_CUT = TSDL_KeyCode(SDL_SCANCODE_CUT or SDLK_SCANCODE_MASK); - SDLK_COPY = TSDL_KeyCode(SDL_SCANCODE_COPY or SDLK_SCANCODE_MASK); - SDLK_PASTE = TSDL_KeyCode(SDL_SCANCODE_PASTE or SDLK_SCANCODE_MASK); - SDLK_FIND = TSDL_KeyCode(SDL_SCANCODE_FIND or SDLK_SCANCODE_MASK); - SDLK_MUTE = TSDL_KeyCode(SDL_SCANCODE_MUTE or SDLK_SCANCODE_MASK); - SDLK_VOLUMEUP = TSDL_KeyCode(SDL_SCANCODE_VOLUMEUP or SDLK_SCANCODE_MASK); - SDLK_VOLUMEDOWN = TSDL_KeyCode(SDL_SCANCODE_VOLUMEDOWN or SDLK_SCANCODE_MASK); - SDLK_KP_COMMA = TSDL_KeyCode(SDL_SCANCODE_KP_COMMA or SDLK_SCANCODE_MASK); - SDLK_KP_EQUALSAS400 = TSDL_KeyCode(SDL_SCANCODE_KP_EQUALSAS400 or SDLK_SCANCODE_MASK); - - SDLK_ALTERASE = TSDL_KeyCode(SDL_SCANCODE_ALTERASE or SDLK_SCANCODE_MASK); - SDLK_SYSREQ = TSDL_KeyCode(SDL_SCANCODE_SYSREQ or SDLK_SCANCODE_MASK); - SDLK_CANCEL = TSDL_KeyCode(SDL_SCANCODE_CANCEL or SDLK_SCANCODE_MASK); - SDLK_CLEAR = TSDL_KeyCode(SDL_SCANCODE_CLEAR or SDLK_SCANCODE_MASK); - SDLK_PRIOR = TSDL_KeyCode(SDL_SCANCODE_PRIOR or SDLK_SCANCODE_MASK); - SDLK_RETURN2 = TSDL_KeyCode(SDL_SCANCODE_RETURN2 or SDLK_SCANCODE_MASK); - SDLK_SEPARATOR = TSDL_KeyCode(SDL_SCANCODE_SEPARATOR or SDLK_SCANCODE_MASK); - SDLK_OUT = TSDL_KeyCode(SDL_SCANCODE_OUT or SDLK_SCANCODE_MASK); - SDLK_OPER = TSDL_KeyCode(SDL_SCANCODE_OPER or SDLK_SCANCODE_MASK); - SDLK_CLEARAGAIN = TSDL_KeyCode(SDL_SCANCODE_CLEARAGAIN or SDLK_SCANCODE_MASK); - SDLK_CRSEL = TSDL_KeyCode(SDL_SCANCODE_CRSEL or SDLK_SCANCODE_MASK); - SDLK_EXSEL = TSDL_KeyCode(SDL_SCANCODE_EXSEL or SDLK_SCANCODE_MASK); - - SDLK_KP_00 = TSDL_KeyCode(SDL_SCANCODE_KP_00 or SDLK_SCANCODE_MASK); - SDLK_KP_000 = TSDL_KeyCode(SDL_SCANCODE_KP_000 or SDLK_SCANCODE_MASK); - SDLK_THOUSANDSSEPARATOR = TSDL_KeyCode(SDL_SCANCODE_THOUSANDSSEPARATOR or SDLK_SCANCODE_MASK); - SDLK_DECIMALSEPARATOR = TSDL_KeyCode(SDL_SCANCODE_DECIMALSEPARATOR or SDLK_SCANCODE_MASK); - SDLK_CURRENCYUNIT = TSDL_KeyCode(SDL_SCANCODE_CURRENCYUNIT or SDLK_SCANCODE_MASK); - SDLK_CURRENCYSUBUNIT = TSDL_KeyCode(SDL_SCANCODE_CURRENCYSUBUNIT or SDLK_SCANCODE_MASK); - SDLK_KP_LEFTPAREN = TSDL_KeyCode(SDL_SCANCODE_KP_LEFTPAREN or SDLK_SCANCODE_MASK); - SDLK_KP_RIGHTPAREN = TSDL_KeyCode(SDL_SCANCODE_KP_RIGHTPAREN or SDLK_SCANCODE_MASK); - SDLK_KP_LEFTBRACE = TSDL_KeyCode(SDL_SCANCODE_KP_LEFTBRACE or SDLK_SCANCODE_MASK); - SDLK_KP_RIGHTBRACE = TSDL_KeyCode(SDL_SCANCODE_KP_RIGHTBRACE or SDLK_SCANCODE_MASK); - SDLK_KP_TAB = TSDL_KeyCode(SDL_SCANCODE_KP_TAB or SDLK_SCANCODE_MASK); - SDLK_KP_BACKSPACE = TSDL_KeyCode(SDL_SCANCODE_KP_BACKSPACE or SDLK_SCANCODE_MASK); - SDLK_KP_A = TSDL_KeyCode(SDL_SCANCODE_KP_A or SDLK_SCANCODE_MASK); - SDLK_KP_B = TSDL_KeyCode(SDL_SCANCODE_KP_B or SDLK_SCANCODE_MASK); - SDLK_KP_C = TSDL_KeyCode(SDL_SCANCODE_KP_C or SDLK_SCANCODE_MASK); - SDLK_KP_D = TSDL_KeyCode(SDL_SCANCODE_KP_D or SDLK_SCANCODE_MASK); - SDLK_KP_E = TSDL_KeyCode(SDL_SCANCODE_KP_E or SDLK_SCANCODE_MASK); - SDLK_KP_F = TSDL_KeyCode(SDL_SCANCODE_KP_F or SDLK_SCANCODE_MASK); - SDLK_KP_XOR = TSDL_KeyCode(SDL_SCANCODE_KP_XOR or SDLK_SCANCODE_MASK); - SDLK_KP_POWER = TSDL_KeyCode(SDL_SCANCODE_KP_POWER or SDLK_SCANCODE_MASK); - SDLK_KP_PERCENT = TSDL_KeyCode(SDL_SCANCODE_KP_PERCENT or SDLK_SCANCODE_MASK); - SDLK_KP_LESS = TSDL_KeyCode(SDL_SCANCODE_KP_LESS or SDLK_SCANCODE_MASK); - SDLK_KP_GREATER = TSDL_KeyCode(SDL_SCANCODE_KP_GREATER or SDLK_SCANCODE_MASK); - SDLK_KP_AMPERSAND = TSDL_KeyCode(SDL_SCANCODE_KP_AMPERSAND or SDLK_SCANCODE_MASK); - SDLK_KP_DBLAMPERSAND = TSDL_KeyCode(SDL_SCANCODE_KP_DBLAMPERSAND or SDLK_SCANCODE_MASK); - SDLK_KP_VERTICALBAR = TSDL_KeyCode(SDL_SCANCODE_KP_VERTICALBAR or SDLK_SCANCODE_MASK); - SDLK_KP_DBLVERTICALBAR = TSDL_KeyCode(SDL_SCANCODE_KP_DBLVERTICALBAR or SDLK_SCANCODE_MASK); - SDLK_KP_COLON = TSDL_KeyCode(SDL_SCANCODE_KP_COLON or SDLK_SCANCODE_MASK); - SDLK_KP_HASH = TSDL_KeyCode(SDL_SCANCODE_KP_HASH or SDLK_SCANCODE_MASK); - SDLK_KP_SPACE = TSDL_KeyCode(SDL_SCANCODE_KP_SPACE or SDLK_SCANCODE_MASK); - SDLK_KP_AT = TSDL_KeyCode(SDL_SCANCODE_KP_AT or SDLK_SCANCODE_MASK); - SDLK_KP_EXCLAM = TSDL_KeyCode(SDL_SCANCODE_KP_EXCLAM or SDLK_SCANCODE_MASK); - SDLK_KP_MEMSTORE = TSDL_KeyCode(SDL_SCANCODE_KP_MEMSTORE or SDLK_SCANCODE_MASK); - SDLK_KP_MEMRECALL = TSDL_KeyCode(SDL_SCANCODE_KP_MEMRECALL or SDLK_SCANCODE_MASK); - SDLK_KP_MEMCLEAR = TSDL_KeyCode(SDL_SCANCODE_KP_MEMCLEAR or SDLK_SCANCODE_MASK); - SDLK_KP_MEMADD = TSDL_KeyCode(SDL_SCANCODE_KP_MEMADD or SDLK_SCANCODE_MASK); - SDLK_KP_MEMSUBTRACT = TSDL_KeyCode(SDL_SCANCODE_KP_MEMSUBTRACT or SDLK_SCANCODE_MASK); - SDLK_KP_MEMMULTIPLY = TSDL_KeyCode(SDL_SCANCODE_KP_MEMMULTIPLY or SDLK_SCANCODE_MASK); - SDLK_KP_MEMDIVIDE = TSDL_KeyCode(SDL_SCANCODE_KP_MEMDIVIDE or SDLK_SCANCODE_MASK); - SDLK_KP_PLUSMINUS = TSDL_KeyCode(SDL_SCANCODE_KP_PLUSMINUS or SDLK_SCANCODE_MASK); - SDLK_KP_CLEAR = TSDL_KeyCode(SDL_SCANCODE_KP_CLEAR or SDLK_SCANCODE_MASK); - SDLK_KP_CLEARENTRY = TSDL_KeyCode(SDL_SCANCODE_KP_CLEARENTRY or SDLK_SCANCODE_MASK); - SDLK_KP_BINARY = TSDL_KeyCode(SDL_SCANCODE_KP_BINARY or SDLK_SCANCODE_MASK); - SDLK_KP_OCTAL = TSDL_KeyCode(SDL_SCANCODE_KP_OCTAL or SDLK_SCANCODE_MASK); - SDLK_KP_DECIMAL = TSDL_KeyCode(SDL_SCANCODE_KP_DECIMAL or SDLK_SCANCODE_MASK); - SDLK_KP_HEXADECIMAL = TSDL_KeyCode(SDL_SCANCODE_KP_HEXADECIMAL or SDLK_SCANCODE_MASK); - - SDLK_LCTRL = TSDL_KeyCode(SDL_SCANCODE_LCTRL or SDLK_SCANCODE_MASK); - SDLK_LSHIFT = TSDL_KeyCode(SDL_SCANCODE_LSHIFT or SDLK_SCANCODE_MASK); - SDLK_LALT = TSDL_KeyCode(SDL_SCANCODE_LALT or SDLK_SCANCODE_MASK); - SDLK_LGUI = TSDL_KeyCode(SDL_SCANCODE_LGUI or SDLK_SCANCODE_MASK); - SDLK_RCTRL = TSDL_KeyCode(SDL_SCANCODE_RCTRL or SDLK_SCANCODE_MASK); - SDLK_RSHIFT = TSDL_KeyCode(SDL_SCANCODE_RSHIFT or SDLK_SCANCODE_MASK); - SDLK_RALT = TSDL_KeyCode(SDL_SCANCODE_RALT or SDLK_SCANCODE_MASK); - SDLK_RGUI = TSDL_KeyCode(SDL_SCANCODE_RGUI or SDLK_SCANCODE_MASK); - - SDLK_MODE = TSDL_KeyCode(SDL_SCANCODE_MODE or SDLK_SCANCODE_MASK); - - SDLK_AUDIONEXT = TSDL_KeyCode(SDL_SCANCODE_AUDIONEXT or SDLK_SCANCODE_MASK); - SDLK_AUDIOPREV = TSDL_KeyCode(SDL_SCANCODE_AUDIOPREV or SDLK_SCANCODE_MASK); - SDLK_AUDIOSTOP = TSDL_KeyCode(SDL_SCANCODE_AUDIOSTOP or SDLK_SCANCODE_MASK); - SDLK_AUDIOPLAY = TSDL_KeyCode(SDL_SCANCODE_AUDIOPLAY or SDLK_SCANCODE_MASK); - SDLK_AUDIOMUTE = TSDL_KeyCode(SDL_SCANCODE_AUDIOMUTE or SDLK_SCANCODE_MASK); - SDLK_MEDIASELECT = TSDL_KeyCode(SDL_SCANCODE_MEDIASELECT or SDLK_SCANCODE_MASK); - SDLK_WWW = TSDL_KeyCode(SDL_SCANCODE_WWW or SDLK_SCANCODE_MASK); - SDLK_MAIL = TSDL_KeyCode(SDL_SCANCODE_MAIL or SDLK_SCANCODE_MASK); - SDLK_CALCULATOR = TSDL_KeyCode(SDL_SCANCODE_CALCULATOR or SDLK_SCANCODE_MASK); - SDLK_COMPUTER = TSDL_KeyCode(SDL_SCANCODE_COMPUTER or SDLK_SCANCODE_MASK); - SDLK_AC_SEARCH = TSDL_KeyCode(SDL_SCANCODE_AC_SEARCH or SDLK_SCANCODE_MASK); - SDLK_AC_HOME = TSDL_KeyCode(SDL_SCANCODE_AC_HOME or SDLK_SCANCODE_MASK); - SDLK_AC_BACK = TSDL_KeyCode(SDL_SCANCODE_AC_BACK or SDLK_SCANCODE_MASK); - SDLK_AC_FORWARD = TSDL_KeyCode(SDL_SCANCODE_AC_FORWARD or SDLK_SCANCODE_MASK); - SDLK_AC_STOP = TSDL_KeyCode(SDL_SCANCODE_AC_STOP or SDLK_SCANCODE_MASK); - SDLK_AC_REFRESH = TSDL_KeyCode(SDL_SCANCODE_AC_REFRESH or SDLK_SCANCODE_MASK); - SDLK_AC_BOOKMARKS = TSDL_KeyCode(SDL_SCANCODE_AC_BOOKMARKS or SDLK_SCANCODE_MASK); - - SDLK_BRIGHTNESSDOWN = TSDL_KeyCode(SDL_SCANCODE_BRIGHTNESSDOWN or SDLK_SCANCODE_MASK); - SDLK_BRIGHTNESSUP = TSDL_KeyCode(SDL_SCANCODE_BRIGHTNESSUP or SDLK_SCANCODE_MASK); - SDLK_DISPLAYSWITCH = TSDL_KeyCode(SDL_SCANCODE_DISPLAYSWITCH or SDLK_SCANCODE_MASK); - SDLK_KBDILLUMTOGGLE = TSDL_KeyCode(SDL_SCANCODE_KBDILLUMTOGGLE or SDLK_SCANCODE_MASK); - SDLK_KBDILLUMDOWN = TSDL_KeyCode(SDL_SCANCODE_KBDILLUMDOWN or SDLK_SCANCODE_MASK); - SDLK_KBDILLUMUP = TSDL_KeyCode(SDL_SCANCODE_KBDILLUMUP or SDLK_SCANCODE_MASK); - SDLK_EJECT = TSDL_KeyCode(SDL_SCANCODE_EJECT or SDLK_SCANCODE_MASK); - SDLK_SLEEP = TSDL_KeyCode(SDL_SCANCODE_SLEEP or SDLK_SCANCODE_MASK); - SDLK_APP1 = TSDL_KeyCode(SDL_SCANCODE_APP1 or SDLK_SCANCODE_MASK); - SDLK_APP2 = TSDL_KeyCode(SDL_SCANCODE_APP2 or SDLK_SCANCODE_MASK); - - SDLK_AUDIOREWIND = TSDL_KeyCode(SDL_SCANCODE_AUDIOREWIND or SDLK_SCANCODE_MASK); - SDLK_AUDIOFASTFORWARD = TSDL_KeyCode(SDL_SCANCODE_AUDIOFASTFORWARD or SDLK_SCANCODE_MASK); - - SDLK_SOFTLEFT = TSDL_KeyCode(SDL_SCANCODE_SOFTLEFT or SDLK_SCANCODE_MASK); - SDLK_SOFTRIGHT = TSDL_KeyCode(SDL_SCANCODE_SOFTRIGHT or SDLK_SCANCODE_MASK); - SDLK_CALL = TSDL_KeyCode(SDL_SCANCODE_CALL or SDLK_SCANCODE_MASK); - SDLK_ENDCALL = TSDL_KeyCode(SDL_SCANCODE_ENDCALL or SDLK_SCANCODE_MASK); - - {** - * Enumeration of valid key mods (possibly OR'd together). - *} -type - PPSDL_KeyMod = ^PSDL_KeyMod; - PSDL_KeyMod = ^TSDL_KeyMod; - TSDL_KeyMod = type cint; - -const - KMOD_NONE = TSDL_KeyMod($0000); - KMOD_LSHIFT = TSDL_KeyMod($0001); - KMOD_RSHIFT = TSDL_KeyMod($0002); - KMOD_LCTRL = TSDL_KeyMod($0040); - KMOD_RCTRL = TSDL_KeyMod($0080); - KMOD_LALT = TSDL_KeyMod($0100); - KMOD_RALT = TSDL_KeyMod($0200); - KMOD_LGUI = TSDL_KeyMod($0400); - KMOD_RGUI = TSDL_KeyMod($0800); - KMOD_NUM = TSDL_KeyMod($1000); - KMOD_CAPS = TSDL_KeyMod($2000); - KMOD_MODE = TSDL_KeyMod($4000); - KMOD_SCROLL = TSDL_KeyMod($8000); - - KMOD_CTRL = KMOD_LCTRL or KMOD_RCTRL; - KMOD_SHIFT = KMOD_LSHIFT or KMOD_RSHIFT; - KMOD_ALT = KMOD_LALT or KMOD_RALT; - KMOD_GUI = KMOD_LGUI or KMOD_RGUI; - - KMOD_RESERVED = KMOD_SCROLL; {* This is for source-level compatibility with SDL 2.0.0. *} +//from "sdl_keycode.h" + + {** + * The SDL virtual key representation. + * + * Values of this type are used to represent keyboard keys using the current + * layout of the keyboard. These values include Unicode values representing + * the unmodified character that would be generated by pressing the key, or + * an SDLK_* constant for those keys that do not generate characters. + * + * A special exception is the number keys at the top of the keyboard which + * always map to SDLK_0...SDLK_9, regardless of layout. + *} +type + PPSDL_KeyCode = ^PSDL_KeyCode; + PSDL_KeyCode = ^TSDL_KeyCode; + TSDL_KeyCode = type cint32; + +const + SDLK_SCANCODE_MASK = 1 shl 30; + //#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK) + //SDL2-for-Pascal: Not translated, see comment about this macro below. + + SDLK_UNKNOWN = TSDL_KeyCode(0); + + SDLK_RETURN = TSDL_KeyCode(#13); // C: '\r' + SDLK_ESCAPE = TSDL_KeyCode(#27); // C: '\x1B' + SDLK_BACKSPACE = TSDL_KeyCode(#8); // C: '\b' + SDLK_TAB = TSDL_KeyCode(#9); // C: '\t' + SDLK_SPACE = TSDL_KeyCode(' '); + SDLK_EXCLAIM = TSDL_KeyCode('!'); + SDLK_QUOTEDBL = TSDL_KeyCode('"'); + SDLK_HASH = TSDL_KeyCode('#'); + SDLK_PERCENT = TSDL_KeyCode('%'); + SDLK_DOLLAR = TSDL_KeyCode('$'); + SDLK_AMPERSAND = TSDL_KeyCode('&'); + SDLK_QUOTE = TSDL_KeyCode(''''); + SDLK_LEFTPAREN = TSDL_KeyCode('('); + SDLK_RIGHTPAREN = TSDL_KeyCode(')'); + SDLK_ASTERISK = TSDL_KeyCode('*'); + SDLK_PLUS = TSDL_KeyCode('+'); + SDLK_COMMA = TSDL_KeyCode(','); + SDLK_MINUS = TSDL_KeyCode('-'); + SDLK_PERIOD = TSDL_KeyCode('.'); + SDLK_SLASH = TSDL_KeyCode('/'); + SDLK_0 = TSDL_KeyCode('0'); + SDLK_1 = TSDL_KeyCode('1'); + SDLK_2 = TSDL_KeyCode('2'); + SDLK_3 = TSDL_KeyCode('3'); + SDLK_4 = TSDL_KeyCode('4'); + SDLK_5 = TSDL_KeyCode('5'); + SDLK_6 = TSDL_KeyCode('6'); + SDLK_7 = TSDL_KeyCode('7'); + SDLK_8 = TSDL_KeyCode('8'); + SDLK_9 = TSDL_KeyCode('9'); + SDLK_COLON = TSDL_KeyCode(':'); + SDLK_SEMICOLON = TSDL_KeyCode(';'); + SDLK_LESS = TSDL_KeyCode('<'); + SDLK_EQUALS = TSDL_KeyCode('='); + SDLK_GREATER = TSDL_KeyCode('>'); + SDLK_QUESTION = TSDL_KeyCode('?'); + SDLK_AT = TSDL_KeyCode('@'); + {* + Skip uppercase letters + *} + SDLK_LEFTBRACKET = TSDL_KeyCode('['); + SDLK_BACKSLASH = TSDL_KeyCode('\'); // C: '\\' + SDLK_RIGHTBRACKET = TSDL_KeyCode(']'); + SDLK_CARET = TSDL_KeyCode('^'); + SDLK_UNDERSCORE = TSDL_KeyCode('_'); + SDLK_BACKQUOTE = TSDL_KeyCode('`'); + SDLK_a = TSDL_KeyCode('a'); + SDLK_b = TSDL_KeyCode('b'); + SDLK_c = TSDL_KeyCode('c'); + SDLK_d = TSDL_KeyCode('d'); + SDLK_e = TSDL_KeyCode('e'); + SDLK_f = TSDL_KeyCode('f'); + SDLK_g = TSDL_KeyCode('g'); + SDLK_h = TSDL_KeyCode('h'); + SDLK_i = TSDL_KeyCode('i'); + SDLK_j = TSDL_KeyCode('j'); + SDLK_k = TSDL_KeyCode('k'); + SDLK_l = TSDL_KeyCode('l'); + SDLK_m = TSDL_KeyCode('m'); + SDLK_n = TSDL_KeyCode('n'); + SDLK_o = TSDL_KeyCode('o'); + SDLK_p = TSDL_KeyCode('p'); + SDLK_q = TSDL_KeyCode('q'); + SDLK_r = TSDL_KeyCode('r'); + SDLK_s = TSDL_KeyCode('s'); + SDLK_t = TSDL_KeyCode('t'); + SDLK_u = TSDL_KeyCode('u'); + SDLK_v = TSDL_KeyCode('v'); + SDLK_w = TSDL_KeyCode('w'); + SDLK_x = TSDL_KeyCode('x'); + SDLK_y = TSDL_KeyCode('y'); + SDLK_z = TSDL_KeyCode('z'); + + {SDL2-for-Pascal: In C the following scancodes are or'd by a macro: + SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK) + + We convert the scancodes directly by: + TSDL_KeyCode(X or SDLK_SCANCODE_MASK); } + + SDLK_CAPSLOCK = TSDL_KeyCode(SDL_SCANCODE_CAPSLOCK or SDLK_SCANCODE_MASK); + + SDLK_F1 = TSDL_KeyCode(SDL_SCANCODE_F1 or SDLK_SCANCODE_MASK); + SDLK_F2 = TSDL_KeyCode(SDL_SCANCODE_F2 or SDLK_SCANCODE_MASK); + SDLK_F3 = TSDL_KeyCode(SDL_SCANCODE_F3 or SDLK_SCANCODE_MASK); + SDLK_F4 = TSDL_KeyCode(SDL_SCANCODE_F4 or SDLK_SCANCODE_MASK); + SDLK_F5 = TSDL_KeyCode(SDL_SCANCODE_F5 or SDLK_SCANCODE_MASK); + SDLK_F6 = TSDL_KeyCode(SDL_SCANCODE_F6 or SDLK_SCANCODE_MASK); + SDLK_F7 = TSDL_KeyCode(SDL_SCANCODE_F7 or SDLK_SCANCODE_MASK); + SDLK_F8 = TSDL_KeyCode(SDL_SCANCODE_F8 or SDLK_SCANCODE_MASK); + SDLK_F9 = TSDL_KeyCode(SDL_SCANCODE_F9 or SDLK_SCANCODE_MASK); + SDLK_F10 = TSDL_KeyCode(SDL_SCANCODE_F10 or SDLK_SCANCODE_MASK); + SDLK_F11 = TSDL_KeyCode(SDL_SCANCODE_F11 or SDLK_SCANCODE_MASK); + SDLK_F12 = TSDL_KeyCode(SDL_SCANCODE_F12 or SDLK_SCANCODE_MASK); + + SDLK_PRINTSCREEN = TSDL_KeyCode(SDL_SCANCODE_PRINTSCREEN or SDLK_SCANCODE_MASK); + SDLK_SCROLLLOCK = TSDL_KeyCode(SDL_SCANCODE_SCROLLLOCK or SDLK_SCANCODE_MASK); + SDLK_PAUSE = TSDL_KeyCode(SDL_SCANCODE_PAUSE or SDLK_SCANCODE_MASK); + SDLK_INSERT = TSDL_KeyCode(SDL_SCANCODE_INSERT or SDLK_SCANCODE_MASK); + SDLK_HOME = TSDL_KeyCode(SDL_SCANCODE_HOME or SDLK_SCANCODE_MASK); + SDLK_PAGEUP = TSDL_KeyCode(SDL_SCANCODE_PAGEUP or SDLK_SCANCODE_MASK); + SDLK_DELETE = TSDL_KeyCode(#127); // C: '\x7F' + SDLK_END = TSDL_KeyCode(SDL_SCANCODE_END or SDLK_SCANCODE_MASK); + SDLK_PAGEDOWN = TSDL_KeyCode(SDL_SCANCODE_PAGEDOWN or SDLK_SCANCODE_MASK); + SDLK_RIGHT = TSDL_KeyCode(SDL_SCANCODE_RIGHT or SDLK_SCANCODE_MASK); + SDLK_LEFT = TSDL_KeyCode(SDL_SCANCODE_LEFT or SDLK_SCANCODE_MASK); + SDLK_DOWN = TSDL_KeyCode(SDL_SCANCODE_DOWN or SDLK_SCANCODE_MASK); + SDLK_UP = TSDL_KeyCode(SDL_SCANCODE_UP or SDLK_SCANCODE_MASK); + + SDLK_NUMLOCKCLEAR = TSDL_KeyCode(SDL_SCANCODE_NUMLOCKCLEAR or SDLK_SCANCODE_MASK); + SDLK_KP_DIVIDE = TSDL_KeyCode(SDL_SCANCODE_KP_DIVIDE or SDLK_SCANCODE_MASK); + SDLK_KP_MULTIPLY = TSDL_KeyCode(SDL_SCANCODE_KP_MULTIPLY or SDLK_SCANCODE_MASK); + SDLK_KP_MINUS = TSDL_KeyCode(SDL_SCANCODE_KP_MINUS or SDLK_SCANCODE_MASK); + SDLK_KP_PLUS = TSDL_KeyCode(SDL_SCANCODE_KP_PLUS or SDLK_SCANCODE_MASK); + SDLK_KP_ENTER = TSDL_KeyCode(SDL_SCANCODE_KP_ENTER or SDLK_SCANCODE_MASK); + SDLK_KP_1 = TSDL_KeyCode(SDL_SCANCODE_KP_1 or SDLK_SCANCODE_MASK); + SDLK_KP_2 = TSDL_KeyCode(SDL_SCANCODE_KP_2 or SDLK_SCANCODE_MASK); + SDLK_KP_3 = TSDL_KeyCode(SDL_SCANCODE_KP_3 or SDLK_SCANCODE_MASK); + SDLK_KP_4 = TSDL_KeyCode(SDL_SCANCODE_KP_4 or SDLK_SCANCODE_MASK); + SDLK_KP_5 = TSDL_KeyCode(SDL_SCANCODE_KP_5 or SDLK_SCANCODE_MASK); + SDLK_KP_6 = TSDL_KeyCode(SDL_SCANCODE_KP_6 or SDLK_SCANCODE_MASK); + SDLK_KP_7 = TSDL_KeyCode(SDL_SCANCODE_KP_7 or SDLK_SCANCODE_MASK); + SDLK_KP_8 = TSDL_KeyCode(SDL_SCANCODE_KP_8 or SDLK_SCANCODE_MASK); + SDLK_KP_9 = TSDL_KeyCode(SDL_SCANCODE_KP_9 or SDLK_SCANCODE_MASK); + SDLK_KP_0 = TSDL_KeyCode(SDL_SCANCODE_KP_0 or SDLK_SCANCODE_MASK); + SDLK_KP_PERIOD = TSDL_KeyCode(SDL_SCANCODE_KP_PERIOD or SDLK_SCANCODE_MASK); + + SDLK_APPLICATION = TSDL_KeyCode(SDL_SCANCODE_APPLICATION or SDLK_SCANCODE_MASK); + SDLK_POWER = TSDL_KeyCode(SDL_SCANCODE_POWER or SDLK_SCANCODE_MASK); + SDLK_KP_EQUALS = TSDL_KeyCode(SDL_SCANCODE_KP_EQUALS or SDLK_SCANCODE_MASK); + SDLK_F13 = TSDL_KeyCode(SDL_SCANCODE_F13 or SDLK_SCANCODE_MASK); + SDLK_F14 = TSDL_KeyCode(SDL_SCANCODE_F14 or SDLK_SCANCODE_MASK); + SDLK_F15 = TSDL_KeyCode(SDL_SCANCODE_F15 or SDLK_SCANCODE_MASK); + SDLK_F16 = TSDL_KeyCode(SDL_SCANCODE_F16 or SDLK_SCANCODE_MASK); + SDLK_F17 = TSDL_KeyCode(SDL_SCANCODE_F17 or SDLK_SCANCODE_MASK); + SDLK_F18 = TSDL_KeyCode(SDL_SCANCODE_F18 or SDLK_SCANCODE_MASK); + SDLK_F19 = TSDL_KeyCode(SDL_SCANCODE_F19 or SDLK_SCANCODE_MASK); + SDLK_F20 = TSDL_KeyCode(SDL_SCANCODE_F20 or SDLK_SCANCODE_MASK); + SDLK_F21 = TSDL_KeyCode(SDL_SCANCODE_F21 or SDLK_SCANCODE_MASK); + SDLK_F22 = TSDL_KeyCode(SDL_SCANCODE_F22 or SDLK_SCANCODE_MASK); + SDLK_F23 = TSDL_KeyCode(SDL_SCANCODE_F23 or SDLK_SCANCODE_MASK); + SDLK_F24 = TSDL_KeyCode(SDL_SCANCODE_F24 or SDLK_SCANCODE_MASK); + SDLK_EXECUTE = TSDL_KeyCode(SDL_SCANCODE_EXECUTE or SDLK_SCANCODE_MASK); + SDLK_HELP = TSDL_KeyCode(SDL_SCANCODE_HELP or SDLK_SCANCODE_MASK); + SDLK_MENU = TSDL_KeyCode(SDL_SCANCODE_MENU or SDLK_SCANCODE_MASK); + SDLK_SELECT = TSDL_KeyCode(SDL_SCANCODE_SELECT or SDLK_SCANCODE_MASK); + SDLK_STOP = TSDL_KeyCode(SDL_SCANCODE_STOP or SDLK_SCANCODE_MASK); + SDLK_AGAIN = TSDL_KeyCode(SDL_SCANCODE_AGAIN or SDLK_SCANCODE_MASK); + SDLK_UNDO = TSDL_KeyCode(SDL_SCANCODE_UNDO or SDLK_SCANCODE_MASK); + SDLK_CUT = TSDL_KeyCode(SDL_SCANCODE_CUT or SDLK_SCANCODE_MASK); + SDLK_COPY = TSDL_KeyCode(SDL_SCANCODE_COPY or SDLK_SCANCODE_MASK); + SDLK_PASTE = TSDL_KeyCode(SDL_SCANCODE_PASTE or SDLK_SCANCODE_MASK); + SDLK_FIND = TSDL_KeyCode(SDL_SCANCODE_FIND or SDLK_SCANCODE_MASK); + SDLK_MUTE = TSDL_KeyCode(SDL_SCANCODE_MUTE or SDLK_SCANCODE_MASK); + SDLK_VOLUMEUP = TSDL_KeyCode(SDL_SCANCODE_VOLUMEUP or SDLK_SCANCODE_MASK); + SDLK_VOLUMEDOWN = TSDL_KeyCode(SDL_SCANCODE_VOLUMEDOWN or SDLK_SCANCODE_MASK); + SDLK_KP_COMMA = TSDL_KeyCode(SDL_SCANCODE_KP_COMMA or SDLK_SCANCODE_MASK); + SDLK_KP_EQUALSAS400 = TSDL_KeyCode(SDL_SCANCODE_KP_EQUALSAS400 or SDLK_SCANCODE_MASK); + + SDLK_ALTERASE = TSDL_KeyCode(SDL_SCANCODE_ALTERASE or SDLK_SCANCODE_MASK); + SDLK_SYSREQ = TSDL_KeyCode(SDL_SCANCODE_SYSREQ or SDLK_SCANCODE_MASK); + SDLK_CANCEL = TSDL_KeyCode(SDL_SCANCODE_CANCEL or SDLK_SCANCODE_MASK); + SDLK_CLEAR = TSDL_KeyCode(SDL_SCANCODE_CLEAR or SDLK_SCANCODE_MASK); + SDLK_PRIOR = TSDL_KeyCode(SDL_SCANCODE_PRIOR or SDLK_SCANCODE_MASK); + SDLK_RETURN2 = TSDL_KeyCode(SDL_SCANCODE_RETURN2 or SDLK_SCANCODE_MASK); + SDLK_SEPARATOR = TSDL_KeyCode(SDL_SCANCODE_SEPARATOR or SDLK_SCANCODE_MASK); + SDLK_OUT = TSDL_KeyCode(SDL_SCANCODE_OUT or SDLK_SCANCODE_MASK); + SDLK_OPER = TSDL_KeyCode(SDL_SCANCODE_OPER or SDLK_SCANCODE_MASK); + SDLK_CLEARAGAIN = TSDL_KeyCode(SDL_SCANCODE_CLEARAGAIN or SDLK_SCANCODE_MASK); + SDLK_CRSEL = TSDL_KeyCode(SDL_SCANCODE_CRSEL or SDLK_SCANCODE_MASK); + SDLK_EXSEL = TSDL_KeyCode(SDL_SCANCODE_EXSEL or SDLK_SCANCODE_MASK); + + SDLK_KP_00 = TSDL_KeyCode(SDL_SCANCODE_KP_00 or SDLK_SCANCODE_MASK); + SDLK_KP_000 = TSDL_KeyCode(SDL_SCANCODE_KP_000 or SDLK_SCANCODE_MASK); + SDLK_THOUSANDSSEPARATOR = TSDL_KeyCode(SDL_SCANCODE_THOUSANDSSEPARATOR or SDLK_SCANCODE_MASK); + SDLK_DECIMALSEPARATOR = TSDL_KeyCode(SDL_SCANCODE_DECIMALSEPARATOR or SDLK_SCANCODE_MASK); + SDLK_CURRENCYUNIT = TSDL_KeyCode(SDL_SCANCODE_CURRENCYUNIT or SDLK_SCANCODE_MASK); + SDLK_CURRENCYSUBUNIT = TSDL_KeyCode(SDL_SCANCODE_CURRENCYSUBUNIT or SDLK_SCANCODE_MASK); + SDLK_KP_LEFTPAREN = TSDL_KeyCode(SDL_SCANCODE_KP_LEFTPAREN or SDLK_SCANCODE_MASK); + SDLK_KP_RIGHTPAREN = TSDL_KeyCode(SDL_SCANCODE_KP_RIGHTPAREN or SDLK_SCANCODE_MASK); + SDLK_KP_LEFTBRACE = TSDL_KeyCode(SDL_SCANCODE_KP_LEFTBRACE or SDLK_SCANCODE_MASK); + SDLK_KP_RIGHTBRACE = TSDL_KeyCode(SDL_SCANCODE_KP_RIGHTBRACE or SDLK_SCANCODE_MASK); + SDLK_KP_TAB = TSDL_KeyCode(SDL_SCANCODE_KP_TAB or SDLK_SCANCODE_MASK); + SDLK_KP_BACKSPACE = TSDL_KeyCode(SDL_SCANCODE_KP_BACKSPACE or SDLK_SCANCODE_MASK); + SDLK_KP_A = TSDL_KeyCode(SDL_SCANCODE_KP_A or SDLK_SCANCODE_MASK); + SDLK_KP_B = TSDL_KeyCode(SDL_SCANCODE_KP_B or SDLK_SCANCODE_MASK); + SDLK_KP_C = TSDL_KeyCode(SDL_SCANCODE_KP_C or SDLK_SCANCODE_MASK); + SDLK_KP_D = TSDL_KeyCode(SDL_SCANCODE_KP_D or SDLK_SCANCODE_MASK); + SDLK_KP_E = TSDL_KeyCode(SDL_SCANCODE_KP_E or SDLK_SCANCODE_MASK); + SDLK_KP_F = TSDL_KeyCode(SDL_SCANCODE_KP_F or SDLK_SCANCODE_MASK); + SDLK_KP_XOR = TSDL_KeyCode(SDL_SCANCODE_KP_XOR or SDLK_SCANCODE_MASK); + SDLK_KP_POWER = TSDL_KeyCode(SDL_SCANCODE_KP_POWER or SDLK_SCANCODE_MASK); + SDLK_KP_PERCENT = TSDL_KeyCode(SDL_SCANCODE_KP_PERCENT or SDLK_SCANCODE_MASK); + SDLK_KP_LESS = TSDL_KeyCode(SDL_SCANCODE_KP_LESS or SDLK_SCANCODE_MASK); + SDLK_KP_GREATER = TSDL_KeyCode(SDL_SCANCODE_KP_GREATER or SDLK_SCANCODE_MASK); + SDLK_KP_AMPERSAND = TSDL_KeyCode(SDL_SCANCODE_KP_AMPERSAND or SDLK_SCANCODE_MASK); + SDLK_KP_DBLAMPERSAND = TSDL_KeyCode(SDL_SCANCODE_KP_DBLAMPERSAND or SDLK_SCANCODE_MASK); + SDLK_KP_VERTICALBAR = TSDL_KeyCode(SDL_SCANCODE_KP_VERTICALBAR or SDLK_SCANCODE_MASK); + SDLK_KP_DBLVERTICALBAR = TSDL_KeyCode(SDL_SCANCODE_KP_DBLVERTICALBAR or SDLK_SCANCODE_MASK); + SDLK_KP_COLON = TSDL_KeyCode(SDL_SCANCODE_KP_COLON or SDLK_SCANCODE_MASK); + SDLK_KP_HASH = TSDL_KeyCode(SDL_SCANCODE_KP_HASH or SDLK_SCANCODE_MASK); + SDLK_KP_SPACE = TSDL_KeyCode(SDL_SCANCODE_KP_SPACE or SDLK_SCANCODE_MASK); + SDLK_KP_AT = TSDL_KeyCode(SDL_SCANCODE_KP_AT or SDLK_SCANCODE_MASK); + SDLK_KP_EXCLAM = TSDL_KeyCode(SDL_SCANCODE_KP_EXCLAM or SDLK_SCANCODE_MASK); + SDLK_KP_MEMSTORE = TSDL_KeyCode(SDL_SCANCODE_KP_MEMSTORE or SDLK_SCANCODE_MASK); + SDLK_KP_MEMRECALL = TSDL_KeyCode(SDL_SCANCODE_KP_MEMRECALL or SDLK_SCANCODE_MASK); + SDLK_KP_MEMCLEAR = TSDL_KeyCode(SDL_SCANCODE_KP_MEMCLEAR or SDLK_SCANCODE_MASK); + SDLK_KP_MEMADD = TSDL_KeyCode(SDL_SCANCODE_KP_MEMADD or SDLK_SCANCODE_MASK); + SDLK_KP_MEMSUBTRACT = TSDL_KeyCode(SDL_SCANCODE_KP_MEMSUBTRACT or SDLK_SCANCODE_MASK); + SDLK_KP_MEMMULTIPLY = TSDL_KeyCode(SDL_SCANCODE_KP_MEMMULTIPLY or SDLK_SCANCODE_MASK); + SDLK_KP_MEMDIVIDE = TSDL_KeyCode(SDL_SCANCODE_KP_MEMDIVIDE or SDLK_SCANCODE_MASK); + SDLK_KP_PLUSMINUS = TSDL_KeyCode(SDL_SCANCODE_KP_PLUSMINUS or SDLK_SCANCODE_MASK); + SDLK_KP_CLEAR = TSDL_KeyCode(SDL_SCANCODE_KP_CLEAR or SDLK_SCANCODE_MASK); + SDLK_KP_CLEARENTRY = TSDL_KeyCode(SDL_SCANCODE_KP_CLEARENTRY or SDLK_SCANCODE_MASK); + SDLK_KP_BINARY = TSDL_KeyCode(SDL_SCANCODE_KP_BINARY or SDLK_SCANCODE_MASK); + SDLK_KP_OCTAL = TSDL_KeyCode(SDL_SCANCODE_KP_OCTAL or SDLK_SCANCODE_MASK); + SDLK_KP_DECIMAL = TSDL_KeyCode(SDL_SCANCODE_KP_DECIMAL or SDLK_SCANCODE_MASK); + SDLK_KP_HEXADECIMAL = TSDL_KeyCode(SDL_SCANCODE_KP_HEXADECIMAL or SDLK_SCANCODE_MASK); + + SDLK_LCTRL = TSDL_KeyCode(SDL_SCANCODE_LCTRL or SDLK_SCANCODE_MASK); + SDLK_LSHIFT = TSDL_KeyCode(SDL_SCANCODE_LSHIFT or SDLK_SCANCODE_MASK); + SDLK_LALT = TSDL_KeyCode(SDL_SCANCODE_LALT or SDLK_SCANCODE_MASK); + SDLK_LGUI = TSDL_KeyCode(SDL_SCANCODE_LGUI or SDLK_SCANCODE_MASK); + SDLK_RCTRL = TSDL_KeyCode(SDL_SCANCODE_RCTRL or SDLK_SCANCODE_MASK); + SDLK_RSHIFT = TSDL_KeyCode(SDL_SCANCODE_RSHIFT or SDLK_SCANCODE_MASK); + SDLK_RALT = TSDL_KeyCode(SDL_SCANCODE_RALT or SDLK_SCANCODE_MASK); + SDLK_RGUI = TSDL_KeyCode(SDL_SCANCODE_RGUI or SDLK_SCANCODE_MASK); + + SDLK_MODE = TSDL_KeyCode(SDL_SCANCODE_MODE or SDLK_SCANCODE_MASK); + + SDLK_AUDIONEXT = TSDL_KeyCode(SDL_SCANCODE_AUDIONEXT or SDLK_SCANCODE_MASK); + SDLK_AUDIOPREV = TSDL_KeyCode(SDL_SCANCODE_AUDIOPREV or SDLK_SCANCODE_MASK); + SDLK_AUDIOSTOP = TSDL_KeyCode(SDL_SCANCODE_AUDIOSTOP or SDLK_SCANCODE_MASK); + SDLK_AUDIOPLAY = TSDL_KeyCode(SDL_SCANCODE_AUDIOPLAY or SDLK_SCANCODE_MASK); + SDLK_AUDIOMUTE = TSDL_KeyCode(SDL_SCANCODE_AUDIOMUTE or SDLK_SCANCODE_MASK); + SDLK_MEDIASELECT = TSDL_KeyCode(SDL_SCANCODE_MEDIASELECT or SDLK_SCANCODE_MASK); + SDLK_WWW = TSDL_KeyCode(SDL_SCANCODE_WWW or SDLK_SCANCODE_MASK); + SDLK_MAIL = TSDL_KeyCode(SDL_SCANCODE_MAIL or SDLK_SCANCODE_MASK); + SDLK_CALCULATOR = TSDL_KeyCode(SDL_SCANCODE_CALCULATOR or SDLK_SCANCODE_MASK); + SDLK_COMPUTER = TSDL_KeyCode(SDL_SCANCODE_COMPUTER or SDLK_SCANCODE_MASK); + SDLK_AC_SEARCH = TSDL_KeyCode(SDL_SCANCODE_AC_SEARCH or SDLK_SCANCODE_MASK); + SDLK_AC_HOME = TSDL_KeyCode(SDL_SCANCODE_AC_HOME or SDLK_SCANCODE_MASK); + SDLK_AC_BACK = TSDL_KeyCode(SDL_SCANCODE_AC_BACK or SDLK_SCANCODE_MASK); + SDLK_AC_FORWARD = TSDL_KeyCode(SDL_SCANCODE_AC_FORWARD or SDLK_SCANCODE_MASK); + SDLK_AC_STOP = TSDL_KeyCode(SDL_SCANCODE_AC_STOP or SDLK_SCANCODE_MASK); + SDLK_AC_REFRESH = TSDL_KeyCode(SDL_SCANCODE_AC_REFRESH or SDLK_SCANCODE_MASK); + SDLK_AC_BOOKMARKS = TSDL_KeyCode(SDL_SCANCODE_AC_BOOKMARKS or SDLK_SCANCODE_MASK); + + SDLK_BRIGHTNESSDOWN = TSDL_KeyCode(SDL_SCANCODE_BRIGHTNESSDOWN or SDLK_SCANCODE_MASK); + SDLK_BRIGHTNESSUP = TSDL_KeyCode(SDL_SCANCODE_BRIGHTNESSUP or SDLK_SCANCODE_MASK); + SDLK_DISPLAYSWITCH = TSDL_KeyCode(SDL_SCANCODE_DISPLAYSWITCH or SDLK_SCANCODE_MASK); + SDLK_KBDILLUMTOGGLE = TSDL_KeyCode(SDL_SCANCODE_KBDILLUMTOGGLE or SDLK_SCANCODE_MASK); + SDLK_KBDILLUMDOWN = TSDL_KeyCode(SDL_SCANCODE_KBDILLUMDOWN or SDLK_SCANCODE_MASK); + SDLK_KBDILLUMUP = TSDL_KeyCode(SDL_SCANCODE_KBDILLUMUP or SDLK_SCANCODE_MASK); + SDLK_EJECT = TSDL_KeyCode(SDL_SCANCODE_EJECT or SDLK_SCANCODE_MASK); + SDLK_SLEEP = TSDL_KeyCode(SDL_SCANCODE_SLEEP or SDLK_SCANCODE_MASK); + SDLK_APP1 = TSDL_KeyCode(SDL_SCANCODE_APP1 or SDLK_SCANCODE_MASK); + SDLK_APP2 = TSDL_KeyCode(SDL_SCANCODE_APP2 or SDLK_SCANCODE_MASK); + + SDLK_AUDIOREWIND = TSDL_KeyCode(SDL_SCANCODE_AUDIOREWIND or SDLK_SCANCODE_MASK); + SDLK_AUDIOFASTFORWARD = TSDL_KeyCode(SDL_SCANCODE_AUDIOFASTFORWARD or SDLK_SCANCODE_MASK); + + SDLK_SOFTLEFT = TSDL_KeyCode(SDL_SCANCODE_SOFTLEFT or SDLK_SCANCODE_MASK); + SDLK_SOFTRIGHT = TSDL_KeyCode(SDL_SCANCODE_SOFTRIGHT or SDLK_SCANCODE_MASK); + SDLK_CALL = TSDL_KeyCode(SDL_SCANCODE_CALL or SDLK_SCANCODE_MASK); + SDLK_ENDCALL = TSDL_KeyCode(SDL_SCANCODE_ENDCALL or SDLK_SCANCODE_MASK); + + {** + * Enumeration of valid key mods (possibly OR'd together). + *} +type + PPSDL_KeyMod = ^PSDL_KeyMod; + PSDL_KeyMod = ^TSDL_KeyMod; + TSDL_KeyMod = type cint; + +const + KMOD_NONE = TSDL_KeyMod($0000); + KMOD_LSHIFT = TSDL_KeyMod($0001); + KMOD_RSHIFT = TSDL_KeyMod($0002); + KMOD_LCTRL = TSDL_KeyMod($0040); + KMOD_RCTRL = TSDL_KeyMod($0080); + KMOD_LALT = TSDL_KeyMod($0100); + KMOD_RALT = TSDL_KeyMod($0200); + KMOD_LGUI = TSDL_KeyMod($0400); + KMOD_RGUI = TSDL_KeyMod($0800); + KMOD_NUM = TSDL_KeyMod($1000); + KMOD_CAPS = TSDL_KeyMod($2000); + KMOD_MODE = TSDL_KeyMod($4000); + KMOD_SCROLL = TSDL_KeyMod($8000); + + KMOD_CTRL = KMOD_LCTRL or KMOD_RCTRL; + KMOD_SHIFT = KMOD_LSHIFT or KMOD_RSHIFT; + KMOD_ALT = KMOD_LALT or KMOD_RALT; + KMOD_GUI = KMOD_LGUI or KMOD_RGUI; + + KMOD_RESERVED = KMOD_SCROLL; {* This is for source-level compatibility with SDL 2.0.0. *} diff --git a/units/sdlloadso.inc b/units/sdlloadso.inc index fb5a4236..8289ced0 100644 --- a/units/sdlloadso.inc +++ b/units/sdlloadso.inc @@ -1,76 +1,92 @@ -//from sdl_loadso.h - -{* - * \file SDL_loadso.h - * - * System dependent library loading routines - * - * Some things to keep in mind: - * \li These functions only work on C function names. Other languages may - * have name mangling and intrinsic language support that varies from - * compiler to compiler. - * \li Make sure you declare your function pointers with the same calling - * convention as the actual library function. Your code will crash - * mysteriously if you do not do this. - * \li Avoid namespace collisions. If you load a symbol from the library, - * it is not defined whether or not it goes into the global symbol - * namespace for the application. If it does and it conflicts with - * symbols in your code or other shared libraries, you will not get - * the results you expect.:) - } - -{* - * Dynamically load a shared object. - * - * \param sofile a system-dependent name of the object file - * \returns an opaque pointer to the object handle or nil if there was an - * error; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_LoadFunction - * \sa SDL_UnloadObject - } -function SDL_LoadObject(sofile: PAnsiChar): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadObject' {$ENDIF} {$ENDIF}; - -{* - * Look up the address of the named function in a shared object. - * - * This function pointer is no longer valid after calling SDL_UnloadObject(). - * - * This function can only look up C function names. Other languages may have - * name mangling and intrinsic language support that varies from compiler to - * compiler. - * - * Make sure you declare your function pointers with the same calling - * convention as the actual library function. Your code will crash - * mysteriously if you do not do this. - * - * If the requested function doesn't exist, nil is returned. - * - * \param handle a valid shared object handle returned by SDL_LoadObject() - * \param name the name of the function to look up - * \returns a pointer to the function or nil if there was an error; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_LoadObject - * \sa SDL_UnloadObject - } -function SDL_LoadFunction(handle: Pointer; name: PAnsiChar): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadFunction' {$ENDIF} {$ENDIF}; - -{* - * Unload a shared object from memory. - * - * \param handle a valid shared object handle returned by SDL_LoadObject() - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_LoadFunction - * \sa SDL_LoadObject - } -procedure SDL_UnloadObject(handle: Pointer); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnloadObject' {$ENDIF} {$ENDIF}; +//from sdl_loadso.h + +{* + * \file SDL_loadso.h + * + * System dependent library loading routines + * + * Some things to keep in mind: + * \li These functions only work on C function names. Other languages may + * have name mangling and intrinsic language support that varies from + * compiler to compiler. + * \li Make sure you declare your function pointers with the same calling + * convention as the actual library function. Your code will crash + * mysteriously if you do not do this. + * \li Avoid namespace collisions. If you load a symbol from the library, + * it is not defined whether or not it goes into the global symbol + * namespace for the application. If it does and it conflicts with + * symbols in your code or other shared libraries, you will not get + * the results you expect.:) + } + +{* + * Dynamically load a shared object. + * + * \param sofile a system-dependent name of the object file + * \returns an opaque pointer to the object handle or nil if there was an + * error; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_LoadFunction + * \sa SDL_UnloadObject + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LoadObject_fun = function(sofile: PAnsiChar): Pointer; cdecl; +Var + SDL_LoadObject : TSDL_LoadObject_fun = Nil; +{$else} + +function SDL_LoadObject(sofile: PAnsiChar): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadObject' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Look up the address of the named function in a shared object. + * + * This function pointer is no longer valid after calling SDL_UnloadObject(). + * + * This function can only look up C function names. Other languages may have + * name mangling and intrinsic language support that varies from compiler to + * compiler. + * + * Make sure you declare your function pointers with the same calling + * convention as the actual library function. Your code will crash + * mysteriously if you do not do this. + * + * If the requested function doesn't exist, nil is returned. + * + * \param handle a valid shared object handle returned by SDL_LoadObject() + * \param name the name of the function to look up + * \returns a pointer to the function or nil if there was an error; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_LoadObject + * \sa SDL_UnloadObject + } +function SDL_LoadFunction(handle: Pointer; name: PAnsiChar): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadFunction' {$ENDIF} {$ENDIF}; + +{* + * Unload a shared object from memory. + * + * \param handle a valid shared object handle returned by SDL_LoadObject() + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_LoadFunction + * \sa SDL_LoadObject + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UnloadObject_proc = procedure(handle: Pointer); cdecl; +Var + SDL_UnloadObject : TSDL_UnloadObject_proc = Nil; +{$else} + +procedure SDL_UnloadObject(handle: Pointer); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnloadObject' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdllocale.inc b/units/sdllocale.inc index 9230152b..472bf3b8 100644 --- a/units/sdllocale.inc +++ b/units/sdllocale.inc @@ -1,54 +1,54 @@ -// based on SDL_locale.h - -type - PPSDL_Locale = ^PSDL_Locale; - PSDL_Locale = ^TSDL_Locale; - TSDL_Locale = record - // A language name, like 'en' for English. - language: PAnsiChar; - // A country, like 'US' for America. Can be NIL. - country: PAnsiChar; - end; - -{** - * \brief Report the user's preferred locale. - * - * This returns an array of SDL_Locale structs, the final item zeroed out. - * When the caller is done with this array, it should call SDL_free() on - * the returned value; all the memory involved is allocated in a single - * block, so a single SDL_free() will suffice. - * - * Returned language strings are in the format xx, where 'xx' is an ISO-639 - * language specifier (such as 'en' for English, 'de' for German, etc). - * Country strings are in the format YY, where 'YY' is an ISO-3166 country - * code (such as "US" for the United States, 'CA' for Canada, etc). Country - * might be NULL if there's no specific guidance on them (so you might get - * ( 'en', 'US' ) for American English, but ( 'en', NIL ) means "English - * language, generically"). Language strings are never NIL, except to - * terminate the array. - * - * Please note that not all of these strings are 2 characters; some are - * three or more. - * - * The returned list of locales are in the order of the user's preference. - * For example, a German citizen that is fluent in US English and knows - * enough Japanese to navigate around Tokyo might have a list like: - * [ 'de', 'en_US', 'jp', NIL ]. Someone from England might prefer British - * English (where "color" is spelled "colour", etc), but will settle for - * anything like it: [ 'en_GB', 'en', NIL ]. - * - * This function returns NIL on error, including when the platform does not - * supply this information at all. - * - * This might be a "slow" call that has to query the operating system. It's - * best to ask for this once and save the results. However, this list can - * change, usually because the user has changed a system preference outside - * of your program; SDL will send an SDL_LOCALECHANGED event in this case, - * if possible, and you can call this function again to get an updated copy - * of preferred locales. - * - * \return array of locales, terminated with a locale with a NIL language - * field. Will return NIL on error. - *} -function SDL_GetPreferredLocales(): PSDL_Locale; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPreferredLocales' {$ENDIF} {$ENDIF}; +// based on SDL_locale.h + +type + PPSDL_Locale = ^PSDL_Locale; + PSDL_Locale = ^TSDL_Locale; + TSDL_Locale = record + // A language name, like 'en' for English. + language: PAnsiChar; + // A country, like 'US' for America. Can be NIL. + country: PAnsiChar; + end; + +{** + * \brief Report the user's preferred locale. + * + * This returns an array of SDL_Locale structs, the final item zeroed out. + * When the caller is done with this array, it should call SDL_free() on + * the returned value; all the memory involved is allocated in a single + * block, so a single SDL_free() will suffice. + * + * Returned language strings are in the format xx, where 'xx' is an ISO-639 + * language specifier (such as 'en' for English, 'de' for German, etc). + * Country strings are in the format YY, where 'YY' is an ISO-3166 country + * code (such as "US" for the United States, 'CA' for Canada, etc). Country + * might be NULL if there's no specific guidance on them (so you might get + * ( 'en', 'US' ) for American English, but ( 'en', NIL ) means "English + * language, generically"). Language strings are never NIL, except to + * terminate the array. + * + * Please note that not all of these strings are 2 characters; some are + * three or more. + * + * The returned list of locales are in the order of the user's preference. + * For example, a German citizen that is fluent in US English and knows + * enough Japanese to navigate around Tokyo might have a list like: + * [ 'de', 'en_US', 'jp', NIL ]. Someone from England might prefer British + * English (where "color" is spelled "colour", etc), but will settle for + * anything like it: [ 'en_GB', 'en', NIL ]. + * + * This function returns NIL on error, including when the platform does not + * supply this information at all. + * + * This might be a "slow" call that has to query the operating system. It's + * best to ask for this once and save the results. However, this list can + * change, usually because the user has changed a system preference outside + * of your program; SDL will send an SDL_LOCALECHANGED event in this case, + * if possible, and you can call this function again to get an updated copy + * of preferred locales. + * + * \return array of locales, terminated with a locale with a NIL language + * field. Will return NIL on error. + *} +function SDL_GetPreferredLocales(): PSDL_Locale; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPreferredLocales' {$ENDIF} {$ENDIF}; diff --git a/units/sdllog.inc b/units/sdllog.inc index 23e1bc12..2da1f31e 100644 --- a/units/sdllog.inc +++ b/units/sdllog.inc @@ -1,173 +1,277 @@ - -//since the array of const in delphi is not C compatible: -{$IFDEF FPC} - -{** - * \brief The maximum size of a log message - * - * Messages longer than the maximum size will be truncated - *} -const - SDL_MAX_LOG_MESSAGE = 4096; - -{** - * \brief The predefined log categories - * - * By default the application category is enabled at the INFO level, - * the assert category is enabled at the WARN level, test is enabled - * at the VERBOSE level and all other categories are enabled at the - * CRITICAL level. - *} -type - PPSDL_LogCategory = ^PSDL_LogCategory; - PSDL_LogCategory = ^TSDL_LogCategory; - TSDL_LogCategory = type cint; - -const - SDL_LOG_CATEGORY_APPLICATION = TSDL_LogCategory(0); - SDL_LOG_CATEGORY_ERROR = TSDL_LogCategory(1); - SDL_LOG_CATEGORY_ASSERT = TSDL_LogCategory(2); - SDL_LOG_CATEGORY_SYSTEM = TSDL_LogCategory(3); - SDL_LOG_CATEGORY_AUDIO = TSDL_LogCategory(4); - SDL_LOG_CATEGORY_VIDEO = TSDL_LogCategory(5); - SDL_LOG_CATEGORY_RENDER = TSDL_LogCategory(6); - SDL_LOG_CATEGORY_INPUT = TSDL_LogCategory(7); - SDL_LOG_CATEGORY_TEST = TSDL_LogCategory(8); - - {* Reserved for future SDL library use *} - SDL_LOG_CATEGORY_RESERVED1 = TSDL_LogCategory(9); - SDL_LOG_CATEGORY_RESERVED2 = TSDL_LogCategory(10); - SDL_LOG_CATEGORY_RESERVED3 = TSDL_LogCategory(11); - SDL_LOG_CATEGORY_RESERVED4 = TSDL_LogCategory(12); - SDL_LOG_CATEGORY_RESERVED5 = TSDL_LogCategory(13); - SDL_LOG_CATEGORY_RESERVED6 = TSDL_LogCategory(14); - SDL_LOG_CATEGORY_RESERVED7 = TSDL_LogCategory(15); - SDL_LOG_CATEGORY_RESERVED8 = TSDL_LogCategory(16); - SDL_LOG_CATEGORY_RESERVED9 = TSDL_LogCategory(17); - SDL_LOG_CATEGORY_RESERVED10 = TSDL_LogCategory(18); - - {* Beyond this point is reserved for application use *} - SDL_LOG_CATEGORY_CUSTOM = TSDL_LogCategory(19); - -{** - * \brief The predefined log priorities - *} -type - PPSDL_LogPriority = ^PSDL_LogPriority; - PSDL_LogPriority = ^TSDL_LogPriority; - TSDL_LogPriority = type cint32; -const - SDL_LOG_PRIORITY_VERBOSE = TSDL_LogPriority(1); - SDL_LOG_PRIORITY_DEBUG = TSDL_LogPriority(2); - SDL_LOG_PRIORITY_INFO = TSDL_LogPriority(3); - SDL_LOG_PRIORITY_WARN = TSDL_LogPriority(4); - SDL_LOG_PRIORITY_ERROR = TSDL_LogPriority(5); - SDL_LOG_PRIORITY_CRITICAL = TSDL_LogPriority(6); - SDL_NUM_LOG_PRIORITIES = TSDL_LogPriority(7); - -{** - * \brief Set the priority of all log categories - *} -procedure SDL_LogSetAllPriority(priority: TSDL_LogPriority); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogSetAllPriority' {$ENDIF} {$ENDIF}; - -{** - * \brief Set the priority of a particular log category - *} -procedure SDL_LogSetPriority(category: TSDL_LogCategory; priority: TSDL_LogPriority); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogSetPriority' {$ENDIF} {$ENDIF}; - -{** - * \brief Get the priority of a particular log category - *} -function SDL_LogGetPriority(category: TSDL_LogCategory): TSDL_LogPriority; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogGetPriority' {$ENDIF} {$ENDIF}; - -{** - * \brief Reset all priorities to default. - * - * \note This is called in SDL_Quit(). - *} -procedure SDL_LogResetPriorities(); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogResetPriorities' {$ENDIF} {$ENDIF}; - -{** - * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO - *} -procedure SDL_Log(const fmt: PAnsiChar; pars: array of const); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Log' {$ENDIF} {$ENDIF}; - -{** - * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE - *} -procedure SDL_LogVerbose(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogVerbose' {$ENDIF} {$ENDIF}; - -{** - * \brief Log a message with SDL_LOG_PRIORITY_DEBUG - *} -procedure SDL_LogDebug(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogDebug' {$ENDIF} {$ENDIF}; - -{** - * \brief Log a message with SDL_LOG_PRIORITY_INFO - *} -procedure SDL_LogInfo(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogInfo' {$ENDIF} {$ENDIF}; - -{** - * \brief Log a message with SDL_LOG_PRIORITY_WARN - *} -procedure SDL_LogWarn(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogWarn' {$ENDIF} {$ENDIF}; - -{** - * \brief Log a message with SDL_LOG_PRIORITY_ERROR - *} -procedure SDL_LogError(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogError' {$ENDIF} {$ENDIF}; - -{** - * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL - *} -procedure SDL_LogCritical(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogCritical' {$ENDIF} {$ENDIF}; - -{** - * \brief Log a message with the specified category and priority. - *} -procedure SDL_LogMessage(category: TSDL_LogCategory; priority: TSDL_LogPriority; const fmt: PAnsiChar; pars: array of const); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogMessage' {$ENDIF} {$ENDIF}; - -{** - * \brief Log a message with the specified category and priority. - *} -procedure SDL_LogMessageV(category: TSDL_LogCategory; priority: TSDL_LogPriority; const fmt: PAnsiChar; ap: array of const); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogMessageV' {$ENDIF} {$ENDIF}; - -{** - * \brief The prototype for the log output function - *} -type - PPSDL_LogOutputFunction = ^PSDL_LogOutputFunction; - PSDL_LogOutputFunction = ^TSDL_LogOutputFunction; - TSDL_LogOutputFunction = procedure( - userdata: Pointer; - category: TSDL_LogCategory; - priority: TSDL_LogPriority; - const msg: PAnsiChar); cdecl; - -{** - * \brief Get the current log output function. - *} -procedure SDL_LogGetOutputFunction(callback: PSDL_LogOutputFunction; userdata: PPointer); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogGetOutputFunction' {$ENDIF} {$ENDIF}; - -{** - * \brief This function allows you to replace the default log output - * function with one of your own. - *} -procedure SDL_LogSetOutputFunction(callback: TSDL_LogOutputFunction; userdata: Pointer); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogSetOutputFunction' {$ENDIF} {$ENDIF}; - -{$ENDIF} + +//since the array of const in delphi is not C compatible: +{$IFDEF FPC} + +{** + * \brief The maximum size of a log message + * + * Messages longer than the maximum size will be truncated + *} +const + SDL_MAX_LOG_MESSAGE = 4096; + +{** + * \brief The predefined log categories + * + * By default the application category is enabled at the INFO level, + * the assert category is enabled at the WARN level, test is enabled + * at the VERBOSE level and all other categories are enabled at the + * CRITICAL level. + *} +type + PPSDL_LogCategory = ^PSDL_LogCategory; + PSDL_LogCategory = ^TSDL_LogCategory; + TSDL_LogCategory = type cint; + +const + SDL_LOG_CATEGORY_APPLICATION = TSDL_LogCategory(0); + SDL_LOG_CATEGORY_ERROR = TSDL_LogCategory(1); + SDL_LOG_CATEGORY_ASSERT = TSDL_LogCategory(2); + SDL_LOG_CATEGORY_SYSTEM = TSDL_LogCategory(3); + SDL_LOG_CATEGORY_AUDIO = TSDL_LogCategory(4); + SDL_LOG_CATEGORY_VIDEO = TSDL_LogCategory(5); + SDL_LOG_CATEGORY_RENDER = TSDL_LogCategory(6); + SDL_LOG_CATEGORY_INPUT = TSDL_LogCategory(7); + SDL_LOG_CATEGORY_TEST = TSDL_LogCategory(8); + + {* Reserved for future SDL library use *} + SDL_LOG_CATEGORY_RESERVED1 = TSDL_LogCategory(9); + SDL_LOG_CATEGORY_RESERVED2 = TSDL_LogCategory(10); + SDL_LOG_CATEGORY_RESERVED3 = TSDL_LogCategory(11); + SDL_LOG_CATEGORY_RESERVED4 = TSDL_LogCategory(12); + SDL_LOG_CATEGORY_RESERVED5 = TSDL_LogCategory(13); + SDL_LOG_CATEGORY_RESERVED6 = TSDL_LogCategory(14); + SDL_LOG_CATEGORY_RESERVED7 = TSDL_LogCategory(15); + SDL_LOG_CATEGORY_RESERVED8 = TSDL_LogCategory(16); + SDL_LOG_CATEGORY_RESERVED9 = TSDL_LogCategory(17); + SDL_LOG_CATEGORY_RESERVED10 = TSDL_LogCategory(18); + + {* Beyond this point is reserved for application use *} + SDL_LOG_CATEGORY_CUSTOM = TSDL_LogCategory(19); + +{** + * \brief The predefined log priorities + *} +type + PPSDL_LogPriority = ^PSDL_LogPriority; + PSDL_LogPriority = ^TSDL_LogPriority; + TSDL_LogPriority = type cint32; +const + SDL_LOG_PRIORITY_VERBOSE = TSDL_LogPriority(1); + SDL_LOG_PRIORITY_DEBUG = TSDL_LogPriority(2); + SDL_LOG_PRIORITY_INFO = TSDL_LogPriority(3); + SDL_LOG_PRIORITY_WARN = TSDL_LogPriority(4); + SDL_LOG_PRIORITY_ERROR = TSDL_LogPriority(5); + SDL_LOG_PRIORITY_CRITICAL = TSDL_LogPriority(6); + SDL_NUM_LOG_PRIORITIES = TSDL_LogPriority(7); + +{** + * \brief Set the priority of all log categories + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogSetAllPriority_proc = procedure(priority: TSDL_LogPriority); cdecl; +Var + SDL_LogSetAllPriority : TSDL_LogSetAllPriority_proc = Nil; +{$else} + +procedure SDL_LogSetAllPriority(priority: TSDL_LogPriority); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogSetAllPriority' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Set the priority of a particular log category + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogSetPriority_proc = procedure(category: TSDL_LogCategory; priority: TSDL_LogPriority); cdecl; +Var + SDL_LogSetPriority : TSDL_LogSetPriority_proc = Nil; +{$else} + +procedure SDL_LogSetPriority(category: TSDL_LogCategory; priority: TSDL_LogPriority); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogSetPriority' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Get the priority of a particular log category + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogGetPriority_fun = function(category: TSDL_LogCategory): TSDL_LogPriority; cdecl; +Var + SDL_LogGetPriority : TSDL_LogGetPriority_fun = Nil; +{$else} + +function SDL_LogGetPriority(category: TSDL_LogCategory): TSDL_LogPriority; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogGetPriority' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Reset all priorities to default. + * + * \note This is called in SDL_Quit(). + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogResetPriorities_proc = procedure(); cdecl; +Var + SDL_LogResetPriorities : TSDL_LogResetPriorities_proc = Nil; +{$else} + +procedure SDL_LogResetPriorities(); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogResetPriorities' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_Log_proc = procedure(const fmt: PAnsiChar; pars: array of const); cdecl; +Var + SDL_Log : TSDL_Log_proc = Nil; +{$else} + +procedure SDL_Log(const fmt: PAnsiChar; pars: array of const); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Log' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogVerbose_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; +Var + SDL_LogVerbose : TSDL_LogVerbose_proc = Nil; +{$else} + +procedure SDL_LogVerbose(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogVerbose' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Log a message with SDL_LOG_PRIORITY_DEBUG + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogDebug_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; +Var + SDL_LogDebug : TSDL_LogDebug_proc = Nil; +{$else} + +procedure SDL_LogDebug(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogDebug' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Log a message with SDL_LOG_PRIORITY_INFO + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogInfo_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; +Var + SDL_LogInfo : TSDL_LogInfo_proc = Nil; +{$else} + +procedure SDL_LogInfo(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogInfo' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Log a message with SDL_LOG_PRIORITY_WARN + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogWarn_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; +Var + SDL_LogWarn : TSDL_LogWarn_proc = Nil; +{$else} + +procedure SDL_LogWarn(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogWarn' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Log a message with SDL_LOG_PRIORITY_ERROR + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogError_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; +Var + SDL_LogError : TSDL_LogError_proc = Nil; +{$else} + +procedure SDL_LogError(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogError' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogCritical_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; +Var + SDL_LogCritical : TSDL_LogCritical_proc = Nil; +{$else} + +procedure SDL_LogCritical(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogCritical' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Log a message with the specified category and priority. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogMessage_proc = procedure(category: TSDL_LogCategory; priority: TSDL_LogPriority; const fmt: PAnsiChar; pars: array of const); cdecl; +Var + SDL_LogMessage : TSDL_LogMessage_proc = Nil; +{$else} + +procedure SDL_LogMessage(category: TSDL_LogCategory; priority: TSDL_LogPriority; const fmt: PAnsiChar; pars: array of const); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogMessage' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Log a message with the specified category and priority. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogMessageV_proc = procedure(category: TSDL_LogCategory; priority: TSDL_LogPriority; const fmt: PAnsiChar; ap: array of const); cdecl; +Var + SDL_LogMessageV : TSDL_LogMessageV_proc = Nil; +{$else} + +procedure SDL_LogMessageV(category: TSDL_LogCategory; priority: TSDL_LogPriority; const fmt: PAnsiChar; ap: array of const); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogMessageV' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief The prototype for the log output function + *} +type + PPSDL_LogOutputFunction = ^PSDL_LogOutputFunction; + PSDL_LogOutputFunction = ^TSDL_LogOutputFunction; + TSDL_LogOutputFunction = procedure( + userdata: Pointer; + category: TSDL_LogCategory; + priority: TSDL_LogPriority; + const msg: PAnsiChar); cdecl; + +{** + * \brief Get the current log output function. + *} +procedure SDL_LogGetOutputFunction(callback: PSDL_LogOutputFunction; userdata: PPointer); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogGetOutputFunction' {$ENDIF} {$ENDIF}; + +{** + * \brief This function allows you to replace the default log output + * function with one of your own. + *} +procedure SDL_LogSetOutputFunction(callback: TSDL_LogOutputFunction; userdata: Pointer); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogSetOutputFunction' {$ENDIF} {$ENDIF}; + +{$ENDIF} diff --git a/units/sdlmessagebox.inc b/units/sdlmessagebox.inc index c9926db6..0e5f6949 100644 --- a/units/sdlmessagebox.inc +++ b/units/sdlmessagebox.inc @@ -1,124 +1,140 @@ -//from "sdl_messagebox.h" - -{** - * SDL_MessageBox flags. If supported will display warning icon, etc. - *} -type - PPSDL_MessageBoxFlags = ^PSDL_MessageBoxFlags; - PSDL_MessageBoxFlags = ^TSDL_MessageBoxFlags; - TSDL_MessageBoxFlags = type cuint32; - -const - SDL_MESSAGEBOX_ERROR = TSDL_MessageBoxFlags($00000010); {**< error dialog *} - SDL_MESSAGEBOX_WARNING = TSDL_MessageBoxFlags($00000020); {**< warning dialog *} - SDL_MESSAGEBOX_INFORMATION = TSDL_MessageBoxFlags($00000040); {**< informational dialog *} - SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = TSDL_MessageBoxFlags($00000080); {/**< buttons placed left to right */} - SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = TSDL_MessageBoxFlags($00000100); {/**< buttons placed right to left */} - -{** - * Flags for SDL_MessageBoxButtonData. - *} -type - PPSDL_MessageBoxButtonFlags = ^PSDL_MessageBoxButtonFlags; - PSDL_MessageBoxButtonFlags = ^TSDL_MessageBoxButtonFlags; - TSDL_MessageBoxButtonFlags = type cuint32; - -const - SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = TSDL_MessageBoxButtonFlags($00000001); {**< Marks the default button when return is hit *} - SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = TSDL_MessageBoxButtonFlags($00000002); {**< Marks the default button when escape is hit *} - - -{** - * Individual button data. - *} -type - PPSDL_MessageBoxButtonData = ^PSDL_MessageBoxButtonData; - PSDL_MessageBoxButtonData = ^TSDL_MessageBoxButtonData; - TSDL_MessageBoxButtonData = record - flags: TSDL_MessageBoxButtonFlags; {**< ::SDL_MessageBoxButtonFlags *} - buttonid: cint; {**< User defined button id (value returned via SDL_ShowMessageBox) *} - text: PAnsiChar; {**< The UTF-8 button text *} - end; - -{** - * RGB value used in a message box color scheme - *} -type - PPSDL_MessageBoxColor = ^PSDL_MessageBoxColor; - PSDL_MessageBoxColor = ^TSDL_MessageBoxColor; - TSDL_MessageBoxColor = record - r, g, b: cuint8; - end; - - PPSDL_MessageBoxColorType = ^PSDL_MessageBoxColorType; - PSDL_MessageBoxColorType = ^TSDL_MessageBoxColorType; - TSDL_MessageBoxColorType = type Word; - -const - SDL_MESSAGEBOX_COLOR_BACKGROUND = TSDL_MessageBoxColorType(0); - SDL_MESSAGEBOX_COLOR_TEXT = TSDL_MessageBoxColorType(1); - SDL_MESSAGEBOX_COLOR_BUTTON_BORDER = TSDL_MessageBoxColorType(2); - SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND = TSDL_MessageBoxColorType(3); - SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED = TSDL_MessageBoxColorType(4); - SDL_MESSAGEBOX_COLOR_MAX = TSDL_MessageBoxColorType(5); - - {** - * A set of colors to use for message box dialogs - *} -type - PPSDL_MessageBoxColorScheme = ^PSDL_MessageBoxColorScheme; - PSDL_MessageBoxColorScheme = ^TSDL_MessageBoxColorScheme; - TSDL_MessageBoxColorScheme = record - colors: array[0..SDL_MESSAGEBOX_COLOR_MAX-1] of TSDL_MessageBoxColor; - end; - - {** - * MessageBox structure containing title, text, window, etc. - *} -type - PPSDL_MessageBoxData = ^PSDL_MessageBoxData; - PSDL_MessageBoxData = ^TSDL_MessageBoxData; - TSDL_MessageBoxData = record - flags: TSDL_MessageBoxFlags; {**< SDL_MessageBoxFlags *} - window: PSDL_Window; {**< Parent window, can be NULL *} - title: PAnsiChar; {**< UTF-8 title *} - _message: PAnsiChar; {**< UTF-8 message text *} - - numbuttons: cint; - buttons: PSDL_MessageBoxButtonData; - - colorScheme: PSDL_MessageBoxColorScheme; {**< SDL_MessageBoxColorScheme, can be NULL to use system settings *} - end; - -{** - * Create a modal message box. - * - * messageboxdata The SDL_MessageBoxData structure with title, text, etc. - * buttonid The pointer to which user id of hit button should be copied. - * - * -1 on error, otherwise 0 and buttonid contains user id of button - * hit or -1 if dialog was closed. - * - * This function should be called on the thread that created the parent - * window, or on the main thread if the messagebox has no parent. It will - * block execution of that thread until the user clicks a button or - * closes the messagebox. - *} -function SDL_ShowMessageBox(messageboxdata: PSDL_MessageBoxData; buttonid: pcint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ShowMessageBox' {$ENDIF} {$ENDIF}; - -{** - * Create a simple modal message box - * - * flags SDL_MessageBoxFlags - * title UTF-8 title text - * message UTF-8 message text - * window The parent window, or NULL for no parent - * - * 0 on success, -1 on error - * - * SDL_ShowMessageBox - *} -function SDL_ShowSimpleMessageBox(flags: TSDL_MessageBoxFlags; title: PAnsiChar; _message: PAnsiChar; window: PSDL_Window): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ShowSimpleMessageBox' {$ENDIF} {$ENDIF}; - +//from "sdl_messagebox.h" + +{** + * SDL_MessageBox flags. If supported will display warning icon, etc. + *} +type + PPSDL_MessageBoxFlags = ^PSDL_MessageBoxFlags; + PSDL_MessageBoxFlags = ^TSDL_MessageBoxFlags; + TSDL_MessageBoxFlags = type cuint32; + +const + SDL_MESSAGEBOX_ERROR = TSDL_MessageBoxFlags($00000010); {**< error dialog *} + SDL_MESSAGEBOX_WARNING = TSDL_MessageBoxFlags($00000020); {**< warning dialog *} + SDL_MESSAGEBOX_INFORMATION = TSDL_MessageBoxFlags($00000040); {**< informational dialog *} + SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = TSDL_MessageBoxFlags($00000080); {/**< buttons placed left to right */} + SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = TSDL_MessageBoxFlags($00000100); {/**< buttons placed right to left */} + +{** + * Flags for SDL_MessageBoxButtonData. + *} +type + PPSDL_MessageBoxButtonFlags = ^PSDL_MessageBoxButtonFlags; + PSDL_MessageBoxButtonFlags = ^TSDL_MessageBoxButtonFlags; + TSDL_MessageBoxButtonFlags = type cuint32; + +const + SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = TSDL_MessageBoxButtonFlags($00000001); {**< Marks the default button when return is hit *} + SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = TSDL_MessageBoxButtonFlags($00000002); {**< Marks the default button when escape is hit *} + + +{** + * Individual button data. + *} +type + PPSDL_MessageBoxButtonData = ^PSDL_MessageBoxButtonData; + PSDL_MessageBoxButtonData = ^TSDL_MessageBoxButtonData; + TSDL_MessageBoxButtonData = record + flags: TSDL_MessageBoxButtonFlags; {**< ::SDL_MessageBoxButtonFlags *} + buttonid: cint; {**< User defined button id (value returned via SDL_ShowMessageBox) *} + text: PAnsiChar; {**< The UTF-8 button text *} + end; + +{** + * RGB value used in a message box color scheme + *} +type + PPSDL_MessageBoxColor = ^PSDL_MessageBoxColor; + PSDL_MessageBoxColor = ^TSDL_MessageBoxColor; + TSDL_MessageBoxColor = record + r, g, b: cuint8; + end; + + PPSDL_MessageBoxColorType = ^PSDL_MessageBoxColorType; + PSDL_MessageBoxColorType = ^TSDL_MessageBoxColorType; + TSDL_MessageBoxColorType = type Word; + +const + SDL_MESSAGEBOX_COLOR_BACKGROUND = TSDL_MessageBoxColorType(0); + SDL_MESSAGEBOX_COLOR_TEXT = TSDL_MessageBoxColorType(1); + SDL_MESSAGEBOX_COLOR_BUTTON_BORDER = TSDL_MessageBoxColorType(2); + SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND = TSDL_MessageBoxColorType(3); + SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED = TSDL_MessageBoxColorType(4); + SDL_MESSAGEBOX_COLOR_MAX = TSDL_MessageBoxColorType(5); + + {** + * A set of colors to use for message box dialogs + *} +type + PPSDL_MessageBoxColorScheme = ^PSDL_MessageBoxColorScheme; + PSDL_MessageBoxColorScheme = ^TSDL_MessageBoxColorScheme; + TSDL_MessageBoxColorScheme = record + colors: array[0..SDL_MESSAGEBOX_COLOR_MAX-1] of TSDL_MessageBoxColor; + end; + + {** + * MessageBox structure containing title, text, window, etc. + *} +type + PPSDL_MessageBoxData = ^PSDL_MessageBoxData; + PSDL_MessageBoxData = ^TSDL_MessageBoxData; + TSDL_MessageBoxData = record + flags: TSDL_MessageBoxFlags; {**< SDL_MessageBoxFlags *} + window: PSDL_Window; {**< Parent window, can be NULL *} + title: PAnsiChar; {**< UTF-8 title *} + _message: PAnsiChar; {**< UTF-8 message text *} + + numbuttons: cint; + buttons: PSDL_MessageBoxButtonData; + + colorScheme: PSDL_MessageBoxColorScheme; {**< SDL_MessageBoxColorScheme, can be NULL to use system settings *} + end; + +{** + * Create a modal message box. + * + * messageboxdata The SDL_MessageBoxData structure with title, text, etc. + * buttonid The pointer to which user id of hit button should be copied. + * + * -1 on error, otherwise 0 and buttonid contains user id of button + * hit or -1 if dialog was closed. + * + * This function should be called on the thread that created the parent + * window, or on the main thread if the messagebox has no parent. It will + * block execution of that thread until the user clicks a button or + * closes the messagebox. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ShowMessageBox_fun = function(messageboxdata: PSDL_MessageBoxData; buttonid: pcint): cint; cdecl; +Var + SDL_ShowMessageBox : TSDL_ShowMessageBox_fun = Nil; +{$else} + +function SDL_ShowMessageBox(messageboxdata: PSDL_MessageBoxData; buttonid: pcint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ShowMessageBox' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Create a simple modal message box + * + * flags SDL_MessageBoxFlags + * title UTF-8 title text + * message UTF-8 message text + * window The parent window, or NULL for no parent + * + * 0 on success, -1 on error + * + * SDL_ShowMessageBox + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ShowSimpleMessageBox_fun = function(flags: TSDL_MessageBoxFlags; title: PAnsiChar; _message: PAnsiChar; window: PSDL_Window): cint; cdecl; +Var + SDL_ShowSimpleMessageBox : TSDL_ShowSimpleMessageBox_fun = Nil; +{$else} + +function SDL_ShowSimpleMessageBox(flags: TSDL_MessageBoxFlags; title: PAnsiChar; _message: PAnsiChar; window: PSDL_Window): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ShowSimpleMessageBox' {$ENDIF} {$ENDIF}; +{$endif} + diff --git a/units/sdlmisc.inc b/units/sdlmisc.inc index a975c072..6ccc47ae 100644 --- a/units/sdlmisc.inc +++ b/units/sdlmisc.inc @@ -1,29 +1,29 @@ -// based on SDL_misc.h - -{** - * \brief Open an URL / URI in the browser or other - * - * Open a URL in a separate, system-provided application. How this works will - * vary wildly depending on the platform. This will likely launch what - * makes sense to handle a specific URL's protocol (a web browser for http://, - * etc), but it might also be able to launch file managers for directories - * and other things. - * - * What happens when you open a URL varies wildly as well: your game window - * may lose focus (and may or may not lose focus if your game was fullscreen - * or grabbing input at the time). On mobile devices, your app will likely - * move to the background or your process might be paused. Any given platform - * may or may not handle a given URL. - * - * If this is unimplemented (or simply unavailable) for a platform, this will - * fail with an error. A successful result does not mean the URL loaded, just - * that we launched something to handle it (or at least believe we did). - * - * All this to say: this function can be useful, but you should definitely - * test it on every platform you target. - * - * \param url A valid URL to open. - * \return 0 on success, or -1 on error. - *} -function SDL_OpenURL(const url: PAnsiChar): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_OpenURL' {$ENDIF} {$ENDIF}; +// based on SDL_misc.h + +{** + * \brief Open an URL / URI in the browser or other + * + * Open a URL in a separate, system-provided application. How this works will + * vary wildly depending on the platform. This will likely launch what + * makes sense to handle a specific URL's protocol (a web browser for http://, + * etc), but it might also be able to launch file managers for directories + * and other things. + * + * What happens when you open a URL varies wildly as well: your game window + * may lose focus (and may or may not lose focus if your game was fullscreen + * or grabbing input at the time). On mobile devices, your app will likely + * move to the background or your process might be paused. Any given platform + * may or may not handle a given URL. + * + * If this is unimplemented (or simply unavailable) for a platform, this will + * fail with an error. A successful result does not mean the URL loaded, just + * that we launched something to handle it (or at least believe we did). + * + * All this to say: this function can be useful, but you should definitely + * test it on every platform you target. + * + * \param url A valid URL to open. + * \return 0 on success, or -1 on error. + *} +function SDL_OpenURL(const url: PAnsiChar): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_OpenURL' {$ENDIF} {$ENDIF}; diff --git a/units/sdlmouse.inc b/units/sdlmouse.inc index 63ef977b..d4fc4fde 100644 --- a/units/sdlmouse.inc +++ b/units/sdlmouse.inc @@ -1,444 +1,555 @@ -//from "sdl_mouse.h" - -type - PPSDL_Cursor = ^PSDL_Cursor; - PSDL_Cursor = type Pointer; {**< Implementation dependent *} - -{** -* Cursor types for SDL_CreateSystemCursor. -*} -type - PPSDL_SystemCursor = ^PSDL_SystemCursor; - PSDL_SystemCursor = ^TSDL_SystemCursor; - TSDL_SystemCursor = type Integer; - -const - SDL_SYSTEM_CURSOR_ARROW = TSDL_SystemCursor(0); // Arrow - SDL_SYSTEM_CURSOR_IBEAM = TSDL_SystemCursor(1); // I-beam - SDL_SYSTEM_CURSOR_WAIT = TSDL_SystemCursor(2); // Wait - SDL_SYSTEM_CURSOR_CROSSHAIR = TSDL_SystemCursor(3); // Crosshair - SDL_SYSTEM_CURSOR_WAITARROW = TSDL_SystemCursor(4); // Small wait cursor (or Wait if not available) - SDL_SYSTEM_CURSOR_SIZENWSE = TSDL_SystemCursor(5); // Double arrow pointing northwest and southeast - SDL_SYSTEM_CURSOR_SIZENESW = TSDL_SystemCursor(6); // Double arrow pointing northeast and southwest - SDL_SYSTEM_CURSOR_SIZEWE = TSDL_SystemCursor(7); // Double arrow pointing west and east - SDL_SYSTEM_CURSOR_SIZENS = TSDL_SystemCursor(8); // Double arrow pointing north and south - SDL_SYSTEM_CURSOR_SIZEALL = TSDL_SystemCursor(9); // Four pointed arrow pointing north, south, east, and west - SDL_SYSTEM_CURSOR_NO = TSDL_SystemCursor(10); // Slashed circle or crossbones - SDL_SYSTEM_CURSOR_HAND = TSDL_SystemCursor(11); // Hand - SDL_NUM_SYSTEM_CURSORS = TSDL_SystemCursor(12); - -type - PPSDL_MouseWheelDirection = ^PSDL_MouseWheelDirection; - PSDL_MouseWheelDirection = ^TSDL_MouseWheelDirection; - TSDL_MouseWheelDirection = type Integer; - -const - SDL_MOUSEWHEEL_NORMAL = TSDL_MouseWheelDirection(0); {**< The scroll direction is normal *} - SDL_MOUSEWHEEL_FLIPPED = TSDL_MouseWheelDirection(1); {**< The scroll direction is flipped / natural *} - - {* Function prototypes *} - - {** - * Get the window which currently has mouse focus. - * - * \returns the window with mouse focus. - * - * \since This function is available since SDL 2.0.0. - *} -function SDL_GetMouseFocus: PSDL_Window; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetMouseFocus' {$ENDIF}{$ENDIF}; - - {** - * Retrieve the current state of the mouse. - * - * The current button state is returned as a button bitmask, which can be - * tested using the `SDL_BUTTON(X)` macros (where `X` is generally 1 for the - * left, 2 for middle, 3 for the right button), and `x` and `y` are set to the - * mouse cursor position relative to the focus window. You can pass NULL for - * either `x` or `y`. - * - * \param x the x coordinate of the mouse cursor position relative to the - * focus window - * \param y the y coordinate of the mouse cursor position relative to the - * focus window - * \returns a 32-bit button bitmask of the current button state. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetGlobalMouseState - * \sa SDL_GetRelativeMouseState - * \sa SDL_PumpEvents - *} -function SDL_GetMouseState(x: pcint; y: pcint): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetMouseState' {$ENDIF}{$ENDIF}; - - - {** - * Get the current state of the mouse in relation to the desktop. - * - * This works similarly to SDL_GetMouseState(), but the coordinates will be - * reported relative to the top-left of the desktop. This can be useful if you - * need to track the mouse outside of a specific window and SDL_CaptureMouse() - * doesn't fit your needs. For example, it could be useful if you need to - * track the mouse while dragging a window, where coordinates relative to a - * window might not be in sync at all times. - * - * Note: SDL_GetMouseState() returns the mouse position as SDL understands it - * from the last pump of the event queue. This function, however, queries the - * OS for the current mouse position, and as such, might be a slightly less - * efficient function. Unless you know what you're doing and have a good - * reason to use this function, you probably want SDL_GetMouseState() instead. - * - * \param x filled in with the current X coord relative to the desktop; can be - * NULL - * \param y filled in with the current Y coord relative to the desktop; can be - * NULL - * \returns the current button state as a bitmask which can be tested using - * the SDL_BUTTON(X) macros. - * - * \since This function is available since SDL 2.0.4. - * - * \sa SDL_CaptureMouse - *} -function SDL_GetGlobalMouseState(x, y: pcint32): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetGlobalMouseState' {$ENDIF}{$ENDIF}; - - {** - * Retrieve the relative state of the mouse. - * - * The current button state is returned as a button bitmask, which can be - * tested using the `SDL_BUTTON(X)` macros (where `X` is generally 1 for the - * left, 2 for middle, 3 for the right button), and `x` and `y` are set to the - * mouse deltas since the last call to SDL_GetRelativeMouseState() or since - * event initialization. You can pass NULL for either `x` or `y`. - * - * \param x a pointer filled with the last recorded x coordinate of the mouse - * \param y a pointer filled with the last recorded y coordinate of the mouse - * \returns a 32-bit button bitmask of the relative button state. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetMouseState - *} -function SDL_GetRelativeMouseState(x: pcint; y: pcint): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRelativeMouseState' {$ENDIF}{$ENDIF}; - - {** - * Move the mouse cursor to the given position within the window. - * - * This function generates a mouse motion event if relative mode is not - * enabled. If relative mode is enabled, you can force mouse events for the - * warp by setting the SDL_HINT_MOUSE_RELATIVE_WARP_MOTION hint. - * - * Note that this function will appear to succeed, but not actually move the - * mouse when used over Microsoft Remote Desktop. - * - * \param window the window to move the mouse into, or NULL for the current - * mouse focus - * \param x the x coordinate within the window - * \param y the y coordinate within the window - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_WarpMouseGlobal - *} -procedure SDL_WarpMouseInWindow(window: PSDL_Window; x: cint; y: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WarpMouseInWindow' {$ENDIF}{$ENDIF}; - - {** - * Move the mouse to the given position in global screen space. - * - * This function generates a mouse motion event. - * - * A failure of this function usually means that it is unsupported by a - * platform. - * - * Note that this function will appear to succeed, but not actually move the - * mouse when used over Microsoft Remote Desktop. - * - * \param x the x coordinate - * \param y the y coordinate - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.4. - * - * \sa SDL_WarpMouseInWindow - *} -function SDL_WarpMouseGlobal(x, y: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WarpMouseGlobal' {$ENDIF}{$ENDIF}; - - {** - * Set relative mouse mode. - * - * While the mouse is in relative mode, the cursor is hidden, and the driver - * will try to report continuous motion in the current window. Only relative - * motion events will be delivered, the mouse position will not change. - * - * Note that this function will not be able to provide continuous relative - * motion when used over Microsoft Remote Desktop, instead motion is limited - * to the bounds of the screen. - * - * This function will flush any pending mouse motion. - * - * \param enabled SDL_TRUE to enable relative mode, SDL_FALSE to disable. - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * If relative mode is not supported, this returns -1. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetRelativeMouseMode - *} -function SDL_SetRelativeMouseMode(enabled: TSDL_Bool): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRelativeMouseMode' {$ENDIF}{$ENDIF}; - - {** - * Capture the mouse and to track input outside an SDL window. - * - * Capturing enables your app to obtain mouse events globally, instead of just - * within your window. Not all video targets support this function. When - * capturing is enabled, the current window will get all mouse events, but - * unlike relative mode, no change is made to the cursor and it is not - * restrained to your window. - * - * This function may also deny mouse input to other windows--both those in - * your application and others on the system--so you should use this function - * sparingly, and in small bursts. For example, you might want to track the - * mouse while the user is dragging something, until the user releases a mouse - * button. It is not recommended that you capture the mouse for long periods - * of time, such as the entire time your app is running. For that, you should - * probably use SDL_SetRelativeMouseMode() or SDL_SetWindowGrab(), depending - * on your goals. - * - * While captured, mouse events still report coordinates relative to the - * current (foreground) window, but those coordinates may be outside the - * bounds of the window (including negative values). Capturing is only allowed - * for the foreground window. If the window loses focus while capturing, the - * capture will be disabled automatically. - * - * While capturing is enabled, the current window will have the - * `SDL_WINDOW_MOUSE_CAPTURE` flag set. - * - * Please note that as of SDL 2.0.22, SDL will attempt to "auto capture" the - * mouse while the user is pressing a button; this is to try and make mouse - * behavior more consistent between platforms, and deal with the common case - * of a user dragging the mouse outside of the window. This means that if you - * are calling SDL_CaptureMouse() only to deal with this situation, you no - * longer have to (although it is safe to do so). If this causes problems for - * your app, you can disable auto capture by setting the - * `SDL_HINT_MOUSE_AUTO_CAPTURE` hint to zero. - * - * \param enabled SDL_TRUE to enable capturing, SDL_FALSE to disable. - * \returns 0 on success or -1 if not supported; call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.4. - * - * \sa SDL_GetGlobalMouseState - *} - function SDL_CaptureMouse(enabled: TSDL_Bool): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CaptureMouse' {$ENDIF}{$ENDIF}; - - {** - * Query whether relative mouse mode is enabled. - * - * \returns SDL_TRUE if relative mode is enabled or SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_SetRelativeMouseMode - *} -function SDL_GetRelativeMouseMode: TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRelativeMouseMode' {$ENDIF}{$ENDIF}; - - {** - * Create a cursor using the specified bitmap data and mask (in MSB format). - * - * `mask` has to be in MSB (Most Significant Bit) format. - * - * The cursor width (`w`) must be a multiple of 8 bits. - * - * The cursor is created in black and white according to the following: - * - * - data=0, mask=1: white - * - data=1, mask=1: black - * - data=0, mask=0: transparent - * - data=1, mask=0: inverted color if possible, black if not. - * - * Cursors created with this function must be freed with SDL_FreeCursor(). - * - * If you want to have a color cursor, or create your cursor from an - * SDL_Surface, you should use SDL_CreateColorCursor(). Alternately, you can - * hide the cursor and draw your own as part of your game's rendering, but it - * will be bound to the framerate. - * - * Also, since SDL 2.0.0, SDL_CreateSystemCursor() is available, which - * provides twelve readily available system cursors to pick from. - * - * \param data the color value for each pixel of the cursor - * \param mask the mask value for each pixel of the cursor - * \param w the width of the cursor - * \param h the height of the cursor - * \param hot_x the X-axis location of the upper left corner of the cursor - * relative to the actual mouse position - * \param hot_y the Y-axis location of the upper left corner of the cursor - * relative to the actual mouse position - * \returns a new cursor with the specified parameters on success or NULL on - * failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_FreeCursor - * \sa SDL_SetCursor - * \sa SDL_ShowCursor - *} -function SDL_CreateCursor( - const data: pcuint8; - const mask: pcuint8; - w: cint; h: cint; - hot_x: cint; hot_y: cint): PSDL_Cursor; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateCursor' {$ENDIF}{$ENDIF}; - - {** - * Create a color cursor. - * - * \param surface an SDL_Surface structure representing the cursor image - * \param hot_x the x position of the cursor hot spot - * \param hot_y the y position of the cursor hot spot - * \returns the new cursor on success or NULL on failure; call SDL_GetError() - * for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_CreateCursor - * \sa SDL_FreeCursor - *} -function SDL_CreateColorCursor( - surface: PSDL_Surface; - hot_x: cint; - hot_y: cint): PSDL_Cursor; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateColorCursor' {$ENDIF}{$ENDIF}; - - {** - * Create a system cursor. - * - * \param id an SDL_SystemCursor enum value - * \returns a cursor on success or NULL on failure; call SDL_GetError() for - * more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_FreeCursor - *} -function SDL_CreateSystemCursor(id: TSDL_SystemCursor): PSDL_Cursor; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateSystemCursor' {$ENDIF}{$ENDIF}; - - {** - * Set the active cursor. - * - * This function sets the currently active cursor to the specified one. If the - * cursor is currently visible, the change will be immediately represented on - * the display. SDL_SetCursor(NULL) can be used to force cursor redraw, if - * this is desired for any reason. - * - * \param cursor a cursor to make active - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_CreateCursor - * \sa SDL_GetCursor - * \sa SDL_ShowCursor - *} -procedure SDL_SetCursor(cursor: PSDL_Cursor); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetCursor' {$ENDIF}{$ENDIF}; - - {** - * Get the active cursor. - * - * This function returns a pointer to the current cursor which is owned by the - * library. It is not necessary to free the cursor with SDL_FreeCursor(). - * - * \returns the active cursor or NULL if there is no mouse. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_SetCursor - *} -function SDL_GetCursor: PSDL_Cursor; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCursor' {$ENDIF}{$ENDIF}; - - {** - * Get the default cursor. - * - * \returns the default cursor on success or NULL on failure. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_CreateSystemCursor - *} -function SDL_GetDefaultCursor: PSDL_Cursor; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDefaultCursor' {$ENDIF}{$ENDIF}; - - {** - * Free a previously-created cursor. - * - * Use this function to free cursor resources created with SDL_CreateCursor(), - * SDL_CreateColorCursor() or SDL_CreateSystemCursor(). - * - * \param cursor the cursor to free - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_CreateColorCursor - * \sa SDL_CreateCursor - * \sa SDL_CreateSystemCursor - *} -procedure SDL_FreeCursor(cursor: PSDL_Cursor); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeCursor' {$ENDIF}{$ENDIF}; - - {** - * Toggle whether or not the cursor is shown. - * - * The cursor starts off displayed but can be turned off. Passing `SDL_ENABLE` - * displays the cursor and passing `SDL_DISABLE` hides it. - * - * The current state of the mouse cursor can be queried by passing - * `SDL_QUERY`; either `SDL_DISABLE` or `SDL_ENABLE` will be returned. - * - * \param toggle `SDL_ENABLE` to show the cursor, `SDL_DISABLE` to hide it, - * `SDL_QUERY` to query the current state without changing it. - * \returns `SDL_ENABLE` if the cursor is shown, or `SDL_DISABLE` if the - * cursor is hidden, or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_CreateCursor - * \sa SDL_SetCursor - *} -function SDL_ShowCursor(toggle: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ShowCursor' {$ENDIF}{$ENDIF}; - -{** - * Used as a mask when testing buttons in buttonstate. - * - Button 1: Left mouse button - * - Button 2: Middle mouse button - * - Button 3: Right mouse button - *} -function SDL_Button(X: cint): cint; {$IFNDEF DELPHI} inline; {$ELSE} {$IFDEF DELPHI10UP} inline; {$ENDIF} {$ENDIF} -const - SDL_BUTTON_LEFT = 1; - SDL_BUTTON_MIDDLE = 2; - SDL_BUTTON_RIGHT = 3; - SDL_BUTTON_X1 = 4; - SDL_BUTTON_X2 = 5; - { Pascal Conv.: For better performance instead of using the - SDL_Button(X) macro, the following defines are - implemented directly. } - SDL_BUTTON_LMASK = 1 shl ((SDL_BUTTON_LEFT) - 1); - SDL_BUTTON_MMASK = 1 shl ((SDL_BUTTON_MIDDLE) - 1); - SDL_BUTTON_RMASK = 1 shl ((SDL_BUTTON_RIGHT) - 1); - SDL_BUTTON_X1MASK = 1 shl ((SDL_BUTTON_X1) - 1); - SDL_BUTTON_X2MASK = 1 shl ((SDL_BUTTON_X2) - 1); +//from "sdl_mouse.h" + +type + PPSDL_Cursor = ^PSDL_Cursor; + PSDL_Cursor = type Pointer; {**< Implementation dependent *} + +{** +* Cursor types for SDL_CreateSystemCursor. +*} +type + PPSDL_SystemCursor = ^PSDL_SystemCursor; + PSDL_SystemCursor = ^TSDL_SystemCursor; + TSDL_SystemCursor = type Integer; + +const + SDL_SYSTEM_CURSOR_ARROW = TSDL_SystemCursor(0); // Arrow + SDL_SYSTEM_CURSOR_IBEAM = TSDL_SystemCursor(1); // I-beam + SDL_SYSTEM_CURSOR_WAIT = TSDL_SystemCursor(2); // Wait + SDL_SYSTEM_CURSOR_CROSSHAIR = TSDL_SystemCursor(3); // Crosshair + SDL_SYSTEM_CURSOR_WAITARROW = TSDL_SystemCursor(4); // Small wait cursor (or Wait if not available) + SDL_SYSTEM_CURSOR_SIZENWSE = TSDL_SystemCursor(5); // Double arrow pointing northwest and southeast + SDL_SYSTEM_CURSOR_SIZENESW = TSDL_SystemCursor(6); // Double arrow pointing northeast and southwest + SDL_SYSTEM_CURSOR_SIZEWE = TSDL_SystemCursor(7); // Double arrow pointing west and east + SDL_SYSTEM_CURSOR_SIZENS = TSDL_SystemCursor(8); // Double arrow pointing north and south + SDL_SYSTEM_CURSOR_SIZEALL = TSDL_SystemCursor(9); // Four pointed arrow pointing north, south, east, and west + SDL_SYSTEM_CURSOR_NO = TSDL_SystemCursor(10); // Slashed circle or crossbones + SDL_SYSTEM_CURSOR_HAND = TSDL_SystemCursor(11); // Hand + SDL_NUM_SYSTEM_CURSORS = TSDL_SystemCursor(12); + +type + PPSDL_MouseWheelDirection = ^PSDL_MouseWheelDirection; + PSDL_MouseWheelDirection = ^TSDL_MouseWheelDirection; + TSDL_MouseWheelDirection = type Integer; + +const + SDL_MOUSEWHEEL_NORMAL = TSDL_MouseWheelDirection(0); {**< The scroll direction is normal *} + SDL_MOUSEWHEEL_FLIPPED = TSDL_MouseWheelDirection(1); {**< The scroll direction is flipped / natural *} + + {* Function prototypes *} + + {** + * Get the window which currently has mouse focus. + * + * \returns the window with mouse focus. + * + * \since This function is available since SDL 2.0.0. + *} +function SDL_GetMouseFocus: PSDL_Window; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetMouseFocus' {$ENDIF}{$ENDIF}; + + {** + * Retrieve the current state of the mouse. + * + * The current button state is returned as a button bitmask, which can be + * tested using the `SDL_BUTTON(X)` macros (where `X` is generally 1 for the + * left, 2 for middle, 3 for the right button), and `x` and `y` are set to the + * mouse cursor position relative to the focus window. You can pass NULL for + * either `x` or `y`. + * + * \param x the x coordinate of the mouse cursor position relative to the + * focus window + * \param y the y coordinate of the mouse cursor position relative to the + * focus window + * \returns a 32-bit button bitmask of the current button state. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetGlobalMouseState + * \sa SDL_GetRelativeMouseState + * \sa SDL_PumpEvents + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetMouseState_fun = function(x: pcint; y: pcint): cuint32; cdecl; +Var + SDL_GetMouseState : TSDL_GetMouseState_fun = Nil; +{$else} + +function SDL_GetMouseState(x: pcint; y: pcint): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetMouseState' {$ENDIF}{$ENDIF}; +{$endif} + + + {** + * Get the current state of the mouse in relation to the desktop. + * + * This works similarly to SDL_GetMouseState(), but the coordinates will be + * reported relative to the top-left of the desktop. This can be useful if you + * need to track the mouse outside of a specific window and SDL_CaptureMouse() + * doesn't fit your needs. For example, it could be useful if you need to + * track the mouse while dragging a window, where coordinates relative to a + * window might not be in sync at all times. + * + * Note: SDL_GetMouseState() returns the mouse position as SDL understands it + * from the last pump of the event queue. This function, however, queries the + * OS for the current mouse position, and as such, might be a slightly less + * efficient function. Unless you know what you're doing and have a good + * reason to use this function, you probably want SDL_GetMouseState() instead. + * + * \param x filled in with the current X coord relative to the desktop; can be + * NULL + * \param y filled in with the current Y coord relative to the desktop; can be + * NULL + * \returns the current button state as a bitmask which can be tested using + * the SDL_BUTTON(X) macros. + * + * \since This function is available since SDL 2.0.4. + * + * \sa SDL_CaptureMouse + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetGlobalMouseState_fun = function(x, y: pcint32): cuint32; cdecl; +Var + SDL_GetGlobalMouseState : TSDL_GetGlobalMouseState_fun = Nil; +{$else} + +function SDL_GetGlobalMouseState(x, y: pcint32): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetGlobalMouseState' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Retrieve the relative state of the mouse. + * + * The current button state is returned as a button bitmask, which can be + * tested using the `SDL_BUTTON(X)` macros (where `X` is generally 1 for the + * left, 2 for middle, 3 for the right button), and `x` and `y` are set to the + * mouse deltas since the last call to SDL_GetRelativeMouseState() or since + * event initialization. You can pass NULL for either `x` or `y`. + * + * \param x a pointer filled with the last recorded x coordinate of the mouse + * \param y a pointer filled with the last recorded y coordinate of the mouse + * \returns a 32-bit button bitmask of the relative button state. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetMouseState + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetRelativeMouseState_fun = function(x: pcint; y: pcint): cuint32; cdecl; +Var + SDL_GetRelativeMouseState : TSDL_GetRelativeMouseState_fun = Nil; +{$else} + +function SDL_GetRelativeMouseState(x: pcint; y: pcint): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRelativeMouseState' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Move the mouse cursor to the given position within the window. + * + * This function generates a mouse motion event if relative mode is not + * enabled. If relative mode is enabled, you can force mouse events for the + * warp by setting the SDL_HINT_MOUSE_RELATIVE_WARP_MOTION hint. + * + * Note that this function will appear to succeed, but not actually move the + * mouse when used over Microsoft Remote Desktop. + * + * \param window the window to move the mouse into, or NULL for the current + * mouse focus + * \param x the x coordinate within the window + * \param y the y coordinate within the window + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_WarpMouseGlobal + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WarpMouseInWindow_proc = procedure(window: PSDL_Window; x: cint; y: cint); cdecl; +Var + SDL_WarpMouseInWindow : TSDL_WarpMouseInWindow_proc = Nil; +{$else} + +procedure SDL_WarpMouseInWindow(window: PSDL_Window; x: cint; y: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WarpMouseInWindow' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Move the mouse to the given position in global screen space. + * + * This function generates a mouse motion event. + * + * A failure of this function usually means that it is unsupported by a + * platform. + * + * Note that this function will appear to succeed, but not actually move the + * mouse when used over Microsoft Remote Desktop. + * + * \param x the x coordinate + * \param y the y coordinate + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.4. + * + * \sa SDL_WarpMouseInWindow + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WarpMouseGlobal_fun = function(x, y: cint): cint; cdecl; +Var + SDL_WarpMouseGlobal : TSDL_WarpMouseGlobal_fun = Nil; +{$else} + +function SDL_WarpMouseGlobal(x, y: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WarpMouseGlobal' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Set relative mouse mode. + * + * While the mouse is in relative mode, the cursor is hidden, and the driver + * will try to report continuous motion in the current window. Only relative + * motion events will be delivered, the mouse position will not change. + * + * Note that this function will not be able to provide continuous relative + * motion when used over Microsoft Remote Desktop, instead motion is limited + * to the bounds of the screen. + * + * This function will flush any pending mouse motion. + * + * \param enabled SDL_TRUE to enable relative mode, SDL_FALSE to disable. + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * If relative mode is not supported, this returns -1. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetRelativeMouseMode + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetRelativeMouseMode_fun = function(enabled: TSDL_Bool): cint; cdecl; +Var + SDL_SetRelativeMouseMode : TSDL_SetRelativeMouseMode_fun = Nil; +{$else} + +function SDL_SetRelativeMouseMode(enabled: TSDL_Bool): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRelativeMouseMode' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Capture the mouse and to track input outside an SDL window. + * + * Capturing enables your app to obtain mouse events globally, instead of just + * within your window. Not all video targets support this function. When + * capturing is enabled, the current window will get all mouse events, but + * unlike relative mode, no change is made to the cursor and it is not + * restrained to your window. + * + * This function may also deny mouse input to other windows--both those in + * your application and others on the system--so you should use this function + * sparingly, and in small bursts. For example, you might want to track the + * mouse while the user is dragging something, until the user releases a mouse + * button. It is not recommended that you capture the mouse for long periods + * of time, such as the entire time your app is running. For that, you should + * probably use SDL_SetRelativeMouseMode() or SDL_SetWindowGrab(), depending + * on your goals. + * + * While captured, mouse events still report coordinates relative to the + * current (foreground) window, but those coordinates may be outside the + * bounds of the window (including negative values). Capturing is only allowed + * for the foreground window. If the window loses focus while capturing, the + * capture will be disabled automatically. + * + * While capturing is enabled, the current window will have the + * `SDL_WINDOW_MOUSE_CAPTURE` flag set. + * + * Please note that as of SDL 2.0.22, SDL will attempt to "auto capture" the + * mouse while the user is pressing a button; this is to try and make mouse + * behavior more consistent between platforms, and deal with the common case + * of a user dragging the mouse outside of the window. This means that if you + * are calling SDL_CaptureMouse() only to deal with this situation, you no + * longer have to (although it is safe to do so). If this causes problems for + * your app, you can disable auto capture by setting the + * `SDL_HINT_MOUSE_AUTO_CAPTURE` hint to zero. + * + * \param enabled SDL_TRUE to enable capturing, SDL_FALSE to disable. + * \returns 0 on success or -1 if not supported; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.4. + * + * \sa SDL_GetGlobalMouseState + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CaptureMouse_fun = function(enabled: TSDL_Bool): cint; cdecl; +Var + SDL_CaptureMouse : TSDL_CaptureMouse_fun = Nil; +{$else} + + function SDL_CaptureMouse(enabled: TSDL_Bool): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CaptureMouse' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Query whether relative mouse mode is enabled. + * + * \returns SDL_TRUE if relative mode is enabled or SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_SetRelativeMouseMode + *} +function SDL_GetRelativeMouseMode: TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRelativeMouseMode' {$ENDIF}{$ENDIF}; + + {** + * Create a cursor using the specified bitmap data and mask (in MSB format). + * + * `mask` has to be in MSB (Most Significant Bit) format. + * + * The cursor width (`w`) must be a multiple of 8 bits. + * + * The cursor is created in black and white according to the following: + * + * - data=0, mask=1: white + * - data=1, mask=1: black + * - data=0, mask=0: transparent + * - data=1, mask=0: inverted color if possible, black if not. + * + * Cursors created with this function must be freed with SDL_FreeCursor(). + * + * If you want to have a color cursor, or create your cursor from an + * SDL_Surface, you should use SDL_CreateColorCursor(). Alternately, you can + * hide the cursor and draw your own as part of your game's rendering, but it + * will be bound to the framerate. + * + * Also, since SDL 2.0.0, SDL_CreateSystemCursor() is available, which + * provides twelve readily available system cursors to pick from. + * + * \param data the color value for each pixel of the cursor + * \param mask the mask value for each pixel of the cursor + * \param w the width of the cursor + * \param h the height of the cursor + * \param hot_x the X-axis location of the upper left corner of the cursor + * relative to the actual mouse position + * \param hot_y the Y-axis location of the upper left corner of the cursor + * relative to the actual mouse position + * \returns a new cursor with the specified parameters on success or NULL on + * failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_FreeCursor + * \sa SDL_SetCursor + * \sa SDL_ShowCursor + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateCursor_fun = function( + const data: pcuint8; + const mask: pcuint8; + w: cint; h: cint; + hot_x: cint; hot_y: cint): PSDL_Cursor; cdecl; +Var + SDL_CreateCursor : TSDL_CreateCursor_fun = Nil; +{$else} + +function SDL_CreateCursor( + const data: pcuint8; + const mask: pcuint8; + w: cint; h: cint; + hot_x: cint; hot_y: cint): PSDL_Cursor; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateCursor' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Create a color cursor. + * + * \param surface an SDL_Surface structure representing the cursor image + * \param hot_x the x position of the cursor hot spot + * \param hot_y the y position of the cursor hot spot + * \returns the new cursor on success or NULL on failure; call SDL_GetError() + * for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_CreateCursor + * \sa SDL_FreeCursor + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateColorCursor_fun = function( + surface: PSDL_Surface; + hot_x: cint; + hot_y: cint): PSDL_Cursor; cdecl; +Var + SDL_CreateColorCursor : TSDL_CreateColorCursor_fun = Nil; +{$else} + +function SDL_CreateColorCursor( + surface: PSDL_Surface; + hot_x: cint; + hot_y: cint): PSDL_Cursor; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateColorCursor' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Create a system cursor. + * + * \param id an SDL_SystemCursor enum value + * \returns a cursor on success or NULL on failure; call SDL_GetError() for + * more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_FreeCursor + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateSystemCursor_fun = function(id: TSDL_SystemCursor): PSDL_Cursor; cdecl; +Var + SDL_CreateSystemCursor : TSDL_CreateSystemCursor_fun = Nil; +{$else} + +function SDL_CreateSystemCursor(id: TSDL_SystemCursor): PSDL_Cursor; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateSystemCursor' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Set the active cursor. + * + * This function sets the currently active cursor to the specified one. If the + * cursor is currently visible, the change will be immediately represented on + * the display. SDL_SetCursor(NULL) can be used to force cursor redraw, if + * this is desired for any reason. + * + * \param cursor a cursor to make active + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_CreateCursor + * \sa SDL_GetCursor + * \sa SDL_ShowCursor + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetCursor_proc = procedure(cursor: PSDL_Cursor); cdecl; +Var + SDL_SetCursor : TSDL_SetCursor_proc = Nil; +{$else} + +procedure SDL_SetCursor(cursor: PSDL_Cursor); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetCursor' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Get the active cursor. + * + * This function returns a pointer to the current cursor which is owned by the + * library. It is not necessary to free the cursor with SDL_FreeCursor(). + * + * \returns the active cursor or NULL if there is no mouse. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_SetCursor + *} +function SDL_GetCursor: PSDL_Cursor; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCursor' {$ENDIF}{$ENDIF}; + + {** + * Get the default cursor. + * + * \returns the default cursor on success or NULL on failure. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_CreateSystemCursor + *} +function SDL_GetDefaultCursor: PSDL_Cursor; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDefaultCursor' {$ENDIF}{$ENDIF}; + + {** + * Free a previously-created cursor. + * + * Use this function to free cursor resources created with SDL_CreateCursor(), + * SDL_CreateColorCursor() or SDL_CreateSystemCursor(). + * + * \param cursor the cursor to free + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_CreateColorCursor + * \sa SDL_CreateCursor + * \sa SDL_CreateSystemCursor + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_FreeCursor_proc = procedure(cursor: PSDL_Cursor); cdecl; +Var + SDL_FreeCursor : TSDL_FreeCursor_proc = Nil; +{$else} + +procedure SDL_FreeCursor(cursor: PSDL_Cursor); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeCursor' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Toggle whether or not the cursor is shown. + * + * The cursor starts off displayed but can be turned off. Passing `SDL_ENABLE` + * displays the cursor and passing `SDL_DISABLE` hides it. + * + * The current state of the mouse cursor can be queried by passing + * `SDL_QUERY`; either `SDL_DISABLE` or `SDL_ENABLE` will be returned. + * + * \param toggle `SDL_ENABLE` to show the cursor, `SDL_DISABLE` to hide it, + * `SDL_QUERY` to query the current state without changing it. + * \returns `SDL_ENABLE` if the cursor is shown, or `SDL_DISABLE` if the + * cursor is hidden, or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_CreateCursor + * \sa SDL_SetCursor + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ShowCursor_fun = function(toggle: cint): cint; cdecl; +Var + SDL_ShowCursor : TSDL_ShowCursor_fun = Nil; +{$else} + +function SDL_ShowCursor(toggle: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ShowCursor' {$ENDIF}{$ENDIF}; +{$endif} + +{** + * Used as a mask when testing buttons in buttonstate. + * - Button 1: Left mouse button + * - Button 2: Middle mouse button + * - Button 3: Right mouse button + *} +function SDL_Button(X: cint): cint; {$IFNDEF DELPHI} inline; {$ELSE} {$IFDEF DELPHI10UP} inline; {$ENDIF} {$ENDIF} +const + SDL_BUTTON_LEFT = 1; + SDL_BUTTON_MIDDLE = 2; + SDL_BUTTON_RIGHT = 3; + SDL_BUTTON_X1 = 4; + SDL_BUTTON_X2 = 5; + { Pascal Conv.: For better performance instead of using the + SDL_Button(X) macro, the following defines are + implemented directly. } + SDL_BUTTON_LMASK = 1 shl ((SDL_BUTTON_LEFT) - 1); + SDL_BUTTON_MMASK = 1 shl ((SDL_BUTTON_MIDDLE) - 1); + SDL_BUTTON_RMASK = 1 shl ((SDL_BUTTON_RIGHT) - 1); + SDL_BUTTON_X1MASK = 1 shl ((SDL_BUTTON_X1) - 1); + SDL_BUTTON_X2MASK = 1 shl ((SDL_BUTTON_X2) - 1); diff --git a/units/sdlmutex.inc b/units/sdlmutex.inc index 2da3af87..aca623b8 100644 --- a/units/sdlmutex.inc +++ b/units/sdlmutex.inc @@ -1,361 +1,489 @@ -// based on "sdl_mutex.h" - -const - {** - * Synchronization functions which can time out return this value - * if they time out. - *} - SDL_MUTEX_TIMEDOUT = 1; - - {** - * This is the timeout value which corresponds to never time out. - *} - SDL_MUTEX_MAXWAIT = Not cuint32(0); - - { -- Mutex functions -- } -type - { The SDL mutex structure, defined in SDL_sysmutex.c } - PPSDL_Mutex = ^PSDL_Mutex; - PSDL_Mutex = Type Pointer; - -{** - * Create a new mutex. - * - * All newly-created mutexes begin in the _unlocked_ state. - * - * Calls to SDL_LockMutex() will not return while the mutex is locked by - * another thread. See SDL_TryLockMutex() to attempt to lock without blocking. - * - * SDL mutexes are reentrant. - * - * \returns the initialized and unlocked mutex or NIL on failure; - * call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *} -function SDL_CreateMutex: PSDL_Mutex; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateMutex' {$ENDIF} {$ENDIF}; - -{** - * Lock the mutex. - * - * This will block until the mutex is available, which is to say it is in the - * unlocked state and the OS has chosen the caller as the next thread to lock - * it. Of all threads waiting to lock the mutex, only one may do so at a time. - * - * It is legal for the owning thread to lock an already-locked mutex. It must - * unlock it the same number of times before it is actually made available for - * other threads in the system (this is known as a "recursive mutex"). - * - * \param mutex the mutex to lock - * \return 0, or -1 on error. - * - * \since This function is available since SDL 2.0.0. - *} -function SDL_LockMutex(mutex: PSDL_Mutex): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockMutex' {$ENDIF} {$ENDIF}; - -{ SDL2-for-Pascal: SDL_mutexP macro ignored; no benefit for the Pascal units } -//C: #define SDL_mutexP(m) SDL_UnlockMutex(m) - -{** - * Try to lock a mutex without blocking. - * - * This works just like SDL_LockMutex(), but if the mutex is not available, - * this function returns SDL_MUTEX_TIMEDOUT immediately. - * - * This technique is useful if you need exclusive access to a resource but - * don't want to wait for it, and will return to it to try again later. - * - * \param mutex the mutex to try to lock - * \returns 0, SDL_MUTEX_TIMEDOUT, or -1 on error; call SDL_GetError() for - * more information. - * - * \since This function is available since SDL 2.0.0. - *} -function SDL_TryLockMutex(mutex: PSDL_Mutex): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TryLockMutex' {$ENDIF} {$ENDIF}; - -{** - * Unlock the mutex. - * - * It is legal for the owning thread to lock an already-locked mutex. It must - * unlock it the same number of times before it is actually made available for - * other threads in the system (this is known as a "recursive mutex"). - * - * It is an error to unlock a mutex that has not been locked by the current - * thread, and doing so results in undefined behavior. - * - * It is also an error to unlock a mutex that isn't locked at all. - * - * \param mutex the mutex to unlock. - * \returns 0, or -1 on error. - * - * \since This function is available since SDL 2.0.0. - *} -function SDL_UnlockMutex(mutex: PSDL_Mutex): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnlockMutex' {$ENDIF} {$ENDIF}; - -{ SDL2-for-Pascal: SDL_mutexV macro ignored; no benefit for the Pascal units } -//C: #define SDL_mutexV(m) SDL_UnlockMutex(m) - -{** - * Destroy a mutex created with SDL_CreateMutex(). - * - * This function must be called on any mutex that is no longer needed. Failure - * to destroy a mutex will result in a system memory or resource leak. While - * it is safe to destroy a mutex that is _unlocked_, it is not safe to attempt - * to destroy a locked mutex, and may result in undefined behavior depending - * on the platform. - * - * \param mutex the mutex to destroy - * - * \since This function is available since SDL 2.0.0. - *} -procedure SDL_DestroyMutex(mutex: PSDL_Mutex); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyMutex' {$ENDIF} {$ENDIF}; - - { -- Semaphore functions -- } -type - { The SDL semaphore structure, defined in SDL_sem.c } - PPSDL_Sem = ^PSDL_Sem; - PSDL_Sem = Type Pointer; - -{** - * Create a semaphore. - * - * This function creates a new semaphore and initializes it with the provided - * initial value. Each wait operation on the semaphore will atomically - * decrement the semaphore value and potentially block if the semaphore value - * is 0. Each post operation will atomically increment the semaphore value and - * wake waiting threads and allow them to retry the wait operation. - * - * \param initial_value the starting value of the semaphore - * \returns a new semaphore or NIL on failure; call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.0. - *} -function SDL_CreateSemaphore(initial_value: cuint32): PSDL_sem; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateSemaphore' {$ENDIF} {$ENDIF}; - -{** - * Destroy a semaphore. - * - * It is not safe to destroy a semaphore if there are threads currently - * waiting on it. - * - * \param sem the semaphore to destroy - * - * \since This function is available since SDL 2.0.0. - *} -procedure SDL_DestroySemaphore(sem: PSDL_Sem); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroySemaphore' {$ENDIF} {$ENDIF}; - -{** - * Wait until a semaphore has a positive value and then decrements it. - * - * This function suspends the calling thread until either the semaphore - * pointed to by `sem` has a positive value or the call is interrupted by a - * signal or error. If the call is successful it will atomically decrement the - * semaphore value. - * - * This function is the equivalent of calling SDL_SemWaitTimeout() with a time - * length of SDL_MUTEX_MAXWAIT. - * - * \param sem the semaphore wait on - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *} -function SDL_SemWait(sem: PSDL_Sem): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SemWait' {$ENDIF} {$ENDIF}; - -{** - * See if a semaphore has a positive value and decrement it if it does. - * - * This function checks to see if the semaphore pointed to by `sem` has a - * positive value and atomically decrements the semaphore value if it does. If - * the semaphore doesn't have a positive value, the function immediately - * returns SDL_MUTEX_TIMEDOUT. - * - * \param sem the semaphore to wait on - * \returns 0 if the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait would - * block, or a negative error code on failure; call SDL_GetError() - * for more information. - * - * \since This function is available since SDL 2.0.0. - *} -function SDL_SemTryWait(sem: PSDL_Sem): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SemTryWait' {$ENDIF} {$ENDIF}; - -{** - * Wait until a semaphore has a positive value and then decrements it. - * - * This function suspends the calling thread until either the semaphore - * pointed to by `sem` has a positive value, the call is interrupted by a - * signal or error, or the specified time has elapsed. If the call is - * successful it will atomically decrement the semaphore value. - * - * \param sem the semaphore to wait on - * \param ms the length of the timeout, in milliseconds - * \returns 0 if the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not - * succeed in the allotted time, or a negative error code on failure; - * call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *} -function SDL_SemWaitTimeout(sem: PSDL_Sem; ms: cuint32): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SemWaitTimeout' {$ENDIF} {$ENDIF}; - -{** - * Atomically increment a semaphore's value and wake waiting threads. - * - * \param sem the semaphore to increment - * \returns 0 on success or a negative error code on failure; - * call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *} -function SDL_SemPost(sem: PSDL_Sem): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SemPost' {$ENDIF} {$ENDIF}; - -{** - * Get the current value of a semaphore. - * - * \param sem the semaphore to query - * \returns the current value of the semaphore. - * - * \since This function is available since SDL 2.0.0. - *} -function SDL_SemValue(sem: PSDL_Sem): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SemValue' {$ENDIF} {$ENDIF}; - - { -- Condition variable functions -- } -type - { The SDL condition variable structure, defined in SDL_cond.c } - PPSDL_Cond = ^PSDL_Cond; - - {** - * The condition variable type. - * - * Typical use of condition variables: - * - * Thread A: - * SDL_LockMutex(lock); - * while ( not condition ) - * begin - * SDL_CondWait(cond, lock); - * end; - * SDL_UnlockMutex(lock); - * - * Thread B: - * SDL_LockMutex(lock); - * ... - * condition := true; - * ... - * SDL_CondSignal(cond); - * SDL_UnlockMutex(lock); - * - * There is some discussion whether to signal the condition variable - * with the mutex locked or not. There is some potential performance - * benefit to unlocking first on some platforms, but there are some - * potential race conditions depending on how your code is structured. - * - * In general it's safer to signal the condition variable while the - * mutex is locked. - *} - PSDL_Cond = Type Pointer; - -{** - * Create a condition variable. - * - * \returns a new condition variable or NIL on failure; call SDL_GetError() - * for more information. - * - * \since This function is available since SDL 2.0.0. - *} -function SDL_CreateCond: PSDL_Cond; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateCond' {$ENDIF} {$ENDIF}; - -{** - * Destroy a condition variable. - * - * \param cond the condition variable to destroy - * - * \since This function is available since SDL 2.0.0. - *} -procedure SDL_DestroyCond(cond: PSDL_Cond); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyCond' {$ENDIF} {$ENDIF}; - -{** - * Restart one of the threads that are waiting on the condition variable. - * - * \param cond the condition variable to signal - * \returns 0 on success or a negative error code on failure; - * call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *} -function SDL_CondSignal(cond: PSDL_Cond): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CondSignal' {$ENDIF} {$ENDIF}; - -{** - * Restart all threads that are waiting on the condition variable. - * - * \param cond the condition variable to signal - * \returns 0 on success or a negative error code on failure; - * call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *} -function SDL_CondBroadcast(cond: PSDL_Cond): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CondBroadcast' {$ENDIF} {$ENDIF}; - -{** - * Wait until a condition variable is signaled. - * - * This function unlocks the specified `mutex` and waits for another thread to - * call SDL_CondSignal() or SDL_CondBroadcast() on the condition variable - * `cond`. Once the condition variable is signaled, the mutex is re-locked and - * the function returns. - * - * The mutex must be locked before calling this function. - * - * This function is the equivalent of calling SDL_CondWaitTimeout() with a - * time length of SDL_MUTEX_MAXWAIT. - * - * \param cond the condition variable to wait on - * \param mutex the mutex used to coordinate thread access - * \returns 0 when it is signaled or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *} -function SDL_CondWait(cond: PSDL_Cond; mutex: PSDL_Mutex): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CondWait' {$ENDIF} {$ENDIF}; - -{** - * Wait until a condition variable is signaled or a certain time has passed. - * - * This function unlocks the specified `mutex` and waits for another thread to - * call SDL_CondSignal() or SDL_CondBroadcast() on the condition variable - * `cond`, or for the specified time to elapse. Once the condition variable is - * signaled or the time elapsed, the mutex is re-locked and the function - * returns. - * - * The mutex must be locked before calling this function. - * - * \param cond the condition variable to wait on - * \param mutex the mutex used to coordinate thread access - * \param ms the maximum time to wait, in milliseconds, or SDL_MUTEX_MAXWAIT - * to wait indefinitely - * \returns 0 if the condition variable is signaled, SDL_MUTEX_TIMEDOUT if - * the condition is not signaled in the allotted time, or a negative - * error code on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *} -function SDL_CondWaitTimeout(cond: PSDL_Cond; mutex: PSDL_Mutex; ms: cuint32): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CondWaitTimeout' {$ENDIF} {$ENDIF}; +// based on "sdl_mutex.h" + +const + {** + * Synchronization functions which can time out return this value + * if they time out. + *} + SDL_MUTEX_TIMEDOUT = 1; + + {** + * This is the timeout value which corresponds to never time out. + *} + SDL_MUTEX_MAXWAIT = Not cuint32(0); + + { -- Mutex functions -- } +type + { The SDL mutex structure, defined in SDL_sysmutex.c } + PPSDL_Mutex = ^PSDL_Mutex; + PSDL_Mutex = Type Pointer; + +{** + * Create a new mutex. + * + * All newly-created mutexes begin in the _unlocked_ state. + * + * Calls to SDL_LockMutex() will not return while the mutex is locked by + * another thread. See SDL_TryLockMutex() to attempt to lock without blocking. + * + * SDL mutexes are reentrant. + * + * \returns the initialized and unlocked mutex or NIL on failure; + * call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *} +function SDL_CreateMutex: PSDL_Mutex; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateMutex' {$ENDIF} {$ENDIF}; + +{** + * Lock the mutex. + * + * This will block until the mutex is available, which is to say it is in the + * unlocked state and the OS has chosen the caller as the next thread to lock + * it. Of all threads waiting to lock the mutex, only one may do so at a time. + * + * It is legal for the owning thread to lock an already-locked mutex. It must + * unlock it the same number of times before it is actually made available for + * other threads in the system (this is known as a "recursive mutex"). + * + * \param mutex the mutex to lock + * \return 0, or -1 on error. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LockMutex_fun = function(mutex: PSDL_Mutex): cint; cdecl; +Var + SDL_LockMutex : TSDL_LockMutex_fun = Nil; +{$else} + +function SDL_LockMutex(mutex: PSDL_Mutex): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockMutex' {$ENDIF} {$ENDIF}; +{$endif} + +{ SDL2-for-Pascal: SDL_mutexP macro ignored; no benefit for the Pascal units } +//C: #define SDL_mutexP(m) SDL_UnlockMutex(m) + +{** + * Try to lock a mutex without blocking. + * + * This works just like SDL_LockMutex(), but if the mutex is not available, + * this function returns SDL_MUTEX_TIMEDOUT immediately. + * + * This technique is useful if you need exclusive access to a resource but + * don't want to wait for it, and will return to it to try again later. + * + * \param mutex the mutex to try to lock + * \returns 0, SDL_MUTEX_TIMEDOUT, or -1 on error; call SDL_GetError() for + * more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_TryLockMutex_fun = function(mutex: PSDL_Mutex): cint; cdecl; +Var + SDL_TryLockMutex : TSDL_TryLockMutex_fun = Nil; +{$else} + +function SDL_TryLockMutex(mutex: PSDL_Mutex): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TryLockMutex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Unlock the mutex. + * + * It is legal for the owning thread to lock an already-locked mutex. It must + * unlock it the same number of times before it is actually made available for + * other threads in the system (this is known as a "recursive mutex"). + * + * It is an error to unlock a mutex that has not been locked by the current + * thread, and doing so results in undefined behavior. + * + * It is also an error to unlock a mutex that isn't locked at all. + * + * \param mutex the mutex to unlock. + * \returns 0, or -1 on error. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UnlockMutex_fun = function(mutex: PSDL_Mutex): cint; cdecl; +Var + SDL_UnlockMutex : TSDL_UnlockMutex_fun = Nil; +{$else} + +function SDL_UnlockMutex(mutex: PSDL_Mutex): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnlockMutex' {$ENDIF} {$ENDIF}; +{$endif} + +{ SDL2-for-Pascal: SDL_mutexV macro ignored; no benefit for the Pascal units } +//C: #define SDL_mutexV(m) SDL_UnlockMutex(m) + +{** + * Destroy a mutex created with SDL_CreateMutex(). + * + * This function must be called on any mutex that is no longer needed. Failure + * to destroy a mutex will result in a system memory or resource leak. While + * it is safe to destroy a mutex that is _unlocked_, it is not safe to attempt + * to destroy a locked mutex, and may result in undefined behavior depending + * on the platform. + * + * \param mutex the mutex to destroy + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_DestroyMutex_proc = procedure(mutex: PSDL_Mutex); cdecl; +Var + SDL_DestroyMutex : TSDL_DestroyMutex_proc = Nil; +{$else} + +procedure SDL_DestroyMutex(mutex: PSDL_Mutex); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyMutex' {$ENDIF} {$ENDIF}; +{$endif} + + { -- Semaphore functions -- } +type + { The SDL semaphore structure, defined in SDL_sem.c } + PPSDL_Sem = ^PSDL_Sem; + PSDL_Sem = Type Pointer; + +{** + * Create a semaphore. + * + * This function creates a new semaphore and initializes it with the provided + * initial value. Each wait operation on the semaphore will atomically + * decrement the semaphore value and potentially block if the semaphore value + * is 0. Each post operation will atomically increment the semaphore value and + * wake waiting threads and allow them to retry the wait operation. + * + * \param initial_value the starting value of the semaphore + * \returns a new semaphore or NIL on failure; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateSemaphore_fun = function(initial_value: cuint32): PSDL_sem; cdecl; +Var + SDL_CreateSemaphore : TSDL_CreateSemaphore_fun = Nil; +{$else} + +function SDL_CreateSemaphore(initial_value: cuint32): PSDL_sem; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateSemaphore' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Destroy a semaphore. + * + * It is not safe to destroy a semaphore if there are threads currently + * waiting on it. + * + * \param sem the semaphore to destroy + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_DestroySemaphore_proc = procedure(sem: PSDL_Sem); cdecl; +Var + SDL_DestroySemaphore : TSDL_DestroySemaphore_proc = Nil; +{$else} + +procedure SDL_DestroySemaphore(sem: PSDL_Sem); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroySemaphore' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Wait until a semaphore has a positive value and then decrements it. + * + * This function suspends the calling thread until either the semaphore + * pointed to by `sem` has a positive value or the call is interrupted by a + * signal or error. If the call is successful it will atomically decrement the + * semaphore value. + * + * This function is the equivalent of calling SDL_SemWaitTimeout() with a time + * length of SDL_MUTEX_MAXWAIT. + * + * \param sem the semaphore wait on + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SemWait_fun = function(sem: PSDL_Sem): cint; cdecl; +Var + SDL_SemWait : TSDL_SemWait_fun = Nil; +{$else} + +function SDL_SemWait(sem: PSDL_Sem): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SemWait' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * See if a semaphore has a positive value and decrement it if it does. + * + * This function checks to see if the semaphore pointed to by `sem` has a + * positive value and atomically decrements the semaphore value if it does. If + * the semaphore doesn't have a positive value, the function immediately + * returns SDL_MUTEX_TIMEDOUT. + * + * \param sem the semaphore to wait on + * \returns 0 if the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait would + * block, or a negative error code on failure; call SDL_GetError() + * for more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SemTryWait_fun = function(sem: PSDL_Sem): cint; cdecl; +Var + SDL_SemTryWait : TSDL_SemTryWait_fun = Nil; +{$else} + +function SDL_SemTryWait(sem: PSDL_Sem): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SemTryWait' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Wait until a semaphore has a positive value and then decrements it. + * + * This function suspends the calling thread until either the semaphore + * pointed to by `sem` has a positive value, the call is interrupted by a + * signal or error, or the specified time has elapsed. If the call is + * successful it will atomically decrement the semaphore value. + * + * \param sem the semaphore to wait on + * \param ms the length of the timeout, in milliseconds + * \returns 0 if the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not + * succeed in the allotted time, or a negative error code on failure; + * call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SemWaitTimeout_fun = function(sem: PSDL_Sem; ms: cuint32): cint; cdecl; +Var + SDL_SemWaitTimeout : TSDL_SemWaitTimeout_fun = Nil; +{$else} + +function SDL_SemWaitTimeout(sem: PSDL_Sem; ms: cuint32): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SemWaitTimeout' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Atomically increment a semaphore's value and wake waiting threads. + * + * \param sem the semaphore to increment + * \returns 0 on success or a negative error code on failure; + * call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SemPost_fun = function(sem: PSDL_Sem): cint; cdecl; +Var + SDL_SemPost : TSDL_SemPost_fun = Nil; +{$else} + +function SDL_SemPost(sem: PSDL_Sem): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SemPost' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the current value of a semaphore. + * + * \param sem the semaphore to query + * \returns the current value of the semaphore. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SemValue_fun = function(sem: PSDL_Sem): cuint32; cdecl; +Var + SDL_SemValue : TSDL_SemValue_fun = Nil; +{$else} + +function SDL_SemValue(sem: PSDL_Sem): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SemValue' {$ENDIF} {$ENDIF}; +{$endif} + + { -- Condition variable functions -- } +type + { The SDL condition variable structure, defined in SDL_cond.c } + PPSDL_Cond = ^PSDL_Cond; + + {** + * The condition variable type. + * + * Typical use of condition variables: + * + * Thread A: + * SDL_LockMutex(lock); + * while ( not condition ) + * begin + * SDL_CondWait(cond, lock); + * end; + * SDL_UnlockMutex(lock); + * + * Thread B: + * SDL_LockMutex(lock); + * ... + * condition := true; + * ... + * SDL_CondSignal(cond); + * SDL_UnlockMutex(lock); + * + * There is some discussion whether to signal the condition variable + * with the mutex locked or not. There is some potential performance + * benefit to unlocking first on some platforms, but there are some + * potential race conditions depending on how your code is structured. + * + * In general it's safer to signal the condition variable while the + * mutex is locked. + *} + PSDL_Cond = Type Pointer; + +{** + * Create a condition variable. + * + * \returns a new condition variable or NIL on failure; call SDL_GetError() + * for more information. + * + * \since This function is available since SDL 2.0.0. + *} +function SDL_CreateCond: PSDL_Cond; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateCond' {$ENDIF} {$ENDIF}; + +{** + * Destroy a condition variable. + * + * \param cond the condition variable to destroy + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_DestroyCond_proc = procedure(cond: PSDL_Cond); cdecl; +Var + SDL_DestroyCond : TSDL_DestroyCond_proc = Nil; +{$else} + +procedure SDL_DestroyCond(cond: PSDL_Cond); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyCond' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Restart one of the threads that are waiting on the condition variable. + * + * \param cond the condition variable to signal + * \returns 0 on success or a negative error code on failure; + * call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CondSignal_fun = function(cond: PSDL_Cond): cint; cdecl; +Var + SDL_CondSignal : TSDL_CondSignal_fun = Nil; +{$else} + +function SDL_CondSignal(cond: PSDL_Cond): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CondSignal' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Restart all threads that are waiting on the condition variable. + * + * \param cond the condition variable to signal + * \returns 0 on success or a negative error code on failure; + * call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CondBroadcast_fun = function(cond: PSDL_Cond): cint; cdecl; +Var + SDL_CondBroadcast : TSDL_CondBroadcast_fun = Nil; +{$else} + +function SDL_CondBroadcast(cond: PSDL_Cond): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CondBroadcast' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Wait until a condition variable is signaled. + * + * This function unlocks the specified `mutex` and waits for another thread to + * call SDL_CondSignal() or SDL_CondBroadcast() on the condition variable + * `cond`. Once the condition variable is signaled, the mutex is re-locked and + * the function returns. + * + * The mutex must be locked before calling this function. + * + * This function is the equivalent of calling SDL_CondWaitTimeout() with a + * time length of SDL_MUTEX_MAXWAIT. + * + * \param cond the condition variable to wait on + * \param mutex the mutex used to coordinate thread access + * \returns 0 when it is signaled or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CondWait_fun = function(cond: PSDL_Cond; mutex: PSDL_Mutex): cint; cdecl; +Var + SDL_CondWait : TSDL_CondWait_fun = Nil; +{$else} + +function SDL_CondWait(cond: PSDL_Cond; mutex: PSDL_Mutex): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CondWait' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Wait until a condition variable is signaled or a certain time has passed. + * + * This function unlocks the specified `mutex` and waits for another thread to + * call SDL_CondSignal() or SDL_CondBroadcast() on the condition variable + * `cond`, or for the specified time to elapse. Once the condition variable is + * signaled or the time elapsed, the mutex is re-locked and the function + * returns. + * + * The mutex must be locked before calling this function. + * + * \param cond the condition variable to wait on + * \param mutex the mutex used to coordinate thread access + * \param ms the maximum time to wait, in milliseconds, or SDL_MUTEX_MAXWAIT + * to wait indefinitely + * \returns 0 if the condition variable is signaled, SDL_MUTEX_TIMEDOUT if + * the condition is not signaled in the allotted time, or a negative + * error code on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CondWaitTimeout_fun = function(cond: PSDL_Cond; mutex: PSDL_Mutex; ms: cuint32): cint; cdecl; +Var + SDL_CondWaitTimeout : TSDL_CondWaitTimeout_fun = Nil; +{$else} + +function SDL_CondWaitTimeout(cond: PSDL_Cond; mutex: PSDL_Mutex; ms: cuint32): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CondWaitTimeout' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlpixels.inc b/units/sdlpixels.inc index bf3b1f2c..02e5783f 100644 --- a/units/sdlpixels.inc +++ b/units/sdlpixels.inc @@ -1,806 +1,919 @@ -// based on "sdl_pixels.h" (2.0.14, WIP) - -{** - * \file SDL_pixels.h - * - * Header for the enumerated pixel format definitions. - *} - -{** - * Transparency definitions - * - * These define alpha as the opacity of a surface. - *} - -const - SDL_ALPHA_OPAQUE = 255; - SDL_ALPHA_TRANSPARENT = 0; - -{** Pixel type. *} -type - PPSDL_PixelType = ^PSDL_PixelType; - PSDL_PixelType = ^TSDL_PixelType; - TSDL_PixelType = type cuint; - -const - SDL_PIXELTYPE_UNKNOWN = TSDL_PixelType(0); - SDL_PIXELTYPE_INDEX1 = TSDL_PixelType(1); - SDL_PIXELTYPE_INDEX4 = TSDL_PixelType(2); - SDL_PIXELTYPE_INDEX8 = TSDL_PixelType(3); - SDL_PIXELTYPE_PACKED8 = TSDL_PixelType(4); - SDL_PIXELTYPE_PACKED16 = TSDL_PixelType(5); - SDL_PIXELTYPE_PACKED32 = TSDL_PixelType(6); - SDL_PIXELTYPE_ARRAYU8 = TSDL_PixelType(7); - SDL_PIXELTYPE_ARRAYU16 = TSDL_PixelType(8); - SDL_PIXELTYPE_ARRAYU32 = TSDL_PixelType(9); - SDL_PIXELTYPE_ARRAYF16 = TSDL_PixelType(10); - SDL_PIXELTYPE_ARRAYF32 = TSDL_PixelType(11); - -{** Bitmap pixel order, high bit -> low bit. *} -type - PPSDL_BitmapOrder = ^PSDL_BitmapOrder; - PSDL_BitmapOrder = ^TSDL_BitmapOrder; - TSDL_BitmapOrder = type cuint32; - -const - SDL_BITMAPORDER_NONE = TSDL_BitmapOrder(0); - SDL_BITMAPORDER_4321 = TSDL_BitmapOrder(1); - SDL_BITMAPORDER_1234 = TSDL_BitmapOrder(2); - -{** Packed component order, high bit -> low bit. *} -type - PPSDL_PackOrder = ^PSDL_PackOrder; - PSDL_PackOrder = ^TSDL_PackOrder; - TSDL_PackOrder = type cuint32; - -const - SDL_PACKEDORDER_NONE = TSDL_PackOrder(0); - SDL_PACKEDORDER_XRGB = TSDL_PackOrder(1); - SDL_PACKEDORDER_RGBX = TSDL_PackOrder(2); - SDL_PACKEDORDER_ARGB = TSDL_PackOrder(3); - SDL_PACKEDORDER_RGBA = TSDL_PackOrder(4); - SDL_PACKEDORDER_XBGR = TSDL_PackOrder(5); - SDL_PACKEDORDER_BGRX = TSDL_PackOrder(6); - SDL_PACKEDORDER_ABGR = TSDL_PackOrder(7); - SDL_PACKEDORDER_BGRA = TSDL_PackOrder(8); - -{** Array component order, low byte -> high byte. *} -type - PPSDL_ArrayOrder = ^PSDL_ArrayOrder; - PSDL_ArrayOrder = ^TSDL_ArrayOrder; - TSDL_ArrayOrder = type cuint32; - -const - SDL_ARRAYORDER_NONE = TSDL_ArrayOrder(0); - SDL_ARRAYORDER_RGB = TSDL_ArrayOrder(1); - SDL_ARRAYORDER_RGBA = TSDL_ArrayOrder(2); - SDL_ARRAYORDER_ARGB = TSDL_ArrayOrder(3); - SDL_ARRAYORDER_BGR = TSDL_ArrayOrder(4); - SDL_ARRAYORDER_BGRA = TSDL_ArrayOrder(5); - SDL_ARRAYORDER_ABGR = TSDL_ArrayOrder(6); - -{** Packed component layout. *} -type - PPSDL_PackedLayout = ^PSDL_PackedLayout; - PSDL_PackedLayout = ^TSDL_PackedLayout; - TSDL_PackedLayout = type cuint32; - -const - SDL_PACKEDLAYOUT_NONE = TSDL_PackedLayout(0); - SDL_PACKEDLAYOUT_332 = TSDL_PackedLayout(1); - SDL_PACKEDLAYOUT_4444 = TSDL_PackedLayout(2); - SDL_PACKEDLAYOUT_1555 = TSDL_PackedLayout(3); - SDL_PACKEDLAYOUT_5551 = TSDL_PackedLayout(4); - SDL_PACKEDLAYOUT_565 = TSDL_PackedLayout(5); - SDL_PACKEDLAYOUT_8888 = TSDL_PackedLayout(6); - SDL_PACKEDLAYOUT_2101010 = TSDL_PackedLayout(7); - SDL_PACKEDLAYOUT_1010102 = TSDL_PackedLayout(8); - -{ -SDL2-for-Pascal: The SDL_DEFINE_PIXELFOURCC macro is replaced - by another macro, the SDL_FOURCC macro (in SDL_stdinc.h). - - The original C SDL_FOURCC macro: - #define SDL_FOURCC(A, B, C, D) \ - ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \ - (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \ - (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \ - (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24)) - - In Pascal it is cleaner to implement this directly as a - constant instead of a function. So we do, e. g.: - - SDL_PIXELFORMAT_YV12 = (cuint32('Y') ) or - (cuint32('V') shl 8) or - (cuint32('1') shl 16) or - (cuint32('2') shl 24); - - In the future it may be desirable to have a Pascal function. - The prototype could look like this: - function SDL_DEFINE_PIXELFOURCC(A,B,C,D: Variant): Variant; -} - -{ -SDL2-for-Pascal: The SDL_DEFINE_PIXELFORMAT macro returns the underlying - pixel format based on five arguments. - - The original C macro: - #define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \ - ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \ - ((bits) << 8) | ((bytes) << 0)) - - This C implementation could be replaced by a Pascal function, - but from a performance stand point this will be slower. - Therefore we decided to keep it as it has been implemented - before by the original binding authors and translate - every pixel format constant by the very same expression: - - SDL_PIXELFORMAT_[...] = (1 shl 28) or - (SDL_PIXELTYPE_[...] shl 24) or - (SDL_BITMAPORDER_[...] shl 20) or - ([...] shl 16) or - ([...] shl 8) or - ([...] shl 0); - - In the future it may be desirable to have a Pascal function. - The prototype could look like this: - function SDL_DEFINE_PIXELFORMAT(type, order, layour, bit, bytes: cuint32): Result; -} - -function SDL_PIXELFLAG(X: cuint32): cuint32; -function SDL_PIXELTYPE(X: cuint32): cuint32; -function SDL_PIXELORDER(X: cuint32): cuint32; -function SDL_PIXELLAYOUT(X: cuint32): cuint32; -function SDL_BITSPERPIXEL(X: cuint32): cuint32; - -{ -SDL2-for-Pascal: Is it worth translating these macros as they seem to be used - by SDL2 internally only? - -#define SDL_BYTESPERPIXEL(X) \ - (SDL_ISPIXELFORMAT_FOURCC(X) ? \ - ((((X) == SDL_PIXELFORMAT_YUY2) || \ - ((X) == SDL_PIXELFORMAT_UYVY) || \ - ((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF)) - -#define SDL_ISPIXELFORMAT_INDEXED(format) \ - (!SDL_ISPIXELFORMAT_FOURCC(format) && \ - ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \ - (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \ - (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8))) - -#define SDL_ISPIXELFORMAT_PACKED(format) \ - (!SDL_ISPIXELFORMAT_FOURCC(format) && \ - ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED8) || \ - (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED16) || \ - (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32))) - -#define SDL_ISPIXELFORMAT_ARRAY(format) \ - (!SDL_ISPIXELFORMAT_FOURCC(format) && \ - ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU8) || \ - (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU16) || \ - (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU32) || \ - (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \ - (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32))) - -#define SDL_ISPIXELFORMAT_ALPHA(format) \ - ((SDL_ISPIXELFORMAT_PACKED(format) && \ - ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \ - (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \ - (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \ - (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))) || \ - (SDL_ISPIXELFORMAT_ARRAY(format) && \ - ((SDL_PIXELORDER(format) == SDL_ARRAYORDER_ARGB) || \ - (SDL_PIXELORDER(format) == SDL_ARRAYORDER_RGBA) || \ - (SDL_PIXELORDER(format) == SDL_ARRAYORDER_ABGR) || \ - (SDL_PIXELORDER(format) == SDL_ARRAYORDER_BGRA)))) -} - -{* The flag is set to 1 because 0x1? is not in the printable ASCII range *} -function SDL_ISPIXELFORMAT_FOURCC(format: Variant): Boolean; - -{* Note: If you modify this list, update SDL_GetPixelFormatName() *} -const - SDL_PIXELFORMAT_UNKNOWN = 0; - SDL_PIXELFORMAT_INDEX1LSB = (1 shl 28) or - (SDL_PIXELTYPE_INDEX1 shl 24) or - (SDL_BITMAPORDER_4321 shl 20) or - (0 shl 16) or - (1 shl 8) or - (0 shl 0); - - SDL_PIXELFORMAT_INDEX1MSB = (1 shl 28) or - (SDL_PIXELTYPE_INDEX1 shl 24) or - (SDL_BITMAPORDER_1234 shl 20) or - (0 shl 16) or - (1 shl 8) or - (0 shl 0); - - SDL_PIXELFORMAT_INDEX4LSB = (1 shl 28) or - (SDL_PIXELTYPE_INDEX4 shl 24) or - (SDL_BITMAPORDER_4321 shl 20) or - (0 shl 16) or - (4 shl 8) or - (0 shl 0); - - SDL_PIXELFORMAT_INDEX4MSB = (1 shl 28) or - (SDL_PIXELTYPE_INDEX4 shl 24) or - (SDL_BITMAPORDER_1234 shl 20) or - (0 shl 16) or - (4 shl 8) or - (0 shl 0); - - SDL_PIXELFORMAT_INDEX8 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED8 shl 24) or - (0 shl 20) or - (0 shl 16) or - (8 shl 8) or - (1 shl 0); - - SDL_PIXELFORMAT_RGB332 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED8 shl 24) or - (SDL_PACKEDORDER_XRGB shl 20) or - (SDL_PACKEDLAYOUT_332 shl 16) or - (8 shl 8) or - (1 shl 0); - - SDL_PIXELFORMAT_RGB444 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_XRGB shl 20) or - (SDL_PACKEDLAYOUT_4444 shl 16) or - (12 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_RGB555 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_XRGB shl 20) or - (SDL_PACKEDLAYOUT_1555 shl 16) or - (15 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_BGR555 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_XBGR shl 20) or - (SDL_PACKEDLAYOUT_1555 shl 16) or - (15 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_ARGB4444 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_ARGB shl 20) or - (SDL_PACKEDLAYOUT_4444 shl 16) or - (16 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_RGBA4444 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_RGBA shl 20) or - (SDL_PACKEDLAYOUT_4444 shl 16) or - (16 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_ABGR4444 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_ABGR shl 20) or - (SDL_PACKEDLAYOUT_4444 shl 16) or - (16 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_BGRA4444 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_BGRA shl 20) or - (SDL_PACKEDLAYOUT_4444 shl 16) or - (16 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_ARGB1555 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_ARGB shl 20) or - (SDL_PACKEDLAYOUT_1555 shl 16) or - (16 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_RGBA5551 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_RGBA shl 20) or - (SDL_PACKEDLAYOUT_5551 shl 16) or - (16 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_ABGR1555 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_ABGR shl 20) or - (SDL_PACKEDLAYOUT_1555 shl 16) or - (16 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_BGRA5551 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_BGRA shl 20) or - (SDL_PACKEDLAYOUT_5551 shl 16) or - (16 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_RGB565 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_XRGB shl 20) or - (SDL_PACKEDLAYOUT_565 shl 16) or - (16 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_BGR565 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_XBGR shl 20) or - (SDL_PACKEDLAYOUT_1555 shl 16) or - (16 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_RGB24 = (1 shl 28) or - (SDL_PIXELTYPE_ARRAYU8 shl 24) or - (SDL_ARRAYORDER_RGB shl 20) or - (0 shl 16) or - (24 shl 8) or - (3 shl 0); - - SDL_PIXELFORMAT_BGR24 = (1 shl 28) or - (SDL_PIXELTYPE_ARRAYU8 shl 24) or - (SDL_ARRAYORDER_BGR shl 20) or - (0 shl 16) or - (24 shl 8) or - (3 shl 0); - - SDL_PIXELFORMAT_RGB888 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED32 shl 24) or - (SDL_PACKEDORDER_XRGB shl 20) or - (SDL_PACKEDLAYOUT_8888 shl 16) or - (24 shl 8) or - (4 shl 0); - - SDL_PIXELFORMAT_RGBX8888 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED32 shl 24) or - (SDL_PACKEDORDER_RGBX shl 20) or - (SDL_PACKEDLAYOUT_8888 shl 16) or - (24 shl 8) or - (4 shl 0); - - SDL_PIXELFORMAT_BGR888 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED32 shl 24) or - (SDL_PACKEDORDER_XBGR shl 20) or - (SDL_PACKEDLAYOUT_8888 shl 16) or - (24 shl 8) or - (4 shl 0); - - SDL_PIXELFORMAT_BGRX8888 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED32 shl 24) or - (SDL_PACKEDORDER_BGRX shl 20) or - (SDL_PACKEDLAYOUT_8888 shl 16) or - (24 shl 8) or - (4 shl 0); - - SDL_PIXELFORMAT_ARGB8888 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED32 shl 24) or - (SDL_PACKEDORDER_ARGB shl 20) or - (SDL_PACKEDLAYOUT_8888 shl 16) or - (32 shl 8) or - (4 shl 0); - - SDL_PIXELFORMAT_RGBA8888 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED32 shl 24) or - (SDL_PACKEDORDER_RGBA shl 20) or - (SDL_PACKEDLAYOUT_8888 shl 16) or - (32 shl 8) or - (4 shl 0); - - SDL_PIXELFORMAT_ABGR8888 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED32 shl 24) or - (SDL_PACKEDORDER_ABGR shl 20) or - (SDL_PACKEDLAYOUT_8888 shl 16) or - (32 shl 8) or - (4 shl 0); - - SDL_PIXELFORMAT_BGRA8888 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED32 shl 24) or - (SDL_PACKEDORDER_RGBX shl 20) or - (SDL_PACKEDLAYOUT_8888 shl 16) or - (32 shl 8) or - (4 shl 0); - - SDL_PIXELFORMAT_ARGB2101010 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED32 shl 24) or - (SDL_PACKEDORDER_ARGB shl 20) or - (SDL_PACKEDLAYOUT_2101010 shl 16)or - (32 shl 8) or - (4 shl 0); - - (* Aliases for RGBA byte arrays of color data, for the current platform *) - {$IFDEF FPC} - {$IF DEFINED(ENDIAN_LITTLE)} - SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888; - SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888; - SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888; - SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888; - {$ELSEIF DEFINED(ENDIAN_BIG)} - SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_RGBA8888; - SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_ARGB8888; - SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_BGRA8888; - SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_ABGR8888; - {$ELSE} - {$FATAL Cannot determine endianness.} - {$IFEND} - {$ENDIF} - - {**< Planar mode: Y + V + U (3 planes) *} - SDL_PIXELFORMAT_YV12 = (cuint32('Y') ) or - (cuint32('V') shl 8) or - (cuint32('1') shl 16) or - (cuint32('2') shl 24); - {**< Planar mode: Y + U + V (3 planes) *} - SDL_PIXELFORMAT_IYUV = (cuint32('I') ) or - (cuint32('Y') shl 8) or - (cuint32('U') shl 16) or - (cuint32('V') shl 24); - {**< Packed mode: Y0+U0+Y1+V0 (1 plane) *} - SDL_PIXELFORMAT_YUY2 = (cuint32('Y') ) or - (cuint32('U') shl 8) or - (cuint32('Y') shl 16) or - (cuint32('2') shl 24); - {**< Packed mode: U0+Y0+V0+Y1 (1 plane) *} - SDL_PIXELFORMAT_UYVY = (cuint32('U') ) or - (cuint32('Y') shl 8) or - (cuint32('V') shl 16) or - (cuint32('Y') shl 24); - {**< Packed mode: Y0+V0+Y1+U0 (1 plane) *} - SDL_PIXELFORMAT_YVYU = (cuint32('Y') ) or - (cuint32('V') shl 8) or - (cuint32('Y') shl 16) or - (cuint32('U') shl 24); - {**< Planar mode: Y + U/V interleaved (2 planes) *} - SDL_PIXELFORMAT_NV12 = (cuint32('N') ) or - (cuint32('V') shl 8) or - (cuint32('1') shl 16) or - (cuint32('2') shl 24); - {**< Planar mode: Y + V/U interleaved (2 planes) *} - SDL_PIXELFORMAT_NV21 = (cuint32('N') ) or - (cuint32('V') shl 8) or - (cuint32('2') shl 16) or - (cuint32('1') shl 24); - {**< Android video texture format *} - SDL_PIXELFORMAT_EXTERMAL_OES - = (cuint32('O') ) or - (cuint32('E') shl 8) or - (cuint32('S') shl 16) or - (cuint32(' ') shl 24); - -type - - {** - * The bits of this structure can be directly reinterpreted as an integer-packed - * color which uses the SDL_PIXELFORMAT_RGBA32 format (SDL_PIXELFORMAT_ABGR8888 - * on little-endian systems and SDL_PIXELFORMAT_RGBA8888 on big-endian systems). - *} - PPSDL_Color = ^PSDL_Color; - PSDL_Color = ^TSDL_Color; - TSDL_Color = record - r: cuint8; - g: cuint8; - b: cuint8; - a: cuint8; - end; - - PPSDL_Colour = ^PSDL_Colour; - PSDL_Colour = ^TSDL_Colour; - TSDL_Colour = TSDL_Color; - - PPSDL_Palette = ^PSDL_Palette; - PSDL_Palette = ^TSDL_Palette; - TSDL_Palette = record - ncolors: cint; - colors: PSDL_Color; - version: cuint32; - refcount: cint; - end; - - {** - * Everything in the pixel format structure is read-only. - *} - PPSDL_PixelFormat = ^PSDL_PixelFormat; - PSDL_PixelFormat = ^TSDL_PixelFormat; - TSDL_PixelFormat = record - format: cuint32; - palette: PSDL_Palette; - BitsPerPixel: cuint8; - BytesPerPixel: cuint8; - padding: array[0..1] of cuint8; - Rmask: cuint32; - Gmask: cuint32; - Bmask: cuint32; - Amask: cuint32; - Rloss: cuint8; - Gloss: cuint8; - Bloss: cuint8; - Aloss: cuint8; - Rshift: cuint8; - Gshift: cuint8; - Bshift: cuint8; - Ashift: cuint8; - refcount: cint; - next: PSDL_PixelFormat; - end; - -{** - * Get the human readable name of a pixel format. - * - * \param format the pixel format to query - * \returns the human readable name of the specified pixel format or - * `SDL_PIXELFORMAT_UNKNOWN` if the format isn't recognized. - * - * \since This function is available since SDL 2.0.0. - *} -function SDL_GetPixelFormatName(format: cuint32): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPixelFormatName' {$ENDIF} {$ENDIF}; - -{** - * Convert one of the enumerated pixel formats to a bpp value and RGBA masks. - * - * \param format one of the SDL_PixelFormatEnum values - * \param bpp a bits per pixel value; usually 15, 16, or 32 - * \param Rmask a pointer filled in with the red mask for the format - * \param Gmask a pointer filled in with the green mask for the format - * \param Bmask a pointer filled in with the blue mask for the format - * \param Amask a pointer filled in with the alpha mask for the format - * \returns SDL_TRUE on success or SDL_FALSE if the conversion wasn't - * possible; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_MasksToPixelFormatEnum - *} -function SDL_PixelFormatEnumToMasks(format: cuint32; bpp: pcint; - Rmask: pcuint32; Gmask: pcuint32; Bmask: pcuint32; Amask: pcuint32): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PixelFormatEnumToMasks' {$ENDIF} {$ENDIF}; - -{** - * Convert a bpp value and RGBA masks to an enumerated pixel format. - * - * This will return `SDL_PIXELFORMAT_UNKNOWN` if the conversion wasn't - * possible. - * - * \param bpp a bits per pixel value; usually 15, 16, or 32 - * \param Rmask the red mask for the format - * \param Gmask the green mask for the format - * \param Bmask the blue mask for the format - * \param Amask the alpha mask for the format - * \returns one of the SDL_PixelFormatEnum values - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_PixelFormatEnumToMasks - *} -function SDL_MasksToPixelFormatEnum(bpp: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MasksToPixelFormatEnum' {$ENDIF} {$ENDIF}; - -{** - * Create an SDL_PixelFormat structure corresponding to a pixel format. - * - * Returned structure may come from a shared global cache (i.e. not newly - * allocated), and hence should not be modified, especially the palette. Weird - * errors such as `Blit combination not supported` may occur. - * - * \param pixel_format one of the SDL_PixelFormatEnum values - * \returns the new SDL_PixelFormat structure or NULL on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_FreeFormat - *} -function SDL_AllocFormat(pixel_format: cuint32): PSDL_PixelFormat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AllocFormat' {$ENDIF} {$ENDIF}; - -{** - * Free an SDL_PixelFormat structure allocated by SDL_AllocFormat(). - * - * \param format the SDL_PixelFormat structure to free - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AllocFormat - *} -procedure SDL_FreeFormat(format: PSDL_PixelFormat); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeFormat' {$ENDIF} {$ENDIF}; - -{** - * Create a palette structure with the specified number of color entries. - * - * The palette entries are initialized to white. - * - * \param ncolors represents the number of color entries in the color palette - * \returns a new SDL_Palette structure on success or NULL on failure (e.g. if - * there wasn't enough memory); call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_FreePalette - *} -function SDL_AllocPalette(ncolors: cint): PSDL_Palette; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AllocPalette' {$ENDIF} {$ENDIF}; - -{** - * Set the palette for a pixel format structure. - * - * \param format the SDL_PixelFormat structure that will use the palette - * \param palette the SDL_Palette structure that will be used - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AllocPalette - * \sa SDL_FreePalette - *} -function SDL_SetPixelFormatPalette(format: PSDL_PixelFormat; palette: PSDL_Palette): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetPixelFormatPalette' {$ENDIF} {$ENDIF}; - -{** - * Set a range of colors in a palette. - * - * \param palette the SDL_Palette structure to modify - * \param colors an array of SDL_Color structures to copy into the palette - * \param firstcolor the index of the first palette entry to modify - * \param ncolors the number of entries to modify - * \returns 0 on success or a negative error code if not all of the colors - * could be set; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AllocPalette - * \sa SDL_CreateRGBSurface - *} -function SDL_SetPaletteColors(palette: PSDL_Palette; const colors: PSDL_Color; firstcolor: cint; ncolors: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetPaletteColors' {$ENDIF} {$ENDIF}; - -{** - * Free a palette created with SDL_AllocPalette(). - * - * \param palette the SDL_Palette structure to be freed - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AllocPalette - *} -procedure SDL_FreePalette(palette: PSDL_Palette); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreePalette' {$ENDIF} {$ENDIF}; - -{** - * Map an RGB triple to an opaque pixel value for a given pixel format. - * - * This function maps the RGB color value to the specified pixel format and - * returns the pixel value best approximating the given RGB color value for - * the given pixel format. - * - * If the format has a palette (8-bit) the index of the closest matching color - * in the palette will be returned. - * - * If the specified pixel format has an alpha component it will be returned as - * all 1 bits (fully opaque). - * - * If the pixel format bpp (color depth) is less than 32-bpp then the unused - * upper bits of the return value can safely be ignored (e.g., with a 16-bpp - * format the return value can be assigned to a Uint16, and similarly a Uint8 - * for an 8-bpp format). - * - * \param format an SDL_PixelFormat structure describing the pixel format - * \param r the red component of the pixel in the range 0-255 - * \param g the green component of the pixel in the range 0-255 - * \param b the blue component of the pixel in the range 0-255 - * \returns a pixel value - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetRGB - * \sa SDL_GetRGBA - * \sa SDL_MapRGBA - *} -function SDL_MapRGB(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cuint8): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MapRGB' {$ENDIF} {$ENDIF}; - -{** - * Map an RGBA quadruple to a pixel value for a given pixel format. - * - * This function maps the RGBA color value to the specified pixel format and - * returns the pixel value best approximating the given RGBA color value for - * the given pixel format. - * - * If the specified pixel format has no alpha component the alpha value will - * be ignored (as it will be in formats with a palette). - * - * If the format has a palette (8-bit) the index of the closest matching color - * in the palette will be returned. - * - * If the pixel format bpp (color depth) is less than 32-bpp then the unused - * upper bits of the return value can safely be ignored (e.g., with a 16-bpp - * format the return value can be assigned to a Uint16, and similarly a Uint8 - * for an 8-bpp format). - * - * \param format an SDL_PixelFormat structure describing the format of the - * pixel - * \param r the red component of the pixel in the range 0-255 - * \param g the green component of the pixel in the range 0-255 - * \param b the blue component of the pixel in the range 0-255 - * \param a the alpha component of the pixel in the range 0-255 - * \returns a pixel value - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetRGB - * \sa SDL_GetRGBA - * \sa SDL_MapRGB - *} -function SDL_MapRGBA(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cuint8; a: cuint8): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MapRGBA' {$ENDIF} {$ENDIF}; - -{** - * Get RGB values from a pixel in the specified format. - * - * This function uses the entire 8-bit [0..255] range when converting color - * components from pixel formats with less than 8-bits per RGB component - * (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, - * 0xff, 0xff] not [0xf8, 0xfc, 0xf8]). - * - * \param pixel a pixel value - * \param format an SDL_PixelFormat structure describing the format of the - * pixel - * \param r a pointer filled in with the red component - * \param g a pointer filled in with the green component - * \param b a pointer filled in with the blue component - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetRGBA - * \sa SDL_MapRGB - * \sa SDL_MapRGBA - *} -procedure SDL_GetRGB(pixel: cuint32; const format: PSDL_PixelFormat; r: pcuint8; g: pcuint8; b: pcuint8); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRGB' {$ENDIF} {$ENDIF}; - -{** - * Get RGBA values from a pixel in the specified format. - * - * This function uses the entire 8-bit [0..255] range when converting color - * components from pixel formats with less than 8-bits per RGB component - * (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, - * 0xff, 0xff] not [0xf8, 0xfc, 0xf8]). - * - * If the surface has no alpha component, the alpha will be returned as 0xff - * (100% opaque). - * - * \param pixel a pixel value - * \param format an SDL_PixelFormat structure describing the format of the - * pixel - * \param r a pointer filled in with the red component - * \param g a pointer filled in with the green component - * \param b a pointer filled in with the blue component - * \param a a pointer filled in with the alpha component - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetRGB - * \sa SDL_MapRGB - * \sa SDL_MapRGBA - *} -procedure SDL_GetRGBA(pixel: cuint32; const format: PSDL_PixelFormat; r: pcuint8; g: pcuint8; b: pcuint8; a: pcuint8); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRGBA' {$ENDIF} {$ENDIF}; - -{/** - * Calculate a 256 entry gamma ramp for a gamma value. - * - * \param gamma a gamma value where 0.0 is black and 1.0 is identity - * \param ramp an array of 256 values filled in with the gamma ramp - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_SetWindowGammaRamp - *} -procedure SDL_CalculateGammaRamp(gamma: cfloat; ramp: pcuint16); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CalculateGammaRamp' {$ENDIF} {$ENDIF}; +// based on "sdl_pixels.h" (2.0.14, WIP) + +{** + * \file SDL_pixels.h + * + * Header for the enumerated pixel format definitions. + *} + +{** + * Transparency definitions + * + * These define alpha as the opacity of a surface. + *} + +const + SDL_ALPHA_OPAQUE = 255; + SDL_ALPHA_TRANSPARENT = 0; + +{** Pixel type. *} +type + PPSDL_PixelType = ^PSDL_PixelType; + PSDL_PixelType = ^TSDL_PixelType; + TSDL_PixelType = type cuint; + +const + SDL_PIXELTYPE_UNKNOWN = TSDL_PixelType(0); + SDL_PIXELTYPE_INDEX1 = TSDL_PixelType(1); + SDL_PIXELTYPE_INDEX4 = TSDL_PixelType(2); + SDL_PIXELTYPE_INDEX8 = TSDL_PixelType(3); + SDL_PIXELTYPE_PACKED8 = TSDL_PixelType(4); + SDL_PIXELTYPE_PACKED16 = TSDL_PixelType(5); + SDL_PIXELTYPE_PACKED32 = TSDL_PixelType(6); + SDL_PIXELTYPE_ARRAYU8 = TSDL_PixelType(7); + SDL_PIXELTYPE_ARRAYU16 = TSDL_PixelType(8); + SDL_PIXELTYPE_ARRAYU32 = TSDL_PixelType(9); + SDL_PIXELTYPE_ARRAYF16 = TSDL_PixelType(10); + SDL_PIXELTYPE_ARRAYF32 = TSDL_PixelType(11); + +{** Bitmap pixel order, high bit -> low bit. *} +type + PPSDL_BitmapOrder = ^PSDL_BitmapOrder; + PSDL_BitmapOrder = ^TSDL_BitmapOrder; + TSDL_BitmapOrder = type cuint32; + +const + SDL_BITMAPORDER_NONE = TSDL_BitmapOrder(0); + SDL_BITMAPORDER_4321 = TSDL_BitmapOrder(1); + SDL_BITMAPORDER_1234 = TSDL_BitmapOrder(2); + +{** Packed component order, high bit -> low bit. *} +type + PPSDL_PackOrder = ^PSDL_PackOrder; + PSDL_PackOrder = ^TSDL_PackOrder; + TSDL_PackOrder = type cuint32; + +const + SDL_PACKEDORDER_NONE = TSDL_PackOrder(0); + SDL_PACKEDORDER_XRGB = TSDL_PackOrder(1); + SDL_PACKEDORDER_RGBX = TSDL_PackOrder(2); + SDL_PACKEDORDER_ARGB = TSDL_PackOrder(3); + SDL_PACKEDORDER_RGBA = TSDL_PackOrder(4); + SDL_PACKEDORDER_XBGR = TSDL_PackOrder(5); + SDL_PACKEDORDER_BGRX = TSDL_PackOrder(6); + SDL_PACKEDORDER_ABGR = TSDL_PackOrder(7); + SDL_PACKEDORDER_BGRA = TSDL_PackOrder(8); + +{** Array component order, low byte -> high byte. *} +type + PPSDL_ArrayOrder = ^PSDL_ArrayOrder; + PSDL_ArrayOrder = ^TSDL_ArrayOrder; + TSDL_ArrayOrder = type cuint32; + +const + SDL_ARRAYORDER_NONE = TSDL_ArrayOrder(0); + SDL_ARRAYORDER_RGB = TSDL_ArrayOrder(1); + SDL_ARRAYORDER_RGBA = TSDL_ArrayOrder(2); + SDL_ARRAYORDER_ARGB = TSDL_ArrayOrder(3); + SDL_ARRAYORDER_BGR = TSDL_ArrayOrder(4); + SDL_ARRAYORDER_BGRA = TSDL_ArrayOrder(5); + SDL_ARRAYORDER_ABGR = TSDL_ArrayOrder(6); + +{** Packed component layout. *} +type + PPSDL_PackedLayout = ^PSDL_PackedLayout; + PSDL_PackedLayout = ^TSDL_PackedLayout; + TSDL_PackedLayout = type cuint32; + +const + SDL_PACKEDLAYOUT_NONE = TSDL_PackedLayout(0); + SDL_PACKEDLAYOUT_332 = TSDL_PackedLayout(1); + SDL_PACKEDLAYOUT_4444 = TSDL_PackedLayout(2); + SDL_PACKEDLAYOUT_1555 = TSDL_PackedLayout(3); + SDL_PACKEDLAYOUT_5551 = TSDL_PackedLayout(4); + SDL_PACKEDLAYOUT_565 = TSDL_PackedLayout(5); + SDL_PACKEDLAYOUT_8888 = TSDL_PackedLayout(6); + SDL_PACKEDLAYOUT_2101010 = TSDL_PackedLayout(7); + SDL_PACKEDLAYOUT_1010102 = TSDL_PackedLayout(8); + +{ +SDL2-for-Pascal: The SDL_DEFINE_PIXELFOURCC macro is replaced + by another macro, the SDL_FOURCC macro (in SDL_stdinc.h). + + The original C SDL_FOURCC macro: + #define SDL_FOURCC(A, B, C, D) \ + ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \ + (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \ + (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \ + (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24)) + + In Pascal it is cleaner to implement this directly as a + constant instead of a function. So we do, e. g.: + + SDL_PIXELFORMAT_YV12 = (cuint32('Y') ) or + (cuint32('V') shl 8) or + (cuint32('1') shl 16) or + (cuint32('2') shl 24); + + In the future it may be desirable to have a Pascal function. + The prototype could look like this: + function SDL_DEFINE_PIXELFOURCC(A,B,C,D: Variant): Variant; +} + +{ +SDL2-for-Pascal: The SDL_DEFINE_PIXELFORMAT macro returns the underlying + pixel format based on five arguments. + + The original C macro: + #define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \ + ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \ + ((bits) << 8) | ((bytes) << 0)) + + This C implementation could be replaced by a Pascal function, + but from a performance stand point this will be slower. + Therefore we decided to keep it as it has been implemented + before by the original binding authors and translate + every pixel format constant by the very same expression: + + SDL_PIXELFORMAT_[...] = (1 shl 28) or + (SDL_PIXELTYPE_[...] shl 24) or + (SDL_BITMAPORDER_[...] shl 20) or + ([...] shl 16) or + ([...] shl 8) or + ([...] shl 0); + + In the future it may be desirable to have a Pascal function. + The prototype could look like this: + function SDL_DEFINE_PIXELFORMAT(type, order, layour, bit, bytes: cuint32): Result; +} + +function SDL_PIXELFLAG(X: cuint32): cuint32; +function SDL_PIXELTYPE(X: cuint32): cuint32; +function SDL_PIXELORDER(X: cuint32): cuint32; +function SDL_PIXELLAYOUT(X: cuint32): cuint32; +function SDL_BITSPERPIXEL(X: cuint32): cuint32; + +{ +SDL2-for-Pascal: Is it worth translating these macros as they seem to be used + by SDL2 internally only? + +#define SDL_BYTESPERPIXEL(X) \ + (SDL_ISPIXELFORMAT_FOURCC(X) ? \ + ((((X) == SDL_PIXELFORMAT_YUY2) || \ + ((X) == SDL_PIXELFORMAT_UYVY) || \ + ((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF)) + +#define SDL_ISPIXELFORMAT_INDEXED(format) \ + (!SDL_ISPIXELFORMAT_FOURCC(format) && \ + ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8))) + +#define SDL_ISPIXELFORMAT_PACKED(format) \ + (!SDL_ISPIXELFORMAT_FOURCC(format) && \ + ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED8) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED16) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32))) + +#define SDL_ISPIXELFORMAT_ARRAY(format) \ + (!SDL_ISPIXELFORMAT_FOURCC(format) && \ + ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU8) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU16) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU32) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32))) + +#define SDL_ISPIXELFORMAT_ALPHA(format) \ + ((SDL_ISPIXELFORMAT_PACKED(format) && \ + ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \ + (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \ + (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \ + (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))) || \ + (SDL_ISPIXELFORMAT_ARRAY(format) && \ + ((SDL_PIXELORDER(format) == SDL_ARRAYORDER_ARGB) || \ + (SDL_PIXELORDER(format) == SDL_ARRAYORDER_RGBA) || \ + (SDL_PIXELORDER(format) == SDL_ARRAYORDER_ABGR) || \ + (SDL_PIXELORDER(format) == SDL_ARRAYORDER_BGRA)))) +} + +{* The flag is set to 1 because 0x1? is not in the printable ASCII range *} +function SDL_ISPIXELFORMAT_FOURCC(format: Variant): Boolean; + +{* Note: If you modify this list, update SDL_GetPixelFormatName() *} +const + SDL_PIXELFORMAT_UNKNOWN = 0; + SDL_PIXELFORMAT_INDEX1LSB = (1 shl 28) or + (SDL_PIXELTYPE_INDEX1 shl 24) or + (SDL_BITMAPORDER_4321 shl 20) or + (0 shl 16) or + (1 shl 8) or + (0 shl 0); + + SDL_PIXELFORMAT_INDEX1MSB = (1 shl 28) or + (SDL_PIXELTYPE_INDEX1 shl 24) or + (SDL_BITMAPORDER_1234 shl 20) or + (0 shl 16) or + (1 shl 8) or + (0 shl 0); + + SDL_PIXELFORMAT_INDEX4LSB = (1 shl 28) or + (SDL_PIXELTYPE_INDEX4 shl 24) or + (SDL_BITMAPORDER_4321 shl 20) or + (0 shl 16) or + (4 shl 8) or + (0 shl 0); + + SDL_PIXELFORMAT_INDEX4MSB = (1 shl 28) or + (SDL_PIXELTYPE_INDEX4 shl 24) or + (SDL_BITMAPORDER_1234 shl 20) or + (0 shl 16) or + (4 shl 8) or + (0 shl 0); + + SDL_PIXELFORMAT_INDEX8 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED8 shl 24) or + (0 shl 20) or + (0 shl 16) or + (8 shl 8) or + (1 shl 0); + + SDL_PIXELFORMAT_RGB332 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED8 shl 24) or + (SDL_PACKEDORDER_XRGB shl 20) or + (SDL_PACKEDLAYOUT_332 shl 16) or + (8 shl 8) or + (1 shl 0); + + SDL_PIXELFORMAT_RGB444 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_XRGB shl 20) or + (SDL_PACKEDLAYOUT_4444 shl 16) or + (12 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_RGB555 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_XRGB shl 20) or + (SDL_PACKEDLAYOUT_1555 shl 16) or + (15 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_BGR555 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_XBGR shl 20) or + (SDL_PACKEDLAYOUT_1555 shl 16) or + (15 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_ARGB4444 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_ARGB shl 20) or + (SDL_PACKEDLAYOUT_4444 shl 16) or + (16 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_RGBA4444 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_RGBA shl 20) or + (SDL_PACKEDLAYOUT_4444 shl 16) or + (16 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_ABGR4444 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_ABGR shl 20) or + (SDL_PACKEDLAYOUT_4444 shl 16) or + (16 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_BGRA4444 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_BGRA shl 20) or + (SDL_PACKEDLAYOUT_4444 shl 16) or + (16 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_ARGB1555 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_ARGB shl 20) or + (SDL_PACKEDLAYOUT_1555 shl 16) or + (16 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_RGBA5551 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_RGBA shl 20) or + (SDL_PACKEDLAYOUT_5551 shl 16) or + (16 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_ABGR1555 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_ABGR shl 20) or + (SDL_PACKEDLAYOUT_1555 shl 16) or + (16 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_BGRA5551 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_BGRA shl 20) or + (SDL_PACKEDLAYOUT_5551 shl 16) or + (16 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_RGB565 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_XRGB shl 20) or + (SDL_PACKEDLAYOUT_565 shl 16) or + (16 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_BGR565 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_XBGR shl 20) or + (SDL_PACKEDLAYOUT_1555 shl 16) or + (16 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_RGB24 = (1 shl 28) or + (SDL_PIXELTYPE_ARRAYU8 shl 24) or + (SDL_ARRAYORDER_RGB shl 20) or + (0 shl 16) or + (24 shl 8) or + (3 shl 0); + + SDL_PIXELFORMAT_BGR24 = (1 shl 28) or + (SDL_PIXELTYPE_ARRAYU8 shl 24) or + (SDL_ARRAYORDER_BGR shl 20) or + (0 shl 16) or + (24 shl 8) or + (3 shl 0); + + SDL_PIXELFORMAT_RGB888 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED32 shl 24) or + (SDL_PACKEDORDER_XRGB shl 20) or + (SDL_PACKEDLAYOUT_8888 shl 16) or + (24 shl 8) or + (4 shl 0); + + SDL_PIXELFORMAT_RGBX8888 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED32 shl 24) or + (SDL_PACKEDORDER_RGBX shl 20) or + (SDL_PACKEDLAYOUT_8888 shl 16) or + (24 shl 8) or + (4 shl 0); + + SDL_PIXELFORMAT_BGR888 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED32 shl 24) or + (SDL_PACKEDORDER_XBGR shl 20) or + (SDL_PACKEDLAYOUT_8888 shl 16) or + (24 shl 8) or + (4 shl 0); + + SDL_PIXELFORMAT_BGRX8888 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED32 shl 24) or + (SDL_PACKEDORDER_BGRX shl 20) or + (SDL_PACKEDLAYOUT_8888 shl 16) or + (24 shl 8) or + (4 shl 0); + + SDL_PIXELFORMAT_ARGB8888 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED32 shl 24) or + (SDL_PACKEDORDER_ARGB shl 20) or + (SDL_PACKEDLAYOUT_8888 shl 16) or + (32 shl 8) or + (4 shl 0); + + SDL_PIXELFORMAT_RGBA8888 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED32 shl 24) or + (SDL_PACKEDORDER_RGBA shl 20) or + (SDL_PACKEDLAYOUT_8888 shl 16) or + (32 shl 8) or + (4 shl 0); + + SDL_PIXELFORMAT_ABGR8888 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED32 shl 24) or + (SDL_PACKEDORDER_ABGR shl 20) or + (SDL_PACKEDLAYOUT_8888 shl 16) or + (32 shl 8) or + (4 shl 0); + + SDL_PIXELFORMAT_BGRA8888 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED32 shl 24) or + (SDL_PACKEDORDER_RGBX shl 20) or + (SDL_PACKEDLAYOUT_8888 shl 16) or + (32 shl 8) or + (4 shl 0); + + SDL_PIXELFORMAT_ARGB2101010 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED32 shl 24) or + (SDL_PACKEDORDER_ARGB shl 20) or + (SDL_PACKEDLAYOUT_2101010 shl 16)or + (32 shl 8) or + (4 shl 0); + + (* Aliases for RGBA byte arrays of color data, for the current platform *) + {$IFDEF FPC} + {$IF DEFINED(ENDIAN_LITTLE)} + SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888; + SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888; + SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888; + SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888; + {$ELSEIF DEFINED(ENDIAN_BIG)} + SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_RGBA8888; + SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_ARGB8888; + SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_BGRA8888; + SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_ABGR8888; + {$ELSE} + {$FATAL Cannot determine endianness.} + {$IFEND} + {$ENDIF} + + {**< Planar mode: Y + V + U (3 planes) *} + SDL_PIXELFORMAT_YV12 = (cuint32('Y') ) or + (cuint32('V') shl 8) or + (cuint32('1') shl 16) or + (cuint32('2') shl 24); + {**< Planar mode: Y + U + V (3 planes) *} + SDL_PIXELFORMAT_IYUV = (cuint32('I') ) or + (cuint32('Y') shl 8) or + (cuint32('U') shl 16) or + (cuint32('V') shl 24); + {**< Packed mode: Y0+U0+Y1+V0 (1 plane) *} + SDL_PIXELFORMAT_YUY2 = (cuint32('Y') ) or + (cuint32('U') shl 8) or + (cuint32('Y') shl 16) or + (cuint32('2') shl 24); + {**< Packed mode: U0+Y0+V0+Y1 (1 plane) *} + SDL_PIXELFORMAT_UYVY = (cuint32('U') ) or + (cuint32('Y') shl 8) or + (cuint32('V') shl 16) or + (cuint32('Y') shl 24); + {**< Packed mode: Y0+V0+Y1+U0 (1 plane) *} + SDL_PIXELFORMAT_YVYU = (cuint32('Y') ) or + (cuint32('V') shl 8) or + (cuint32('Y') shl 16) or + (cuint32('U') shl 24); + {**< Planar mode: Y + U/V interleaved (2 planes) *} + SDL_PIXELFORMAT_NV12 = (cuint32('N') ) or + (cuint32('V') shl 8) or + (cuint32('1') shl 16) or + (cuint32('2') shl 24); + {**< Planar mode: Y + V/U interleaved (2 planes) *} + SDL_PIXELFORMAT_NV21 = (cuint32('N') ) or + (cuint32('V') shl 8) or + (cuint32('2') shl 16) or + (cuint32('1') shl 24); + {**< Android video texture format *} + SDL_PIXELFORMAT_EXTERMAL_OES + = (cuint32('O') ) or + (cuint32('E') shl 8) or + (cuint32('S') shl 16) or + (cuint32(' ') shl 24); + +type + + {** + * The bits of this structure can be directly reinterpreted as an integer-packed + * color which uses the SDL_PIXELFORMAT_RGBA32 format (SDL_PIXELFORMAT_ABGR8888 + * on little-endian systems and SDL_PIXELFORMAT_RGBA8888 on big-endian systems). + *} + PPSDL_Color = ^PSDL_Color; + PSDL_Color = ^TSDL_Color; + TSDL_Color = record + r: cuint8; + g: cuint8; + b: cuint8; + a: cuint8; + end; + + PPSDL_Colour = ^PSDL_Colour; + PSDL_Colour = ^TSDL_Colour; + TSDL_Colour = TSDL_Color; + + PPSDL_Palette = ^PSDL_Palette; + PSDL_Palette = ^TSDL_Palette; + TSDL_Palette = record + ncolors: cint; + colors: PSDL_Color; + version: cuint32; + refcount: cint; + end; + + {** + * Everything in the pixel format structure is read-only. + *} + PPSDL_PixelFormat = ^PSDL_PixelFormat; + PSDL_PixelFormat = ^TSDL_PixelFormat; + TSDL_PixelFormat = record + format: cuint32; + palette: PSDL_Palette; + BitsPerPixel: cuint8; + BytesPerPixel: cuint8; + padding: array[0..1] of cuint8; + Rmask: cuint32; + Gmask: cuint32; + Bmask: cuint32; + Amask: cuint32; + Rloss: cuint8; + Gloss: cuint8; + Bloss: cuint8; + Aloss: cuint8; + Rshift: cuint8; + Gshift: cuint8; + Bshift: cuint8; + Ashift: cuint8; + refcount: cint; + next: PSDL_PixelFormat; + end; + +{** + * Get the human readable name of a pixel format. + * + * \param format the pixel format to query + * \returns the human readable name of the specified pixel format or + * `SDL_PIXELFORMAT_UNKNOWN` if the format isn't recognized. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetPixelFormatName_fun = function(format: cuint32): PAnsiChar; cdecl; +Var + SDL_GetPixelFormatName : TSDL_GetPixelFormatName_fun = Nil; +{$else} + +function SDL_GetPixelFormatName(format: cuint32): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPixelFormatName' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Convert one of the enumerated pixel formats to a bpp value and RGBA masks. + * + * \param format one of the SDL_PixelFormatEnum values + * \param bpp a bits per pixel value; usually 15, 16, or 32 + * \param Rmask a pointer filled in with the red mask for the format + * \param Gmask a pointer filled in with the green mask for the format + * \param Bmask a pointer filled in with the blue mask for the format + * \param Amask a pointer filled in with the alpha mask for the format + * \returns SDL_TRUE on success or SDL_FALSE if the conversion wasn't + * possible; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_MasksToPixelFormatEnum + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_PixelFormatEnumToMasks_fun = function(format: cuint32; bpp: pcint; + Rmask: pcuint32; Gmask: pcuint32; Bmask: pcuint32; Amask: pcuint32): TSDL_Bool; cdecl; +Var + SDL_PixelFormatEnumToMasks : TSDL_PixelFormatEnumToMasks_fun = Nil; +{$else} + +function SDL_PixelFormatEnumToMasks(format: cuint32; bpp: pcint; + Rmask: pcuint32; Gmask: pcuint32; Bmask: pcuint32; Amask: pcuint32): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PixelFormatEnumToMasks' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Convert a bpp value and RGBA masks to an enumerated pixel format. + * + * This will return `SDL_PIXELFORMAT_UNKNOWN` if the conversion wasn't + * possible. + * + * \param bpp a bits per pixel value; usually 15, 16, or 32 + * \param Rmask the red mask for the format + * \param Gmask the green mask for the format + * \param Bmask the blue mask for the format + * \param Amask the alpha mask for the format + * \returns one of the SDL_PixelFormatEnum values + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_PixelFormatEnumToMasks + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_MasksToPixelFormatEnum_fun = function(bpp: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): cuint32; cdecl; +Var + SDL_MasksToPixelFormatEnum : TSDL_MasksToPixelFormatEnum_fun = Nil; +{$else} + +function SDL_MasksToPixelFormatEnum(bpp: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MasksToPixelFormatEnum' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Create an SDL_PixelFormat structure corresponding to a pixel format. + * + * Returned structure may come from a shared global cache (i.e. not newly + * allocated), and hence should not be modified, especially the palette. Weird + * errors such as `Blit combination not supported` may occur. + * + * \param pixel_format one of the SDL_PixelFormatEnum values + * \returns the new SDL_PixelFormat structure or NULL on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_FreeFormat + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AllocFormat_fun = function(pixel_format: cuint32): PSDL_PixelFormat; cdecl; +Var + SDL_AllocFormat : TSDL_AllocFormat_fun = Nil; +{$else} + +function SDL_AllocFormat(pixel_format: cuint32): PSDL_PixelFormat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AllocFormat' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Free an SDL_PixelFormat structure allocated by SDL_AllocFormat(). + * + * \param format the SDL_PixelFormat structure to free + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AllocFormat + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_FreeFormat_proc = procedure(format: PSDL_PixelFormat); cdecl; +Var + SDL_FreeFormat : TSDL_FreeFormat_proc = Nil; +{$else} + +procedure SDL_FreeFormat(format: PSDL_PixelFormat); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeFormat' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Create a palette structure with the specified number of color entries. + * + * The palette entries are initialized to white. + * + * \param ncolors represents the number of color entries in the color palette + * \returns a new SDL_Palette structure on success or NULL on failure (e.g. if + * there wasn't enough memory); call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_FreePalette + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AllocPalette_fun = function(ncolors: cint): PSDL_Palette; cdecl; +Var + SDL_AllocPalette : TSDL_AllocPalette_fun = Nil; +{$else} + +function SDL_AllocPalette(ncolors: cint): PSDL_Palette; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AllocPalette' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Set the palette for a pixel format structure. + * + * \param format the SDL_PixelFormat structure that will use the palette + * \param palette the SDL_Palette structure that will be used + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AllocPalette + * \sa SDL_FreePalette + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetPixelFormatPalette_fun = function(format: PSDL_PixelFormat; palette: PSDL_Palette): cint; cdecl; +Var + SDL_SetPixelFormatPalette : TSDL_SetPixelFormatPalette_fun = Nil; +{$else} + +function SDL_SetPixelFormatPalette(format: PSDL_PixelFormat; palette: PSDL_Palette): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetPixelFormatPalette' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Set a range of colors in a palette. + * + * \param palette the SDL_Palette structure to modify + * \param colors an array of SDL_Color structures to copy into the palette + * \param firstcolor the index of the first palette entry to modify + * \param ncolors the number of entries to modify + * \returns 0 on success or a negative error code if not all of the colors + * could be set; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AllocPalette + * \sa SDL_CreateRGBSurface + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetPaletteColors_fun = function(palette: PSDL_Palette; const colors: PSDL_Color; firstcolor: cint; ncolors: cint): cint; cdecl; +Var + SDL_SetPaletteColors : TSDL_SetPaletteColors_fun = Nil; +{$else} + +function SDL_SetPaletteColors(palette: PSDL_Palette; const colors: PSDL_Color; firstcolor: cint; ncolors: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetPaletteColors' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Free a palette created with SDL_AllocPalette(). + * + * \param palette the SDL_Palette structure to be freed + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AllocPalette + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_FreePalette_proc = procedure(palette: PSDL_Palette); cdecl; +Var + SDL_FreePalette : TSDL_FreePalette_proc = Nil; +{$else} + +procedure SDL_FreePalette(palette: PSDL_Palette); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreePalette' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Map an RGB triple to an opaque pixel value for a given pixel format. + * + * This function maps the RGB color value to the specified pixel format and + * returns the pixel value best approximating the given RGB color value for + * the given pixel format. + * + * If the format has a palette (8-bit) the index of the closest matching color + * in the palette will be returned. + * + * If the specified pixel format has an alpha component it will be returned as + * all 1 bits (fully opaque). + * + * If the pixel format bpp (color depth) is less than 32-bpp then the unused + * upper bits of the return value can safely be ignored (e.g., with a 16-bpp + * format the return value can be assigned to a Uint16, and similarly a Uint8 + * for an 8-bpp format). + * + * \param format an SDL_PixelFormat structure describing the pixel format + * \param r the red component of the pixel in the range 0-255 + * \param g the green component of the pixel in the range 0-255 + * \param b the blue component of the pixel in the range 0-255 + * \returns a pixel value + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetRGB + * \sa SDL_GetRGBA + * \sa SDL_MapRGBA + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_MapRGB_fun = function(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cuint8): cuint32; cdecl; +Var + SDL_MapRGB : TSDL_MapRGB_fun = Nil; +{$else} + +function SDL_MapRGB(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cuint8): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MapRGB' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Map an RGBA quadruple to a pixel value for a given pixel format. + * + * This function maps the RGBA color value to the specified pixel format and + * returns the pixel value best approximating the given RGBA color value for + * the given pixel format. + * + * If the specified pixel format has no alpha component the alpha value will + * be ignored (as it will be in formats with a palette). + * + * If the format has a palette (8-bit) the index of the closest matching color + * in the palette will be returned. + * + * If the pixel format bpp (color depth) is less than 32-bpp then the unused + * upper bits of the return value can safely be ignored (e.g., with a 16-bpp + * format the return value can be assigned to a Uint16, and similarly a Uint8 + * for an 8-bpp format). + * + * \param format an SDL_PixelFormat structure describing the format of the + * pixel + * \param r the red component of the pixel in the range 0-255 + * \param g the green component of the pixel in the range 0-255 + * \param b the blue component of the pixel in the range 0-255 + * \param a the alpha component of the pixel in the range 0-255 + * \returns a pixel value + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetRGB + * \sa SDL_GetRGBA + * \sa SDL_MapRGB + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_MapRGBA_fun = function(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cuint8; a: cuint8): cuint32; cdecl; +Var + SDL_MapRGBA : TSDL_MapRGBA_fun = Nil; +{$else} + +function SDL_MapRGBA(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cuint8; a: cuint8): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MapRGBA' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get RGB values from a pixel in the specified format. + * + * This function uses the entire 8-bit [0..255] range when converting color + * components from pixel formats with less than 8-bits per RGB component + * (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, + * 0xff, 0xff] not [0xf8, 0xfc, 0xf8]). + * + * \param pixel a pixel value + * \param format an SDL_PixelFormat structure describing the format of the + * pixel + * \param r a pointer filled in with the red component + * \param g a pointer filled in with the green component + * \param b a pointer filled in with the blue component + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetRGBA + * \sa SDL_MapRGB + * \sa SDL_MapRGBA + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetRGB_proc = procedure(pixel: cuint32; const format: PSDL_PixelFormat; r: pcuint8; g: pcuint8; b: pcuint8); cdecl; +Var + SDL_GetRGB : TSDL_GetRGB_proc = Nil; +{$else} + +procedure SDL_GetRGB(pixel: cuint32; const format: PSDL_PixelFormat; r: pcuint8; g: pcuint8; b: pcuint8); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRGB' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get RGBA values from a pixel in the specified format. + * + * This function uses the entire 8-bit [0..255] range when converting color + * components from pixel formats with less than 8-bits per RGB component + * (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, + * 0xff, 0xff] not [0xf8, 0xfc, 0xf8]). + * + * If the surface has no alpha component, the alpha will be returned as 0xff + * (100% opaque). + * + * \param pixel a pixel value + * \param format an SDL_PixelFormat structure describing the format of the + * pixel + * \param r a pointer filled in with the red component + * \param g a pointer filled in with the green component + * \param b a pointer filled in with the blue component + * \param a a pointer filled in with the alpha component + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetRGB + * \sa SDL_MapRGB + * \sa SDL_MapRGBA + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetRGBA_proc = procedure(pixel: cuint32; const format: PSDL_PixelFormat; r: pcuint8; g: pcuint8; b: pcuint8; a: pcuint8); cdecl; +Var + SDL_GetRGBA : TSDL_GetRGBA_proc = Nil; +{$else} + +procedure SDL_GetRGBA(pixel: cuint32; const format: PSDL_PixelFormat; r: pcuint8; g: pcuint8; b: pcuint8; a: pcuint8); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRGBA' {$ENDIF} {$ENDIF}; +{$endif} + +{/** + * Calculate a 256 entry gamma ramp for a gamma value. + * + * \param gamma a gamma value where 0.0 is black and 1.0 is identity + * \param ramp an array of 256 values filled in with the gamma ramp + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_SetWindowGammaRamp + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CalculateGammaRamp_proc = procedure(gamma: cfloat; ramp: pcuint16); cdecl; +Var + SDL_CalculateGammaRamp : TSDL_CalculateGammaRamp_proc = Nil; +{$else} + +procedure SDL_CalculateGammaRamp(gamma: cfloat; ramp: pcuint16); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CalculateGammaRamp' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlplatform.inc b/units/sdlplatform.inc index 0b5eb625..e54b9c1d 100644 --- a/units/sdlplatform.inc +++ b/units/sdlplatform.inc @@ -1,13 +1,13 @@ -// based on "sdl_platform.h" (2.0.14) - -{** - * \file SDL_platform.h - * - * Try to get a standard set of platform defines. - *} - -{** - * Gets the name of the platform. - *} -function SDL_GetPlatform: PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPlatform' {$ENDIF} {$ENDIF}; +// based on "sdl_platform.h" (2.0.14) + +{** + * \file SDL_platform.h + * + * Try to get a standard set of platform defines. + *} + +{** + * Gets the name of the platform. + *} +function SDL_GetPlatform: PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPlatform' {$ENDIF} {$ENDIF}; diff --git a/units/sdlpower.inc b/units/sdlpower.inc index 54d8e6f9..c1c6e102 100644 --- a/units/sdlpower.inc +++ b/units/sdlpower.inc @@ -1,35 +1,43 @@ -// based on "sdl_power.h" (2.0.14) - -{** - * \file SDL_power.h - * - * Header for the SDL power management routines. - *} - - {** - * The basic state for the system's power supply. - *} -type - PPSDL_PowerState = ^PSDL_PowerState; - PSDL_PowerState = ^TSDL_PowerState; - TSDL_PowerState = (SDL_POWERSTATE_UNKNOWN, {**< cannot determine power status *} - SDL_POWERSTATE_ON_BATTERY, {**< Not plugged in, running on the battery *} - SDL_POWERSTATE_NO_BATTERY, {**< Plugged in, no battery available *} - SDL_POWERSTATE_CHARGING, {**< Plugged in, charging battery *} - SDL_POWERSTATE_CHARGED); {**< Plugged in, battery charged *} - - {** - * \brief Get the current power supply details. - * - * \param secs Seconds of battery life left. You can pass a NULL here if - * you don't care. Will return -1 if we can't determine a - * value, or we're not running on a battery. - * - * \param pct Percentage of battery life left, between 0 and 100. You can - * pass a NULL here if you don't care. Will return -1 if we - * can't determine a value, or we're not running on a battery. - * - * \return The state of the battery (if any). - *} -function SDL_GetPowerInfo(secs: pcint; pct: pcint): TSDL_PowerState; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPowerInfo' {$ENDIF} {$ENDIF}; +// based on "sdl_power.h" (2.0.14) + +{** + * \file SDL_power.h + * + * Header for the SDL power management routines. + *} + + {** + * The basic state for the system's power supply. + *} +type + PPSDL_PowerState = ^PSDL_PowerState; + PSDL_PowerState = ^TSDL_PowerState; + TSDL_PowerState = (SDL_POWERSTATE_UNKNOWN, {**< cannot determine power status *} + SDL_POWERSTATE_ON_BATTERY, {**< Not plugged in, running on the battery *} + SDL_POWERSTATE_NO_BATTERY, {**< Plugged in, no battery available *} + SDL_POWERSTATE_CHARGING, {**< Plugged in, charging battery *} + SDL_POWERSTATE_CHARGED); {**< Plugged in, battery charged *} + + {** + * \brief Get the current power supply details. + * + * \param secs Seconds of battery life left. You can pass a NULL here if + * you don't care. Will return -1 if we can't determine a + * value, or we're not running on a battery. + * + * \param pct Percentage of battery life left, between 0 and 100. You can + * pass a NULL here if you don't care. Will return -1 if we + * can't determine a value, or we're not running on a battery. + * + * \return The state of the battery (if any). + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetPowerInfo_fun = function(secs: pcint; pct: pcint): TSDL_PowerState; cdecl; +Var + SDL_GetPowerInfo : TSDL_GetPowerInfo_fun = Nil; +{$else} + +function SDL_GetPowerInfo(secs: pcint; pct: pcint): TSDL_PowerState; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPowerInfo' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlrect.inc b/units/sdlrect.inc index fabde395..69b0e095 100644 --- a/units/sdlrect.inc +++ b/units/sdlrect.inc @@ -1,228 +1,308 @@ -// based on "sdl_rect.h" (2.24.0) - -{** - * \file SDL_rect.h - * - * Header file for SDL_rect definition and management functions. - *} - -type - {** - * \brief The structure that defines a point (integer) - * - * \sa SDL_EnclosePoints - * \sa SDL_PointInRect - *} - PPSDL_Point = ^PSDL_Point; - PSDL_Point = ^TSDL_Point; - TSDL_Point = record - x: cint; - y: cint; - end; - - {** - * \brief The structure that defines a point (floating point) - * - * \sa SDL_EnclosePoints - * \sa SDL_PointInRect - *} - PPSDL_FPoint = ^PSDL_FPoint; - PSDL_FPoint = ^TSDL_FPoint; - TSDL_FPoint = record - x: cfloat; - y: cfloat; - end; - - {** - * \brief A rectangle, with the origin at the upper left (integer). - * - * \sa SDL_RectEmpty - * \sa SDL_RectEquals - * \sa SDL_HasIntersection - * \sa SDL_IntersectRect - * \sa SDL_UnionRect - * \sa SDL_EnclosePoints - *} - PPSDL_Rect = ^PSDL_Rect; - PSDL_Rect = ^TSDL_Rect; - TSDL_Rect = record - x,y: cint; - w,h: cint; - end; - - {** - * A rectangle, with the origin at the upper left. (floating point) - *} - PPSDL_FRect = ^PSDL_FRect; - PSDL_FRect = ^TSDL_FRect; - TSDL_FRect = record - x,y: cfloat; - w,h: cfloat; - end; - -{** - * Returns true if point resides inside a rectangle. - *} -function SDL_PointInRect(const p: PSDL_Point; const r: PSDL_Rect): Boolean; Inline; - -{** - * Returns true if the rectangle has no area. - *} -function SDL_RectEmpty(const r: PSDL_Rect): Boolean; inline; - -{** - * Returns true if the two rectangles are equal. - *} -function SDL_RectEquals(const a, b: PSDL_Rect): Boolean; inline; - -{** - * Determine whether two rectangles intersect. - * - * SDL_TRUE if there is an intersection, SDL_FALSE otherwise. - *} -function SDL_HasIntersection(const a, b: PSDL_Rect): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasIntersection' {$ENDIF} {$ENDIF}; - -{** - * Calculate the intersection of two rectangles. - * - * SDL_TRUE if there is an intersection, SDL_FALSE otherwise. - *} -function SDL_IntersectRect(const A, B: PSDL_Rect; result: PSDL_Rect): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IntersectRect' {$ENDIF} {$ENDIF}; - -{** - * Calculate the union of two rectangles. - *} -procedure SDL_UnionRect(const A, B: PSDL_Rect; result: PSDL_Rect); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnionRect' {$ENDIF} {$ENDIF}; - -{** - * Calculate a minimal rectangle enclosing a set of points - * - * SDL_TRUE if any points were within the clipping rect - *} -function SDL_EnclosePoints(const points: PSDL_Point; count: cint; const clip: PSDL_Rect; result: PSDL_Rect): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EnclosePoints' {$ENDIF} {$ENDIF}; - -{** - * Calculate the intersection of a rectangle and line segment. - * - * SDL_TRUE if there is an intersection, SDL_FALSE otherwise. - *} -function SDL_IntersectRectAndLine(const rect: PSDL_Rect; X1, Y1, X2, Y2: pcint): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IntersectRectAndLine' {$ENDIF} {$ENDIF}; - -{** - * Returns true if point resides inside a rectangle. - *} -function SDL_PointInFRect(const p: PSDL_FPoint; const r: PSDL_FRect): Boolean; Inline; - -{** - * Returns true if the rectangle has no area. - *} -function SDL_FRectEmpty(const r: PSDL_FRect): Boolean; inline; - -{** - * Returns true if the two rectangles are equal, within some given epsilon. - * - * \since This function is available since SDL 2.0.22. - *} -function SDL_FRectEqualsEpsilon(const a, b: PSDL_FRect; const epsilon: cfloat): Boolean; Inline; - -{** - * Returns true if the two rectangles are equal, using a default epsilon. - * - * \since This function is available since SDL 2.0.22. - *} -function SDL_FRectEquals(const a, b: PSDL_FRect): Boolean; Inline; - -{** - * Determine whether two rectangles intersect with float precision. - * - * If either pointer is NIL the function will return SDL_FALSE. - * - * \param A an SDL_FRect structure representing the first rectangle - * \param B an SDL_FRect structure representing the second rectangle - * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.22. - * - * \sa SDL_IntersectRect - *} -function SDL_HasIntersectionF(const a, b: PSDL_FRect): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasIntersectionF' {$ENDIF} {$ENDIF}; - -{** - * Calculate the intersection of two rectangles with float precision. - * - * If `result` is NIL then this function will return SDL_FALSE. - * - * \param A an SDL_FRect structure representing the first rectangle - * \param B an SDL_FRect structure representing the second rectangle - * \param result an SDL_FRect structure filled in with the intersection of - * rectangles `A` and `B` - * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.22. - * - * \sa SDL_HasIntersectionF - *} -function SDL_IntersectFRect(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IntersectFRect' {$ENDIF} {$ENDIF}; - -{** - * Calculate the union of two rectangles with float precision. - * - * \param A an SDL_FRect structure representing the first rectangle - * \param B an SDL_FRect structure representing the second rectangle - * \param result an SDL_FRect structure filled in with the union of rectangles - * `A` and `B` - * - * \since This function is available since SDL 2.0.22. - *} -function SDL_UnionFRect(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnionFRect' {$ENDIF} {$ENDIF}; - -{** - * Calculate a minimal rectangle enclosing a set of points with float - * precision. - * - * If `clip` is not NIL then only points inside of the clipping rectangle - * are considered. - * - * \param points an array of SDL_FPoint structures representing points to be - * enclosed - * \param count the number of structures in the `points` array - * \param clip an SDL_FRect used for clipping or NIL to enclose all points - * \param result an SDL_FRect structure filled in with the minimal enclosing - * rectangle - * \returns SDL_TRUE if any points were enclosed or SDL_FALSE if all the - * points were outside of the clipping rectangle. - * - * \since This function is available since SDL 2.0.22. - *} -function SDL_EncloseFPoints(const points: PSDL_FPoint; count: cint; const clip: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EncloseFPoints' {$ENDIF} {$ENDIF}; - -{** - * Calculate the intersection of a rectangle and line segment with float - * precision. - * - * This function is used to clip a line segment to a rectangle. A line segment - * contained entirely within the rectangle or that does not intersect will - * remain unchanged. A line segment that crosses the rectangle at either or - * both ends will be clipped to the boundary of the rectangle and the new - * coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary. - * - * \param rect an SDL_FRect structure representing the rectangle to intersect - * \param X1 a pointer to the starting X-coordinate of the line - * \param Y1 a pointer to the starting Y-coordinate of the line - * \param X2 a pointer to the ending X-coordinate of the line - * \param Y2 a pointer to the ending Y-coordinate of the line - * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.22. - *} -function SDL_IntersectFRectAndLine(const rect: PSDL_FRect; X1, Y1, X2, Y2: pcfloat): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IntersectFRectAndLine' {$ENDIF} {$ENDIF}; +// based on "sdl_rect.h" (2.24.0) + +{** + * \file SDL_rect.h + * + * Header file for SDL_rect definition and management functions. + *} + +type + {** + * \brief The structure that defines a point (integer) + * + * \sa SDL_EnclosePoints + * \sa SDL_PointInRect + *} + PPSDL_Point = ^PSDL_Point; + PSDL_Point = ^TSDL_Point; + TSDL_Point = record + x: cint; + y: cint; + end; + + {** + * \brief The structure that defines a point (floating point) + * + * \sa SDL_EnclosePoints + * \sa SDL_PointInRect + *} + PPSDL_FPoint = ^PSDL_FPoint; + PSDL_FPoint = ^TSDL_FPoint; + TSDL_FPoint = record + x: cfloat; + y: cfloat; + end; + + {** + * \brief A rectangle, with the origin at the upper left (integer). + * + * \sa SDL_RectEmpty + * \sa SDL_RectEquals + * \sa SDL_HasIntersection + * \sa SDL_IntersectRect + * \sa SDL_UnionRect + * \sa SDL_EnclosePoints + *} + PPSDL_Rect = ^PSDL_Rect; + PSDL_Rect = ^TSDL_Rect; + TSDL_Rect = record + x,y: cint; + w,h: cint; + end; + + {** + * A rectangle, with the origin at the upper left. (floating point) + *} + PPSDL_FRect = ^PSDL_FRect; + PSDL_FRect = ^TSDL_FRect; + TSDL_FRect = record + x,y: cfloat; + w,h: cfloat; + end; + +{** + * Returns true if point resides inside a rectangle. + *} +function SDL_PointInRect(const p: PSDL_Point; const r: PSDL_Rect): Boolean; Inline; + +{** + * Returns true if the rectangle has no area. + *} +function SDL_RectEmpty(const r: PSDL_Rect): Boolean; inline; + +{** + * Returns true if the two rectangles are equal. + *} +function SDL_RectEquals(const a, b: PSDL_Rect): Boolean; inline; + +{** + * Determine whether two rectangles intersect. + * + * SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HasIntersection_fun = function(const a, b: PSDL_Rect): TSDL_Bool; cdecl; +Var + SDL_HasIntersection : TSDL_HasIntersection_fun = Nil; +{$else} + +function SDL_HasIntersection(const a, b: PSDL_Rect): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasIntersection' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Calculate the intersection of two rectangles. + * + * SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_IntersectRect_fun = function(const A, B: PSDL_Rect; result: PSDL_Rect): TSDL_Bool; cdecl; +Var + SDL_IntersectRect : TSDL_IntersectRect_fun = Nil; +{$else} + +function SDL_IntersectRect(const A, B: PSDL_Rect; result: PSDL_Rect): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IntersectRect' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Calculate the union of two rectangles. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UnionRect_proc = procedure(const A, B: PSDL_Rect; result: PSDL_Rect); cdecl; +Var + SDL_UnionRect : TSDL_UnionRect_proc = Nil; +{$else} + +procedure SDL_UnionRect(const A, B: PSDL_Rect; result: PSDL_Rect); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnionRect' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Calculate a minimal rectangle enclosing a set of points + * + * SDL_TRUE if any points were within the clipping rect + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_EnclosePoints_fun = function(const points: PSDL_Point; count: cint; const clip: PSDL_Rect; result: PSDL_Rect): TSDL_Bool; cdecl; +Var + SDL_EnclosePoints : TSDL_EnclosePoints_fun = Nil; +{$else} + +function SDL_EnclosePoints(const points: PSDL_Point; count: cint; const clip: PSDL_Rect; result: PSDL_Rect): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EnclosePoints' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Calculate the intersection of a rectangle and line segment. + * + * SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_IntersectRectAndLine_fun = function(const rect: PSDL_Rect; X1, Y1, X2, Y2: pcint): TSDL_Bool; cdecl; +Var + SDL_IntersectRectAndLine : TSDL_IntersectRectAndLine_fun = Nil; +{$else} + +function SDL_IntersectRectAndLine(const rect: PSDL_Rect; X1, Y1, X2, Y2: pcint): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IntersectRectAndLine' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Returns true if point resides inside a rectangle. + *} +function SDL_PointInFRect(const p: PSDL_FPoint; const r: PSDL_FRect): Boolean; Inline; + +{** + * Returns true if the rectangle has no area. + *} +function SDL_FRectEmpty(const r: PSDL_FRect): Boolean; inline; + +{** + * Returns true if the two rectangles are equal, within some given epsilon. + * + * \since This function is available since SDL 2.0.22. + *} +function SDL_FRectEqualsEpsilon(const a, b: PSDL_FRect; const epsilon: cfloat): Boolean; Inline; + +{** + * Returns true if the two rectangles are equal, using a default epsilon. + * + * \since This function is available since SDL 2.0.22. + *} +function SDL_FRectEquals(const a, b: PSDL_FRect): Boolean; Inline; + +{** + * Determine whether two rectangles intersect with float precision. + * + * If either pointer is NIL the function will return SDL_FALSE. + * + * \param A an SDL_FRect structure representing the first rectangle + * \param B an SDL_FRect structure representing the second rectangle + * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.22. + * + * \sa SDL_IntersectRect + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HasIntersectionF_fun = function(const a, b: PSDL_FRect): TSDL_Bool; cdecl; +Var + SDL_HasIntersectionF : TSDL_HasIntersectionF_fun = Nil; +{$else} + +function SDL_HasIntersectionF(const a, b: PSDL_FRect): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasIntersectionF' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Calculate the intersection of two rectangles with float precision. + * + * If `result` is NIL then this function will return SDL_FALSE. + * + * \param A an SDL_FRect structure representing the first rectangle + * \param B an SDL_FRect structure representing the second rectangle + * \param result an SDL_FRect structure filled in with the intersection of + * rectangles `A` and `B` + * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.22. + * + * \sa SDL_HasIntersectionF + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_IntersectFRect_fun = function(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; +Var + SDL_IntersectFRect : TSDL_IntersectFRect_fun = Nil; +{$else} + +function SDL_IntersectFRect(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IntersectFRect' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Calculate the union of two rectangles with float precision. + * + * \param A an SDL_FRect structure representing the first rectangle + * \param B an SDL_FRect structure representing the second rectangle + * \param result an SDL_FRect structure filled in with the union of rectangles + * `A` and `B` + * + * \since This function is available since SDL 2.0.22. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UnionFRect_fun = function(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; +Var + SDL_UnionFRect : TSDL_UnionFRect_fun = Nil; +{$else} + +function SDL_UnionFRect(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnionFRect' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Calculate a minimal rectangle enclosing a set of points with float + * precision. + * + * If `clip` is not NIL then only points inside of the clipping rectangle + * are considered. + * + * \param points an array of SDL_FPoint structures representing points to be + * enclosed + * \param count the number of structures in the `points` array + * \param clip an SDL_FRect used for clipping or NIL to enclose all points + * \param result an SDL_FRect structure filled in with the minimal enclosing + * rectangle + * \returns SDL_TRUE if any points were enclosed or SDL_FALSE if all the + * points were outside of the clipping rectangle. + * + * \since This function is available since SDL 2.0.22. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_EncloseFPoints_fun = function(const points: PSDL_FPoint; count: cint; const clip: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; +Var + SDL_EncloseFPoints : TSDL_EncloseFPoints_fun = Nil; +{$else} + +function SDL_EncloseFPoints(const points: PSDL_FPoint; count: cint; const clip: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EncloseFPoints' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Calculate the intersection of a rectangle and line segment with float + * precision. + * + * This function is used to clip a line segment to a rectangle. A line segment + * contained entirely within the rectangle or that does not intersect will + * remain unchanged. A line segment that crosses the rectangle at either or + * both ends will be clipped to the boundary of the rectangle and the new + * coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary. + * + * \param rect an SDL_FRect structure representing the rectangle to intersect + * \param X1 a pointer to the starting X-coordinate of the line + * \param Y1 a pointer to the starting Y-coordinate of the line + * \param X2 a pointer to the ending X-coordinate of the line + * \param Y2 a pointer to the ending Y-coordinate of the line + * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.22. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_IntersectFRectAndLine_fun = function(const rect: PSDL_FRect; X1, Y1, X2, Y2: pcfloat): TSDL_Bool; cdecl; +Var + SDL_IntersectFRectAndLine : TSDL_IntersectFRectAndLine_fun = Nil; +{$else} + +function SDL_IntersectFRectAndLine(const rect: PSDL_FRect; X1, Y1, X2, Y2: pcfloat): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IntersectFRectAndLine' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlrenderer.inc b/units/sdlrenderer.inc index afc8e201..09e6ef37 100644 --- a/units/sdlrenderer.inc +++ b/units/sdlrenderer.inc @@ -1,1093 +1,1222 @@ -//from "sdl_renderer.h" - - {** - * Flags used when creating a rendering context - *} -const - SDL_RENDERER_SOFTWARE = $00000001; {**< The renderer is a software fallback *} - SDL_RENDERER_ACCELERATED = $00000002; {**< The renderer uses hardware - acceleration *} - SDL_RENDERER_PRESENTVSYNC = $00000004; {**< Present is synchronized - with the refresh rate *} - SDL_RENDERER_TARGETTEXTURE = $00000008; {**< The renderer supports - rendering to texture *} - -type - PPSDL_RendererFlags = ^PSDL_RendererFlags; - PSDL_RendererFlags = ^TSDL_RendererFlags; - TSDL_RendererFlags = Word; - - {** - * Information on the capabilities of a render driver or context. - *} - PPSDL_RendererInfo = ^PSDL_RendererInfo; - PSDL_RendererInfo = ^TSDL_RendererInfo; - TSDL_RendererInfo = record - name: PAnsiChar; {**< The name of the renderer *} - flags: cuint32; {**< Supported ::SDL_RendererFlags *} - num_texture_formats: cuint32; {**< The number of available texture formats *} - texture_formats: array[0..15] of cuint32; {**< The available texture formats *} - max_texture_width: cint32; {**< The maximimum texture width *} - max_texture_height: cint32; {**< The maximimum texture height *} - end; - - PPSDL_Vertex = ^PSDL_Vertex; - PSDL_Vertex = ^TSDL_Vertex; - TSDL_Vertex = record - position: TSDL_FPoint; - color: TSDL_Color; - tex_coord: TSDL_FPoint; - end; - -{** - * The scaling mode for a texture. - *} - PPSDL_ScaleMode = ^PSDL_ScaleMode; - PSDL_ScaleMode = ^TSDL_ScaleMode; - TSDL_ScaleMode = type cint; - -const - SDL_ScaleModeNearest = TSDL_ScaleMode(0); {**< nearest pixel sampling *} - SDL_ScaleModeLinear = TSDL_ScaleMode(1); {**< linear filtering *} - SDL_ScaleModeBest = TSDL_ScaleMode(2); {**< anisotropic filtering *} - - {** - * The access pattern allowed for a texture. - *} -type - PPSDL_TextureAccess = ^PSDL_TextureAccess; - PSDL_TextureAccess = ^TSDL_TextureAccess; - TSDL_TextureAccess = type cint; - -const - SDL_TEXTUREACCESS_STATIC = 0; {**< Changes rarely, not lockable *} - SDL_TEXTUREACCESS_STREAMING = 1; {**< Changes frequently, lockable *} - SDL_TEXTUREACCESS_TARGET = 2; {**< Texture can be used as a render target *} - -type - {** - * The texture channel modulation used in SDL_RenderCopy(). - *} - PPSDL_TextureModulate = ^PSDL_TextureModulate; - PSDL_TextureModulate = ^TSDL_TextureModulate; - TSDL_TextureModulate = type cint; - -const - SDL_TEXTUREMODULATE_NONE = TSDL_TextureModulate(0); {**< No modulation *} - SDL_TEXTUREMODULATE_COLOR = TSDL_TextureModulate(1); {**< srcC = srcC * color *} - SDL_TEXTUREMODULATE_ALPHA = TSDL_TextureModulate(2); {**< srcA = srcA * alpha *} - -type - {** - * Flip constants for SDL_RenderCopyEx - *} - PPSDL_RenderFlip = ^PSDL_RenderFlip; - PSDL_RenderFlip = ^TSDL_RenderFlip; - TSDL_RenderFlip = type cint; - -const - SDL_FLIP_NONE = TSDL_RenderFlip($0); {**< Do not flip *} - SDL_FLIP_HORIZONTAL = TSDL_RenderFlip($1); {**< flip horizontally *} - SDL_FLIP_VERTICAL = TSDL_RenderFlip($2); {**< flip vertically *} - -type - {** - * A structure representing rendering state - *} - - PPSDL_Renderer = ^PSDL_Renderer; - PSDL_Renderer = type Pointer; - - {** - * An efficient driver-specific representation of pixel data - *} - PPSDL_Texture = ^PSDL_Texture; - PSDL_Texture = type Pointer; - - {* Function prototypes *} - - {** - * Get the number of 2D rendering drivers available for the current - * display. - * - * A render driver is a set of code that handles rendering and texture - * management on a particular display. Normally there is only one, but - * some drivers may have several available with different capabilities. - * - * SDL_GetRenderDriverInfo() - * SDL_CreateRenderer() - *} -function SDL_GetNumRenderDrivers: cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumRenderDrivers' {$ENDIF} {$ENDIF}; - - {** - * Get information about a specific 2D rendering driver for the current - * display. - * - * index The index of the driver to query information about. - * info A pointer to an SDL_RendererInfo struct to be filled with - * information on the rendering driver. - * - * 0 on success, -1 if the index was out of range. - * - * SDL_CreateRenderer() - *} -function SDL_GetRenderDriverInfo(index: cint32; info: PSDL_RendererInfo): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderDriverInfo' {$ENDIF} {$ENDIF}; - - {** - * Create a window and default renderer - * - * width The width of the window - * height The height of the window - * window_flags The flags used to create the window - * window A pointer filled with the window, or NULL on error - * renderer A pointer filled with the renderer, or NULL on error - * - * 0 on success, or -1 on error - *} -function SDL_CreateWindowAndRenderer(width: cint32; height: cint32; window_flags: cuint32; window: PPSDL_Window; renderer: PPSDL_Renderer): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateWindowAndRenderer' {$ENDIF} {$ENDIF}; - - {** - * Create a 2D rendering context for a window. - * - * window The window where rendering is displayed. - * index The index of the rendering driver to initialize, or -1 to - * initialize the first one supporting the requested flags. - * flags ::SDL_RendererFlags. - * - * A valid rendering context or NULL if there was an error. - * - * SDL_CreateSoftwareRenderer() - * SDL_GetRendererInfo() - * SDL_DestroyRenderer() - *} -function SDL_CreateRenderer(window: PSDL_Window; index: cint32; flags: cuint32): PSDL_Renderer cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRenderer' {$ENDIF} {$ENDIF}; - - {** - * Create a 2D software rendering context for a surface. - * - * surface The surface where rendering is done. - * - * A valid rendering context or NULL if there was an error. - * - * SDL_CreateRenderer() - * SDL_DestroyRenderer() - *} -function SDL_CreateSoftwareRenderer(surface: PSDL_Surface): PSDL_Renderer cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateSoftwareRenderer' {$ENDIF} {$ENDIF}; - - {** - * Get the renderer associated with a window. - *} -function SDL_GetRenderer(window: PSDL_Window): PSDL_Renderer cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderer' {$ENDIF} {$ENDIF}; - -{** - * Get the window associated with a renderer. - *} -function SDL_RenderGetWindow(renderer: PSDL_Renderer): PSDL_Window; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetWindow' {$ENDIF} {$ENDIF}; - - {** - * Get information about a rendering context. - *} -function SDL_GetRendererInfo(renderer: PSDL_Renderer; info: PSDL_RendererInfo): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRendererInfo' {$ENDIF} {$ENDIF}; - - {** - * Get the output size of a rendering context. - *} -function SDL_GetRendererOutputSize(renderer: PSDL_Renderer; w: pcint; h: pcint): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRendererOutputSize' {$ENDIF} {$ENDIF}; - - {** - * Create a texture for a rendering context. - * - * renderer The renderer. - * format The format of the texture. - * access One of the enumerated values in ::SDL_TextureAccess. - * w The width of the texture in pixels. - * h The height of the texture in pixels. - * - * The created texture is returned, or 0 if no rendering context was - * active, the format was unsupported, or the width or height were out - * of range. - * - * SDL_QueryTexture() - * SDL_UpdateTexture() - * SDL_DestroyTexture() - *} -function SDL_CreateTexture(renderer: PSDL_Renderer; format: cuint32; access: cint32; w: cint32; h: cint32): PSDL_Texture cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateTexture' {$ENDIF} {$ENDIF}; - - {** - * Create a texture from an existing surface. - * - * renderer The renderer. - * surface The surface containing pixel data used to fill the texture. - * - * The created texture is returned, or 0 on error. - * - * The surface is not modified or freed by this function. - * - * SDL_QueryTexture() - * SDL_DestroyTexture() - *} -function SDL_CreateTextureFromSurface(renderer: PSDL_Renderer; surface: PSDL_Surface): PSDL_Texture cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateTextureFromSurface' {$ENDIF} {$ENDIF}; - - {** - * Query the attributes of a texture - * - * texture A texture to be queried. - * format A pointer filled in with the raw format of the texture. The - * actual format may differ, but pixel transfers will use this - * format. - * access A pointer filled in with the actual access to the texture. - * w A pointer filled in with the width of the texture in pixels. - * h A pointer filled in with the height of the texture in pixels. - * - * 0 on success, or -1 if the texture is not valid. - *} -function SDL_QueryTexture(texture: PSDL_Texture; format: pcuint32; access: pcint; w: pcint; h: pcint): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_QueryTexture' {$ENDIF} {$ENDIF}; - - {** - * Set an additional color value used in render copy operations. - * - * texture The texture to update. - * r The red color value multiplied into copy operations. - * g The green color value multiplied into copy operations. - * b The blue color value multiplied into copy operations. - * - * 0 on success, or -1 if the texture is not valid or color modulation - * is not supported. - * - * SDL_GetTextureColorMod() - *} -function SDL_SetTextureColorMod(texture: PSDL_Texture; r: cuint8; g: cuint8; b: cuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureColorMod' {$ENDIF} {$ENDIF}; - - {** - * Get the additional color value used in render copy operations. - * - * texture The texture to query. - * r A pointer filled in with the current red color value. - * g A pointer filled in with the current green color value. - * b A pointer filled in with the current blue color value. - * - * 0 on success, or -1 if the texture is not valid. - * - * SDL_SetTextureColorMod() - *} -function SDL_GetTextureColorMod(texture: PSDL_Texture; r: pcuint8; g: pcuint8; b: pcuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureColorMod' {$ENDIF} {$ENDIF}; - - {** - * Set an additional alpha value used in render copy operations. - * - * texture The texture to update. - * alpha The alpha value multiplied into copy operations. - * - * 0 on success, or -1 if the texture is not valid or alpha modulation - * is not supported. - * - * SDL_GetTextureAlphaMod() - *} -function SDL_SetTextureAlphaMod(texture: PSDL_Texture; alpha: cuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureAlphaMod' {$ENDIF} {$ENDIF}; - - {** - * Get the additional alpha value used in render copy operations. - * - * texture The texture to query. - * alpha A pointer filled in with the current alpha value. - * - * 0 on success, or -1 if the texture is not valid. - * - * SDL_SetTextureAlphaMod() - *} -function SDL_GetTextureAlphaMod(texture: PSDL_Texture; alpha: pcuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureAlphaMod' {$ENDIF} {$ENDIF}; - - {** - * Set the blend mode used for texture copy operations. - * - * texture The texture to update. - * blendMode ::SDL_BlendMode to use for texture blending. - * - * 0 on success, or -1 if the texture is not valid or the blend mode is - * not supported. - * - * If the blend mode is not supported, the closest supported mode is - * chosen. - * - * SDL_GetTextureBlendMode() - *} -function SDL_SetTextureBlendMode(texture: PSDL_Texture; blendMode: TSDL_BlendMode): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureBlendMode' {$ENDIF} {$ENDIF}; - - {** - * Get the blend mode used for texture copy operations. - * - * texture The texture to query. - * blendMode A pointer filled in with the current blend mode. - * - * 0 on success, or -1 if the texture is not valid. - * - * SDL_SetTextureBlendMode() - *} -function SDL_GetTextureBlendMode(texture: PSDL_Texture; blendMode: PSDL_BlendMode): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureBlendMode' {$ENDIF} {$ENDIF}; - -{** - * Set the scale mode used for texture scale operations. - * If the scale mode is not supported, the closest supported mode is chosen. - *} -function SDL_SetTextureScaleMode(texture: PSDL_Texture; scaleMode: TSDL_ScaleMode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureScaleMode' {$ENDIF} {$ENDIF}; - -{** - * Get the scale mode used for texture scale operations. - *} -function SDL_GetTextureScaleMode(texture: PSDL_Texture; scaleMode: PSDL_ScaleMode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureScaleMode' {$ENDIF} {$ENDIF}; - -{** - * Associate a user-specified pointer with a texture. - *} -function SDL_SetTextureUserData(texture: PSDL_Texture; userdata: Pointer): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureUserData' {$ENDIF} {$ENDIF}; - -{** - * Get the user-specified pointer associated with a texture. - *} -function SDL_GetTextureUserData(texture: PSDL_Texture): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureUserData' {$ENDIF} {$ENDIF}; - - {** - * Update the given texture rectangle with new pixel data. - * - * texture The texture to update - * rect A pointer to the rectangle of pixels to update, or NULL to - * update the entire texture. - * pixels The raw pixel data. - * pitch The number of bytes between rows of pixel data. - * - * 0 on success, or -1 if the texture is not valid. - * - * This is a fairly slow function. - *} -function SDL_UpdateTexture(texture: PSDL_Texture; rect: PSDL_Rect; pixels: Pointer; pitch: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateTexture' {$ENDIF} {$ENDIF}; - - {** - * Lock a portion of the texture for write-only pixel access. - * - * texture The texture to lock for access, which was created with - * SDL_TEXTUREACCESS_STREAMING. - * rect A pointer to the rectangle to lock for access. If the rect - * is NULL, the entire texture will be locked. - * pixels This is filled in with a pointer to the locked pixels, - * appropriately offset by the locked area. - * pitch This is filled in with the pitch of the locked pixels. - * - * 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING. - * - * SDL_UnlockTexture() - *} -function SDL_LockTexture(texture: PSDL_Texture; const rect: PSDL_Rect; pixels: PPointer; pitch: pcint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockTexture' {$ENDIF} {$ENDIF}; - -{** - * \brief Lock a portion of the texture for write-only pixel access. - * Expose it as a SDL surface. - * - * \param texture The texture to lock for access, which was created with - * ::SDL_TEXTUREACCESS_STREAMING. - * \param rect A pointer to the rectangle to lock for access. If the rect - * is NULL, the entire texture will be locked. - * \param surface This is filled in with a SDL surface representing the locked area - * Surface is freed internally after calling SDL_UnlockTexture or SDL_DestroyTexture. - * - * \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING. - * - * \sa SDL_UnlockTexture() - *} -function SDL_LockTextureToSurface(texture: PSDL_Texture; const rect: PSDL_Rect; surface: PPSDL_Surface): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockTextureToSurface' {$ENDIF} {$ENDIF}; - - {** - * Unlock a texture, uploading the changes to video memory, if needed. - * - * SDL_LockTexture() - *} -procedure SDL_UnlockTexture(texture: PSDL_Texture) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockTexture' {$ENDIF} {$ENDIF}; - - {** - * Determines whether a window supports the use of render targets - * - * renderer The renderer that will be checked - * - * SDL_TRUE if supported, SDL_FALSE if not. - *} -function SDL_RenderTargetSupported(renderer: PSDL_Renderer): Boolean cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderTargetSupported' {$ENDIF} {$ENDIF}; - - {** - * Set a texture as the current rendering target. - * - * renderer The renderer. - * texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target - * - * 0 on success, or -1 on error - * - * SDL_GetRenderTarget() - *} -function SDL_SetRenderTarget(renderer: PSDL_Renderer; texture: PSDL_Texture): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRenderTarget' {$ENDIF} {$ENDIF}; - - {** - * Get the current render target or NULL for the default render target. - * - * The current render target - * - * SDL_SetRenderTarget() - *} -function SDL_GetRenderTarget(renderer: PSDL_Renderer): PSDL_Texture cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderTarget' {$ENDIF} {$ENDIF}; - - {** - * Set device independent resolution for rendering - * - * renderer The renderer for which resolution should be set. - * w The width of the logical resolution - * h The height of the logical resolution - * - * This function uses the viewport and scaling functionality to allow a fixed logical - * resolution for rendering, regardless of the actual output resolution. If the actual - * output resolution doesn't have the same aspect ratio the output rendering will be - * centered within the output display. - * - * If the output display is a window, mouse events in the window will be filtered - * and scaled so they seem to arrive within the logical resolution. - * - * If this function results in scaling or subpixel drawing by the - * rendering backend, it will be handled using the appropriate - * quality hints. - * - * SDL_RenderGetLogicalSize() - * SDL_RenderSetScale() - * SDL_RenderSetViewport() - *} -function SDL_RenderSetLogicalSize(renderer: PSDL_Renderer; w: cint32; h: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetLogicalSize' {$ENDIF} {$ENDIF}; - - {** - * Get device independent resolution for rendering - * - * renderer The renderer from which resolution should be queried. - * w A pointer filled with the width of the logical resolution - * h A pointer filled with the height of the logical resolution - * - * SDL_RenderSetLogicalSize() - *} -procedure SDL_RenderGetLogicalSize(renderer: PSDL_Renderer; w: pcint; h: pcint) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetLogicalSize' {$ENDIF} {$ENDIF}; - -{** - * \brief Set whether to force integer scales for resolution-independent rendering - * - * \param renderer The renderer for which integer scaling should be set. - * \param enable Enable or disable integer scaling - * - * This function restricts the logical viewport to integer values - that is, when - * a resolution is between two multiples of a logical size, the viewport size is - * rounded down to the lower multiple. - * - * \sa SDL_RenderSetLogicalSize() - *} -function SDL_RenderSetIntegerScale(renderer: PSDL_Renderer; enable : TSDL_bool): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetIntegerScale' {$ENDIF} {$ENDIF}; - -{** - * \brief Get whether integer scales are forced for resolution-independent rendering - * - * \param renderer The renderer from which integer scaling should be queried. - * - * \sa SDL_RenderSetIntegerScale() - *} -function SDL_RenderGetIntegerScale(renderer: PSDL_Renderer): TSDL_bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetIntegerScale' {$ENDIF} {$ENDIF}; - - {** - * Set the drawing area for rendering on the current target. - * - * renderer The renderer for which the drawing area should be set. - * rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target. - * - * The x,y of the viewport rect represents the origin for rendering. - * - * 0 on success, or -1 on error - * - * If the window associated with the renderer is resized, the viewport is automatically reset. - * - * SDL_RenderGetViewport() - * SDL_RenderSetLogicalSize() - *} -function SDL_RenderSetViewport(renderer: PSDL_Renderer; const rect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetViewport' {$ENDIF} {$ENDIF}; - - {** - * Get the drawing area for the current target. - * - * SDL_RenderSetViewport() - *} -procedure SDL_RenderGetViewport(renderer: PSDL_Renderer; rect: PSDL_Rect) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetViewport' {$ENDIF} {$ENDIF}; - - {** - * Set the clip rectangle for the current target. - * - * renderer The renderer for which clip rectangle should be set. - * rect A pointer to the rectangle to set as the clip rectangle, or - * NULL to disable clipping. - * - * 0 on success, or -1 on error - * - * SDL_RenderGetClipRect() - *} -function SDL_RenderSetClipRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetClipRect' {$ENDIF} {$ENDIF}; - - {** - * Get the clip rectangle for the current target. - * - * renderer The renderer from which clip rectangle should be queried. - * rect A pointer filled in with the current clip rectangle, or - * an empty rectangle if clipping is disabled. - * - * SDL_RenderSetClipRect() - *} -procedure SDL_RenderGetClipRect(renderer: PSDL_Renderer; rect: PSDL_Rect) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetClipRect' {$ENDIF} {$ENDIF}; - - {** - * \brief Get whether clipping is enabled on the given renderer. - * - * \param renderer The renderer from which clip state should be queried. - * - * \sa SDL_RenderGetClipRect() - *} -function SDL_RenderIsClipEnabled(renderer: PSDL_Renderer): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderIsClipEnabled' {$ENDIF} {$ENDIF}; - - {** - * Set the drawing scale for rendering on the current target. - * - * renderer The renderer for which the drawing scale should be set. - * scaleX The horizontal scaling factor - * scaleY The vertical scaling factor - * - * The drawing coordinates are scaled by the x/y scaling factors - * before they are used by the renderer. This allows resolution - * independent drawing with a single coordinate system. - * - * If this results in scaling or subpixel drawing by the - * rendering backend, it will be handled using the appropriate - * quality hints. For best results use integer scaling factors. - * - * SDL_RenderGetScale() - * SDL_RenderSetLogicalSize() - *} -function SDL_RenderSetScale(renderer: PSDL_Renderer; scaleX: cfloat; scaleY: cfloat): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetScale' {$ENDIF} {$ENDIF}; - - {** - * Get the drawing scale for the current target. - * - * renderer The renderer from which drawing scale should be queried. - * scaleX A pointer filled in with the horizontal scaling factor - * scaleY A pointer filled in with the vertical scaling factor - * - * SDL_RenderSetScale() - *} -procedure SDL_RenderGetScale(renderer: PSDL_Renderer; scaleX: pcfloat; scaleY: pcfloat) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetScale' {$ENDIF} {$ENDIF}; - -{** - * Get logical coordinates of point in renderer when given real coordinates of - * point in window. Logical coordinates will differ from real coordinates when - * render is scaled and logical renderer size set. - *} -procedure SDL_RenderWindowToLogical(renderer: PSDL_Renderer; windowX, windowY: cint; logicalX, logicalY: PSingle); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderWindowToLogical' {$ENDIF} {$ENDIF}; - -{** - * Get real coordinates of point in window when given logical coordinates of - * point in renderer. Logical coordinates will differ from real coordinate - * when render is scaled and logical renderer size set. - *} -procedure SDL_RenderLogicalToWindow(renderer: PSDL_Renderer; logicalX, logicalY: Single; windowX, windowY: Pcint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderLogicalToWindow' {$ENDIF} {$ENDIF}; - - {** - * Set the color used for drawing operations (Rect, Line and Clear). - * - * renderer The renderer for which drawing color should be set. - * r The red value used to draw on the rendering target. - * g The green value used to draw on the rendering target. - * b The blue value used to draw on the rendering target. - * a The alpha value used to draw on the rendering target, usually - * SDL_ALPHA_OPAQUE (255). - * - * 0 on success, or -1 on error - *} -function SDL_SetRenderDrawColor(renderer: PSDL_Renderer; r: cuint8; g: cuint8; b: cuint8; a: cuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRenderDrawColor' {$ENDIF} {$ENDIF}; - - {** - * Get the color used for drawing operations (Rect, Line and Clear). - * - * renderer The renderer from which drawing color should be queried. - * r A pointer to the red value used to draw on the rendering target. - * g A pointer to the green value used to draw on the rendering target. - * b A pointer to the blue value used to draw on the rendering target. - * a A pointer to the alpha value used to draw on the rendering target, - * usually SDL_ALPHA_OPAQUE (255). - * - * 0 on success, or -1 on error - *} -function SDL_GetRenderDrawColor(renderer: PSDL_Renderer; r: pcuint8; g: pcuint8; b: pcuint8; a: pcuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderDrawColor' {$ENDIF} {$ENDIF}; - - {** - * Set the blend mode used for drawing operations (Fill and Line). - * - * renderer The renderer for which blend mode should be set. - * blendMode SDL_BlendMode to use for blending. - * - * 0 on success, or -1 on error - * - * If the blend mode is not supported, the closest supported mode is - * chosen. - * - * SDL_GetRenderDrawBlendMode() - *} -function SDL_SetRenderDrawBlendMode(renderer: PSDL_Renderer; blendMode: TSDL_BlendMode): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRenderDrawBlendMode' {$ENDIF} {$ENDIF}; - - {** - * Get the blend mode used for drawing operations. - * - * renderer The renderer from which blend mode should be queried. - * blendMode A pointer filled in with the current blend mode. - * - * 0 on success, or -1 on error - * - * SDL_SetRenderDrawBlendMode() - *} -function SDL_GetRenderDrawBlendMode(renderer: PSDL_Renderer; blendMode: PSDL_BlendMode): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderDrawBlendMode' {$ENDIF} {$ENDIF}; - - {** - * Clear the current rendering target with the drawing color - * - * This function clears the entire rendering target, ignoring the viewport. - * - * 0 on success, or -1 on error - *} -function SDL_RenderClear(renderer: PSDL_Renderer): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderClear' {$ENDIF} {$ENDIF}; - - {** - * Draw a point on the current rendering target. - * - * renderer The renderer which should draw a point. - * x The x coordinate of the point. - * y The y coordinate of the point. - * - * 0 on success, or -1 on error - *} -function SDL_RenderDrawPoint(renderer: PSDL_Renderer; x: cint32; y: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPoint' {$ENDIF} {$ENDIF}; - - {** - * Draw a point on the current rendering target. - * - * renderer The renderer which should draw a point. - * x The x coordinate of the point. - * y The y coordinate of the point. - * - * 0 on success, or -1 on error - *} -function SDL_RenderDrawPointF(renderer: PSDL_Renderer; x, y: single): cint32 cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPointF' {$ENDIF} {$ENDIF}; - - {** - * Draw multiple points on the current rendering target. - * - * renderer The renderer which should draw multiple points. - * points The points to draw - * count The number of points to draw - * - * 0 on success, or -1 on error - *} -function SDL_RenderDrawPoints(renderer: PSDL_Renderer; points: PSDL_Point; count: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPoints' {$ENDIF} {$ENDIF}; - - {** - * Draw multiple points on the current rendering target. - * - * renderer The renderer which should draw multiple points. - * points The points to draw - * count The number of points to draw - * - * 0 on success, or -1 on error - *} -function SDL_RenderDrawPointsF(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPointsF' {$ENDIF} {$ENDIF}; - - {** - * Draw a line on the current rendering target. - * - * renderer The renderer which should draw a line. - * x1 The x coordinate of the start point. - * y1 The y coordinate of the start point. - * x2 The x coordinate of the end point. - * y2 The y coordinate of the end point. - * - * 0 on success, or -1 on error - *} -function SDL_RenderDrawLine(renderer: PSDL_Renderer; x1: cint32; y1: cint32; x2: cint32; y2: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLine' {$ENDIF} {$ENDIF}; - - {** - * Draw a line on the current rendering target. - * - * renderer The renderer which should draw a line. - * x1 The x coordinate of the start point. - * y1 The y coordinate of the start point. - * x2 The x coordinate of the end point. - * y2 The y coordinate of the end point. - * - * 0 on success, or -1 on error - *} -function SDL_RenderDrawLineF(renderer: PSDL_Renderer; x1, y1, x2, y2: single): cint32 cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLineF' {$ENDIF} {$ENDIF}; - - {** - * \brief Draw a series of connected lines on the current rendering target. - * - * \param renderer The renderer which should draw multiple lines. - * \param points The points along the lines - * \param count The number of points, drawing count-1 lines - * - * \return 0 on success, or -1 on error - *} -function SDL_RenderDrawLines(renderer: PSDL_Renderer; points: PSDL_Point; count: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLines' {$ENDIF} {$ENDIF}; - - {** - * Draw a series of connected lines on the current rendering target. - * - * renderer The renderer which should draw multiple lines. - * points The points along the lines - * count The number of points, drawing count-1 lines - * - * 0 on success, or -1 on error - *} -function SDL_RenderDrawLinesF(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLinesF' {$ENDIF} {$ENDIF}; - - {** - * Draw a rectangle on the current rendering target. - * - * renderer The renderer which should draw a rectangle. - * rect A pointer to the destination rectangle, or NULL to outline the entire rendering target. - * - * 0 on success, or -1 on error - *} -function SDL_RenderDrawRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRect' {$ENDIF} {$ENDIF}; - - {** - * Draw a rectangle on the current rendering target. - * - * renderer The renderer which should draw a rectangle. - * rect A pointer to the destination rectangle, or NULL to outline the entire rendering target. - * - * 0 on success, or -1 on error - *} -function SDL_RenderDrawRectF(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRectF' {$ENDIF} {$ENDIF}; - - {** - * Draw some number of rectangles on the current rendering target. - * - * renderer The renderer which should draw multiple rectangles. - * rects A pointer to an array of destination rectangles. - * count The number of rectangles. - * - * 0 on success, or -1 on error - *} -function SDL_RenderDrawRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRects' {$ENDIF} {$ENDIF}; - - {** - * Draw some number of rectangles on the current rendering target. - * - * renderer The renderer which should draw multiple rectangles. - * rects A pointer to an array of destination rectangles. - * count The number of rectangles. - * - * 0 on success, or -1 on error - *} -function SDL_RenderDrawRectsF(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRectsF' {$ENDIF} {$ENDIF}; - - {** - * Fill a rectangle on the current rendering target with the drawing color. - * - * renderer The renderer which should fill a rectangle. - * rect A pointer to the destination rectangle, or NULL for the entire - * rendering target. - * - * 0 on success, or -1 on error - *} -function SDL_RenderFillRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRect' {$ENDIF} {$ENDIF}; - - {** - * Fill a rectangle on the current rendering target with the drawing color. - * - * renderer The renderer which should fill a rectangle. - * rect A pointer to the destination rectangle, or NULL for the entire rendering target. - * - * 0 on success, or -1 on error - *} -function SDL_RenderFillRectF(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRectF' {$ENDIF} {$ENDIF}; - - {** - * Fill some number of rectangles on the current rendering target with the drawing color. - * - * renderer The renderer which should fill multiple rectangles. - * rects A pointer to an array of destination rectangles. - * count The number of rectangles. - * - * 0 on success, or -1 on error - *} -function SDL_RenderFillRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRects' {$ENDIF} {$ENDIF}; - - {** - * Fill some number of rectangles on the current rendering target with the drawing color. - * - * renderer The renderer which should fill multiple rectangles. - * rects A pointer to an array of destination rectangles. - * count The number of rectangles. - * - * 0 on success, or -1 on error - *} -function SDL_RenderFillRectsF(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRectsF' {$ENDIF} {$ENDIF}; - - {** - * Copy a portion of the texture to the current rendering target. - * - * renderer The renderer which should copy parts of a texture. - * texture The source texture. - * srcrect A pointer to the source rectangle, or NULL for the entire - * texture. - * dstrect A pointer to the destination rectangle, or NULL for the - * entire rendering target. - * - * 0 on success, or -1 on error - *} -function SDL_RenderCopy(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: PSDL_Rect; dstrect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopy' {$ENDIF} {$ENDIF}; - - {** - * Copy a portion of the texture to the current rendering target. - * - * renderer The renderer which should copy parts of a texture. - * texture The source texture. - * srcrect A pointer to the source rectangle, or NIL for the entire texture. - * dstrect A pointer to the destination rectangle, or NIL for the entire rendering target. - * - * 0 on success, or -1 on error - *} -function SDL_RenderCopyF(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: PSDL_Rect; dstrect: PSDL_FRect): cint32 cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopyF' {$ENDIF} {$ENDIF}; - - {** - * Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center - * - * renderer The renderer which should copy parts of a texture. - * texture The source texture. - * srcrect A pointer to the source rectangle, or NULL for the entire - * texture. - * dstrect A pointer to the destination rectangle, or NULL for the - * entire rendering target. - * angle An angle in degrees that indicates the rotation that will be applied to dstrect - * center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done aroud dstrect.w/2, dstrect.h/2) - * flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture - * - * 0 on success, or -1 on error - *} -function SDL_RenderCopyEx(renderer: PSDL_Renderer; texture: PSDL_Texture; const srcrect: PSDL_Rect; dstrect: PSDL_Rect; angle: cdouble; center: PSDL_Point; flip: TSDL_RenderFlip): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopyEx' {$ENDIF} {$ENDIF}; - - {** - * Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center - * - * renderer The renderer which should copy parts of a texture. - * texture The source texture. - * srcrect A pointer to the source rectangle, or NIL for the entire texture. - * dstrect A pointer to the destination rectangle, or NIL for the entire rendering target. - * angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction - * center A pointer to a point indicating the point around which dstrect will be rotated (if NIL, rotation will be done around dstrect.w/2, dstrect.h/2). - * flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture - * - * 0 on success, or -1 on error - *} -function SDL_RenderCopyExF(renderer: PSDL_Renderer; texture: PSDL_Texture; const srcrect: PSDL_Rect; dstrect: PSDL_FRect; angle: cdouble; center: PSDL_FPoint; flip: TSDL_RenderFlip): cint32 cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopyExF' {$ENDIF} {$ENDIF}; - -{** - * Render a list of triangles, optionally using a texture and indices into the - * vertex array. Color and alpha modulation is done per vertex. - * SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored. - *} -function SDL_RenderGeometry( - renderer: PSDL_Renderer; - texture: PSDL_Texture; - Const vertices: PSDL_Vertex; num_vertices: cint; - Const indices: Pcint; num_indices: cint -): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGeometry' {$ENDIF} {$ENDIF}; - -{** - * Render a list of triangles, optionally using a texture and indices into the - * vertex arrays. Color and alpha modulation is done per vertex. - * SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored. - *} -function SDL_RenderGeometryRaw( - renderer: PSDL_Renderer; - texture: PSDL_Texture; - Const xy: PSingle; xy_stride: cint; - Const color: PSDL_Color; color_stride: cint; - Const uv: PSingle; uv_stride: cint; - num_vertices: cint; - Const indices: Pointer; num_indices, size_indices: cint -): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGeometryRaw' {$ENDIF} {$ENDIF}; - - {** - * Read pixels from the current rendering target. - * - * renderer The renderer from which pixels should be read. - * rect A pointer to the rectangle to read, or NULL for the entire - * render target. - * format The desired format of the pixel data, or 0 to use the format - * of the rendering target - * pixels A pointer to be filled in with the pixel data - * pitch The pitch of the pixels parameter. - * - * 0 on success, or -1 if pixel reading is not supported. - * - * This is a very slow operation, and should not be used frequently. - *} -function SDL_RenderReadPixels(renderer: PSDL_Renderer; rect: PSDL_Rect; format: cuint32; pixels: Pointer; pitch: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderReadPixels' {$ENDIF} {$ENDIF}; - - {** - * Update the screen with rendering performed. - *} -procedure SDL_RenderPresent(renderer: PSDL_Renderer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderPresent' {$ENDIF} {$ENDIF}; - - {** - * Destroy the specified texture. - * - * SDL_CreateTexture() - * SDL_CreateTextureFromSurface() - *} -procedure SDL_DestroyTexture(texture: PSDL_Texture) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyTexture' {$ENDIF} {$ENDIF}; - - {** - * Destroy the rendering context for a window and free associated - * textures. - * - * SDL_CreateRenderer() - *} -procedure SDL_DestroyRenderer(renderer: PSDL_Renderer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyRenderer' {$ENDIF} {$ENDIF}; - -{** - * Force the rendering context to flush any pending commands to the underlying - * rendering API. - * - * You do not need to (and in fact, shouldn't) call this function unless you - * are planning to call into OpenGL/Direct3D/Metal/whatever directly in - * addition to using an SDL_Renderer. - * - * This is for a very-specific case: if you are using SDL's render API, you - * asked for a specific renderer backend (OpenGL, Direct3D, etc), you set - * SDL_HINT_RENDER_BATCHING to "1", and you plan to make OpenGL/D3D/whatever - * calls in addition to SDL render API calls. If all of this applies, you - * should call SDL_RenderFlush() between calls to SDL's render API and the - * low-level API you're using in cooperation. - * - * In all other cases, you can ignore this function. This is only here to get - * maximum performance out of a specific situation. In all other cases, SDL - * will do the right thing, perhaps at a performance loss. - * - * This function is first available in SDL 2.0.10, and is not needed in 2.0.9 - * and earlier, as earlier versions did not queue rendering commands at all, - * instead flushing them to the OS immediately. - *} -function SDL_RenderFlush(renderer: PSDL_Renderer): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFlush' {$ENDIF} {$ENDIF}; - - {** - * Bind the texture to the current OpenGL/ES/ES2 context for use with - * OpenGL instructions. - * - * texture The SDL texture to bind - * texw A pointer to a float that will be filled with the texture width - * texh A pointer to a float that will be filled with the texture height - * - * 0 on success, or -1 if the operation is not supported - *} -function SDL_GL_BindTexture(texture: PSDL_Texture; texw: pcfloat; texh: pcfloat): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_BindTexture' {$ENDIF} {$ENDIF}; - - {** - * Unbind a texture from the current OpenGL/ES/ES2 context. - * - * texture The SDL texture to unbind - * - * 0 on success, or -1 if the operation is not supported - *} -function SDL_GL_UnbindTexture(texture: PSDL_Texture): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_UnbindTexture' {$ENDIF} {$ENDIF}; - -{** - * Get the CAMetalLayer associated with the given Metal renderer. - * - * This function returns a raw Pointer, so SDL doesn't have to include Metal's headers, - * but it can be safely cast to a pointer to `CAMetalLayer`. - * - *} -function SDL_RenderGetMetalLayer(renderer: PSDL_Renderer): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetMetalLayer' {$ENDIF} {$ENDIF}; - -{** - * Get the Metal command encoder for the current frame - * - * This function returns a raw Pointer, so SDL doesn't have to include Metal's headers, - * but it can be safely cast to an `id`. - * - * Note that as of SDL 2.0.18, this will return NULL if Metal refuses to give - * SDL a drawable to render to, which might happen if the window is - * hidden/minimized/offscreen. This doesn't apply to command encoders for - * render targets, just the window's backbacker. Check your return values! - *} -function SDL_RenderGetMetalCommandEncoder(renderer: PSDL_Renderer): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetMetalCommandEncoder' {$ENDIF} {$ENDIF}; - -{** - * Toggle VSync of the given renderer. - *} -function SDL_RenderSetVSync(renderer: PSDL_Renderer; vsync: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetVSync' {$ENDIF} {$ENDIF}; - - {** - * Update a rectangle within a planar YV12 or IYUV texture with new pixel data. - * - * texture The texture to update - * rect A pointer to the rectangle of pixels to update, or NULL to update the entire texture. - * Yplane The raw pixel data for the Y plane. - * Ypitch The number of bytes between rows of pixel data for the Y plane. - * Uplane The raw pixel data for the U plane. - * Upitch The number of bytes between rows of pixel data for the U plane. - * Vplane The raw pixel data for the V plane. - * Vpitch The number of bytes between rows of pixel data for the V plane. - * - * 0 on success, or -1 if the texture is not valid. - * - * You can use SDL_UpdateTexture() as long as your pixel data is - * a contiguous block of Y and U/V planes in the proper order, but - * this function is available if your pixel data is not contiguous. - *} -function SDL_UpdateYUVTexture(texture: PSDL_Texture; rect: PSDL_Rect; Yplane: pcuint8; Ypitch: cint32; Uplane: pcuint8; UPitch: cint32; Vplane: pcuint8; VPitch: cint32):cint32; - cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateYUVTexture' {$ENDIF} {$ENDIF}; - -{** - * Update a rectangle within a planar NV12 or NV21 texture with new pixels. - * - * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous - * block of NV12/21 planes in the proper order, but this function is available - * if your pixel data is not contiguous. - *} -function SDL_UpdateNVTexture( - texture: PSDL_Texture; - Const rect: PSDL_Rect; - Const Yplane: Pcuint8; Ypitch: cint; - Const UVplane: Pcuint8; UVpitch: cint -): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateNVTexture' {$ENDIF} {$ENDIF}; +//from "sdl_renderer.h" + + {** + * Flags used when creating a rendering context + *} +const + SDL_RENDERER_SOFTWARE = $00000001; {**< The renderer is a software fallback *} + SDL_RENDERER_ACCELERATED = $00000002; {**< The renderer uses hardware + acceleration *} + SDL_RENDERER_PRESENTVSYNC = $00000004; {**< Present is synchronized + with the refresh rate *} + SDL_RENDERER_TARGETTEXTURE = $00000008; {**< The renderer supports + rendering to texture *} + +type + PPSDL_RendererFlags = ^PSDL_RendererFlags; + PSDL_RendererFlags = ^TSDL_RendererFlags; + TSDL_RendererFlags = Word; + + {** + * Information on the capabilities of a render driver or context. + *} + PPSDL_RendererInfo = ^PSDL_RendererInfo; + PSDL_RendererInfo = ^TSDL_RendererInfo; + TSDL_RendererInfo = record + name: PAnsiChar; {**< The name of the renderer *} + flags: cuint32; {**< Supported ::SDL_RendererFlags *} + num_texture_formats: cuint32; {**< The number of available texture formats *} + texture_formats: array[0..15] of cuint32; {**< The available texture formats *} + max_texture_width: cint32; {**< The maximimum texture width *} + max_texture_height: cint32; {**< The maximimum texture height *} + end; + + PPSDL_Vertex = ^PSDL_Vertex; + PSDL_Vertex = ^TSDL_Vertex; + TSDL_Vertex = record + position: TSDL_FPoint; + color: TSDL_Color; + tex_coord: TSDL_FPoint; + end; + +{** + * The scaling mode for a texture. + *} + PPSDL_ScaleMode = ^PSDL_ScaleMode; + PSDL_ScaleMode = ^TSDL_ScaleMode; + TSDL_ScaleMode = type cint; + +const + SDL_ScaleModeNearest = TSDL_ScaleMode(0); {**< nearest pixel sampling *} + SDL_ScaleModeLinear = TSDL_ScaleMode(1); {**< linear filtering *} + SDL_ScaleModeBest = TSDL_ScaleMode(2); {**< anisotropic filtering *} + + {** + * The access pattern allowed for a texture. + *} +type + PPSDL_TextureAccess = ^PSDL_TextureAccess; + PSDL_TextureAccess = ^TSDL_TextureAccess; + TSDL_TextureAccess = type cint; + +const + SDL_TEXTUREACCESS_STATIC = 0; {**< Changes rarely, not lockable *} + SDL_TEXTUREACCESS_STREAMING = 1; {**< Changes frequently, lockable *} + SDL_TEXTUREACCESS_TARGET = 2; {**< Texture can be used as a render target *} + +type + {** + * The texture channel modulation used in SDL_RenderCopy(). + *} + PPSDL_TextureModulate = ^PSDL_TextureModulate; + PSDL_TextureModulate = ^TSDL_TextureModulate; + TSDL_TextureModulate = type cint; + +const + SDL_TEXTUREMODULATE_NONE = TSDL_TextureModulate(0); {**< No modulation *} + SDL_TEXTUREMODULATE_COLOR = TSDL_TextureModulate(1); {**< srcC = srcC * color *} + SDL_TEXTUREMODULATE_ALPHA = TSDL_TextureModulate(2); {**< srcA = srcA * alpha *} + +type + {** + * Flip constants for SDL_RenderCopyEx + *} + PPSDL_RenderFlip = ^PSDL_RenderFlip; + PSDL_RenderFlip = ^TSDL_RenderFlip; + TSDL_RenderFlip = type cint; + +const + SDL_FLIP_NONE = TSDL_RenderFlip($0); {**< Do not flip *} + SDL_FLIP_HORIZONTAL = TSDL_RenderFlip($1); {**< flip horizontally *} + SDL_FLIP_VERTICAL = TSDL_RenderFlip($2); {**< flip vertically *} + +type + {** + * A structure representing rendering state + *} + + PPSDL_Renderer = ^PSDL_Renderer; + PSDL_Renderer = type Pointer; + + {** + * An efficient driver-specific representation of pixel data + *} + PPSDL_Texture = ^PSDL_Texture; + PSDL_Texture = type Pointer; + + {* Function prototypes *} + + {** + * Get the number of 2D rendering drivers available for the current + * display. + * + * A render driver is a set of code that handles rendering and texture + * management on a particular display. Normally there is only one, but + * some drivers may have several available with different capabilities. + * + * SDL_GetRenderDriverInfo() + * SDL_CreateRenderer() + *} +function SDL_GetNumRenderDrivers: cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumRenderDrivers' {$ENDIF} {$ENDIF}; + + {** + * Get information about a specific 2D rendering driver for the current + * display. + * + * index The index of the driver to query information about. + * info A pointer to an SDL_RendererInfo struct to be filled with + * information on the rendering driver. + * + * 0 on success, -1 if the index was out of range. + * + * SDL_CreateRenderer() + *} +function SDL_GetRenderDriverInfo(index: cint32; info: PSDL_RendererInfo): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderDriverInfo' {$ENDIF} {$ENDIF}; + + {** + * Create a window and default renderer + * + * width The width of the window + * height The height of the window + * window_flags The flags used to create the window + * window A pointer filled with the window, or NULL on error + * renderer A pointer filled with the renderer, or NULL on error + * + * 0 on success, or -1 on error + *} +function SDL_CreateWindowAndRenderer(width: cint32; height: cint32; window_flags: cuint32; window: PPSDL_Window; renderer: PPSDL_Renderer): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateWindowAndRenderer' {$ENDIF} {$ENDIF}; + + {** + * Create a 2D rendering context for a window. + * + * window The window where rendering is displayed. + * index The index of the rendering driver to initialize, or -1 to + * initialize the first one supporting the requested flags. + * flags ::SDL_RendererFlags. + * + * A valid rendering context or NULL if there was an error. + * + * SDL_CreateSoftwareRenderer() + * SDL_GetRendererInfo() + * SDL_DestroyRenderer() + *} +function SDL_CreateRenderer(window: PSDL_Window; index: cint32; flags: cuint32): PSDL_Renderer cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRenderer' {$ENDIF} {$ENDIF}; + + {** + * Create a 2D software rendering context for a surface. + * + * surface The surface where rendering is done. + * + * A valid rendering context or NULL if there was an error. + * + * SDL_CreateRenderer() + * SDL_DestroyRenderer() + *} +function SDL_CreateSoftwareRenderer(surface: PSDL_Surface): PSDL_Renderer cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateSoftwareRenderer' {$ENDIF} {$ENDIF}; + + {** + * Get the renderer associated with a window. + *} +function SDL_GetRenderer(window: PSDL_Window): PSDL_Renderer cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderer' {$ENDIF} {$ENDIF}; + +{** + * Get the window associated with a renderer. + *} +function SDL_RenderGetWindow(renderer: PSDL_Renderer): PSDL_Window; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetWindow' {$ENDIF} {$ENDIF}; + + {** + * Get information about a rendering context. + *} +function SDL_GetRendererInfo(renderer: PSDL_Renderer; info: PSDL_RendererInfo): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRendererInfo' {$ENDIF} {$ENDIF}; + + {** + * Get the output size of a rendering context. + *} +function SDL_GetRendererOutputSize(renderer: PSDL_Renderer; w: pcint; h: pcint): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRendererOutputSize' {$ENDIF} {$ENDIF}; + + {** + * Create a texture for a rendering context. + * + * renderer The renderer. + * format The format of the texture. + * access One of the enumerated values in ::SDL_TextureAccess. + * w The width of the texture in pixels. + * h The height of the texture in pixels. + * + * The created texture is returned, or 0 if no rendering context was + * active, the format was unsupported, or the width or height were out + * of range. + * + * SDL_QueryTexture() + * SDL_UpdateTexture() + * SDL_DestroyTexture() + *} +function SDL_CreateTexture(renderer: PSDL_Renderer; format: cuint32; access: cint32; w: cint32; h: cint32): PSDL_Texture cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateTexture' {$ENDIF} {$ENDIF}; + + {** + * Create a texture from an existing surface. + * + * renderer The renderer. + * surface The surface containing pixel data used to fill the texture. + * + * The created texture is returned, or 0 on error. + * + * The surface is not modified or freed by this function. + * + * SDL_QueryTexture() + * SDL_DestroyTexture() + *} +function SDL_CreateTextureFromSurface(renderer: PSDL_Renderer; surface: PSDL_Surface): PSDL_Texture cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateTextureFromSurface' {$ENDIF} {$ENDIF}; + + {** + * Query the attributes of a texture + * + * texture A texture to be queried. + * format A pointer filled in with the raw format of the texture. The + * actual format may differ, but pixel transfers will use this + * format. + * access A pointer filled in with the actual access to the texture. + * w A pointer filled in with the width of the texture in pixels. + * h A pointer filled in with the height of the texture in pixels. + * + * 0 on success, or -1 if the texture is not valid. + *} +function SDL_QueryTexture(texture: PSDL_Texture; format: pcuint32; access: pcint; w: pcint; h: pcint): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_QueryTexture' {$ENDIF} {$ENDIF}; + + {** + * Set an additional color value used in render copy operations. + * + * texture The texture to update. + * r The red color value multiplied into copy operations. + * g The green color value multiplied into copy operations. + * b The blue color value multiplied into copy operations. + * + * 0 on success, or -1 if the texture is not valid or color modulation + * is not supported. + * + * SDL_GetTextureColorMod() + *} +function SDL_SetTextureColorMod(texture: PSDL_Texture; r: cuint8; g: cuint8; b: cuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureColorMod' {$ENDIF} {$ENDIF}; + + {** + * Get the additional color value used in render copy operations. + * + * texture The texture to query. + * r A pointer filled in with the current red color value. + * g A pointer filled in with the current green color value. + * b A pointer filled in with the current blue color value. + * + * 0 on success, or -1 if the texture is not valid. + * + * SDL_SetTextureColorMod() + *} +function SDL_GetTextureColorMod(texture: PSDL_Texture; r: pcuint8; g: pcuint8; b: pcuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureColorMod' {$ENDIF} {$ENDIF}; + + {** + * Set an additional alpha value used in render copy operations. + * + * texture The texture to update. + * alpha The alpha value multiplied into copy operations. + * + * 0 on success, or -1 if the texture is not valid or alpha modulation + * is not supported. + * + * SDL_GetTextureAlphaMod() + *} +function SDL_SetTextureAlphaMod(texture: PSDL_Texture; alpha: cuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureAlphaMod' {$ENDIF} {$ENDIF}; + + {** + * Get the additional alpha value used in render copy operations. + * + * texture The texture to query. + * alpha A pointer filled in with the current alpha value. + * + * 0 on success, or -1 if the texture is not valid. + * + * SDL_SetTextureAlphaMod() + *} +function SDL_GetTextureAlphaMod(texture: PSDL_Texture; alpha: pcuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureAlphaMod' {$ENDIF} {$ENDIF}; + + {** + * Set the blend mode used for texture copy operations. + * + * texture The texture to update. + * blendMode ::SDL_BlendMode to use for texture blending. + * + * 0 on success, or -1 if the texture is not valid or the blend mode is + * not supported. + * + * If the blend mode is not supported, the closest supported mode is + * chosen. + * + * SDL_GetTextureBlendMode() + *} +function SDL_SetTextureBlendMode(texture: PSDL_Texture; blendMode: TSDL_BlendMode): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureBlendMode' {$ENDIF} {$ENDIF}; + + {** + * Get the blend mode used for texture copy operations. + * + * texture The texture to query. + * blendMode A pointer filled in with the current blend mode. + * + * 0 on success, or -1 if the texture is not valid. + * + * SDL_SetTextureBlendMode() + *} +function SDL_GetTextureBlendMode(texture: PSDL_Texture; blendMode: PSDL_BlendMode): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureBlendMode' {$ENDIF} {$ENDIF}; + +{** + * Set the scale mode used for texture scale operations. + * If the scale mode is not supported, the closest supported mode is chosen. + *} +function SDL_SetTextureScaleMode(texture: PSDL_Texture; scaleMode: TSDL_ScaleMode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureScaleMode' {$ENDIF} {$ENDIF}; + +{** + * Get the scale mode used for texture scale operations. + *} +function SDL_GetTextureScaleMode(texture: PSDL_Texture; scaleMode: PSDL_ScaleMode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureScaleMode' {$ENDIF} {$ENDIF}; + +{** + * Associate a user-specified pointer with a texture. + *} +function SDL_SetTextureUserData(texture: PSDL_Texture; userdata: Pointer): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureUserData' {$ENDIF} {$ENDIF}; + +{** + * Get the user-specified pointer associated with a texture. + *} +function SDL_GetTextureUserData(texture: PSDL_Texture): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureUserData' {$ENDIF} {$ENDIF}; + + {** + * Update the given texture rectangle with new pixel data. + * + * texture The texture to update + * rect A pointer to the rectangle of pixels to update, or NULL to + * update the entire texture. + * pixels The raw pixel data. + * pitch The number of bytes between rows of pixel data. + * + * 0 on success, or -1 if the texture is not valid. + * + * This is a fairly slow function. + *} +function SDL_UpdateTexture(texture: PSDL_Texture; rect: PSDL_Rect; pixels: Pointer; pitch: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateTexture' {$ENDIF} {$ENDIF}; + + {** + * Lock a portion of the texture for write-only pixel access. + * + * texture The texture to lock for access, which was created with + * SDL_TEXTUREACCESS_STREAMING. + * rect A pointer to the rectangle to lock for access. If the rect + * is NULL, the entire texture will be locked. + * pixels This is filled in with a pointer to the locked pixels, + * appropriately offset by the locked area. + * pitch This is filled in with the pitch of the locked pixels. + * + * 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING. + * + * SDL_UnlockTexture() + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LockTexture_fun = function(texture: PSDL_Texture; const rect: PSDL_Rect; pixels: PPointer; pitch: pcint): cint; cdecl; +Var + SDL_LockTexture : TSDL_LockTexture_fun = Nil; +{$else} + +function SDL_LockTexture(texture: PSDL_Texture; const rect: PSDL_Rect; pixels: PPointer; pitch: pcint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockTexture' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Lock a portion of the texture for write-only pixel access. + * Expose it as a SDL surface. + * + * \param texture The texture to lock for access, which was created with + * ::SDL_TEXTUREACCESS_STREAMING. + * \param rect A pointer to the rectangle to lock for access. If the rect + * is NULL, the entire texture will be locked. + * \param surface This is filled in with a SDL surface representing the locked area + * Surface is freed internally after calling SDL_UnlockTexture or SDL_DestroyTexture. + * + * \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING. + * + * \sa SDL_UnlockTexture() + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LockTextureToSurface_fun = function(texture: PSDL_Texture; const rect: PSDL_Rect; surface: PPSDL_Surface): cint; cdecl; +Var + SDL_LockTextureToSurface : TSDL_LockTextureToSurface_fun = Nil; +{$else} + +function SDL_LockTextureToSurface(texture: PSDL_Texture; const rect: PSDL_Rect; surface: PPSDL_Surface): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockTextureToSurface' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Unlock a texture, uploading the changes to video memory, if needed. + * + * SDL_LockTexture() + *} +procedure SDL_UnlockTexture(texture: PSDL_Texture) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockTexture' {$ENDIF} {$ENDIF}; + + {** + * Determines whether a window supports the use of render targets + * + * renderer The renderer that will be checked + * + * SDL_TRUE if supported, SDL_FALSE if not. + *} +function SDL_RenderTargetSupported(renderer: PSDL_Renderer): Boolean cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderTargetSupported' {$ENDIF} {$ENDIF}; + + {** + * Set a texture as the current rendering target. + * + * renderer The renderer. + * texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target + * + * 0 on success, or -1 on error + * + * SDL_GetRenderTarget() + *} +function SDL_SetRenderTarget(renderer: PSDL_Renderer; texture: PSDL_Texture): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRenderTarget' {$ENDIF} {$ENDIF}; + + {** + * Get the current render target or NULL for the default render target. + * + * The current render target + * + * SDL_SetRenderTarget() + *} +function SDL_GetRenderTarget(renderer: PSDL_Renderer): PSDL_Texture cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderTarget' {$ENDIF} {$ENDIF}; + + {** + * Set device independent resolution for rendering + * + * renderer The renderer for which resolution should be set. + * w The width of the logical resolution + * h The height of the logical resolution + * + * This function uses the viewport and scaling functionality to allow a fixed logical + * resolution for rendering, regardless of the actual output resolution. If the actual + * output resolution doesn't have the same aspect ratio the output rendering will be + * centered within the output display. + * + * If the output display is a window, mouse events in the window will be filtered + * and scaled so they seem to arrive within the logical resolution. + * + * If this function results in scaling or subpixel drawing by the + * rendering backend, it will be handled using the appropriate + * quality hints. + * + * SDL_RenderGetLogicalSize() + * SDL_RenderSetScale() + * SDL_RenderSetViewport() + *} +function SDL_RenderSetLogicalSize(renderer: PSDL_Renderer; w: cint32; h: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetLogicalSize' {$ENDIF} {$ENDIF}; + + {** + * Get device independent resolution for rendering + * + * renderer The renderer from which resolution should be queried. + * w A pointer filled with the width of the logical resolution + * h A pointer filled with the height of the logical resolution + * + * SDL_RenderSetLogicalSize() + *} +procedure SDL_RenderGetLogicalSize(renderer: PSDL_Renderer; w: pcint; h: pcint) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetLogicalSize' {$ENDIF} {$ENDIF}; + +{** + * \brief Set whether to force integer scales for resolution-independent rendering + * + * \param renderer The renderer for which integer scaling should be set. + * \param enable Enable or disable integer scaling + * + * This function restricts the logical viewport to integer values - that is, when + * a resolution is between two multiples of a logical size, the viewport size is + * rounded down to the lower multiple. + * + * \sa SDL_RenderSetLogicalSize() + *} +function SDL_RenderSetIntegerScale(renderer: PSDL_Renderer; enable : TSDL_bool): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetIntegerScale' {$ENDIF} {$ENDIF}; + +{** + * \brief Get whether integer scales are forced for resolution-independent rendering + * + * \param renderer The renderer from which integer scaling should be queried. + * + * \sa SDL_RenderSetIntegerScale() + *} +function SDL_RenderGetIntegerScale(renderer: PSDL_Renderer): TSDL_bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetIntegerScale' {$ENDIF} {$ENDIF}; + + {** + * Set the drawing area for rendering on the current target. + * + * renderer The renderer for which the drawing area should be set. + * rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target. + * + * The x,y of the viewport rect represents the origin for rendering. + * + * 0 on success, or -1 on error + * + * If the window associated with the renderer is resized, the viewport is automatically reset. + * + * SDL_RenderGetViewport() + * SDL_RenderSetLogicalSize() + *} +function SDL_RenderSetViewport(renderer: PSDL_Renderer; const rect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetViewport' {$ENDIF} {$ENDIF}; + + {** + * Get the drawing area for the current target. + * + * SDL_RenderSetViewport() + *} +procedure SDL_RenderGetViewport(renderer: PSDL_Renderer; rect: PSDL_Rect) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetViewport' {$ENDIF} {$ENDIF}; + + {** + * Set the clip rectangle for the current target. + * + * renderer The renderer for which clip rectangle should be set. + * rect A pointer to the rectangle to set as the clip rectangle, or + * NULL to disable clipping. + * + * 0 on success, or -1 on error + * + * SDL_RenderGetClipRect() + *} +function SDL_RenderSetClipRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetClipRect' {$ENDIF} {$ENDIF}; + + {** + * Get the clip rectangle for the current target. + * + * renderer The renderer from which clip rectangle should be queried. + * rect A pointer filled in with the current clip rectangle, or + * an empty rectangle if clipping is disabled. + * + * SDL_RenderSetClipRect() + *} +procedure SDL_RenderGetClipRect(renderer: PSDL_Renderer; rect: PSDL_Rect) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetClipRect' {$ENDIF} {$ENDIF}; + + {** + * \brief Get whether clipping is enabled on the given renderer. + * + * \param renderer The renderer from which clip state should be queried. + * + * \sa SDL_RenderGetClipRect() + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderIsClipEnabled_fun = function(renderer: PSDL_Renderer): TSDL_Bool; cdecl; +Var + SDL_RenderIsClipEnabled : TSDL_RenderIsClipEnabled_fun = Nil; +{$else} + +function SDL_RenderIsClipEnabled(renderer: PSDL_Renderer): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderIsClipEnabled' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the drawing scale for rendering on the current target. + * + * renderer The renderer for which the drawing scale should be set. + * scaleX The horizontal scaling factor + * scaleY The vertical scaling factor + * + * The drawing coordinates are scaled by the x/y scaling factors + * before they are used by the renderer. This allows resolution + * independent drawing with a single coordinate system. + * + * If this results in scaling or subpixel drawing by the + * rendering backend, it will be handled using the appropriate + * quality hints. For best results use integer scaling factors. + * + * SDL_RenderGetScale() + * SDL_RenderSetLogicalSize() + *} +function SDL_RenderSetScale(renderer: PSDL_Renderer; scaleX: cfloat; scaleY: cfloat): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetScale' {$ENDIF} {$ENDIF}; + + {** + * Get the drawing scale for the current target. + * + * renderer The renderer from which drawing scale should be queried. + * scaleX A pointer filled in with the horizontal scaling factor + * scaleY A pointer filled in with the vertical scaling factor + * + * SDL_RenderSetScale() + *} +procedure SDL_RenderGetScale(renderer: PSDL_Renderer; scaleX: pcfloat; scaleY: pcfloat) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetScale' {$ENDIF} {$ENDIF}; + +{** + * Get logical coordinates of point in renderer when given real coordinates of + * point in window. Logical coordinates will differ from real coordinates when + * render is scaled and logical renderer size set. + *} +procedure SDL_RenderWindowToLogical(renderer: PSDL_Renderer; windowX, windowY: cint; logicalX, logicalY: PSingle); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderWindowToLogical' {$ENDIF} {$ENDIF}; + +{** + * Get real coordinates of point in window when given logical coordinates of + * point in renderer. Logical coordinates will differ from real coordinate + * when render is scaled and logical renderer size set. + *} +procedure SDL_RenderLogicalToWindow(renderer: PSDL_Renderer; logicalX, logicalY: Single; windowX, windowY: Pcint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderLogicalToWindow' {$ENDIF} {$ENDIF}; + + {** + * Set the color used for drawing operations (Rect, Line and Clear). + * + * renderer The renderer for which drawing color should be set. + * r The red value used to draw on the rendering target. + * g The green value used to draw on the rendering target. + * b The blue value used to draw on the rendering target. + * a The alpha value used to draw on the rendering target, usually + * SDL_ALPHA_OPAQUE (255). + * + * 0 on success, or -1 on error + *} +function SDL_SetRenderDrawColor(renderer: PSDL_Renderer; r: cuint8; g: cuint8; b: cuint8; a: cuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRenderDrawColor' {$ENDIF} {$ENDIF}; + + {** + * Get the color used for drawing operations (Rect, Line and Clear). + * + * renderer The renderer from which drawing color should be queried. + * r A pointer to the red value used to draw on the rendering target. + * g A pointer to the green value used to draw on the rendering target. + * b A pointer to the blue value used to draw on the rendering target. + * a A pointer to the alpha value used to draw on the rendering target, + * usually SDL_ALPHA_OPAQUE (255). + * + * 0 on success, or -1 on error + *} +function SDL_GetRenderDrawColor(renderer: PSDL_Renderer; r: pcuint8; g: pcuint8; b: pcuint8; a: pcuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderDrawColor' {$ENDIF} {$ENDIF}; + + {** + * Set the blend mode used for drawing operations (Fill and Line). + * + * renderer The renderer for which blend mode should be set. + * blendMode SDL_BlendMode to use for blending. + * + * 0 on success, or -1 on error + * + * If the blend mode is not supported, the closest supported mode is + * chosen. + * + * SDL_GetRenderDrawBlendMode() + *} +function SDL_SetRenderDrawBlendMode(renderer: PSDL_Renderer; blendMode: TSDL_BlendMode): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRenderDrawBlendMode' {$ENDIF} {$ENDIF}; + + {** + * Get the blend mode used for drawing operations. + * + * renderer The renderer from which blend mode should be queried. + * blendMode A pointer filled in with the current blend mode. + * + * 0 on success, or -1 on error + * + * SDL_SetRenderDrawBlendMode() + *} +function SDL_GetRenderDrawBlendMode(renderer: PSDL_Renderer; blendMode: PSDL_BlendMode): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderDrawBlendMode' {$ENDIF} {$ENDIF}; + + {** + * Clear the current rendering target with the drawing color + * + * This function clears the entire rendering target, ignoring the viewport. + * + * 0 on success, or -1 on error + *} +function SDL_RenderClear(renderer: PSDL_Renderer): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderClear' {$ENDIF} {$ENDIF}; + + {** + * Draw a point on the current rendering target. + * + * renderer The renderer which should draw a point. + * x The x coordinate of the point. + * y The y coordinate of the point. + * + * 0 on success, or -1 on error + *} +function SDL_RenderDrawPoint(renderer: PSDL_Renderer; x: cint32; y: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPoint' {$ENDIF} {$ENDIF}; + + {** + * Draw a point on the current rendering target. + * + * renderer The renderer which should draw a point. + * x The x coordinate of the point. + * y The y coordinate of the point. + * + * 0 on success, or -1 on error + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderDrawPointF_fun = function(renderer: PSDL_Renderer; x, y: single): cint32 cdecl; +Var + SDL_RenderDrawPointF : TSDL_RenderDrawPointF_fun = Nil; +{$else} + +function SDL_RenderDrawPointF(renderer: PSDL_Renderer; x, y: single): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPointF' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Draw multiple points on the current rendering target. + * + * renderer The renderer which should draw multiple points. + * points The points to draw + * count The number of points to draw + * + * 0 on success, or -1 on error + *} +function SDL_RenderDrawPoints(renderer: PSDL_Renderer; points: PSDL_Point; count: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPoints' {$ENDIF} {$ENDIF}; + + {** + * Draw multiple points on the current rendering target. + * + * renderer The renderer which should draw multiple points. + * points The points to draw + * count The number of points to draw + * + * 0 on success, or -1 on error + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderDrawPointsF_fun = function(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl; +Var + SDL_RenderDrawPointsF : TSDL_RenderDrawPointsF_fun = Nil; +{$else} + +function SDL_RenderDrawPointsF(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPointsF' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Draw a line on the current rendering target. + * + * renderer The renderer which should draw a line. + * x1 The x coordinate of the start point. + * y1 The y coordinate of the start point. + * x2 The x coordinate of the end point. + * y2 The y coordinate of the end point. + * + * 0 on success, or -1 on error + *} +function SDL_RenderDrawLine(renderer: PSDL_Renderer; x1: cint32; y1: cint32; x2: cint32; y2: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLine' {$ENDIF} {$ENDIF}; + + {** + * Draw a line on the current rendering target. + * + * renderer The renderer which should draw a line. + * x1 The x coordinate of the start point. + * y1 The y coordinate of the start point. + * x2 The x coordinate of the end point. + * y2 The y coordinate of the end point. + * + * 0 on success, or -1 on error + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderDrawLineF_fun = function(renderer: PSDL_Renderer; x1, y1, x2, y2: single): cint32 cdecl; +Var + SDL_RenderDrawLineF : TSDL_RenderDrawLineF_fun = Nil; +{$else} + +function SDL_RenderDrawLineF(renderer: PSDL_Renderer; x1, y1, x2, y2: single): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLineF' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * \brief Draw a series of connected lines on the current rendering target. + * + * \param renderer The renderer which should draw multiple lines. + * \param points The points along the lines + * \param count The number of points, drawing count-1 lines + * + * \return 0 on success, or -1 on error + *} +function SDL_RenderDrawLines(renderer: PSDL_Renderer; points: PSDL_Point; count: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLines' {$ENDIF} {$ENDIF}; + + {** + * Draw a series of connected lines on the current rendering target. + * + * renderer The renderer which should draw multiple lines. + * points The points along the lines + * count The number of points, drawing count-1 lines + * + * 0 on success, or -1 on error + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderDrawLinesF_fun = function(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl; +Var + SDL_RenderDrawLinesF : TSDL_RenderDrawLinesF_fun = Nil; +{$else} + +function SDL_RenderDrawLinesF(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLinesF' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Draw a rectangle on the current rendering target. + * + * renderer The renderer which should draw a rectangle. + * rect A pointer to the destination rectangle, or NULL to outline the entire rendering target. + * + * 0 on success, or -1 on error + *} +function SDL_RenderDrawRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRect' {$ENDIF} {$ENDIF}; + + {** + * Draw a rectangle on the current rendering target. + * + * renderer The renderer which should draw a rectangle. + * rect A pointer to the destination rectangle, or NULL to outline the entire rendering target. + * + * 0 on success, or -1 on error + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderDrawRectF_fun = function(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl; +Var + SDL_RenderDrawRectF : TSDL_RenderDrawRectF_fun = Nil; +{$else} + +function SDL_RenderDrawRectF(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRectF' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Draw some number of rectangles on the current rendering target. + * + * renderer The renderer which should draw multiple rectangles. + * rects A pointer to an array of destination rectangles. + * count The number of rectangles. + * + * 0 on success, or -1 on error + *} +function SDL_RenderDrawRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRects' {$ENDIF} {$ENDIF}; + + {** + * Draw some number of rectangles on the current rendering target. + * + * renderer The renderer which should draw multiple rectangles. + * rects A pointer to an array of destination rectangles. + * count The number of rectangles. + * + * 0 on success, or -1 on error + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderDrawRectsF_fun = function(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl; +Var + SDL_RenderDrawRectsF : TSDL_RenderDrawRectsF_fun = Nil; +{$else} + +function SDL_RenderDrawRectsF(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRectsF' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Fill a rectangle on the current rendering target with the drawing color. + * + * renderer The renderer which should fill a rectangle. + * rect A pointer to the destination rectangle, or NULL for the entire + * rendering target. + * + * 0 on success, or -1 on error + *} +function SDL_RenderFillRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRect' {$ENDIF} {$ENDIF}; + + {** + * Fill a rectangle on the current rendering target with the drawing color. + * + * renderer The renderer which should fill a rectangle. + * rect A pointer to the destination rectangle, or NULL for the entire rendering target. + * + * 0 on success, or -1 on error + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderFillRectF_fun = function(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl; +Var + SDL_RenderFillRectF : TSDL_RenderFillRectF_fun = Nil; +{$else} + +function SDL_RenderFillRectF(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRectF' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Fill some number of rectangles on the current rendering target with the drawing color. + * + * renderer The renderer which should fill multiple rectangles. + * rects A pointer to an array of destination rectangles. + * count The number of rectangles. + * + * 0 on success, or -1 on error + *} +function SDL_RenderFillRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRects' {$ENDIF} {$ENDIF}; + + {** + * Fill some number of rectangles on the current rendering target with the drawing color. + * + * renderer The renderer which should fill multiple rectangles. + * rects A pointer to an array of destination rectangles. + * count The number of rectangles. + * + * 0 on success, or -1 on error + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderFillRectsF_fun = function(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl; +Var + SDL_RenderFillRectsF : TSDL_RenderFillRectsF_fun = Nil; +{$else} + +function SDL_RenderFillRectsF(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRectsF' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Copy a portion of the texture to the current rendering target. + * + * renderer The renderer which should copy parts of a texture. + * texture The source texture. + * srcrect A pointer to the source rectangle, or NULL for the entire + * texture. + * dstrect A pointer to the destination rectangle, or NULL for the + * entire rendering target. + * + * 0 on success, or -1 on error + *} +function SDL_RenderCopy(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: PSDL_Rect; dstrect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopy' {$ENDIF} {$ENDIF}; + + {** + * Copy a portion of the texture to the current rendering target. + * + * renderer The renderer which should copy parts of a texture. + * texture The source texture. + * srcrect A pointer to the source rectangle, or NIL for the entire texture. + * dstrect A pointer to the destination rectangle, or NIL for the entire rendering target. + * + * 0 on success, or -1 on error + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderCopyF_fun = function(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: PSDL_Rect; dstrect: PSDL_FRect): cint32 cdecl; +Var + SDL_RenderCopyF : TSDL_RenderCopyF_fun = Nil; +{$else} + +function SDL_RenderCopyF(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: PSDL_Rect; dstrect: PSDL_FRect): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopyF' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center + * + * renderer The renderer which should copy parts of a texture. + * texture The source texture. + * srcrect A pointer to the source rectangle, or NULL for the entire + * texture. + * dstrect A pointer to the destination rectangle, or NULL for the + * entire rendering target. + * angle An angle in degrees that indicates the rotation that will be applied to dstrect + * center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done aroud dstrect.w/2, dstrect.h/2) + * flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture + * + * 0 on success, or -1 on error + *} +function SDL_RenderCopyEx(renderer: PSDL_Renderer; texture: PSDL_Texture; const srcrect: PSDL_Rect; dstrect: PSDL_Rect; angle: cdouble; center: PSDL_Point; flip: TSDL_RenderFlip): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopyEx' {$ENDIF} {$ENDIF}; + + {** + * Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center + * + * renderer The renderer which should copy parts of a texture. + * texture The source texture. + * srcrect A pointer to the source rectangle, or NIL for the entire texture. + * dstrect A pointer to the destination rectangle, or NIL for the entire rendering target. + * angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction + * center A pointer to a point indicating the point around which dstrect will be rotated (if NIL, rotation will be done around dstrect.w/2, dstrect.h/2). + * flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture + * + * 0 on success, or -1 on error + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderCopyExF_fun = function(renderer: PSDL_Renderer; texture: PSDL_Texture; const srcrect: PSDL_Rect; dstrect: PSDL_FRect; angle: cdouble; center: PSDL_FPoint; flip: TSDL_RenderFlip): cint32 cdecl; +Var + SDL_RenderCopyExF : TSDL_RenderCopyExF_fun = Nil; +{$else} + +function SDL_RenderCopyExF(renderer: PSDL_Renderer; texture: PSDL_Texture; const srcrect: PSDL_Rect; dstrect: PSDL_FRect; angle: cdouble; center: PSDL_FPoint; flip: TSDL_RenderFlip): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopyExF' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Render a list of triangles, optionally using a texture and indices into the + * vertex array. Color and alpha modulation is done per vertex. + * SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored. + *} +function SDL_RenderGeometry( + renderer: PSDL_Renderer; + texture: PSDL_Texture; + Const vertices: PSDL_Vertex; num_vertices: cint; + Const indices: Pcint; num_indices: cint +): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGeometry' {$ENDIF} {$ENDIF}; + +{** + * Render a list of triangles, optionally using a texture and indices into the + * vertex arrays. Color and alpha modulation is done per vertex. + * SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored. + *} +function SDL_RenderGeometryRaw( + renderer: PSDL_Renderer; + texture: PSDL_Texture; + Const xy: PSingle; xy_stride: cint; + Const color: PSDL_Color; color_stride: cint; + Const uv: PSingle; uv_stride: cint; + num_vertices: cint; + Const indices: Pointer; num_indices, size_indices: cint +): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGeometryRaw' {$ENDIF} {$ENDIF}; + + {** + * Read pixels from the current rendering target. + * + * renderer The renderer from which pixels should be read. + * rect A pointer to the rectangle to read, or NULL for the entire + * render target. + * format The desired format of the pixel data, or 0 to use the format + * of the rendering target + * pixels A pointer to be filled in with the pixel data + * pitch The pitch of the pixels parameter. + * + * 0 on success, or -1 if pixel reading is not supported. + * + * This is a very slow operation, and should not be used frequently. + *} +function SDL_RenderReadPixels(renderer: PSDL_Renderer; rect: PSDL_Rect; format: cuint32; pixels: Pointer; pitch: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderReadPixels' {$ENDIF} {$ENDIF}; + + {** + * Update the screen with rendering performed. + *} +procedure SDL_RenderPresent(renderer: PSDL_Renderer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderPresent' {$ENDIF} {$ENDIF}; + + {** + * Destroy the specified texture. + * + * SDL_CreateTexture() + * SDL_CreateTextureFromSurface() + *} +procedure SDL_DestroyTexture(texture: PSDL_Texture) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyTexture' {$ENDIF} {$ENDIF}; + + {** + * Destroy the rendering context for a window and free associated + * textures. + * + * SDL_CreateRenderer() + *} +procedure SDL_DestroyRenderer(renderer: PSDL_Renderer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyRenderer' {$ENDIF} {$ENDIF}; + +{** + * Force the rendering context to flush any pending commands to the underlying + * rendering API. + * + * You do not need to (and in fact, shouldn't) call this function unless you + * are planning to call into OpenGL/Direct3D/Metal/whatever directly in + * addition to using an SDL_Renderer. + * + * This is for a very-specific case: if you are using SDL's render API, you + * asked for a specific renderer backend (OpenGL, Direct3D, etc), you set + * SDL_HINT_RENDER_BATCHING to "1", and you plan to make OpenGL/D3D/whatever + * calls in addition to SDL render API calls. If all of this applies, you + * should call SDL_RenderFlush() between calls to SDL's render API and the + * low-level API you're using in cooperation. + * + * In all other cases, you can ignore this function. This is only here to get + * maximum performance out of a specific situation. In all other cases, SDL + * will do the right thing, perhaps at a performance loss. + * + * This function is first available in SDL 2.0.10, and is not needed in 2.0.9 + * and earlier, as earlier versions did not queue rendering commands at all, + * instead flushing them to the OS immediately. + *} +function SDL_RenderFlush(renderer: PSDL_Renderer): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFlush' {$ENDIF} {$ENDIF}; + + {** + * Bind the texture to the current OpenGL/ES/ES2 context for use with + * OpenGL instructions. + * + * texture The SDL texture to bind + * texw A pointer to a float that will be filled with the texture width + * texh A pointer to a float that will be filled with the texture height + * + * 0 on success, or -1 if the operation is not supported + *} +function SDL_GL_BindTexture(texture: PSDL_Texture; texw: pcfloat; texh: pcfloat): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_BindTexture' {$ENDIF} {$ENDIF}; + + {** + * Unbind a texture from the current OpenGL/ES/ES2 context. + * + * texture The SDL texture to unbind + * + * 0 on success, or -1 if the operation is not supported + *} +function SDL_GL_UnbindTexture(texture: PSDL_Texture): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_UnbindTexture' {$ENDIF} {$ENDIF}; + +{** + * Get the CAMetalLayer associated with the given Metal renderer. + * + * This function returns a raw Pointer, so SDL doesn't have to include Metal's headers, + * but it can be safely cast to a pointer to `CAMetalLayer`. + * + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderGetMetalLayer_fun = function(renderer: PSDL_Renderer): Pointer; cdecl; +Var + SDL_RenderGetMetalLayer : TSDL_RenderGetMetalLayer_fun = Nil; +{$else} + +function SDL_RenderGetMetalLayer(renderer: PSDL_Renderer): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetMetalLayer' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the Metal command encoder for the current frame + * + * This function returns a raw Pointer, so SDL doesn't have to include Metal's headers, + * but it can be safely cast to an `id`. + * + * Note that as of SDL 2.0.18, this will return NULL if Metal refuses to give + * SDL a drawable to render to, which might happen if the window is + * hidden/minimized/offscreen. This doesn't apply to command encoders for + * render targets, just the window's backbacker. Check your return values! + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderGetMetalCommandEncoder_fun = function(renderer: PSDL_Renderer): Pointer; cdecl; +Var + SDL_RenderGetMetalCommandEncoder : TSDL_RenderGetMetalCommandEncoder_fun = Nil; +{$else} + +function SDL_RenderGetMetalCommandEncoder(renderer: PSDL_Renderer): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetMetalCommandEncoder' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Toggle VSync of the given renderer. + *} +function SDL_RenderSetVSync(renderer: PSDL_Renderer; vsync: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetVSync' {$ENDIF} {$ENDIF}; + + {** + * Update a rectangle within a planar YV12 or IYUV texture with new pixel data. + * + * texture The texture to update + * rect A pointer to the rectangle of pixels to update, or NULL to update the entire texture. + * Yplane The raw pixel data for the Y plane. + * Ypitch The number of bytes between rows of pixel data for the Y plane. + * Uplane The raw pixel data for the U plane. + * Upitch The number of bytes between rows of pixel data for the U plane. + * Vplane The raw pixel data for the V plane. + * Vpitch The number of bytes between rows of pixel data for the V plane. + * + * 0 on success, or -1 if the texture is not valid. + * + * You can use SDL_UpdateTexture() as long as your pixel data is + * a contiguous block of Y and U/V planes in the proper order, but + * this function is available if your pixel data is not contiguous. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UpdateYUVTexture_fun = function(texture: PSDL_Texture; rect: PSDL_Rect; Yplane: pcuint8; Ypitch: cint32; Uplane: pcuint8; UPitch: cint32; Vplane: pcuint8; VPitch: cint32):cint32; + cdecl; +Var + SDL_UpdateYUVTexture : TSDL_UpdateYUVTexture_fun = Nil; +{$else} + +function SDL_UpdateYUVTexture(texture: PSDL_Texture; rect: PSDL_Rect; Yplane: pcuint8; Ypitch: cint32; Uplane: pcuint8; UPitch: cint32; Vplane: pcuint8; VPitch: cint32):cint32; + cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateYUVTexture' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Update a rectangle within a planar NV12 or NV21 texture with new pixels. + * + * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous + * block of NV12/21 planes in the proper order, but this function is available + * if your pixel data is not contiguous. + *} +function SDL_UpdateNVTexture( + texture: PSDL_Texture; + Const rect: PSDL_Rect; + Const Yplane: Pcuint8; Ypitch: cint; + Const UVplane: Pcuint8; UVpitch: cint +): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateNVTexture' {$ENDIF} {$ENDIF}; diff --git a/units/sdlrwops.inc b/units/sdlrwops.inc index e0d844e9..2b1f6162 100644 --- a/units/sdlrwops.inc +++ b/units/sdlrwops.inc @@ -1,280 +1,496 @@ -//based on "sdl_rwops" (2.0.14) - -{** - * \file SDL_rwops.h - * - * This file provides a general interface for SDL to read and write - * data streams. It can easily be extended to files, memory, etc. - *} - -const - {* RWops Types *} - SDL_RWOPS_UNKNOWN = 0; {* Unknown stream type *} - SDL_RWOPS_WINFILE = 1; {* Win32 file *} - SDL_RWOPS_STDFILE = 2; {* Stdio file *} - SDL_RWOPS_JNIFILE = 3; {* Android asset *} - SDL_RWOPS_MEMORY = 4; {* Memory stream *} - SDL_RWOPS_MEMORY_RO = 5; {* Read-Only memory stream *} - -type - PPSDL_RWops = ^PSDL_RWops; - PSDL_RWops = ^TSDL_RWops; - - {** - * This is the read/write operation structure -- very basic. - *} - - {** - * Return the size of the file in this rwops, or -1 if unknown - *} - TSize = function(context: PSDL_RWops): cint64; {$IFNDEF GPC} cdecl; {$ENDIF} - - {** - * Seek to offset relative to whence, one of stdio's whence values: - * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END - * - * the final offset in the data stream, or -1 on error. - *} - TSeek = function(context: PSDL_RWops; offset: cint64; whence: cint): cint64; {$IFNDEF GPC} cdecl; {$ENDIF} - - {** - * Read up to maxnum objects each of size size from the data - * stream to the area pointed at by ptr. - * - * the number of objects read, or 0 at error or end of file. - *} - TRead = function(context: PSDL_RWops; ptr: Pointer; size: csize_t; maxnum: csize_t): csize_t; {$IFNDEF GPC} cdecl; {$ENDIF} - - {** - * Write exactly num objects each of size size from the area - * pointed at by ptr to data stream. - * - * the number of objects written, or 0 at error or end of file. - *} - TWrite = function(context: PSDL_RWops; const ptr: Pointer; size: csize_t; num: csize_t): csize_t; {$IFNDEF GPC} cdecl; {$ENDIF} - - {** - * Close and free an allocated SDL_RWops structure. - * - * 0 if successful or -1 on write error when flushing data. - *} - TClose = function(context: PSDL_RWops): cint; {$IFNDEF GPC} cdecl; {$ENDIF} - - // (2.0.14) Outdated decl., kept commented just in case. - {TAndroidIO = record - fileNameRef: Pointer; - inputStreamRef: Pointer; - readableByteChannelRef: Pointer; - readMethod: Pointer; - assetFileDescriptorRef: Pointer; - position: LongInt; - size: LongInt; - offset: LongInt; - fd: cint32; - end;} - - TAndroidIO = record - asset: Pointer; - end; - - TWindowsIOBuffer = record - data: Pointer; - size: csize_t; - left: csize_t; - end; - - TWindowsIO = record - append: TSDL_Bool; - h: Pointer; - buffer: TWindowsIOBuffer; - end; - - TStdio = record - autoclose: TSDL_Bool; - fp: file; // Is this appropriate? C FILE --> Pascal file - end; - - TMem = record - base: pcuint8; - here: pcuint8; - stop: pcuint8; - end; - - TUnknown = record - data1: Pointer; - data2: Pointer; - end; - - TSDL_RWops = packed record - size: TSize; - seek: TSeek; - read: TRead; - write: TWrite; - close: TClose; - - _type: cuint32; - - case hidden: cint of - {$IFDEF ANDROID} - 0: (androidio: TAndroidIO); - {$ENDIF} - {$IFDEF WINDOWS} - 0: (windowsio: TWindowsIO); - {$ENDIF} - 1: (stdio: TStdio); - 2: (mem: TMem); - 3: (unknown: TUnknown); - end; - -{** - * RWFrom functions - * - * Functions to create SDL_RWops structures from various data streams. - *} -function SDL_RWFromFile(const _file: PAnsiChar; const mode: PAnsiChar): PSDL_RWops; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWFromFile' {$ENDIF} {$ENDIF}; - -{function SDL_RWFromFP(fp: file; autoclose: TSDL_Bool): PSDL_RWops; cdecl; - external SDL_LibName;} //don't know if this works - -function SDL_RWFromFP(fp: Pointer; autoclose: TSDL_Bool): PSDL_RWops; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWFromFP' {$ENDIF} {$ENDIF}; - -function SDL_RWFromMem(mem: Pointer; size: cint): PSDL_RWops; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWFromMem' {$ENDIF} {$ENDIF}; - -function SDL_RWFromConstMem(const mem: Pointer; size: cint): PSDL_RWops; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWFromConstMem' {$ENDIF} {$ENDIF}; - -{*RWFrom functions*} -function SDL_AllocRW: PSDL_RWops; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AllocRW' {$ENDIF} {$ENDIF}; - -procedure SDL_FreeRW(area: PSDL_RWops); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeRW' {$ENDIF} {$ENDIF}; - -const - RW_SEEK_SET = 0; {**< Seek from the beginning of data *} - RW_SEEK_CUR = 1; {**< Seek relative to current read point *} - RW_SEEK_END = 2; {**< Seek relative to the end of data *} - -{** - * Return the size of the file in this rwops, or -1 if unknown - *} -function SDL_RWsize(context: PSDL_RWops): cint64; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWsize' {$ENDIF} {$ENDIF}; - -{** - * Seek to \c offset relative to \c whence, one of stdio's whence values: - * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END - * - * \return the final offset in the data stream, or -1 on error. - *} -function SDL_RWseek(context: PSDL_RWops; offset: cint64; whence: cint): cint64; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_RWseek' {$ENDIF} {$ENDIF}; - -{** - * Return the current offset in the data stream, or -1 on error. - *} -function SDL_RWtell(context: PSDL_RWops): cint64; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWtell' {$ENDIF} {$ENDIF}; - -{** - * Read up to \c maxnum objects each of size \c size from the data - * stream to the area pointed at by \c ptr. - * - * \return the number of objects read, or 0 at error or end of file. - *} -function SDL_RWread(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t): csize_t; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWread' {$ENDIF} {$ENDIF}; - -{** - * Write exactly \c num objects each of size \c size from the area - * pointed at by \c ptr to data stream. - * - * \return the number of objects written, or 0 at error or end of file. - *} -function SDL_RWwrite(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t): csize_t; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWwrite' {$ENDIF} {$ENDIF}; - -{** - * Close and free an allocated SDL_RWops structure. - * - * \return 0 if successful or -1 on write error when flushing data. - *} -function SDL_RWclose(context: PSDL_RWops): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWclose' {$ENDIF} {$ENDIF}; - -{** - * Load all the data from an SDL data stream. - * - * The data is allocated with a zero byte at the end (null terminated) - * - * If \c datasize is not NULL, it is filled with the size of the data read. - * - * If \c freesrc is non-zero, the stream will be closed after being read. - * - * The data should be freed with SDL_free(). - * - * \return the data, or NULL if there was an error. - *} -function SDL_LoadFile_RW(src: PSDL_RWops; datasize: pcsize_t; freesrc: cint): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadFile_RW' {$ENDIF} {$ENDIF}; - -{** - * Load an entire file. - * - * The data is allocated with a zero byte at the end (null terminated) - * - * If \c datasize is not NULL, it is filled with the size of the data read. - * - * If \c freesrc is non-zero, the stream will be closed after being read. - * - * The data should be freed with SDL_free(). - * - * \return the data, or NULL if there was an error. - *} -function SDL_LoadFile(file_: PAnsiChar; datasize: pcsize_t): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadFile' {$ENDIF} {$ENDIF}; - -{** - * Read endian functions - * - * Read an item of the specified endianness and return in native format. - *} -function SDL_ReadU8(src: PSDL_RWops): cuint8; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadU8' {$ENDIF} {$ENDIF}; -function SDL_ReadLE16(src: PSDL_RWops): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadLE16' {$ENDIF} {$ENDIF}; -function SDL_ReadBE16(src: PSDL_RWops): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadBE16' {$ENDIF} {$ENDIF}; -function SDL_ReadLE32(src: PSDL_RWops): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadLE32' {$ENDIF} {$ENDIF}; -function SDL_ReadBE32(src: PSDL_RWops): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadBE32' {$ENDIF} {$ENDIF}; -function SDL_ReadLE64(src: PSDL_RWops): cuint64; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadLE64' {$ENDIF} {$ENDIF}; -function SDL_ReadBE64(src: PSDL_RWops): cuint64; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadBE64' {$ENDIF} {$ENDIF}; -{ Read endian functions } - -{** - * Write endian functions - * - * Write an item of native format to the specified endianness. - *} -function SDL_WriteU8(dst: PSDL_RWops; value: cuint8): csize_t; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteU8' {$ENDIF} {$ENDIF}; -function SDL_WriteLE16(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteLE16' {$ENDIF} {$ENDIF}; -function SDL_WriteBE16(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteBE16' {$ENDIF} {$ENDIF}; -function SDL_WriteLE32(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteLE32' {$ENDIF} {$ENDIF}; -function SDL_WriteBE32(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteBE32' {$ENDIF} {$ENDIF}; -function SDL_WriteLE64(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteLE64' {$ENDIF} {$ENDIF}; -function SDL_WriteBE64(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteBE64' {$ENDIF} {$ENDIF}; -{ Write endian functions } +//based on "sdl_rwops" (2.0.14) + +{** + * \file SDL_rwops.h + * + * This file provides a general interface for SDL to read and write + * data streams. It can easily be extended to files, memory, etc. + *} + +const + {* RWops Types *} + SDL_RWOPS_UNKNOWN = 0; {* Unknown stream type *} + SDL_RWOPS_WINFILE = 1; {* Win32 file *} + SDL_RWOPS_STDFILE = 2; {* Stdio file *} + SDL_RWOPS_JNIFILE = 3; {* Android asset *} + SDL_RWOPS_MEMORY = 4; {* Memory stream *} + SDL_RWOPS_MEMORY_RO = 5; {* Read-Only memory stream *} + +type + PPSDL_RWops = ^PSDL_RWops; + PSDL_RWops = ^TSDL_RWops; + + {** + * This is the read/write operation structure -- very basic. + *} + + {** + * Return the size of the file in this rwops, or -1 if unknown + *} + TSize = function(context: PSDL_RWops): cint64; {$IFNDEF GPC} cdecl; {$ENDIF} + + {** + * Seek to offset relative to whence, one of stdio's whence values: + * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END + * + * the final offset in the data stream, or -1 on error. + *} + TSeek = function(context: PSDL_RWops; offset: cint64; whence: cint): cint64; {$IFNDEF GPC} cdecl; {$ENDIF} + + {** + * Read up to maxnum objects each of size size from the data + * stream to the area pointed at by ptr. + * + * the number of objects read, or 0 at error or end of file. + *} + TRead = function(context: PSDL_RWops; ptr: Pointer; size: csize_t; maxnum: csize_t): csize_t; {$IFNDEF GPC} cdecl; {$ENDIF} + + {** + * Write exactly num objects each of size size from the area + * pointed at by ptr to data stream. + * + * the number of objects written, or 0 at error or end of file. + *} + TWrite = function(context: PSDL_RWops; const ptr: Pointer; size: csize_t; num: csize_t): csize_t; {$IFNDEF GPC} cdecl; {$ENDIF} + + {** + * Close and free an allocated SDL_RWops structure. + * + * 0 if successful or -1 on write error when flushing data. + *} + TClose = function(context: PSDL_RWops): cint; {$IFNDEF GPC} cdecl; {$ENDIF} + + // (2.0.14) Outdated decl., kept commented just in case. + {TAndroidIO = record + fileNameRef: Pointer; + inputStreamRef: Pointer; + readableByteChannelRef: Pointer; + readMethod: Pointer; + assetFileDescriptorRef: Pointer; + position: LongInt; + size: LongInt; + offset: LongInt; + fd: cint32; + end;} + + TAndroidIO = record + asset: Pointer; + end; + + TWindowsIOBuffer = record + data: Pointer; + size: csize_t; + left: csize_t; + end; + + TWindowsIO = record + append: TSDL_Bool; + h: Pointer; + buffer: TWindowsIOBuffer; + end; + + TStdio = record + autoclose: TSDL_Bool; + fp: file; // Is this appropriate? C FILE --> Pascal file + end; + + TMem = record + base: pcuint8; + here: pcuint8; + stop: pcuint8; + end; + + TUnknown = record + data1: Pointer; + data2: Pointer; + end; + + TSDL_RWops = packed record + size: TSize; + seek: TSeek; + read: TRead; + write: TWrite; + close: TClose; + + _type: cuint32; + + case hidden: cint of + {$IFDEF ANDROID} + 0: (androidio: TAndroidIO); + {$ENDIF} + {$IFDEF WINDOWS} + 0: (windowsio: TWindowsIO); + {$ENDIF} + 1: (stdio: TStdio); + 2: (mem: TMem); + 3: (unknown: TUnknown); + end; + +{** + * RWFrom functions + * + * Functions to create SDL_RWops structures from various data streams. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RWFromFile_fun = function(const _file: PAnsiChar; const mode: PAnsiChar): PSDL_RWops; cdecl; +Var + SDL_RWFromFile : TSDL_RWFromFile_fun = Nil; +{$else} + +function SDL_RWFromFile(const _file: PAnsiChar; const mode: PAnsiChar): PSDL_RWops; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWFromFile' {$ENDIF} {$ENDIF}; +{$endif} + +{function SDL_RWFromFP(fp: file; autoclose: TSDL_Bool): PSDL_RWops; cdecl; + external SDL_LibName;} //don't know if this works + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RWFromFP_fun = function(fp: Pointer; autoclose: TSDL_Bool): PSDL_RWops; cdecl; +Var + SDL_RWFromFP : TSDL_RWFromFP_fun = Nil; +{$else} + +function SDL_RWFromFP(fp: Pointer; autoclose: TSDL_Bool): PSDL_RWops; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWFromFP' {$ENDIF} {$ENDIF}; +{$endif} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RWFromMem_fun = function(mem: Pointer; size: cint): PSDL_RWops; cdecl; +Var + SDL_RWFromMem : TSDL_RWFromMem_fun = Nil; +{$else} + +function SDL_RWFromMem(mem: Pointer; size: cint): PSDL_RWops; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWFromMem' {$ENDIF} {$ENDIF}; +{$endif} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RWFromConstMem_fun = function(const mem: Pointer; size: cint): PSDL_RWops; cdecl; +Var + SDL_RWFromConstMem : TSDL_RWFromConstMem_fun = Nil; +{$else} + +function SDL_RWFromConstMem(const mem: Pointer; size: cint): PSDL_RWops; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWFromConstMem' {$ENDIF} {$ENDIF}; +{$endif} + +{*RWFrom functions*} +function SDL_AllocRW: PSDL_RWops; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AllocRW' {$ENDIF} {$ENDIF}; + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_FreeRW_proc = procedure(area: PSDL_RWops); cdecl; +Var + SDL_FreeRW : TSDL_FreeRW_proc = Nil; +{$else} + +procedure SDL_FreeRW(area: PSDL_RWops); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeRW' {$ENDIF} {$ENDIF}; +{$endif} + +const + RW_SEEK_SET = 0; {**< Seek from the beginning of data *} + RW_SEEK_CUR = 1; {**< Seek relative to current read point *} + RW_SEEK_END = 2; {**< Seek relative to the end of data *} + +{** + * Return the size of the file in this rwops, or -1 if unknown + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RWsize_fun = function(context: PSDL_RWops): cint64; cdecl; +Var + SDL_RWsize : TSDL_RWsize_fun = Nil; +{$else} + +function SDL_RWsize(context: PSDL_RWops): cint64; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWsize' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Seek to \c offset relative to \c whence, one of stdio's whence values: + * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END + * + * \return the final offset in the data stream, or -1 on error. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RWseek_fun = function(context: PSDL_RWops; offset: cint64; whence: cint): cint64; cdecl; +Var + SDL_RWseek : TSDL_RWseek_fun = Nil; +{$else} + +function SDL_RWseek(context: PSDL_RWops; offset: cint64; whence: cint): cint64; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_RWseek' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Return the current offset in the data stream, or -1 on error. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RWtell_fun = function(context: PSDL_RWops): cint64; cdecl; +Var + SDL_RWtell : TSDL_RWtell_fun = Nil; +{$else} + +function SDL_RWtell(context: PSDL_RWops): cint64; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWtell' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Read up to \c maxnum objects each of size \c size from the data + * stream to the area pointed at by \c ptr. + * + * \return the number of objects read, or 0 at error or end of file. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RWread_fun = function(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t): csize_t; cdecl; +Var + SDL_RWread : TSDL_RWread_fun = Nil; +{$else} + +function SDL_RWread(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t): csize_t; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWread' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Write exactly \c num objects each of size \c size from the area + * pointed at by \c ptr to data stream. + * + * \return the number of objects written, or 0 at error or end of file. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RWwrite_fun = function(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t): csize_t; cdecl; +Var + SDL_RWwrite : TSDL_RWwrite_fun = Nil; +{$else} + +function SDL_RWwrite(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t): csize_t; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWwrite' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Close and free an allocated SDL_RWops structure. + * + * \return 0 if successful or -1 on write error when flushing data. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RWclose_fun = function(context: PSDL_RWops): cint; cdecl; +Var + SDL_RWclose : TSDL_RWclose_fun = Nil; +{$else} + +function SDL_RWclose(context: PSDL_RWops): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWclose' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Load all the data from an SDL data stream. + * + * The data is allocated with a zero byte at the end (null terminated) + * + * If \c datasize is not NULL, it is filled with the size of the data read. + * + * If \c freesrc is non-zero, the stream will be closed after being read. + * + * The data should be freed with SDL_free(). + * + * \return the data, or NULL if there was an error. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LoadFile_RW_fun = function(src: PSDL_RWops; datasize: pcsize_t; freesrc: cint): Pointer; cdecl; +Var + SDL_LoadFile_RW : TSDL_LoadFile_RW_fun = Nil; +{$else} + +function SDL_LoadFile_RW(src: PSDL_RWops; datasize: pcsize_t; freesrc: cint): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadFile_RW' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Load an entire file. + * + * The data is allocated with a zero byte at the end (null terminated) + * + * If \c datasize is not NULL, it is filled with the size of the data read. + * + * If \c freesrc is non-zero, the stream will be closed after being read. + * + * The data should be freed with SDL_free(). + * + * \return the data, or NULL if there was an error. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LoadFile_fun = function(file_: PAnsiChar; datasize: pcsize_t): Pointer; cdecl; +Var + SDL_LoadFile : TSDL_LoadFile_fun = Nil; +{$else} + +function SDL_LoadFile(file_: PAnsiChar; datasize: pcsize_t): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadFile' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Read endian functions + * + * Read an item of the specified endianness and return in native format. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ReadU8_fun = function(src: PSDL_RWops): cuint8; cdecl; +Var + SDL_ReadU8 : TSDL_ReadU8_fun = Nil; +{$else} + +function SDL_ReadU8(src: PSDL_RWops): cuint8; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadU8' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ReadLE16_fun = function(src: PSDL_RWops): cuint16; cdecl; +Var + SDL_ReadLE16 : TSDL_ReadLE16_fun = Nil; +{$else} + +function SDL_ReadLE16(src: PSDL_RWops): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadLE16' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ReadBE16_fun = function(src: PSDL_RWops): cuint16; cdecl; +Var + SDL_ReadBE16 : TSDL_ReadBE16_fun = Nil; +{$else} + +function SDL_ReadBE16(src: PSDL_RWops): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadBE16' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ReadLE32_fun = function(src: PSDL_RWops): cuint32; cdecl; +Var + SDL_ReadLE32 : TSDL_ReadLE32_fun = Nil; +{$else} + +function SDL_ReadLE32(src: PSDL_RWops): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadLE32' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ReadBE32_fun = function(src: PSDL_RWops): cuint32; cdecl; +Var + SDL_ReadBE32 : TSDL_ReadBE32_fun = Nil; +{$else} + +function SDL_ReadBE32(src: PSDL_RWops): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadBE32' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ReadLE64_fun = function(src: PSDL_RWops): cuint64; cdecl; +Var + SDL_ReadLE64 : TSDL_ReadLE64_fun = Nil; +{$else} + +function SDL_ReadLE64(src: PSDL_RWops): cuint64; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadLE64' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ReadBE64_fun = function(src: PSDL_RWops): cuint64; cdecl; +Var + SDL_ReadBE64 : TSDL_ReadBE64_fun = Nil; +{$else} + +function SDL_ReadBE64(src: PSDL_RWops): cuint64; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadBE64' {$ENDIF} {$ENDIF}; +{$endif} +{ Read endian functions } + +{** + * Write endian functions + * + * Write an item of native format to the specified endianness. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WriteU8_fun = function(dst: PSDL_RWops; value: cuint8): csize_t; cdecl; +Var + SDL_WriteU8 : TSDL_WriteU8_fun = Nil; +{$else} + +function SDL_WriteU8(dst: PSDL_RWops; value: cuint8): csize_t; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteU8' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WriteLE16_fun = function(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; +Var + SDL_WriteLE16 : TSDL_WriteLE16_fun = Nil; +{$else} + +function SDL_WriteLE16(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteLE16' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WriteBE16_fun = function(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; +Var + SDL_WriteBE16 : TSDL_WriteBE16_fun = Nil; +{$else} + +function SDL_WriteBE16(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteBE16' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WriteLE32_fun = function(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; +Var + SDL_WriteLE32 : TSDL_WriteLE32_fun = Nil; +{$else} + +function SDL_WriteLE32(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteLE32' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WriteBE32_fun = function(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; +Var + SDL_WriteBE32 : TSDL_WriteBE32_fun = Nil; +{$else} + +function SDL_WriteBE32(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteBE32' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WriteLE64_fun = function(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; +Var + SDL_WriteLE64 : TSDL_WriteLE64_fun = Nil; +{$else} + +function SDL_WriteLE64(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteLE64' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WriteBE64_fun = function(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; +Var + SDL_WriteBE64 : TSDL_WriteBE64_fun = Nil; +{$else} + +function SDL_WriteBE64(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteBE64' {$ENDIF} {$ENDIF}; +{$endif} +{ Write endian functions } diff --git a/units/sdlscancode.inc b/units/sdlscancode.inc index 13aafe9c..a621ea71 100644 --- a/units/sdlscancode.inc +++ b/units/sdlscancode.inc @@ -1,394 +1,394 @@ -//from "sdl_scancode.h" - - {** - * The SDL keyboard scancode representation. - * - * Values of this type are used to represent keyboard keys, among other places - * in the SDL_Keysym.scancode key.keysym.scancode \endlink field of the - * SDL_Event structure. - * - * The values in this enumeration are based on the USB usage page standard: - * https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf - *} -type - PPSDL_ScanCode = ^PSDL_ScanCode; - PSDL_ScanCode = ^TSDL_ScanCode; - TSDL_ScanCode = type cint; - -const - SDL_SCANCODE_UNKNOWN = TSDL_ScanCode(0); - - {** - * Usage page $07 - * - * These values are from usage page $07 (USB keyboard page). - *} - - SDL_SCANCODE_A = TSDL_ScanCode(4); - SDL_SCANCODE_B = TSDL_ScanCode(5); - SDL_SCANCODE_C = TSDL_ScanCode(6); - SDL_SCANCODE_D = TSDL_ScanCode(7); - SDL_SCANCODE_E = TSDL_ScanCode(8); - SDL_SCANCODE_F = TSDL_ScanCode(9); - SDL_SCANCODE_G = TSDL_ScanCode(10); - SDL_SCANCODE_H = TSDL_ScanCode(11); - SDL_SCANCODE_I = TSDL_ScanCode(12); - SDL_SCANCODE_J = TSDL_ScanCode(13); - SDL_SCANCODE_K = TSDL_ScanCode(14); - SDL_SCANCODE_L = TSDL_ScanCode(15); - SDL_SCANCODE_M = TSDL_ScanCode(16); - SDL_SCANCODE_N = TSDL_ScanCode(17); - SDL_SCANCODE_O = TSDL_ScanCode(18); - SDL_SCANCODE_P = TSDL_ScanCode(19); - SDL_SCANCODE_Q = TSDL_ScanCode(20); - SDL_SCANCODE_R = TSDL_ScanCode(21); - SDL_SCANCODE_S = TSDL_ScanCode(22); - SDL_SCANCODE_T = TSDL_ScanCode(23); - SDL_SCANCODE_U = TSDL_ScanCode(24); - SDL_SCANCODE_V = TSDL_ScanCode(25); - SDL_SCANCODE_W = TSDL_ScanCode(26); - SDL_SCANCODE_X = TSDL_ScanCode(27); - SDL_SCANCODE_Y = TSDL_ScanCode(28); - SDL_SCANCODE_Z = TSDL_ScanCode(29); - - SDL_SCANCODE_1 = TSDL_ScanCode(30); - SDL_SCANCODE_2 = TSDL_ScanCode(31); - SDL_SCANCODE_3 = TSDL_ScanCode(32); - SDL_SCANCODE_4 = TSDL_ScanCode(33); - SDL_SCANCODE_5 = TSDL_ScanCode(34); - SDL_SCANCODE_6 = TSDL_ScanCode(35); - SDL_SCANCODE_7 = TSDL_ScanCode(36); - SDL_SCANCODE_8 = TSDL_ScanCode(37); - SDL_SCANCODE_9 = TSDL_ScanCode(38); - SDL_SCANCODE_0 = TSDL_ScanCode(39); - - SDL_SCANCODE_RETURN = TSDL_ScanCode(40); - SDL_SCANCODE_ESCAPE = TSDL_ScanCode(41); - SDL_SCANCODE_BACKSPACE = TSDL_ScanCode(42); - SDL_SCANCODE_TAB = TSDL_ScanCode(43); - SDL_SCANCODE_SPACE = TSDL_ScanCode(44); - - SDL_SCANCODE_MINUS = TSDL_ScanCode(45); - SDL_SCANCODE_EQUALS = TSDL_ScanCode(46); - SDL_SCANCODE_LEFTBRACKET = TSDL_ScanCode(47); - SDL_SCANCODE_RIGHTBRACKET = TSDL_ScanCode(48); - SDL_SCANCODE_BACKSLASH = TSDL_ScanCode(49); {**< Located at the lower left of the return - * key on ISO keyboards and at the right end - * of the QWERTY row on ANSI keyboards. - * Produces REVERSE SOLIDUS (backslash) and - * VERTICAL LINE in a US layout; REVERSE - * SOLIDUS and VERTICAL LINE in a UK Mac - * layout; NUMBER SIGN and TILDE in a UK - * Windows layout; DOLLAR SIGN and POUND SIGN - * in a Swiss German layout; NUMBER SIGN and - * APOSTROPHE in a German layout; GRAVE - * ACCENT and POUND SIGN in a French Mac - * layout; and ASTERISK and MICRO SIGN in a - * French Windows layout. - *} - SDL_SCANCODE_NONUSHASH = TSDL_ScanCode(50); {**< ISO USB keyboards actually use this code - * instead of 49 for the same key; but all - * OSes I've seen treat the two codes - * identically. So; as an implementor; unless - * your keyboard generates both of those - * codes and your OS treats them differently; - * you should generate SDL_SCANCODE_BACKSLASH - * instead of this code. As a user; you - * should not rely on this code because SDL - * will never generate it with most (all?) - * keyboards. - *} - SDL_SCANCODE_SEMICOLON = TSDL_ScanCode(51); - SDL_SCANCODE_APOSTROPHE = TSDL_ScanCode(52); - SDL_SCANCODE_GRAVE = TSDL_ScanCode(53); {**< Located in the top left corner (on both ANSI - * and ISO keyboards). Produces GRAVE ACCENT and - * TILDE in a US Windows layout and in US and UK - * Mac layouts on ANSI keyboards; GRAVE ACCENT - * and NOT SIGN in a UK Windows layout; SECTION - * SIGN and PLUS-MINUS SIGN in US and UK Mac - * layouts on ISO keyboards; SECTION SIGN and - * DEGREE SIGN in a Swiss German layout (Mac: - * only on ISO keyboards); CIRCUMFLEX ACCENT and - * DEGREE SIGN in a German layout (Mac: only on - * ISO keyboards); SUPERSCRIPT TWO and TILDE in a - * French Windows layout; COMMERCIAL AT and - * NUMBER SIGN in a French Mac layout on ISO - * keyboards; and LESS-THAN SIGN and GREATER-THAN - * SIGN in a Swiss German; German; or French Mac - * layout on ANSI keyboards. - *} - SDL_SCANCODE_COMMA = TSDL_ScanCode(54); - SDL_SCANCODE_PERIOD = TSDL_ScanCode(55); - SDL_SCANCODE_SLASH = TSDL_ScanCode(56); - - SDL_SCANCODE_CAPSLOCK = TSDL_ScanCode(57); - - SDL_SCANCODE_F1 = TSDL_ScanCode(58); - SDL_SCANCODE_F2 = TSDL_ScanCode(59); - SDL_SCANCODE_F3 = TSDL_ScanCode(60); - SDL_SCANCODE_F4 = TSDL_ScanCode(61); - SDL_SCANCODE_F5 = TSDL_ScanCode(62); - SDL_SCANCODE_F6 = TSDL_ScanCode(63); - SDL_SCANCODE_F7 = TSDL_ScanCode(64); - SDL_SCANCODE_F8 = TSDL_ScanCode(65); - SDL_SCANCODE_F9 = TSDL_ScanCode(66); - SDL_SCANCODE_F10 = TSDL_ScanCode(67); - SDL_SCANCODE_F11 = TSDL_ScanCode(68); - SDL_SCANCODE_F12 = TSDL_ScanCode(69); - - SDL_SCANCODE_PRINTSCREEN = TSDL_ScanCode(70); - SDL_SCANCODE_SCROLLLOCK = TSDL_ScanCode(71); - SDL_SCANCODE_PAUSE = TSDL_ScanCode(72); - SDL_SCANCODE_INSERT = TSDL_ScanCode(73); {**< insert on PC; help on some Mac keyboards (but - does send code 73; not 117) *} - SDL_SCANCODE_HOME = TSDL_ScanCode(74); - SDL_SCANCODE_PAGEUP = TSDL_ScanCode(75); - SDL_SCANCODE_DELETE = TSDL_ScanCode(76); - SDL_SCANCODE_END = TSDL_ScanCode(77); - SDL_SCANCODE_PAGEDOWN = TSDL_ScanCode(78); - SDL_SCANCODE_RIGHT = TSDL_ScanCode(79); - SDL_SCANCODE_LEFT = TSDL_ScanCode(80); - SDL_SCANCODE_DOWN = TSDL_ScanCode(81); - SDL_SCANCODE_UP = TSDL_ScanCode(82); - - SDL_SCANCODE_NUMLOCKCLEAR = TSDL_ScanCode(83); {**< num lock on PC; clear on Mac keyboards - *} - SDL_SCANCODE_KP_DIVIDE = TSDL_ScanCode(84); - SDL_SCANCODE_KP_MULTIPLY = TSDL_ScanCode(85); - SDL_SCANCODE_KP_MINUS = TSDL_ScanCode(86); - SDL_SCANCODE_KP_PLUS = TSDL_ScanCode(87); - SDL_SCANCODE_KP_ENTER = TSDL_ScanCode(88); - SDL_SCANCODE_KP_1 = TSDL_ScanCode(89); - SDL_SCANCODE_KP_2 = TSDL_ScanCode(90); - SDL_SCANCODE_KP_3 = TSDL_ScanCode(91); - SDL_SCANCODE_KP_4 = TSDL_ScanCode(92); - SDL_SCANCODE_KP_5 = TSDL_ScanCode(93); - SDL_SCANCODE_KP_6 = TSDL_ScanCode(94); - SDL_SCANCODE_KP_7 = TSDL_ScanCode(95); - SDL_SCANCODE_KP_8 = TSDL_ScanCode(96); - SDL_SCANCODE_KP_9 = TSDL_ScanCode(97); - SDL_SCANCODE_KP_0 = TSDL_ScanCode(98); - SDL_SCANCODE_KP_PERIOD = TSDL_ScanCode(99); - - SDL_SCANCODE_NONUSBACKSLASH = TSDL_ScanCode(100); {**< This is the additional key that ISO - * keyboards have over ANSI ones; - * located between left shift and Y. - * Produces GRAVE ACCENT and TILDE in a - * US or UK Mac layout; REVERSE SOLIDUS - * (backslash) and VERTICAL LINE in a - * US or UK Windows layout; and - * LESS-THAN SIGN and GREATER-THAN SIGN - * in a Swiss German; German; or French - * layout. *} - SDL_SCANCODE_APPLICATION = TSDL_ScanCode(101); {**< windows contextual menu; compose *} - SDL_SCANCODE_POWER = TSDL_ScanCode(102); {**< The USB document says this is a status flag; - * not a physical key - but some Mac keyboards - * do have a power key. *} - SDL_SCANCODE_KP_EQUALS = TSDL_ScanCode(103); - SDL_SCANCODE_F13 = TSDL_ScanCode(104); - SDL_SCANCODE_F14 = TSDL_ScanCode(105); - SDL_SCANCODE_F15 = TSDL_ScanCode(106); - SDL_SCANCODE_F16 = TSDL_ScanCode(107); - SDL_SCANCODE_F17 = TSDL_ScanCode(108); - SDL_SCANCODE_F18 = TSDL_ScanCode(109); - SDL_SCANCODE_F19 = TSDL_ScanCode(110); - SDL_SCANCODE_F20 = TSDL_ScanCode(111); - SDL_SCANCODE_F21 = TSDL_ScanCode(112); - SDL_SCANCODE_F22 = TSDL_ScanCode(113); - SDL_SCANCODE_F23 = TSDL_ScanCode(114); - SDL_SCANCODE_F24 = TSDL_ScanCode(115); - SDL_SCANCODE_EXECUTE = TSDL_ScanCode(116); - SDL_SCANCODE_HELP = TSDL_ScanCode(117); { AL Integrated Help Center } - SDL_SCANCODE_MENU = TSDL_ScanCode(118); { Menu (show menu) } - SDL_SCANCODE_SELECT = TSDL_ScanCode(119); - SDL_SCANCODE_STOP = TSDL_ScanCode(120); { AC Stop } - SDL_SCANCODE_AGAIN = TSDL_ScanCode(121); { AC Redo/Repeat } - SDL_SCANCODE_UNDO = TSDL_ScanCode(122); { AC Undo } - SDL_SCANCODE_CUT = TSDL_ScanCode(123); { AC Cut } - SDL_SCANCODE_COPY = TSDL_ScanCode(124); { AC Copy } - SDL_SCANCODE_PASTE = TSDL_ScanCode(125); { AC Paste } - SDL_SCANCODE_FIND = TSDL_ScanCode(126); { AC Find } - SDL_SCANCODE_MUTE = TSDL_ScanCode(127); - SDL_SCANCODE_VOLUMEUP = TSDL_ScanCode(128); - SDL_SCANCODE_VOLUMEDOWN = TSDL_ScanCode(129); - {* not sure whether there's a reason to enable these *} - {* SDL_SCANCODE_LOCKINGCAPSLOCK = 130; *} - {* SDL_SCANCODE_LOCKINGNUMLOCK = 131; *} - {* SDL_SCANCODE_LOCKINGSCROLLLOCK = 132; *} - SDL_SCANCODE_KP_COMMA = TSDL_ScanCode(133); - SDL_SCANCODE_KP_EQUALSAS400 = TSDL_ScanCode(134); - - SDL_SCANCODE_INTERNATIONAL1 = TSDL_ScanCode(135); {**< used on Asian keyboards; see - footnotes in USB doc *} - SDL_SCANCODE_INTERNATIONAL2 = TSDL_ScanCode(136); - SDL_SCANCODE_INTERNATIONAL3 = TSDL_ScanCode(137); {**< Yen *} - SDL_SCANCODE_INTERNATIONAL4 = TSDL_ScanCode(138); - SDL_SCANCODE_INTERNATIONAL5 = TSDL_ScanCode(139); - SDL_SCANCODE_INTERNATIONAL6 = TSDL_ScanCode(140); - SDL_SCANCODE_INTERNATIONAL7 = TSDL_ScanCode(141); - SDL_SCANCODE_INTERNATIONAL8 = TSDL_ScanCode(142); - SDL_SCANCODE_INTERNATIONAL9 = TSDL_ScanCode(143); - SDL_SCANCODE_LANG1 = TSDL_ScanCode(144); {**< Hangul/English toggle *} - SDL_SCANCODE_LANG2 = TSDL_ScanCode(145); {**< Hanja conversion *} - SDL_SCANCODE_LANG3 = TSDL_ScanCode(146); {**< Katakana *} - SDL_SCANCODE_LANG4 = TSDL_ScanCode(147); {**< Hiragana *} - SDL_SCANCODE_LANG5 = TSDL_ScanCode(148); {**< Zenkaku/Hankaku *} - SDL_SCANCODE_LANG6 = TSDL_ScanCode(149); {**< reserved *} - SDL_SCANCODE_LANG7 = TSDL_ScanCode(150); {**< reserved *} - SDL_SCANCODE_LANG8 = TSDL_ScanCode(151); {**< reserved *} - SDL_SCANCODE_LANG9 = TSDL_ScanCode(152); {**< reserved *} - - SDL_SCANCODE_ALTERASE = TSDL_ScanCode(153); {**< Erase-Eaze *} - SDL_SCANCODE_SYSREQ = TSDL_ScanCode(154); - SDL_SCANCODE_CANCEL = TSDL_ScanCode(155); { AC Cancel } - SDL_SCANCODE_CLEAR = TSDL_ScanCode(156); - SDL_SCANCODE_PRIOR = TSDL_ScanCode(157); - SDL_SCANCODE_RETURN2 = TSDL_ScanCode(158); - SDL_SCANCODE_SEPARATOR = TSDL_ScanCode(159); - SDL_SCANCODE_OUT = TSDL_ScanCode(160); - SDL_SCANCODE_OPER = TSDL_ScanCode(161); - SDL_SCANCODE_CLEARAGAIN = TSDL_ScanCode(162); - SDL_SCANCODE_CRSEL = TSDL_ScanCode(163); - SDL_SCANCODE_EXSEL = TSDL_ScanCode(164); - - SDL_SCANCODE_KP_00 = TSDL_ScanCode(176); - SDL_SCANCODE_KP_000 = TSDL_ScanCode(177); - SDL_SCANCODE_THOUSANDSSEPARATOR = TSDL_ScanCode(178); - SDL_SCANCODE_DECIMALSEPARATOR = TSDL_ScanCode(179); - SDL_SCANCODE_CURRENCYUNIT = TSDL_ScanCode(180); - SDL_SCANCODE_CURRENCYSUBUNIT = TSDL_ScanCode(181); - SDL_SCANCODE_KP_LEFTPAREN = TSDL_ScanCode(182); - SDL_SCANCODE_KP_RIGHTPAREN = TSDL_ScanCode(183); - SDL_SCANCODE_KP_LEFTBRACE = TSDL_ScanCode(184); - SDL_SCANCODE_KP_RIGHTBRACE = TSDL_ScanCode(185); - SDL_SCANCODE_KP_TAB = TSDL_ScanCode(186); - SDL_SCANCODE_KP_BACKSPACE = TSDL_ScanCode(187); - SDL_SCANCODE_KP_A = TSDL_ScanCode(188); - SDL_SCANCODE_KP_B = TSDL_ScanCode(189); - SDL_SCANCODE_KP_C = TSDL_ScanCode(190); - SDL_SCANCODE_KP_D = TSDL_ScanCode(191); - SDL_SCANCODE_KP_E = TSDL_ScanCode(192); - SDL_SCANCODE_KP_F = TSDL_ScanCode(193); - SDL_SCANCODE_KP_XOR = TSDL_ScanCode(194); - SDL_SCANCODE_KP_POWER = TSDL_ScanCode(195); - SDL_SCANCODE_KP_PERCENT = TSDL_ScanCode(196); - SDL_SCANCODE_KP_LESS = TSDL_ScanCode(197); - SDL_SCANCODE_KP_GREATER = TSDL_ScanCode(198); - SDL_SCANCODE_KP_AMPERSAND = TSDL_ScanCode(199); - SDL_SCANCODE_KP_DBLAMPERSAND = TSDL_ScanCode(200); - SDL_SCANCODE_KP_VERTICALBAR = TSDL_ScanCode(201); - SDL_SCANCODE_KP_DBLVERTICALBAR = TSDL_ScanCode(202); - SDL_SCANCODE_KP_COLON = TSDL_ScanCode(203); - SDL_SCANCODE_KP_HASH = TSDL_ScanCode(204); - SDL_SCANCODE_KP_SPACE = TSDL_ScanCode(205); - SDL_SCANCODE_KP_AT = TSDL_ScanCode(206); - SDL_SCANCODE_KP_EXCLAM = TSDL_ScanCode(207); - SDL_SCANCODE_KP_MEMSTORE = TSDL_ScanCode(208); - SDL_SCANCODE_KP_MEMRECALL = TSDL_ScanCode(209); - SDL_SCANCODE_KP_MEMCLEAR = TSDL_ScanCode(210); - SDL_SCANCODE_KP_MEMADD = TSDL_ScanCode(211); - SDL_SCANCODE_KP_MEMSUBTRACT = TSDL_ScanCode(212); - SDL_SCANCODE_KP_MEMMULTIPLY = TSDL_ScanCode(213); - SDL_SCANCODE_KP_MEMDIVIDE = TSDL_ScanCode(214); - SDL_SCANCODE_KP_PLUSMINUS = TSDL_ScanCode(215); - SDL_SCANCODE_KP_CLEAR = TSDL_ScanCode(216); - SDL_SCANCODE_KP_CLEARENTRY = TSDL_ScanCode(217); - SDL_SCANCODE_KP_BINARY = TSDL_ScanCode(218); - SDL_SCANCODE_KP_OCTAL = TSDL_ScanCode(219); - SDL_SCANCODE_KP_DECIMAL = TSDL_ScanCode(220); - SDL_SCANCODE_KP_HEXADECIMAL = TSDL_ScanCode(221); - - SDL_SCANCODE_LCTRL = TSDL_ScanCode(224); - SDL_SCANCODE_LSHIFT = TSDL_ScanCode(225); - SDL_SCANCODE_LALT = TSDL_ScanCode(226); {**< alt; option *} - SDL_SCANCODE_LGUI = TSDL_ScanCode(227); {**< windows; command (apple); meta *} - SDL_SCANCODE_RCTRL = TSDL_ScanCode(228); - SDL_SCANCODE_RSHIFT = TSDL_ScanCode(229); - SDL_SCANCODE_RALT = TSDL_ScanCode(230); {**< alt gr; option *} - SDL_SCANCODE_RGUI = TSDL_ScanCode(231); {**< windows; command (apple); meta *} - - SDL_SCANCODE_MODE = TSDL_ScanCode(257); {**< I'm not sure if this is really not covered - * by any of the above; but since there's a - * special KMOD_MODE for it I'm adding it here - *} - - {** - * \name Usage page 0x0C - * - * These values are mapped from usage page 0x0C (USB consumer page). - * See https://usb.org/sites/default/files/hut1_2.pdf - * - * There are way more keys in the spec than we can represent in the - * current scancode range, so pick the ones that commonly come up in - * real world usage. - */ These values are mapped from usage page $0C (USB consumer page). - *} - - SDL_SCANCODE_AUDIONEXT = TSDL_ScanCode(258); - SDL_SCANCODE_AUDIOPREV = TSDL_ScanCode(259); - SDL_SCANCODE_AUDIOSTOP = TSDL_ScanCode(260); - SDL_SCANCODE_AUDIOPLAY = TSDL_ScanCode(261); - SDL_SCANCODE_AUDIOMUTE = TSDL_ScanCode(262); - SDL_SCANCODE_MEDIASELECT = TSDL_ScanCode(263); - SDL_SCANCODE_WWW = TSDL_ScanCode(264); - SDL_SCANCODE_MAIL = TSDL_ScanCode(265); - SDL_SCANCODE_CALCULATOR = TSDL_ScanCode(266); - SDL_SCANCODE_COMPUTER = TSDL_ScanCode(267); - SDL_SCANCODE_AC_SEARCH = TSDL_ScanCode(268); - SDL_SCANCODE_AC_HOME = TSDL_ScanCode(269); - SDL_SCANCODE_AC_BACK = TSDL_ScanCode(270); - SDL_SCANCODE_AC_FORWARD = TSDL_ScanCode(271); - SDL_SCANCODE_AC_STOP = TSDL_ScanCode(272); - SDL_SCANCODE_AC_REFRESH = TSDL_ScanCode(273); - SDL_SCANCODE_AC_BOOKMARKS = TSDL_ScanCode(274); - - {** - * Walther keys - * - * These are values that Christian Walther added (for mac keyboard?). - *} - - SDL_SCANCODE_BRIGHTNESSDOWN = TSDL_ScanCode(275); - SDL_SCANCODE_BRIGHTNESSUP = TSDL_ScanCode(276); - SDL_SCANCODE_DISPLAYSWITCH = TSDL_ScanCode(277); {**< display mirroring/dual display - switch; video mode switch *} - SDL_SCANCODE_KBDILLUMTOGGLE = TSDL_ScanCode(278); - SDL_SCANCODE_KBDILLUMDOWN = TSDL_ScanCode(279); - SDL_SCANCODE_KBDILLUMUP = TSDL_ScanCode(280); - SDL_SCANCODE_EJECT = TSDL_ScanCode(281); - SDL_SCANCODE_SLEEP = TSDL_ScanCode(282); { SC System Sleep } - - SDL_SCANCODE_APP1 = TSDL_ScanCode(283); - SDL_SCANCODE_APP2 = TSDL_ScanCode(284); - - {** - * \name Usage page 0x0C (additional media keys) - * - * These values are mapped from usage page 0x0C (USB consumer page). - *} - - SDL_SCANCODE_AUDIOREWIND = TSDL_ScanCode(285); - SDL_SCANCODE_AUDIOFASTFORWARD = TSDL_ScanCode(286); - - {** - * \name Mobile keys - * - * These are values that are often used on mobile phones. - *} - - SDL_SCANCODE_SOFTLEFT = TSDL_ScanCode(287); {**< Usually situated below the display on phones and - used as a multi-function feature key for selecting - a software defined function shown on the bottom left - of the display. *} - SDL_SCANCODE_SOFTRIGHT = TSDL_ScanCode(288); {**< Usually situated below the display on phones and - used as a multi-function feature key for selecting - a software defined function shown on the bottom right - of the display. *} - SDL_SCANCODE_CALL = TSDL_ScanCode(289); {**< Used for accepting phone calls. *} - SDL_SCANCODE_ENDCALL = TSDL_ScanCode(290); {**< Used for rejecting phone calls. *} - - {* Add any other keys here. *} - - SDL_NUM_SCANCODES = TSDL_ScanCode(512); {**< not a key, just marks the number of scancodes - for array bounds *} - +//from "sdl_scancode.h" + + {** + * The SDL keyboard scancode representation. + * + * Values of this type are used to represent keyboard keys, among other places + * in the SDL_Keysym.scancode key.keysym.scancode \endlink field of the + * SDL_Event structure. + * + * The values in this enumeration are based on the USB usage page standard: + * https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf + *} +type + PPSDL_ScanCode = ^PSDL_ScanCode; + PSDL_ScanCode = ^TSDL_ScanCode; + TSDL_ScanCode = type cint; + +const + SDL_SCANCODE_UNKNOWN = TSDL_ScanCode(0); + + {** + * Usage page $07 + * + * These values are from usage page $07 (USB keyboard page). + *} + + SDL_SCANCODE_A = TSDL_ScanCode(4); + SDL_SCANCODE_B = TSDL_ScanCode(5); + SDL_SCANCODE_C = TSDL_ScanCode(6); + SDL_SCANCODE_D = TSDL_ScanCode(7); + SDL_SCANCODE_E = TSDL_ScanCode(8); + SDL_SCANCODE_F = TSDL_ScanCode(9); + SDL_SCANCODE_G = TSDL_ScanCode(10); + SDL_SCANCODE_H = TSDL_ScanCode(11); + SDL_SCANCODE_I = TSDL_ScanCode(12); + SDL_SCANCODE_J = TSDL_ScanCode(13); + SDL_SCANCODE_K = TSDL_ScanCode(14); + SDL_SCANCODE_L = TSDL_ScanCode(15); + SDL_SCANCODE_M = TSDL_ScanCode(16); + SDL_SCANCODE_N = TSDL_ScanCode(17); + SDL_SCANCODE_O = TSDL_ScanCode(18); + SDL_SCANCODE_P = TSDL_ScanCode(19); + SDL_SCANCODE_Q = TSDL_ScanCode(20); + SDL_SCANCODE_R = TSDL_ScanCode(21); + SDL_SCANCODE_S = TSDL_ScanCode(22); + SDL_SCANCODE_T = TSDL_ScanCode(23); + SDL_SCANCODE_U = TSDL_ScanCode(24); + SDL_SCANCODE_V = TSDL_ScanCode(25); + SDL_SCANCODE_W = TSDL_ScanCode(26); + SDL_SCANCODE_X = TSDL_ScanCode(27); + SDL_SCANCODE_Y = TSDL_ScanCode(28); + SDL_SCANCODE_Z = TSDL_ScanCode(29); + + SDL_SCANCODE_1 = TSDL_ScanCode(30); + SDL_SCANCODE_2 = TSDL_ScanCode(31); + SDL_SCANCODE_3 = TSDL_ScanCode(32); + SDL_SCANCODE_4 = TSDL_ScanCode(33); + SDL_SCANCODE_5 = TSDL_ScanCode(34); + SDL_SCANCODE_6 = TSDL_ScanCode(35); + SDL_SCANCODE_7 = TSDL_ScanCode(36); + SDL_SCANCODE_8 = TSDL_ScanCode(37); + SDL_SCANCODE_9 = TSDL_ScanCode(38); + SDL_SCANCODE_0 = TSDL_ScanCode(39); + + SDL_SCANCODE_RETURN = TSDL_ScanCode(40); + SDL_SCANCODE_ESCAPE = TSDL_ScanCode(41); + SDL_SCANCODE_BACKSPACE = TSDL_ScanCode(42); + SDL_SCANCODE_TAB = TSDL_ScanCode(43); + SDL_SCANCODE_SPACE = TSDL_ScanCode(44); + + SDL_SCANCODE_MINUS = TSDL_ScanCode(45); + SDL_SCANCODE_EQUALS = TSDL_ScanCode(46); + SDL_SCANCODE_LEFTBRACKET = TSDL_ScanCode(47); + SDL_SCANCODE_RIGHTBRACKET = TSDL_ScanCode(48); + SDL_SCANCODE_BACKSLASH = TSDL_ScanCode(49); {**< Located at the lower left of the return + * key on ISO keyboards and at the right end + * of the QWERTY row on ANSI keyboards. + * Produces REVERSE SOLIDUS (backslash) and + * VERTICAL LINE in a US layout; REVERSE + * SOLIDUS and VERTICAL LINE in a UK Mac + * layout; NUMBER SIGN and TILDE in a UK + * Windows layout; DOLLAR SIGN and POUND SIGN + * in a Swiss German layout; NUMBER SIGN and + * APOSTROPHE in a German layout; GRAVE + * ACCENT and POUND SIGN in a French Mac + * layout; and ASTERISK and MICRO SIGN in a + * French Windows layout. + *} + SDL_SCANCODE_NONUSHASH = TSDL_ScanCode(50); {**< ISO USB keyboards actually use this code + * instead of 49 for the same key; but all + * OSes I've seen treat the two codes + * identically. So; as an implementor; unless + * your keyboard generates both of those + * codes and your OS treats them differently; + * you should generate SDL_SCANCODE_BACKSLASH + * instead of this code. As a user; you + * should not rely on this code because SDL + * will never generate it with most (all?) + * keyboards. + *} + SDL_SCANCODE_SEMICOLON = TSDL_ScanCode(51); + SDL_SCANCODE_APOSTROPHE = TSDL_ScanCode(52); + SDL_SCANCODE_GRAVE = TSDL_ScanCode(53); {**< Located in the top left corner (on both ANSI + * and ISO keyboards). Produces GRAVE ACCENT and + * TILDE in a US Windows layout and in US and UK + * Mac layouts on ANSI keyboards; GRAVE ACCENT + * and NOT SIGN in a UK Windows layout; SECTION + * SIGN and PLUS-MINUS SIGN in US and UK Mac + * layouts on ISO keyboards; SECTION SIGN and + * DEGREE SIGN in a Swiss German layout (Mac: + * only on ISO keyboards); CIRCUMFLEX ACCENT and + * DEGREE SIGN in a German layout (Mac: only on + * ISO keyboards); SUPERSCRIPT TWO and TILDE in a + * French Windows layout; COMMERCIAL AT and + * NUMBER SIGN in a French Mac layout on ISO + * keyboards; and LESS-THAN SIGN and GREATER-THAN + * SIGN in a Swiss German; German; or French Mac + * layout on ANSI keyboards. + *} + SDL_SCANCODE_COMMA = TSDL_ScanCode(54); + SDL_SCANCODE_PERIOD = TSDL_ScanCode(55); + SDL_SCANCODE_SLASH = TSDL_ScanCode(56); + + SDL_SCANCODE_CAPSLOCK = TSDL_ScanCode(57); + + SDL_SCANCODE_F1 = TSDL_ScanCode(58); + SDL_SCANCODE_F2 = TSDL_ScanCode(59); + SDL_SCANCODE_F3 = TSDL_ScanCode(60); + SDL_SCANCODE_F4 = TSDL_ScanCode(61); + SDL_SCANCODE_F5 = TSDL_ScanCode(62); + SDL_SCANCODE_F6 = TSDL_ScanCode(63); + SDL_SCANCODE_F7 = TSDL_ScanCode(64); + SDL_SCANCODE_F8 = TSDL_ScanCode(65); + SDL_SCANCODE_F9 = TSDL_ScanCode(66); + SDL_SCANCODE_F10 = TSDL_ScanCode(67); + SDL_SCANCODE_F11 = TSDL_ScanCode(68); + SDL_SCANCODE_F12 = TSDL_ScanCode(69); + + SDL_SCANCODE_PRINTSCREEN = TSDL_ScanCode(70); + SDL_SCANCODE_SCROLLLOCK = TSDL_ScanCode(71); + SDL_SCANCODE_PAUSE = TSDL_ScanCode(72); + SDL_SCANCODE_INSERT = TSDL_ScanCode(73); {**< insert on PC; help on some Mac keyboards (but + does send code 73; not 117) *} + SDL_SCANCODE_HOME = TSDL_ScanCode(74); + SDL_SCANCODE_PAGEUP = TSDL_ScanCode(75); + SDL_SCANCODE_DELETE = TSDL_ScanCode(76); + SDL_SCANCODE_END = TSDL_ScanCode(77); + SDL_SCANCODE_PAGEDOWN = TSDL_ScanCode(78); + SDL_SCANCODE_RIGHT = TSDL_ScanCode(79); + SDL_SCANCODE_LEFT = TSDL_ScanCode(80); + SDL_SCANCODE_DOWN = TSDL_ScanCode(81); + SDL_SCANCODE_UP = TSDL_ScanCode(82); + + SDL_SCANCODE_NUMLOCKCLEAR = TSDL_ScanCode(83); {**< num lock on PC; clear on Mac keyboards + *} + SDL_SCANCODE_KP_DIVIDE = TSDL_ScanCode(84); + SDL_SCANCODE_KP_MULTIPLY = TSDL_ScanCode(85); + SDL_SCANCODE_KP_MINUS = TSDL_ScanCode(86); + SDL_SCANCODE_KP_PLUS = TSDL_ScanCode(87); + SDL_SCANCODE_KP_ENTER = TSDL_ScanCode(88); + SDL_SCANCODE_KP_1 = TSDL_ScanCode(89); + SDL_SCANCODE_KP_2 = TSDL_ScanCode(90); + SDL_SCANCODE_KP_3 = TSDL_ScanCode(91); + SDL_SCANCODE_KP_4 = TSDL_ScanCode(92); + SDL_SCANCODE_KP_5 = TSDL_ScanCode(93); + SDL_SCANCODE_KP_6 = TSDL_ScanCode(94); + SDL_SCANCODE_KP_7 = TSDL_ScanCode(95); + SDL_SCANCODE_KP_8 = TSDL_ScanCode(96); + SDL_SCANCODE_KP_9 = TSDL_ScanCode(97); + SDL_SCANCODE_KP_0 = TSDL_ScanCode(98); + SDL_SCANCODE_KP_PERIOD = TSDL_ScanCode(99); + + SDL_SCANCODE_NONUSBACKSLASH = TSDL_ScanCode(100); {**< This is the additional key that ISO + * keyboards have over ANSI ones; + * located between left shift and Y. + * Produces GRAVE ACCENT and TILDE in a + * US or UK Mac layout; REVERSE SOLIDUS + * (backslash) and VERTICAL LINE in a + * US or UK Windows layout; and + * LESS-THAN SIGN and GREATER-THAN SIGN + * in a Swiss German; German; or French + * layout. *} + SDL_SCANCODE_APPLICATION = TSDL_ScanCode(101); {**< windows contextual menu; compose *} + SDL_SCANCODE_POWER = TSDL_ScanCode(102); {**< The USB document says this is a status flag; + * not a physical key - but some Mac keyboards + * do have a power key. *} + SDL_SCANCODE_KP_EQUALS = TSDL_ScanCode(103); + SDL_SCANCODE_F13 = TSDL_ScanCode(104); + SDL_SCANCODE_F14 = TSDL_ScanCode(105); + SDL_SCANCODE_F15 = TSDL_ScanCode(106); + SDL_SCANCODE_F16 = TSDL_ScanCode(107); + SDL_SCANCODE_F17 = TSDL_ScanCode(108); + SDL_SCANCODE_F18 = TSDL_ScanCode(109); + SDL_SCANCODE_F19 = TSDL_ScanCode(110); + SDL_SCANCODE_F20 = TSDL_ScanCode(111); + SDL_SCANCODE_F21 = TSDL_ScanCode(112); + SDL_SCANCODE_F22 = TSDL_ScanCode(113); + SDL_SCANCODE_F23 = TSDL_ScanCode(114); + SDL_SCANCODE_F24 = TSDL_ScanCode(115); + SDL_SCANCODE_EXECUTE = TSDL_ScanCode(116); + SDL_SCANCODE_HELP = TSDL_ScanCode(117); { AL Integrated Help Center } + SDL_SCANCODE_MENU = TSDL_ScanCode(118); { Menu (show menu) } + SDL_SCANCODE_SELECT = TSDL_ScanCode(119); + SDL_SCANCODE_STOP = TSDL_ScanCode(120); { AC Stop } + SDL_SCANCODE_AGAIN = TSDL_ScanCode(121); { AC Redo/Repeat } + SDL_SCANCODE_UNDO = TSDL_ScanCode(122); { AC Undo } + SDL_SCANCODE_CUT = TSDL_ScanCode(123); { AC Cut } + SDL_SCANCODE_COPY = TSDL_ScanCode(124); { AC Copy } + SDL_SCANCODE_PASTE = TSDL_ScanCode(125); { AC Paste } + SDL_SCANCODE_FIND = TSDL_ScanCode(126); { AC Find } + SDL_SCANCODE_MUTE = TSDL_ScanCode(127); + SDL_SCANCODE_VOLUMEUP = TSDL_ScanCode(128); + SDL_SCANCODE_VOLUMEDOWN = TSDL_ScanCode(129); + {* not sure whether there's a reason to enable these *} + {* SDL_SCANCODE_LOCKINGCAPSLOCK = 130; *} + {* SDL_SCANCODE_LOCKINGNUMLOCK = 131; *} + {* SDL_SCANCODE_LOCKINGSCROLLLOCK = 132; *} + SDL_SCANCODE_KP_COMMA = TSDL_ScanCode(133); + SDL_SCANCODE_KP_EQUALSAS400 = TSDL_ScanCode(134); + + SDL_SCANCODE_INTERNATIONAL1 = TSDL_ScanCode(135); {**< used on Asian keyboards; see + footnotes in USB doc *} + SDL_SCANCODE_INTERNATIONAL2 = TSDL_ScanCode(136); + SDL_SCANCODE_INTERNATIONAL3 = TSDL_ScanCode(137); {**< Yen *} + SDL_SCANCODE_INTERNATIONAL4 = TSDL_ScanCode(138); + SDL_SCANCODE_INTERNATIONAL5 = TSDL_ScanCode(139); + SDL_SCANCODE_INTERNATIONAL6 = TSDL_ScanCode(140); + SDL_SCANCODE_INTERNATIONAL7 = TSDL_ScanCode(141); + SDL_SCANCODE_INTERNATIONAL8 = TSDL_ScanCode(142); + SDL_SCANCODE_INTERNATIONAL9 = TSDL_ScanCode(143); + SDL_SCANCODE_LANG1 = TSDL_ScanCode(144); {**< Hangul/English toggle *} + SDL_SCANCODE_LANG2 = TSDL_ScanCode(145); {**< Hanja conversion *} + SDL_SCANCODE_LANG3 = TSDL_ScanCode(146); {**< Katakana *} + SDL_SCANCODE_LANG4 = TSDL_ScanCode(147); {**< Hiragana *} + SDL_SCANCODE_LANG5 = TSDL_ScanCode(148); {**< Zenkaku/Hankaku *} + SDL_SCANCODE_LANG6 = TSDL_ScanCode(149); {**< reserved *} + SDL_SCANCODE_LANG7 = TSDL_ScanCode(150); {**< reserved *} + SDL_SCANCODE_LANG8 = TSDL_ScanCode(151); {**< reserved *} + SDL_SCANCODE_LANG9 = TSDL_ScanCode(152); {**< reserved *} + + SDL_SCANCODE_ALTERASE = TSDL_ScanCode(153); {**< Erase-Eaze *} + SDL_SCANCODE_SYSREQ = TSDL_ScanCode(154); + SDL_SCANCODE_CANCEL = TSDL_ScanCode(155); { AC Cancel } + SDL_SCANCODE_CLEAR = TSDL_ScanCode(156); + SDL_SCANCODE_PRIOR = TSDL_ScanCode(157); + SDL_SCANCODE_RETURN2 = TSDL_ScanCode(158); + SDL_SCANCODE_SEPARATOR = TSDL_ScanCode(159); + SDL_SCANCODE_OUT = TSDL_ScanCode(160); + SDL_SCANCODE_OPER = TSDL_ScanCode(161); + SDL_SCANCODE_CLEARAGAIN = TSDL_ScanCode(162); + SDL_SCANCODE_CRSEL = TSDL_ScanCode(163); + SDL_SCANCODE_EXSEL = TSDL_ScanCode(164); + + SDL_SCANCODE_KP_00 = TSDL_ScanCode(176); + SDL_SCANCODE_KP_000 = TSDL_ScanCode(177); + SDL_SCANCODE_THOUSANDSSEPARATOR = TSDL_ScanCode(178); + SDL_SCANCODE_DECIMALSEPARATOR = TSDL_ScanCode(179); + SDL_SCANCODE_CURRENCYUNIT = TSDL_ScanCode(180); + SDL_SCANCODE_CURRENCYSUBUNIT = TSDL_ScanCode(181); + SDL_SCANCODE_KP_LEFTPAREN = TSDL_ScanCode(182); + SDL_SCANCODE_KP_RIGHTPAREN = TSDL_ScanCode(183); + SDL_SCANCODE_KP_LEFTBRACE = TSDL_ScanCode(184); + SDL_SCANCODE_KP_RIGHTBRACE = TSDL_ScanCode(185); + SDL_SCANCODE_KP_TAB = TSDL_ScanCode(186); + SDL_SCANCODE_KP_BACKSPACE = TSDL_ScanCode(187); + SDL_SCANCODE_KP_A = TSDL_ScanCode(188); + SDL_SCANCODE_KP_B = TSDL_ScanCode(189); + SDL_SCANCODE_KP_C = TSDL_ScanCode(190); + SDL_SCANCODE_KP_D = TSDL_ScanCode(191); + SDL_SCANCODE_KP_E = TSDL_ScanCode(192); + SDL_SCANCODE_KP_F = TSDL_ScanCode(193); + SDL_SCANCODE_KP_XOR = TSDL_ScanCode(194); + SDL_SCANCODE_KP_POWER = TSDL_ScanCode(195); + SDL_SCANCODE_KP_PERCENT = TSDL_ScanCode(196); + SDL_SCANCODE_KP_LESS = TSDL_ScanCode(197); + SDL_SCANCODE_KP_GREATER = TSDL_ScanCode(198); + SDL_SCANCODE_KP_AMPERSAND = TSDL_ScanCode(199); + SDL_SCANCODE_KP_DBLAMPERSAND = TSDL_ScanCode(200); + SDL_SCANCODE_KP_VERTICALBAR = TSDL_ScanCode(201); + SDL_SCANCODE_KP_DBLVERTICALBAR = TSDL_ScanCode(202); + SDL_SCANCODE_KP_COLON = TSDL_ScanCode(203); + SDL_SCANCODE_KP_HASH = TSDL_ScanCode(204); + SDL_SCANCODE_KP_SPACE = TSDL_ScanCode(205); + SDL_SCANCODE_KP_AT = TSDL_ScanCode(206); + SDL_SCANCODE_KP_EXCLAM = TSDL_ScanCode(207); + SDL_SCANCODE_KP_MEMSTORE = TSDL_ScanCode(208); + SDL_SCANCODE_KP_MEMRECALL = TSDL_ScanCode(209); + SDL_SCANCODE_KP_MEMCLEAR = TSDL_ScanCode(210); + SDL_SCANCODE_KP_MEMADD = TSDL_ScanCode(211); + SDL_SCANCODE_KP_MEMSUBTRACT = TSDL_ScanCode(212); + SDL_SCANCODE_KP_MEMMULTIPLY = TSDL_ScanCode(213); + SDL_SCANCODE_KP_MEMDIVIDE = TSDL_ScanCode(214); + SDL_SCANCODE_KP_PLUSMINUS = TSDL_ScanCode(215); + SDL_SCANCODE_KP_CLEAR = TSDL_ScanCode(216); + SDL_SCANCODE_KP_CLEARENTRY = TSDL_ScanCode(217); + SDL_SCANCODE_KP_BINARY = TSDL_ScanCode(218); + SDL_SCANCODE_KP_OCTAL = TSDL_ScanCode(219); + SDL_SCANCODE_KP_DECIMAL = TSDL_ScanCode(220); + SDL_SCANCODE_KP_HEXADECIMAL = TSDL_ScanCode(221); + + SDL_SCANCODE_LCTRL = TSDL_ScanCode(224); + SDL_SCANCODE_LSHIFT = TSDL_ScanCode(225); + SDL_SCANCODE_LALT = TSDL_ScanCode(226); {**< alt; option *} + SDL_SCANCODE_LGUI = TSDL_ScanCode(227); {**< windows; command (apple); meta *} + SDL_SCANCODE_RCTRL = TSDL_ScanCode(228); + SDL_SCANCODE_RSHIFT = TSDL_ScanCode(229); + SDL_SCANCODE_RALT = TSDL_ScanCode(230); {**< alt gr; option *} + SDL_SCANCODE_RGUI = TSDL_ScanCode(231); {**< windows; command (apple); meta *} + + SDL_SCANCODE_MODE = TSDL_ScanCode(257); {**< I'm not sure if this is really not covered + * by any of the above; but since there's a + * special KMOD_MODE for it I'm adding it here + *} + + {** + * \name Usage page 0x0C + * + * These values are mapped from usage page 0x0C (USB consumer page). + * See https://usb.org/sites/default/files/hut1_2.pdf + * + * There are way more keys in the spec than we can represent in the + * current scancode range, so pick the ones that commonly come up in + * real world usage. + */ These values are mapped from usage page $0C (USB consumer page). + *} + + SDL_SCANCODE_AUDIONEXT = TSDL_ScanCode(258); + SDL_SCANCODE_AUDIOPREV = TSDL_ScanCode(259); + SDL_SCANCODE_AUDIOSTOP = TSDL_ScanCode(260); + SDL_SCANCODE_AUDIOPLAY = TSDL_ScanCode(261); + SDL_SCANCODE_AUDIOMUTE = TSDL_ScanCode(262); + SDL_SCANCODE_MEDIASELECT = TSDL_ScanCode(263); + SDL_SCANCODE_WWW = TSDL_ScanCode(264); + SDL_SCANCODE_MAIL = TSDL_ScanCode(265); + SDL_SCANCODE_CALCULATOR = TSDL_ScanCode(266); + SDL_SCANCODE_COMPUTER = TSDL_ScanCode(267); + SDL_SCANCODE_AC_SEARCH = TSDL_ScanCode(268); + SDL_SCANCODE_AC_HOME = TSDL_ScanCode(269); + SDL_SCANCODE_AC_BACK = TSDL_ScanCode(270); + SDL_SCANCODE_AC_FORWARD = TSDL_ScanCode(271); + SDL_SCANCODE_AC_STOP = TSDL_ScanCode(272); + SDL_SCANCODE_AC_REFRESH = TSDL_ScanCode(273); + SDL_SCANCODE_AC_BOOKMARKS = TSDL_ScanCode(274); + + {** + * Walther keys + * + * These are values that Christian Walther added (for mac keyboard?). + *} + + SDL_SCANCODE_BRIGHTNESSDOWN = TSDL_ScanCode(275); + SDL_SCANCODE_BRIGHTNESSUP = TSDL_ScanCode(276); + SDL_SCANCODE_DISPLAYSWITCH = TSDL_ScanCode(277); {**< display mirroring/dual display + switch; video mode switch *} + SDL_SCANCODE_KBDILLUMTOGGLE = TSDL_ScanCode(278); + SDL_SCANCODE_KBDILLUMDOWN = TSDL_ScanCode(279); + SDL_SCANCODE_KBDILLUMUP = TSDL_ScanCode(280); + SDL_SCANCODE_EJECT = TSDL_ScanCode(281); + SDL_SCANCODE_SLEEP = TSDL_ScanCode(282); { SC System Sleep } + + SDL_SCANCODE_APP1 = TSDL_ScanCode(283); + SDL_SCANCODE_APP2 = TSDL_ScanCode(284); + + {** + * \name Usage page 0x0C (additional media keys) + * + * These values are mapped from usage page 0x0C (USB consumer page). + *} + + SDL_SCANCODE_AUDIOREWIND = TSDL_ScanCode(285); + SDL_SCANCODE_AUDIOFASTFORWARD = TSDL_ScanCode(286); + + {** + * \name Mobile keys + * + * These are values that are often used on mobile phones. + *} + + SDL_SCANCODE_SOFTLEFT = TSDL_ScanCode(287); {**< Usually situated below the display on phones and + used as a multi-function feature key for selecting + a software defined function shown on the bottom left + of the display. *} + SDL_SCANCODE_SOFTRIGHT = TSDL_ScanCode(288); {**< Usually situated below the display on phones and + used as a multi-function feature key for selecting + a software defined function shown on the bottom right + of the display. *} + SDL_SCANCODE_CALL = TSDL_ScanCode(289); {**< Used for accepting phone calls. *} + SDL_SCANCODE_ENDCALL = TSDL_ScanCode(290); {**< Used for rejecting phone calls. *} + + {* Add any other keys here. *} + + SDL_NUM_SCANCODES = TSDL_ScanCode(512); {**< not a key, just marks the number of scancodes + for array bounds *} + diff --git a/units/sdlsensor.inc b/units/sdlsensor.inc index 995fa7d1..12b66ec0 100644 --- a/units/sdlsensor.inc +++ b/units/sdlsensor.inc @@ -1,295 +1,295 @@ -// based on SDL_sensor.h - - -{** - * \brief SDL_sensor.h - * - * In order to use these functions, SDL_Init() must have been called - * with the ::SDL_INIT_SENSOR flag. This causes SDL to scan the system - * for sensors, and load appropriate drivers. - *} -type - PPSDL_Sensor = ^PSDL_Sensor; - PSDL_Sensor = type Pointer; - -{** - * This is a unique ID for a sensor for the time it is connected to the system, - * and is never reused for the lifetime of the application. - * - * The ID value starts at 0 and increments from there. The value -1 is an invalid ID. - *} -type - PPSDL_SensorID = ^PSDL_SensorID; - PSDL_SensorID = ^TSDL_SensorID; - TSDL_SensorID = type cint32; - -{** - * The different sensors defined by SDL - * - * Additional sensors may be available, using platform dependent semantics. - * - * Hare are the additional Android sensors: - * https://developer.android.com/reference/android/hardware/SensorEvent.html#values - *} -type - PPSDL_SensorType = ^PSDL_SensorType; - PSDL_SensorType = ^TSDL_SensorType; - TSDL_SensorType = type cint; - -const - SDL_SENSOR_INVALID = TSDL_SensorType(-1); {**< Returned for an invalid sensor *} - SDL_SENSOR_UNKNOWN = TSDL_SensorType(0); {**< Unknown sensor type *} - SDL_SENSOR_ACCEL = TSDL_SensorType(1); {**< Accelerometer *} - SDL_SENSOR_GYRO = TSDL_SensorType(2); {**< Gyroscope *} - SDL_SENSOR_ACCEL_L = TSDL_SensorType(3); {**< Accelerometer for left Joy-Con controller and Wii nunchuk *} - SDL_SENSOR_GYRO_L = TSDL_SensorType(4); {**< Gyroscope for left Joy-Con controller *} - SDL_SENSOR_ACCEL_R = TSDL_SensorType(5); {**< Accelerometer for right Joy-Con controller *} - SDL_SENSOR_GYRO_R = TSDL_SensorType(6); {**< Gyroscope for right Joy-Con controller *} - -{** - * Accelerometer sensor - * - * The accelerometer returns the current acceleration in SI meters per - * second squared. This measurement includes the force of gravity, so - * a device at rest will have an value of SDL_STANDARD_GRAVITY away - * from the center of the earth. - * - * values[0]: Acceleration on the x axis - * values[1]: Acceleration on the y axis - * values[2]: Acceleration on the z axis - * - * For phones held in portrait mode and game controllers held in front of you, - * the axes are defined as follows: - * -X ... +X : left ... right - * -Y ... +Y : bottom ... top - * -Z ... +Z : farther ... closer - * - * The axis data is not changed when the phone is rotated. - * - * \sa SDL_GetDisplayOrientation() - *} -const - SDL_STANDARD_GRAVITY = 9.80665; - -{** - * Gyroscope sensor - * - * The gyroscope returns the current rate of rotation in radians per second. - * The rotation is positive in the counter-clockwise direction. That is, - * an observer looking from a positive location on one of the axes would - * see positive rotation on that axis when it appeared to be rotating - * counter-clockwise. - * - * values[0]: Angular speed around the x axis (pitch) - * values[1]: Angular speed around the y axis (yaw) - * values[2]: Angular speed around the z axis (roll) - * - * For phones held in portrait mode and game controllers held in front of you, - * the axes are defined as follows: - * -X ... +X : left ... right - * -Y ... +Y : bottom ... top - * -Z ... +Z : farther ... closer - * - * The axis data is not changed when the phone or controller is rotated. - * - * \sa SDL_GetDisplayOrientation() - *} - -{--- Function prototypes ---} - -{** - * Locking for multi-threaded access to the sensor API - * - * If you are using the sensor API or handling events from multiple threads - * you should use these locking functions to protect access to the sensors. - * - * In particular, you are guaranteed that the sensor list won't change, so - * the API functions that take a sensor index will be valid, and sensor - * events will not be delivered. - * - * \since This function is available since SDL 2.0.14. - *} -procedure SDL_LockSensors(); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockSensors' {$ENDIF} {$ENDIF}; -procedure SDL_UnlockSensors(); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnlockSensors' {$ENDIF} {$ENDIF}; - -{** - * Count the number of sensors attached to the system right now. - * - * \returns the number of sensors detected. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_NumSensors(): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_NumSensors' {$ENDIF} {$ENDIF}; - -{** - * Get the implementation dependent name of a sensor. - * - * \param device_index The sensor to obtain name from - * \returns the sensor name, or NIL if `device_index` is out of range. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_SensorGetDeviceName(device_index: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetDeviceName' {$ENDIF} {$ENDIF}; - -{** - * Get the type of a sensor. - * - * \param device_index The sensor to get the type from - * \returns the SDL_SensorType, or `SDL_SENSOR_INVALID` if `device_index` is - * out of range. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_SensorGetDeviceType(device_index: cint): TSDL_SensorType; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetDeviceType' {$ENDIF} {$ENDIF}; - -{** - * Get the platform dependent type of a sensor. - * - * \param device_index The sensor to check - * \returns the sensor platform dependent type, or -1 if `device_index` is out - * of range. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_SensorGetDeviceNonPortableType(device_index: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetDeviceNonPortableType' {$ENDIF} {$ENDIF}; - -{** - * Get the instance ID of a sensor. - * - * \param device_index The sensor to get instance id from - * \returns the sensor instance ID, or -1 if `device_index` is out of range. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_SensorGetDeviceInstanceID(device_index: cint): TSDL_SensorID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetDeviceInstanceID' {$ENDIF} {$ENDIF}; - -{** - * Open a sensor for use. - * - * \param device_index The sensor to open - * \returns an SDL_Sensor sensor object, or NIL if an error occurred. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_SensorOpen(device_index: cint): PSDL_Sensor; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorOpen' {$ENDIF} {$ENDIF}; - -{** - * Return the SDL_Sensor associated with an instance id. - * - * \param instance_id The sensor from instance id - * \returns an SDL_Sensor object. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_SensorFromInstanceID(instance_id: TSDL_SensorID): PSDL_Sensor; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorFromInstanceID' {$ENDIF} {$ENDIF}; - -{** - * Get the implementation dependent name of a sensor - * - * \param sensor The SDL_Sensor object - * \returns the sensor name, or NIL if `sensor` is NIL. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_SensorGetName(sensor: PSDL_Sensor): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetName' {$ENDIF} {$ENDIF}; - -{** - * Get the type of a sensor. - * - * \param sensor The SDL_Sensor object to inspect - * \returns the SDL_SensorType type, or `SDL_SENSOR_INVALID` - * if `sensor` is NIL. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_SensorGetType(sensor: PSDL_Sensor): TSDL_SensorType; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetType' {$ENDIF} {$ENDIF}; - -{** - * Get the platform dependent type of a sensor. - * - * \param sensor The SDL_Sensor object to inspect - * \returns the sensor platform dependent type, or -1 if `sensor` is NIL. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_SensorGetNonPortableType(sensor: PSDL_Sensor): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetNonPortableType' {$ENDIF} {$ENDIF}; - -{** - * Get the instance ID of a sensor. - * - * \param sensor The SDL_Sensor object to inspect - * \returns the sensor instance ID, or -1 if `sensor` is NIL. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_SensorGetInstanceID(sensor: PSDL_Sensor): TSDL_SensorID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetInstanceID' {$ENDIF} {$ENDIF}; - -{** - * Get the current state of an opened sensor. - * - * The number of values and interpretation of the data is sensor dependent. - * - * \param sensor The SDL_Sensor object to query - * \param data A pointer filled with the current sensor state - * \param num_values The number of values to write to data - * \returns 0 or -1 if an error occurred. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_SensorGetData(sensor: PSDL_Sensor; data: pcfloat; num_values: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetData' {$ENDIF} {$ENDIF}; - -{** - * Get the current state of an opened sensor with the timestamp of the last - * update. - * - * The number of values and interpretation of the data is sensor dependent. - * - * \param sensor The SDL_Sensor object to query - * \param timestamp A pointer filled with the timestamp in microseconds of the - * current sensor reading if available, or 0 if not - * \param data A pointer filled with the current sensor state - * \param num_values The number of values to write to data - * \returns 0 or -1 if an error occurred. - * - * \since This function is available since SDL 2.26.0. - *} -function SDL_SensorGetDataWithTimestamp(sensor: PSDL_Sensor; timestamp: pcuint64; data: pcfloat; num_values: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetDataWithTimestamp' {$ENDIF} {$ENDIF}; - -{** - * Close a sensor previously opened with SDL_SensorOpen(). - * - * \param sensor The SDL_Sensor object to close - * - * \since This function is available since SDL 2.0.9. - *} -procedure SDL_SensorClose(sensor: PSDL_Sensor); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorClose' {$ENDIF} {$ENDIF}; - -{** - * Update the current state of the open sensors. - * - * This is called automatically by the event loop if sensor events are - * enabled. - * - * This needs to be called from the thread that initialized the sensor - * subsystem. - * - * \since This function is available since SDL 2.0.9. - *} -procedure SDL_SensorUpdate(); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorUpdate' {$ENDIF} {$ENDIF}; +// based on SDL_sensor.h + + +{** + * \brief SDL_sensor.h + * + * In order to use these functions, SDL_Init() must have been called + * with the ::SDL_INIT_SENSOR flag. This causes SDL to scan the system + * for sensors, and load appropriate drivers. + *} +type + PPSDL_Sensor = ^PSDL_Sensor; + PSDL_Sensor = type Pointer; + +{** + * This is a unique ID for a sensor for the time it is connected to the system, + * and is never reused for the lifetime of the application. + * + * The ID value starts at 0 and increments from there. The value -1 is an invalid ID. + *} +type + PPSDL_SensorID = ^PSDL_SensorID; + PSDL_SensorID = ^TSDL_SensorID; + TSDL_SensorID = type cint32; + +{** + * The different sensors defined by SDL + * + * Additional sensors may be available, using platform dependent semantics. + * + * Hare are the additional Android sensors: + * https://developer.android.com/reference/android/hardware/SensorEvent.html#values + *} +type + PPSDL_SensorType = ^PSDL_SensorType; + PSDL_SensorType = ^TSDL_SensorType; + TSDL_SensorType = type cint; + +const + SDL_SENSOR_INVALID = TSDL_SensorType(-1); {**< Returned for an invalid sensor *} + SDL_SENSOR_UNKNOWN = TSDL_SensorType(0); {**< Unknown sensor type *} + SDL_SENSOR_ACCEL = TSDL_SensorType(1); {**< Accelerometer *} + SDL_SENSOR_GYRO = TSDL_SensorType(2); {**< Gyroscope *} + SDL_SENSOR_ACCEL_L = TSDL_SensorType(3); {**< Accelerometer for left Joy-Con controller and Wii nunchuk *} + SDL_SENSOR_GYRO_L = TSDL_SensorType(4); {**< Gyroscope for left Joy-Con controller *} + SDL_SENSOR_ACCEL_R = TSDL_SensorType(5); {**< Accelerometer for right Joy-Con controller *} + SDL_SENSOR_GYRO_R = TSDL_SensorType(6); {**< Gyroscope for right Joy-Con controller *} + +{** + * Accelerometer sensor + * + * The accelerometer returns the current acceleration in SI meters per + * second squared. This measurement includes the force of gravity, so + * a device at rest will have an value of SDL_STANDARD_GRAVITY away + * from the center of the earth. + * + * values[0]: Acceleration on the x axis + * values[1]: Acceleration on the y axis + * values[2]: Acceleration on the z axis + * + * For phones held in portrait mode and game controllers held in front of you, + * the axes are defined as follows: + * -X ... +X : left ... right + * -Y ... +Y : bottom ... top + * -Z ... +Z : farther ... closer + * + * The axis data is not changed when the phone is rotated. + * + * \sa SDL_GetDisplayOrientation() + *} +const + SDL_STANDARD_GRAVITY = 9.80665; + +{** + * Gyroscope sensor + * + * The gyroscope returns the current rate of rotation in radians per second. + * The rotation is positive in the counter-clockwise direction. That is, + * an observer looking from a positive location on one of the axes would + * see positive rotation on that axis when it appeared to be rotating + * counter-clockwise. + * + * values[0]: Angular speed around the x axis (pitch) + * values[1]: Angular speed around the y axis (yaw) + * values[2]: Angular speed around the z axis (roll) + * + * For phones held in portrait mode and game controllers held in front of you, + * the axes are defined as follows: + * -X ... +X : left ... right + * -Y ... +Y : bottom ... top + * -Z ... +Z : farther ... closer + * + * The axis data is not changed when the phone or controller is rotated. + * + * \sa SDL_GetDisplayOrientation() + *} + +{--- Function prototypes ---} + +{** + * Locking for multi-threaded access to the sensor API + * + * If you are using the sensor API or handling events from multiple threads + * you should use these locking functions to protect access to the sensors. + * + * In particular, you are guaranteed that the sensor list won't change, so + * the API functions that take a sensor index will be valid, and sensor + * events will not be delivered. + * + * \since This function is available since SDL 2.0.14. + *} +procedure SDL_LockSensors(); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockSensors' {$ENDIF} {$ENDIF}; +procedure SDL_UnlockSensors(); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnlockSensors' {$ENDIF} {$ENDIF}; + +{** + * Count the number of sensors attached to the system right now. + * + * \returns the number of sensors detected. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_NumSensors(): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_NumSensors' {$ENDIF} {$ENDIF}; + +{** + * Get the implementation dependent name of a sensor. + * + * \param device_index The sensor to obtain name from + * \returns the sensor name, or NIL if `device_index` is out of range. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_SensorGetDeviceName(device_index: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetDeviceName' {$ENDIF} {$ENDIF}; + +{** + * Get the type of a sensor. + * + * \param device_index The sensor to get the type from + * \returns the SDL_SensorType, or `SDL_SENSOR_INVALID` if `device_index` is + * out of range. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_SensorGetDeviceType(device_index: cint): TSDL_SensorType; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetDeviceType' {$ENDIF} {$ENDIF}; + +{** + * Get the platform dependent type of a sensor. + * + * \param device_index The sensor to check + * \returns the sensor platform dependent type, or -1 if `device_index` is out + * of range. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_SensorGetDeviceNonPortableType(device_index: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetDeviceNonPortableType' {$ENDIF} {$ENDIF}; + +{** + * Get the instance ID of a sensor. + * + * \param device_index The sensor to get instance id from + * \returns the sensor instance ID, or -1 if `device_index` is out of range. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_SensorGetDeviceInstanceID(device_index: cint): TSDL_SensorID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetDeviceInstanceID' {$ENDIF} {$ENDIF}; + +{** + * Open a sensor for use. + * + * \param device_index The sensor to open + * \returns an SDL_Sensor sensor object, or NIL if an error occurred. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_SensorOpen(device_index: cint): PSDL_Sensor; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorOpen' {$ENDIF} {$ENDIF}; + +{** + * Return the SDL_Sensor associated with an instance id. + * + * \param instance_id The sensor from instance id + * \returns an SDL_Sensor object. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_SensorFromInstanceID(instance_id: TSDL_SensorID): PSDL_Sensor; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorFromInstanceID' {$ENDIF} {$ENDIF}; + +{** + * Get the implementation dependent name of a sensor + * + * \param sensor The SDL_Sensor object + * \returns the sensor name, or NIL if `sensor` is NIL. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_SensorGetName(sensor: PSDL_Sensor): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetName' {$ENDIF} {$ENDIF}; + +{** + * Get the type of a sensor. + * + * \param sensor The SDL_Sensor object to inspect + * \returns the SDL_SensorType type, or `SDL_SENSOR_INVALID` + * if `sensor` is NIL. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_SensorGetType(sensor: PSDL_Sensor): TSDL_SensorType; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetType' {$ENDIF} {$ENDIF}; + +{** + * Get the platform dependent type of a sensor. + * + * \param sensor The SDL_Sensor object to inspect + * \returns the sensor platform dependent type, or -1 if `sensor` is NIL. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_SensorGetNonPortableType(sensor: PSDL_Sensor): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetNonPortableType' {$ENDIF} {$ENDIF}; + +{** + * Get the instance ID of a sensor. + * + * \param sensor The SDL_Sensor object to inspect + * \returns the sensor instance ID, or -1 if `sensor` is NIL. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_SensorGetInstanceID(sensor: PSDL_Sensor): TSDL_SensorID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetInstanceID' {$ENDIF} {$ENDIF}; + +{** + * Get the current state of an opened sensor. + * + * The number of values and interpretation of the data is sensor dependent. + * + * \param sensor The SDL_Sensor object to query + * \param data A pointer filled with the current sensor state + * \param num_values The number of values to write to data + * \returns 0 or -1 if an error occurred. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_SensorGetData(sensor: PSDL_Sensor; data: pcfloat; num_values: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetData' {$ENDIF} {$ENDIF}; + +{** + * Get the current state of an opened sensor with the timestamp of the last + * update. + * + * The number of values and interpretation of the data is sensor dependent. + * + * \param sensor The SDL_Sensor object to query + * \param timestamp A pointer filled with the timestamp in microseconds of the + * current sensor reading if available, or 0 if not + * \param data A pointer filled with the current sensor state + * \param num_values The number of values to write to data + * \returns 0 or -1 if an error occurred. + * + * \since This function is available since SDL 2.26.0. + *} +function SDL_SensorGetDataWithTimestamp(sensor: PSDL_Sensor; timestamp: pcuint64; data: pcfloat; num_values: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetDataWithTimestamp' {$ENDIF} {$ENDIF}; + +{** + * Close a sensor previously opened with SDL_SensorOpen(). + * + * \param sensor The SDL_Sensor object to close + * + * \since This function is available since SDL 2.0.9. + *} +procedure SDL_SensorClose(sensor: PSDL_Sensor); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorClose' {$ENDIF} {$ENDIF}; + +{** + * Update the current state of the open sensors. + * + * This is called automatically by the event loop if sensor events are + * enabled. + * + * This needs to be called from the thread that initialized the sensor + * subsystem. + * + * \since This function is available since SDL 2.0.9. + *} +procedure SDL_SensorUpdate(); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorUpdate' {$ENDIF} {$ENDIF}; diff --git a/units/sdlshape.inc b/units/sdlshape.inc index 56f6826c..a57790e4 100644 --- a/units/sdlshape.inc +++ b/units/sdlshape.inc @@ -1,129 +1,161 @@ -// from "sdl_shape.h" - -{** SDL_shape.h - * - * Header file for the shaped window API. - *} -const - SDL_NONSHAPEABLE_WINDOW = -1; - SDL_INVALID_SHAPE_ARGUMENT = -2; - SDL_WINDOW_LACKS_SHAPE = -3; - -{** - * Create a window that can be shaped with the specified position, dimensions, - * and flags. - * - * \param title The title of the window, in UTF-8 encoding. - * \param x The x position of the window, SDL_WINDOWPOS_CENTERED, - * or SDL_WINDOWPOS_UNDEFINED. - * \param y The y position of the window, SDL_WINDOWPOS_CENTERED, - * or SDL_WINDOWPOS_UNDEFINED. - * \param w The width of the window. - * \param h The height of the window. - * \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with - * any of the following: SDL_WINDOW_OPENGL, - * SDL_WINDOW_INPUT_GRABBED, SDL_WINDOW_HIDDEN, - * SDL_WINDOW_RESIZABLE, SDL_WINDOW_MAXIMIZED, - * SDL_WINDOW_MINIMIZED. - * SDL_WINDOW_BORDERLESS is always set, - * and SDL_WINDOW_FULLSCREEN is always unset. - * \return the window created, or NIL if window creation failed. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_DestroyWindow - *} -function SDL_CreateShapedWindow(title: PAnsiChar; x: cuint; y: cuint; w: cuint; h: cuint; flags: cuint32): PSDL_Window; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateShapedWindow' {$ENDIF} {$ENDIF}; - -{** - * Return whether the given window is a shaped window. - * - * \param window The window to query for being shaped. - * \return SDL_TRUE if the window is a window that can be shaped, - * SDL_FALSE if the window is unshaped or NIL. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_CreateShapedWindow - *} -function SDL_IsShapedWindow(window: PSDL_Window): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsShapedWindow' {$ENDIF} {$ENDIF}; - - -type - {** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. *} - PPWindowShapeMode = ^PWindowShapeMode; - PWindowShapeMode = ^TWindowShapeMode; - TWindowShapeMode = type Integer; - -const - {** \brief The default mode, a binarized alpha cutoff of 1. *} - ShapeModeDefault = TWindowShapeMode(0); - {** \brief A binarized alpha cutoff with a given integer value. *} - ShapeModeBinarizeAlpha = TWindowShapeMode(1); - {** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. *} - ShapeModeReverseBinarizeAlpha = TWindowShapeMode(2); - {** \brief A color key is applied. *} - ShapeModeColorKey = TWindowShapeMode(3); - -function SDL_SHAPEMODEALPHA(mode: TWindowShapeMode): Boolean; - -type - {** A union containing parameters for shaped windows. *} - PPSDL_WindowShapeParams = ^PSDL_WindowShapeParams; - PSDL_WindowShapeParams = ^TSDL_WindowShapeParams; - TSDL_WindowShapeParams = record - case cint of - {** a cutoff alpha value for binarization of the window shape's alpha channel. *} - 0: (binarizationCutoff: cuint8;); - 1: (colorKey: TSDL_Color;); - end; - - {** A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. *} - PPSDL_WindowShapeMode = ^PSDL_WindowShapeMode; - PSDL_WindowShapeMode = ^TSDL_WindowShapeMode; - TSDL_WindowShapeMode = record - {** The mode of these window-shape parameters. *} - mode: TWindowShapeMode; - {** Window-shape parameters. *} - parameters: TSDL_WindowShapeParams; - end; - -{** - * Set the shape and parameters of a shaped window. - * - * \param window The shaped window whose parameters should be set. - * \param shape A surface encoding the desired shape for the window. - * \param shape_mode The parameters to set for the shaped window. - * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape - * argument, or SDL_NONSHAPEABLE_WINDOW if the SDL_Window given does - * not reference a valid shaped window. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_WindowShapeMode - * \sa SDL_GetShapedWindowMode - *} -function SDL_SetWindowShape(window: PSDL_Window; shape: PSDL_Surface; shape_mode: PSDL_WindowShapeMode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowShape' {$ENDIF} {$ENDIF}; - -{** - * Get the shape parameters of a shaped window. - * - * \param window The shaped window whose parameters should be retrieved. - * \param shape_mode An empty shape-mode structure to fill, or NIL to check - * whether the window has a shape. - * \return 0 if the window has a shape and, provided shape_mode was not NIL, - * shape_mode has been filled with the mode data, - * SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped - * window, or SDL_WINDOW_LACKS_SHAPE if the SDL_Window given is a - * shapeable window currently lacking a shape. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_WindowShapeMode - * \sa SDL_SetWindowShape - *} -function SDL_GetShapedWindowMode(window: PSDL_Window; shape_mode: PSDL_WindowShapeMode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetShapedWindowMode' {$ENDIF} {$ENDIF}; +// from "sdl_shape.h" + +{** SDL_shape.h + * + * Header file for the shaped window API. + *} +const + SDL_NONSHAPEABLE_WINDOW = -1; + SDL_INVALID_SHAPE_ARGUMENT = -2; + SDL_WINDOW_LACKS_SHAPE = -3; + +{** + * Create a window that can be shaped with the specified position, dimensions, + * and flags. + * + * \param title The title of the window, in UTF-8 encoding. + * \param x The x position of the window, SDL_WINDOWPOS_CENTERED, + * or SDL_WINDOWPOS_UNDEFINED. + * \param y The y position of the window, SDL_WINDOWPOS_CENTERED, + * or SDL_WINDOWPOS_UNDEFINED. + * \param w The width of the window. + * \param h The height of the window. + * \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with + * any of the following: SDL_WINDOW_OPENGL, + * SDL_WINDOW_INPUT_GRABBED, SDL_WINDOW_HIDDEN, + * SDL_WINDOW_RESIZABLE, SDL_WINDOW_MAXIMIZED, + * SDL_WINDOW_MINIMIZED. + * SDL_WINDOW_BORDERLESS is always set, + * and SDL_WINDOW_FULLSCREEN is always unset. + * \return the window created, or NIL if window creation failed. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_DestroyWindow + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateShapedWindow_fun = function(title: PAnsiChar; x: cuint; y: cuint; w: cuint; h: cuint; flags: cuint32): PSDL_Window; cdecl; +Var + SDL_CreateShapedWindow : TSDL_CreateShapedWindow_fun = Nil; +{$else} + +function SDL_CreateShapedWindow(title: PAnsiChar; x: cuint; y: cuint; w: cuint; h: cuint; flags: cuint32): PSDL_Window; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateShapedWindow' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Return whether the given window is a shaped window. + * + * \param window The window to query for being shaped. + * \return SDL_TRUE if the window is a window that can be shaped, + * SDL_FALSE if the window is unshaped or NIL. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_CreateShapedWindow + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_IsShapedWindow_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; +Var + SDL_IsShapedWindow : TSDL_IsShapedWindow_fun = Nil; +{$else} + +function SDL_IsShapedWindow(window: PSDL_Window): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsShapedWindow' {$ENDIF} {$ENDIF}; +{$endif} + + +type + {** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. *} + PPWindowShapeMode = ^PWindowShapeMode; + PWindowShapeMode = ^TWindowShapeMode; + TWindowShapeMode = type Integer; + +const + {** \brief The default mode, a binarized alpha cutoff of 1. *} + ShapeModeDefault = TWindowShapeMode(0); + {** \brief A binarized alpha cutoff with a given integer value. *} + ShapeModeBinarizeAlpha = TWindowShapeMode(1); + {** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. *} + ShapeModeReverseBinarizeAlpha = TWindowShapeMode(2); + {** \brief A color key is applied. *} + ShapeModeColorKey = TWindowShapeMode(3); + +function SDL_SHAPEMODEALPHA(mode: TWindowShapeMode): Boolean; + +type + {** A union containing parameters for shaped windows. *} + PPSDL_WindowShapeParams = ^PSDL_WindowShapeParams; + PSDL_WindowShapeParams = ^TSDL_WindowShapeParams; + TSDL_WindowShapeParams = record + case cint of + {** a cutoff alpha value for binarization of the window shape's alpha channel. *} + 0: (binarizationCutoff: cuint8;); + 1: (colorKey: TSDL_Color;); + end; + + {** A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. *} + PPSDL_WindowShapeMode = ^PSDL_WindowShapeMode; + PSDL_WindowShapeMode = ^TSDL_WindowShapeMode; + TSDL_WindowShapeMode = record + {** The mode of these window-shape parameters. *} + mode: TWindowShapeMode; + {** Window-shape parameters. *} + parameters: TSDL_WindowShapeParams; + end; + +{** + * Set the shape and parameters of a shaped window. + * + * \param window The shaped window whose parameters should be set. + * \param shape A surface encoding the desired shape for the window. + * \param shape_mode The parameters to set for the shaped window. + * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape + * argument, or SDL_NONSHAPEABLE_WINDOW if the SDL_Window given does + * not reference a valid shaped window. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_WindowShapeMode + * \sa SDL_GetShapedWindowMode + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowShape_fun = function(window: PSDL_Window; shape: PSDL_Surface; shape_mode: PSDL_WindowShapeMode): cint; cdecl; +Var + SDL_SetWindowShape : TSDL_SetWindowShape_fun = Nil; +{$else} + +function SDL_SetWindowShape(window: PSDL_Window; shape: PSDL_Surface; shape_mode: PSDL_WindowShapeMode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowShape' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the shape parameters of a shaped window. + * + * \param window The shaped window whose parameters should be retrieved. + * \param shape_mode An empty shape-mode structure to fill, or NIL to check + * whether the window has a shape. + * \return 0 if the window has a shape and, provided shape_mode was not NIL, + * shape_mode has been filled with the mode data, + * SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped + * window, or SDL_WINDOW_LACKS_SHAPE if the SDL_Window given is a + * shapeable window currently lacking a shape. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_WindowShapeMode + * \sa SDL_SetWindowShape + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetShapedWindowMode_fun = function(window: PSDL_Window; shape_mode: PSDL_WindowShapeMode): cint; cdecl; +Var + SDL_GetShapedWindowMode : TSDL_GetShapedWindowMode_fun = Nil; +{$else} + +function SDL_GetShapedWindowMode(window: PSDL_Window; shape_mode: PSDL_WindowShapeMode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetShapedWindowMode' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlstdinc.inc b/units/sdlstdinc.inc index c6aca345..b7d1c3ad 100644 --- a/units/sdlstdinc.inc +++ b/units/sdlstdinc.inc @@ -1,697 +1,1217 @@ -//types from SDL_stdinc.h - -{ SDL-For-Pascal: A lot of the functions are missing. Some functions are useless - if working with Pascal (e. g. memory management functions), - others could be useful (e. g. math functions). - - TODO: Investigate header file and translate potentially useful functions. } - -type - PPSDL_Bool = ^PSDL_Bool; - PSDL_Bool = ^TSDL_Bool; - TSDL_Bool = cbool; - -const - SDL_FALSE = TSDL_Bool(0); - SDL_TRUE = TSDL_Bool(1); - - SDL_MAX_SINT8 = High(cint8); - SDL_MIN_SINT8 = Low(cint8); - - SDL_MAX_UINT8 = High(cuint8); - SDL_MIN_UINT8 = Low(cuint8); - - SDL_MAX_SINT16 = High(cint16); - SDL_MIN_SINT16 = Low(cint16); - - SDL_MAX_UINT16 = High(cuint16); - SDL_MIN_UINT16 = Low(cuint16); - - SDL_MAX_SINT32 = High(cint32); - SDL_MIN_SINT32 = Low(cint32); - - SDL_MAX_UINT32 = High(cuint32); - SDL_MIN_UINT32 = Low(cuint32); - - {$IFDEF Has_Int64} - SDL_MAX_SINT64 = High(cint64); - SDL_MIN_SINT64 = Low(cint64); - - SDL_MAX_UINT64 = High(cuint64); - SDL_MIN_UINT64 = Low(cuint64); - {$ELSE} - SDL_MAX_SINT64: cuint64 = (hi: SDL_MAX_SINT32; lo: SDL_MAX_UINT32); - SDL_MIN_SINT64: cuint64 = (hi: SDL_MIN_SINT32; lo: 0); - - SDL_MAX_UINT64: cuint64 = (hi: SDL_MAX_UINT32; lo: SDL_MAX_UINT32); - SDL_MIN_UINT64: cuint64 = (hi: 0; lo: 0); - {$ENDIF} - - SDL_FLT_EPSILON = cfloat(1.1920928955078125e-07); - -type - PPSDL_malloc_func = ^PSDL_malloc_func; - PSDL_malloc_func = ^TSDL_malloc_func; - TSDL_malloc_func = function(size: csize_t): Pointer; cdecl; - - PPSDL_calloc_func = ^PSDL_calloc_func; - PSDL_calloc_func = ^TSDL_calloc_func; - TSDL_calloc_func = function(nmemb, size: csize_t): Pointer; cdecl; - - PPSDL_realloc_func = ^PSDL_realloc_func; - PSDL_realloc_func = ^TSDL_realloc_func; - TSDL_realloc_func = function(mem: Pointer; size: csize_t): Pointer; cdecl; - - PPSDL_free_func = ^PSDL_free_func; - PSDL_free_func = ^TSDL_free_func; - TSDL_free_func = procedure(mem: Pointer); cdecl; - -{** - * Get the original set of SDL memory functions - * - * \since This function is available since SDL 2.24.0. - *} -procedure SDL_GetOriginalMemoryFunctions( - malloc_func: PSDL_malloc_func; - calloc_func: PSDL_calloc_func; - realloc_func: PSDL_realloc_func; - free_func: PSDL_free_func -); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetOriginalMemoryFunctions' {$ENDIF} {$ENDIF}; - -(** - * Get the current set of SDL memory functions - * - * \since This function is available since SDL 2.0.7. - *) -procedure SDL_GetMemoryFunctions( - malloc_func: PSDL_malloc_func; - calloc_func: PSDL_calloc_func; - realloc_func: PSDL_realloc_func; - free_func: PSDL_free_func -); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetMemoryFunctions' {$ENDIF} {$ENDIF}; - -(** - * Replace SDL's memory allocation functions with a custom set - * - * \since This function is available since SDL 2.0.7. - *) -function SDL_SetMemoryFunctions( - malloc_func: TSDL_malloc_func; - calloc_func: TSDL_calloc_func; - realloc_func: TSDL_realloc_func; - free_func: TSDL_free_func -): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetMemoryFunctions' {$ENDIF} {$ENDIF}; - -(** - * Get the number of outstanding (unfreed) allocations - * - * \since This function is available since SDL 2.0.7. - *) -function SDL_GetNumAllocations(): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumAllocations' {$ENDIF} {$ENDIF}; - -(** - * Allocate a block of memory. The memory is *not* initialized. - *) -function SDL_malloc(size: csize_t): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_malloc' {$ENDIF} {$ENDIF}; - -(** - * Allocate a block of memory that can fit an array of nmemb elements, each of given size. - * The memory is initialized by setting every byte to 0. - *) -function SDL_calloc(nmemb, size: csize_t): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_calloc' {$ENDIF} {$ENDIF}; - -(** - * Resize a block of memory allocated previously with SDL_malloc() or SDL_calloc(). - * - * The returned pointer may or may not be the same as the original pointer. - * If the new size is larger than the old size, any new memory will *not* be initialized. - *) -function SDL_realloc(mem: Pointer; size: csize_t): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_realloc' {$ENDIF} {$ENDIF}; - -(** - * Free memory returned by functions like SDL_GetBasePath(), SDL_GetPrefPath(), etc. - * - * Calling SDL_free() on the same pointer twice is undefined behaviour and may cause - * your program to crash or behave in unexpected ways. - *) -procedure SDL_free(mem: Pointer); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_free' {$ENDIF} {$ENDIF}; - - - -{*** --- Character functions --- *** - -SDL2-for-Pascal: All comments are added by us and not found in the include file.} - - -(** - * Check if the provided ASCII character is an alphabetic character (a letter). - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.16. - *) -function SDL_isalpha(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isalpha' {$ENDIF} {$ENDIF}; - -(** - * Check if the provided ASCII character is an alphanumeric character. - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.16. - *) -function SDL_isalnum(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isalnum' {$ENDIF} {$ENDIF}; - -(** - * Check if the provided ASCII character is a blank character (a space or a tab). - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.16. - *) -function SDL_isblank(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isblank' {$ENDIF} {$ENDIF}; - -(** - * Check if the provided ASCII character is a control character. - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.16. - *) -function SDL_iscntrl(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iscntrl' {$ENDIF} {$ENDIF}; - -(** - * Check if the provided ASCII character is a decimal digit. - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.4. - *) -function SDL_isdigit(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isdigit' {$ENDIF} {$ENDIF}; - -(** - * Check if the provided ASCII character is a hexadecimal digit. - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.16. - *) -function SDL_isxdigit(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isxdigit' {$ENDIF} {$ENDIF}; - -(** - * Check if the provided ASCII character is any printable character - * which is not a space or an alphanumeric character. - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.16. - *) -function SDL_ispunct(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ispunct' {$ENDIF} {$ENDIF}; - -(** - * Check if the provided ASCII character is a whitespace character. - * This set includes the following characters: space, - * form feed (FF), newline/line feed (LF), carriage return (CR), - * horizontal tab (HT), vertical tab (VT). - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.4. - *) -function SDL_isspace(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isspace' {$ENDIF} {$ENDIF}; - -(** - * Check if the provided ASCII character is an uppercase letter. - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.12. - *) -function SDL_isupper(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isupper' {$ENDIF} {$ENDIF}; - -(** - * Check if the provided ASCII character is a lowercase letter. - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.12. - *) -function SDL_islower(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_islower' {$ENDIF} {$ENDIF}; - -(** - * Check if the provided ASCII character is a printable character (including space). - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.16. - *) -function SDL_isprint(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isprint' {$ENDIF} {$ENDIF}; - -(** - * Check if the provided ASCII character is a printable character (excluding space). - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.16. - *) -function SDL_isgraph(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isgraph' {$ENDIF} {$ENDIF}; - -(** - * If the given ASCII character is a lowercase letter, converts it to uppercase. - * Otherwise returns the original value. - * - * \since This function is available since SDL 2.0.4. - *) -function SDL_toupper(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_toupper' {$ENDIF} {$ENDIF}; - -(** - * If the given ASCII character is an uppercase letter, converts it to lowercase. - * Otherwise returns the original value. - * - * \since This function is available since SDL 2.0.4. - *) -function SDL_tolower(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_tolower' {$ENDIF} {$ENDIF}; - - - -(*** --- Math functions --- ***) - - -(** - * Calculate the arc cosine of x; - * that is, the value (in radians) whose cosine equals x. - * - * \since This function is available since SDL 2.0.4. - *) -function SDL_acos(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_acos' {$ENDIF} {$ENDIF}; - -(** - * Calculate the arc cosine of x; - * that is, the value (in radians) whose cosine equals x. - * - * \since This function is available since SDL 2.0.8. - *) -function SDL_acosf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_acosf' {$ENDIF} {$ENDIF}; - -(** - * Calculate the arc sine of x; - * that is, the value (in radians) whose sine equals x. - * - * \since This function is available since SDL 2.0.4. - *) -function SDL_asin(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_asin' {$ENDIF} {$ENDIF}; - -(** - * Calculate the arc sine of x; - * that is, the value (in radians) whose sine equals x. - * - * \since This function is available since SDL 2.0.8. - *) -function SDL_asinf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_asinf' {$ENDIF} {$ENDIF}; - -(** - * Calculate the arc tangent of x; - * that is, the value (in radians) whose tangent equals x. - * - * \since This function is available since SDL 2.0.4. - *) -function SDL_atan(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_atan' {$ENDIF} {$ENDIF}; - -(** - * Calculate the arc tangent of x; - * that is, the value (in radians) whose tangent equals x. - * - * \since This function is available since SDL 2.0.8. - *) -function SDL_atanf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_atanf' {$ENDIF} {$ENDIF}; - -(** - * Calculate the arc tangent of y/x, using the signs of the two arguments - * to determine the quadrant of the result. - * - * \since This function is available since SDL 2.0.4. - *) -function SDL_atan2(y, x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_atan2' {$ENDIF} {$ENDIF}; - -(** - * Calculate the arc tangent of y/x, using the signs of the two arguments - * to determine the quadrant of the result. - * - * \since This function is available since SDL 2.0.8. - *) -function SDL_atan2f(y, x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_atan2f' {$ENDIF} {$ENDIF}; - -(** - * Calculate the smallest integral value that is not less than x. - * - * \since This function is available since SDL 2.0.4. - *) -function SDL_ceil(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ceil' {$ENDIF} {$ENDIF}; - -(** - * Calculate the smallest integral value that is not less than x. - * - * \since This function is available since SDL 2.0.8. - *) -function SDL_ceilf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ceilf' {$ENDIF} {$ENDIF}; - -(** - * Return a number whose absolute value matches that of x, - * but the sign matches that of y. - * - * \since This function is available since SDL 2.0.4. - *) -function SDL_copysign(x, y: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_copysign' {$ENDIF} {$ENDIF}; - -(** - * Return a number whose absolute value matches that of x, - * but the sign matches that of y. - * - * \since This function is available since SDL 2.0.8. - *) -function SDL_copysignf(x, y: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_copysignf' {$ENDIF} {$ENDIF}; - -(** - * Calculate the cosine of x, where x is given in radians. - * - * \since This function is available since SDL 2.0.4. - *) -function SDL_cos(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_cos' {$ENDIF} {$ENDIF}; - -(** - * Calculate the cosine of x, where x is given in radians. - * - * \since This function is available since SDL 2.0.4. - *) -function SDL_cosf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_cosf' {$ENDIF} {$ENDIF}; - -(** - * Calculate the value of e (the base of natural logarithms) - * raised to the power of x. - * - * \since This function is available since SDL 2.0.9. - *) -function SDL_exp(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_exp' {$ENDIF} {$ENDIF}; - -(** - * Calculate the value of e (the base of natural logarithms) - * raised to the power of x. - * - * \since This function is available since SDL 2.0.9. - *) -function SDL_expf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_expf' {$ENDIF} {$ENDIF}; - -(** - * Calculate the absolute value of x. - * - * \since This function is available since SDL 2.0.4. - *) -function SDL_fabs(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_fabs' {$ENDIF} {$ENDIF}; - -(** - * Calculate the absolute value of x. - * - * \since This function is available since SDL 2.0.8. - *) -function SDL_fabsf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_fabsf' {$ENDIF} {$ENDIF}; - -(** - * Calculate the largest integral value that is not greater than x. - * - * \since This function is available since SDL 2.0.4. - *) -function SDL_floor(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_floor' {$ENDIF} {$ENDIF}; - -(** - * Calculate the largest integral value that is not greater than x. - * - * \since This function is available since SDL 2.0.8. - *) -function SDL_floorf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_floorf' {$ENDIF} {$ENDIF}; - -(** - * Calculate the floating-point remainder of dividing x by y. - * - * \since This function is available since SDL 2.0.8. - *) -function SDL_fmod(x, y: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_fmod' {$ENDIF} {$ENDIF}; - -(** - * Calculate the floating-point remainder of dividing x by y. - * - * \since This function is available since SDL 2.0.8. - *) -function SDL_fmodf(x, y: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_fmodf' {$ENDIF} {$ENDIF}; - -(** - * Calculate the natural logarithm of x. - * - * \since This function is available since SDL 2.0.4. - - SDL2-for-Pascal: ATTENTION: The original C name of this function is SDL_log, - but since Pascal names are case-insensitive, it is in conflict with SDL_Log (logging function). - Hence we decided to rename it. - *) -function SDL_nlog(x: cdouble): cdouble; cdecl; - external SDL_LibName - name {$IF DEFINED(DELPHI) AND DEFINED(MACOS)} '_SDL_log' {$ELSE} 'SDL_log' {$ENDIF}; - -(** - * Calculate the natural logarithm of x. - * - * \since This function is available since SDL 2.0.8. - - SDL2-for-Pascal: ATTENTION: The original C name of this function is SDL_logf, - but to be consistent with the renamed SDL_log function (see comment of SDL_nlog - for details), we decided to rename it. - *) -function SDL_nlogf(x: cfloat): cfloat; cdecl; - external SDL_LibName - name {$IF DEFINED(DELPHI) AND DEFINED(MACOS)} '_SDL_logf' {$ELSE} 'SDL_logf' {$ENDIF}; - -(** - * Calculate the base 10 logarithm of x. - * - * \since This function is available since SDL 2.0.8. - *) -function SDL_log10(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_log10' {$ENDIF} {$ENDIF}; - -(** - * Calculate the base 10 logarithm of x. - * - * \since This function is available since SDL 2.0.8. - *) -function SDL_log10f(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_log10f' {$ENDIF} {$ENDIF}; - -(** - * Round to nearest integer, away from zero. - * - * \since This function is available since SDL 2.0.16. - *) -function SDL_lround(x: cdouble): clong; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_lround' {$ENDIF} {$ENDIF}; - -(** - * Round to nearest integer, away from zero. - * - * \since This function is available since SDL 2.0.16. - *) -function SDL_lroundf(x: cfloat): clong; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_lroundf' {$ENDIF} {$ENDIF}; - -(** - * Calculate the value of x raised to the power of y. - * - * \since This function is available since SDL 2.0.4. - *) -function SDL_pow(x, y: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_pow' {$ENDIF} {$ENDIF}; - -(** - * Calculate the value of x raised to the power of y. - * - * \since This function is available since SDL 2.0.8. - *) -function SDL_powf(x, y: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_powf' {$ENDIF} {$ENDIF}; - -(** - * Round to nearest integral value, away from zero. - * - * \since This function is available since SDL 2.0.16. - *) -function SDL_round(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_round' {$ENDIF} {$ENDIF}; - -(** - * Round to nearest integral value, away from zero. - * - * \since This function is available since SDL 2.0.16. - *) -function SDL_roundf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_roundf' {$ENDIF} {$ENDIF}; - -(** - * Calculate x multiplied by the floating-point radix to the power of n. - * On most systems, the radix is 2, making this equivalent to x*(2**n). - * - * \since This function is available since SDL 2.0.4. - *) -function SDL_scalbn(x: cdouble; n: cint): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_scalbn' {$ENDIF} {$ENDIF}; - -(** - * Calculate x multiplied by the floating-point radix to the power of n. - * On most systems, the radix is 2, making this equivalent to x*(2**n). - * - * \since This function is available since SDL 2.0.8. - *) -function SDL_scalbnf(x: cfloat; n: cint): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_scalbnf' {$ENDIF} {$ENDIF}; - -(** - * Calculate the sine of x, where x is given in radians. - * - * \since This function is available since SDL 2.0.4. - *) -function SDL_sin(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_sin' {$ENDIF} {$ENDIF}; - -(** - * Calculate the sine of x, where x is given in radians. - * - * \since This function is available since SDL 2.0.4. - *) -function SDL_sinf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_sinf' {$ENDIF} {$ENDIF}; - -(** - * Calculate the non-negative square root of x. - * - * \since This function is available since SDL 2.0.4. - *) -function SDL_sqrt(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_sqrt' {$ENDIF} {$ENDIF}; - -(** - * Calculate the non-negative square root of x. - * - * \since This function is available since SDL 2.0.4. - *) -function SDL_sqrtf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_sqrtf' {$ENDIF} {$ENDIF}; - -(** - * Calculate the tangent of x, where x is given in radians. - * - * \since This function is available since SDL 2.0.4. - *) -function SDL_tan(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_tan' {$ENDIF} {$ENDIF}; - -(** - * Calculate the tangent of x, where x is given in radians. - * - * \since This function is available since SDL 2.0.4. - *) -function SDL_tanf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_tanf' {$ENDIF} {$ENDIF}; - -(** - * Round to nearest integral value, towards zero. - * - * \since This function is available since SDL 2.0.14. - *) -function SDL_trunc(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_trunc' {$ENDIF} {$ENDIF}; - -(** - * Round to nearest integral value, towards zero. - * - * \since This function is available since SDL 2.0.14. - *) -function SDL_truncf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_truncf' {$ENDIF} {$ENDIF}; - - - -(*** --- iconv functions --- ***) - - -(** - * This function converts a string between encodings in one pass, returning a - * string that must be freed with SDL_free(), or NIL on error. - * - * \since This function is available since SDL 2.0.0. - *) -function SDL_iconv_string(Const tocode, fromcode, inbuf: PAnsiChar; inbytesleft: csize_t): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iconv_string' {$ENDIF} {$ENDIF}; - -// These are macros in the original C headers, we will reimplement them as simple Pascal functions. -function SDL_iconv_utf8_locale(Const str: PAnsiChar): PAnsiChar; cdecl; -function SDL_iconv_utf8_ucs2(Const str: PAnsiChar): pcUint16; cdecl; -function SDL_iconv_utf8_ucs4(Const str: PAnsiChar): pcUint32; cdecl; - -(* The SDL implementation of iconv() returns these error codes *) -const - SDL_ICONV_ERROR = csize_t(-1); - SDL_ICONV_E2BIG = csize_t(-2); - SDL_ICONV_EILSEQ = csize_t(-3); - SDL_ICONV_EINVAL = csize_t(-4); - -type - PSDL_iconv = type Pointer; - -function SDL_iconv_open(Const tocode, fromcode: PAnsiChar): PSDL_iconv; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iconv_open' {$ENDIF} {$ENDIF}; - -function SDL_iconv_close(cd: PSDL_iconv): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iconv_close' {$ENDIF} {$ENDIF}; - -function SDL_iconv(cd: PSDL_iconv; Const inbuf: PPAnsiChar; inbytesleft: pcsize_t; outbuf: PPAnsiChar; outbytesleft: pcsize_t): csize_t; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iconv' {$ENDIF} {$ENDIF}; +//types from SDL_stdinc.h + +{ SDL-For-Pascal: A lot of the functions are missing. Some functions are useless + if working with Pascal (e. g. memory management functions), + others could be useful (e. g. math functions). + + TODO: Investigate header file and translate potentially useful functions. } + +type + PPSDL_Bool = ^PSDL_Bool; + PSDL_Bool = ^TSDL_Bool; + TSDL_Bool = cbool; + +const + SDL_FALSE = TSDL_Bool(0); + SDL_TRUE = TSDL_Bool(1); + + SDL_MAX_SINT8 = High(cint8); + SDL_MIN_SINT8 = Low(cint8); + + SDL_MAX_UINT8 = High(cuint8); + SDL_MIN_UINT8 = Low(cuint8); + + SDL_MAX_SINT16 = High(cint16); + SDL_MIN_SINT16 = Low(cint16); + + SDL_MAX_UINT16 = High(cuint16); + SDL_MIN_UINT16 = Low(cuint16); + + SDL_MAX_SINT32 = High(cint32); + SDL_MIN_SINT32 = Low(cint32); + + SDL_MAX_UINT32 = High(cuint32); + SDL_MIN_UINT32 = Low(cuint32); + + {$IFDEF Has_Int64} + SDL_MAX_SINT64 = High(cint64); + SDL_MIN_SINT64 = Low(cint64); + + SDL_MAX_UINT64 = High(cuint64); + SDL_MIN_UINT64 = Low(cuint64); + {$ELSE} + SDL_MAX_SINT64: cuint64 = (hi: SDL_MAX_SINT32; lo: SDL_MAX_UINT32); + SDL_MIN_SINT64: cuint64 = (hi: SDL_MIN_SINT32; lo: 0); + + SDL_MAX_UINT64: cuint64 = (hi: SDL_MAX_UINT32; lo: SDL_MAX_UINT32); + SDL_MIN_UINT64: cuint64 = (hi: 0; lo: 0); + {$ENDIF} + + SDL_FLT_EPSILON = cfloat(1.1920928955078125e-07); + +type + PPSDL_malloc_func = ^PSDL_malloc_func; + PSDL_malloc_func = ^TSDL_malloc_func; + TSDL_malloc_func = function(size: csize_t): Pointer; cdecl; + + PPSDL_calloc_func = ^PSDL_calloc_func; + PSDL_calloc_func = ^TSDL_calloc_func; + TSDL_calloc_func = function(nmemb, size: csize_t): Pointer; cdecl; + + PPSDL_realloc_func = ^PSDL_realloc_func; + PSDL_realloc_func = ^TSDL_realloc_func; + TSDL_realloc_func = function(mem: Pointer; size: csize_t): Pointer; cdecl; + + PPSDL_free_func = ^PSDL_free_func; + PSDL_free_func = ^TSDL_free_func; + TSDL_free_func = procedure(mem: Pointer); cdecl; + +{** + * Get the original set of SDL memory functions + * + * \since This function is available since SDL 2.24.0. + *} +procedure SDL_GetOriginalMemoryFunctions( + malloc_func: PSDL_malloc_func; + calloc_func: PSDL_calloc_func; + realloc_func: PSDL_realloc_func; + free_func: PSDL_free_func +); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetOriginalMemoryFunctions' {$ENDIF} {$ENDIF}; + +(** + * Get the current set of SDL memory functions + * + * \since This function is available since SDL 2.0.7. + *) +procedure SDL_GetMemoryFunctions( + malloc_func: PSDL_malloc_func; + calloc_func: PSDL_calloc_func; + realloc_func: PSDL_realloc_func; + free_func: PSDL_free_func +); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetMemoryFunctions' {$ENDIF} {$ENDIF}; + +(** + * Replace SDL's memory allocation functions with a custom set + * + * \since This function is available since SDL 2.0.7. + *) +function SDL_SetMemoryFunctions( + malloc_func: TSDL_malloc_func; + calloc_func: TSDL_calloc_func; + realloc_func: TSDL_realloc_func; + free_func: TSDL_free_func +): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetMemoryFunctions' {$ENDIF} {$ENDIF}; + +(** + * Get the number of outstanding (unfreed) allocations + * + * \since This function is available since SDL 2.0.7. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetNumAllocations_fun = function(): cint; cdecl; +Var + SDL_GetNumAllocations : TSDL_GetNumAllocations_fun = Nil; +{$else} + +function SDL_GetNumAllocations(): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumAllocations' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Allocate a block of memory. The memory is *not* initialized. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_malloc_fun = function(size: csize_t): Pointer; cdecl; +Var + SDL_malloc : TSDL_malloc_fun = Nil; +{$else} + +function SDL_malloc(size: csize_t): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_malloc' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Allocate a block of memory that can fit an array of nmemb elements, each of given size. + * The memory is initialized by setting every byte to 0. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_calloc_fun = function(nmemb, size: csize_t): Pointer; cdecl; +Var + SDL_calloc : TSDL_calloc_fun = Nil; +{$else} + +function SDL_calloc(nmemb, size: csize_t): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_calloc' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Resize a block of memory allocated previously with SDL_malloc() or SDL_calloc(). + * + * The returned pointer may or may not be the same as the original pointer. + * If the new size is larger than the old size, any new memory will *not* be initialized. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_realloc_fun = function(mem: Pointer; size: csize_t): Pointer; cdecl; +Var + SDL_realloc : TSDL_realloc_fun = Nil; +{$else} + +function SDL_realloc(mem: Pointer; size: csize_t): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_realloc' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Free memory returned by functions like SDL_GetBasePath(), SDL_GetPrefPath(), etc. + * + * Calling SDL_free() on the same pointer twice is undefined behaviour and may cause + * your program to crash or behave in unexpected ways. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_free_proc = procedure(mem: Pointer); cdecl; +Var + SDL_free : TSDL_free_proc = Nil; +{$else} + +procedure SDL_free(mem: Pointer); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_free' {$ENDIF} {$ENDIF}; +{$endif} + + + +{*** --- Character functions --- *** + +SDL2-for-Pascal: All comments are added by us and not found in the include file.} + + +(** + * Check if the provided ASCII character is an alphabetic character (a letter). + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_isalpha_fun = function(x: cint):cint; cdecl; +Var + SDL_isalpha : TSDL_isalpha_fun = Nil; +{$else} + +function SDL_isalpha(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isalpha' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Check if the provided ASCII character is an alphanumeric character. + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_isalnum_fun = function(x: cint):cint; cdecl; +Var + SDL_isalnum : TSDL_isalnum_fun = Nil; +{$else} + +function SDL_isalnum(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isalnum' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Check if the provided ASCII character is a blank character (a space or a tab). + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_isblank_fun = function(x: cint):cint; cdecl; +Var + SDL_isblank : TSDL_isblank_fun = Nil; +{$else} + +function SDL_isblank(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isblank' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Check if the provided ASCII character is a control character. + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_iscntrl_fun = function(x: cint):cint; cdecl; +Var + SDL_iscntrl : TSDL_iscntrl_fun = Nil; +{$else} + +function SDL_iscntrl(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iscntrl' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Check if the provided ASCII character is a decimal digit. + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_isdigit_fun = function(x: cint):cint; cdecl; +Var + SDL_isdigit : TSDL_isdigit_fun = Nil; +{$else} + +function SDL_isdigit(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isdigit' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Check if the provided ASCII character is a hexadecimal digit. + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_isxdigit_fun = function(x: cint):cint; cdecl; +Var + SDL_isxdigit : TSDL_isxdigit_fun = Nil; +{$else} + +function SDL_isxdigit(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isxdigit' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Check if the provided ASCII character is any printable character + * which is not a space or an alphanumeric character. + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ispunct_fun = function(x: cint):cint; cdecl; +Var + SDL_ispunct : TSDL_ispunct_fun = Nil; +{$else} + +function SDL_ispunct(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ispunct' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Check if the provided ASCII character is a whitespace character. + * This set includes the following characters: space, + * form feed (FF), newline/line feed (LF), carriage return (CR), + * horizontal tab (HT), vertical tab (VT). + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_isspace_fun = function(x: cint):cint; cdecl; +Var + SDL_isspace : TSDL_isspace_fun = Nil; +{$else} + +function SDL_isspace(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isspace' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Check if the provided ASCII character is an uppercase letter. + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.12. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_isupper_fun = function(x: cint):cint; cdecl; +Var + SDL_isupper : TSDL_isupper_fun = Nil; +{$else} + +function SDL_isupper(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isupper' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Check if the provided ASCII character is a lowercase letter. + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.12. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_islower_fun = function(x: cint):cint; cdecl; +Var + SDL_islower : TSDL_islower_fun = Nil; +{$else} + +function SDL_islower(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_islower' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Check if the provided ASCII character is a printable character (including space). + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_isprint_fun = function(x: cint):cint; cdecl; +Var + SDL_isprint : TSDL_isprint_fun = Nil; +{$else} + +function SDL_isprint(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isprint' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Check if the provided ASCII character is a printable character (excluding space). + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_isgraph_fun = function(x: cint):cint; cdecl; +Var + SDL_isgraph : TSDL_isgraph_fun = Nil; +{$else} + +function SDL_isgraph(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isgraph' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * If the given ASCII character is a lowercase letter, converts it to uppercase. + * Otherwise returns the original value. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_toupper_fun = function(x: cint):cint; cdecl; +Var + SDL_toupper : TSDL_toupper_fun = Nil; +{$else} + +function SDL_toupper(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_toupper' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * If the given ASCII character is an uppercase letter, converts it to lowercase. + * Otherwise returns the original value. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_tolower_fun = function(x: cint):cint; cdecl; +Var + SDL_tolower : TSDL_tolower_fun = Nil; +{$else} + +function SDL_tolower(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_tolower' {$ENDIF} {$ENDIF}; +{$endif} + + + +(*** --- Math functions --- ***) + + +(** + * Calculate the arc cosine of x; + * that is, the value (in radians) whose cosine equals x. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_acos_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_acos : TSDL_acos_fun = Nil; +{$else} + +function SDL_acos(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_acos' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the arc cosine of x; + * that is, the value (in radians) whose cosine equals x. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_acosf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_acosf : TSDL_acosf_fun = Nil; +{$else} + +function SDL_acosf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_acosf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the arc sine of x; + * that is, the value (in radians) whose sine equals x. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_asin_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_asin : TSDL_asin_fun = Nil; +{$else} + +function SDL_asin(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_asin' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the arc sine of x; + * that is, the value (in radians) whose sine equals x. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_asinf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_asinf : TSDL_asinf_fun = Nil; +{$else} + +function SDL_asinf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_asinf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the arc tangent of x; + * that is, the value (in radians) whose tangent equals x. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_atan_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_atan : TSDL_atan_fun = Nil; +{$else} + +function SDL_atan(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_atan' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the arc tangent of x; + * that is, the value (in radians) whose tangent equals x. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_atanf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_atanf : TSDL_atanf_fun = Nil; +{$else} + +function SDL_atanf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_atanf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the arc tangent of y/x, using the signs of the two arguments + * to determine the quadrant of the result. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_atan2_fun = function(y, x: cdouble): cdouble; cdecl; +Var + SDL_atan2 : TSDL_atan2_fun = Nil; +{$else} + +function SDL_atan2(y, x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_atan2' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the arc tangent of y/x, using the signs of the two arguments + * to determine the quadrant of the result. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_atan2f_fun = function(y, x: cfloat): cfloat; cdecl; +Var + SDL_atan2f : TSDL_atan2f_fun = Nil; +{$else} + +function SDL_atan2f(y, x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_atan2f' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the smallest integral value that is not less than x. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ceil_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_ceil : TSDL_ceil_fun = Nil; +{$else} + +function SDL_ceil(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ceil' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the smallest integral value that is not less than x. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ceilf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_ceilf : TSDL_ceilf_fun = Nil; +{$else} + +function SDL_ceilf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ceilf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Return a number whose absolute value matches that of x, + * but the sign matches that of y. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_copysign_fun = function(x, y: cdouble): cdouble; cdecl; +Var + SDL_copysign : TSDL_copysign_fun = Nil; +{$else} + +function SDL_copysign(x, y: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_copysign' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Return a number whose absolute value matches that of x, + * but the sign matches that of y. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_copysignf_fun = function(x, y: cfloat): cfloat; cdecl; +Var + SDL_copysignf : TSDL_copysignf_fun = Nil; +{$else} + +function SDL_copysignf(x, y: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_copysignf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the cosine of x, where x is given in radians. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_cos_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_cos : TSDL_cos_fun = Nil; +{$else} + +function SDL_cos(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_cos' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the cosine of x, where x is given in radians. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_cosf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_cosf : TSDL_cosf_fun = Nil; +{$else} + +function SDL_cosf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_cosf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the value of e (the base of natural logarithms) + * raised to the power of x. + * + * \since This function is available since SDL 2.0.9. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_exp_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_exp : TSDL_exp_fun = Nil; +{$else} + +function SDL_exp(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_exp' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the value of e (the base of natural logarithms) + * raised to the power of x. + * + * \since This function is available since SDL 2.0.9. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_expf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_expf : TSDL_expf_fun = Nil; +{$else} + +function SDL_expf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_expf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the absolute value of x. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_fabs_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_fabs : TSDL_fabs_fun = Nil; +{$else} + +function SDL_fabs(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_fabs' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the absolute value of x. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_fabsf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_fabsf : TSDL_fabsf_fun = Nil; +{$else} + +function SDL_fabsf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_fabsf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the largest integral value that is not greater than x. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_floor_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_floor : TSDL_floor_fun = Nil; +{$else} + +function SDL_floor(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_floor' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the largest integral value that is not greater than x. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_floorf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_floorf : TSDL_floorf_fun = Nil; +{$else} + +function SDL_floorf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_floorf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the floating-point remainder of dividing x by y. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_fmod_fun = function(x, y: cdouble): cdouble; cdecl; +Var + SDL_fmod : TSDL_fmod_fun = Nil; +{$else} + +function SDL_fmod(x, y: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_fmod' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the floating-point remainder of dividing x by y. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_fmodf_fun = function(x, y: cfloat): cfloat; cdecl; +Var + SDL_fmodf : TSDL_fmodf_fun = Nil; +{$else} + +function SDL_fmodf(x, y: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_fmodf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the natural logarithm of x. + * + * \since This function is available since SDL 2.0.4. + + SDL2-for-Pascal: ATTENTION: The original C name of this function is SDL_log, + but since Pascal names are case-insensitive, it is in conflict with SDL_Log (logging function). + Hence we decided to rename it. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_nlog_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_nlog : TSDL_nlog_fun = Nil; +{$else} + +function SDL_nlog(x: cdouble): cdouble; cdecl; + external SDL_LibName + name {$IF DEFINED(DELPHI) AND DEFINED(MACOS)} '_SDL_log' {$ELSE} 'SDL_log' {$ENDIF}; +{$endif} + +(** + * Calculate the natural logarithm of x. + * + * \since This function is available since SDL 2.0.8. + + SDL2-for-Pascal: ATTENTION: The original C name of this function is SDL_logf, + but to be consistent with the renamed SDL_log function (see comment of SDL_nlog + for details), we decided to rename it. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_nlogf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_nlogf : TSDL_nlogf_fun = Nil; +{$else} + +function SDL_nlogf(x: cfloat): cfloat; cdecl; + external SDL_LibName + name {$IF DEFINED(DELPHI) AND DEFINED(MACOS)} '_SDL_logf' {$ELSE} 'SDL_logf' {$ENDIF}; +{$endif} + +(** + * Calculate the base 10 logarithm of x. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_log10_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_log10 : TSDL_log10_fun = Nil; +{$else} + +function SDL_log10(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_log10' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the base 10 logarithm of x. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_log10f_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_log10f : TSDL_log10f_fun = Nil; +{$else} + +function SDL_log10f(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_log10f' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Round to nearest integer, away from zero. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_lround_fun = function(x: cdouble): clong; cdecl; +Var + SDL_lround : TSDL_lround_fun = Nil; +{$else} + +function SDL_lround(x: cdouble): clong; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_lround' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Round to nearest integer, away from zero. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_lroundf_fun = function(x: cfloat): clong; cdecl; +Var + SDL_lroundf : TSDL_lroundf_fun = Nil; +{$else} + +function SDL_lroundf(x: cfloat): clong; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_lroundf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the value of x raised to the power of y. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_pow_fun = function(x, y: cdouble): cdouble; cdecl; +Var + SDL_pow : TSDL_pow_fun = Nil; +{$else} + +function SDL_pow(x, y: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_pow' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the value of x raised to the power of y. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_powf_fun = function(x, y: cfloat): cfloat; cdecl; +Var + SDL_powf : TSDL_powf_fun = Nil; +{$else} + +function SDL_powf(x, y: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_powf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Round to nearest integral value, away from zero. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_round_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_round : TSDL_round_fun = Nil; +{$else} + +function SDL_round(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_round' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Round to nearest integral value, away from zero. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_roundf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_roundf : TSDL_roundf_fun = Nil; +{$else} + +function SDL_roundf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_roundf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate x multiplied by the floating-point radix to the power of n. + * On most systems, the radix is 2, making this equivalent to x*(2**n). + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_scalbn_fun = function(x: cdouble; n: cint): cdouble; cdecl; +Var + SDL_scalbn : TSDL_scalbn_fun = Nil; +{$else} + +function SDL_scalbn(x: cdouble; n: cint): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_scalbn' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate x multiplied by the floating-point radix to the power of n. + * On most systems, the radix is 2, making this equivalent to x*(2**n). + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_scalbnf_fun = function(x: cfloat; n: cint): cfloat; cdecl; +Var + SDL_scalbnf : TSDL_scalbnf_fun = Nil; +{$else} + +function SDL_scalbnf(x: cfloat; n: cint): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_scalbnf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the sine of x, where x is given in radians. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_sin_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_sin : TSDL_sin_fun = Nil; +{$else} + +function SDL_sin(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_sin' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the sine of x, where x is given in radians. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_sinf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_sinf : TSDL_sinf_fun = Nil; +{$else} + +function SDL_sinf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_sinf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the non-negative square root of x. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_sqrt_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_sqrt : TSDL_sqrt_fun = Nil; +{$else} + +function SDL_sqrt(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_sqrt' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the non-negative square root of x. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_sqrtf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_sqrtf : TSDL_sqrtf_fun = Nil; +{$else} + +function SDL_sqrtf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_sqrtf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the tangent of x, where x is given in radians. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_tan_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_tan : TSDL_tan_fun = Nil; +{$else} + +function SDL_tan(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_tan' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the tangent of x, where x is given in radians. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_tanf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_tanf : TSDL_tanf_fun = Nil; +{$else} + +function SDL_tanf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_tanf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Round to nearest integral value, towards zero. + * + * \since This function is available since SDL 2.0.14. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_trunc_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_trunc : TSDL_trunc_fun = Nil; +{$else} + +function SDL_trunc(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_trunc' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Round to nearest integral value, towards zero. + * + * \since This function is available since SDL 2.0.14. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_truncf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_truncf : TSDL_truncf_fun = Nil; +{$else} + +function SDL_truncf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_truncf' {$ENDIF} {$ENDIF}; +{$endif} + + + +(*** --- iconv functions --- ***) + + +(** + * This function converts a string between encodings in one pass, returning a + * string that must be freed with SDL_free(), or NIL on error. + * + * \since This function is available since SDL 2.0.0. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_iconv_string_fun = function(Const tocode, fromcode, inbuf: PAnsiChar; inbytesleft: csize_t): PAnsiChar; cdecl; +Var + SDL_iconv_string : TSDL_iconv_string_fun = Nil; +{$else} + +function SDL_iconv_string(Const tocode, fromcode, inbuf: PAnsiChar; inbytesleft: csize_t): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iconv_string' {$ENDIF} {$ENDIF}; +{$endif} + +// These are macros in the original C headers, we will reimplement them as simple Pascal functions. +function SDL_iconv_utf8_locale(Const str: PAnsiChar): PAnsiChar; cdecl; +function SDL_iconv_utf8_ucs2(Const str: PAnsiChar): pcUint16; cdecl; +function SDL_iconv_utf8_ucs4(Const str: PAnsiChar): pcUint32; cdecl; + +(* The SDL implementation of iconv() returns these error codes *) +const + SDL_ICONV_ERROR = csize_t(-1); + SDL_ICONV_E2BIG = csize_t(-2); + SDL_ICONV_EILSEQ = csize_t(-3); + SDL_ICONV_EINVAL = csize_t(-4); + +type + PSDL_iconv = type Pointer; + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_iconv_open_fun = function(Const tocode, fromcode: PAnsiChar): PSDL_iconv; cdecl; +Var + SDL_iconv_open : TSDL_iconv_open_fun = Nil; +{$else} + +function SDL_iconv_open(Const tocode, fromcode: PAnsiChar): PSDL_iconv; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iconv_open' {$ENDIF} {$ENDIF}; +{$endif} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_iconv_close_fun = function(cd: PSDL_iconv): cint; cdecl; +Var + SDL_iconv_close : TSDL_iconv_close_fun = Nil; +{$else} + +function SDL_iconv_close(cd: PSDL_iconv): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iconv_close' {$ENDIF} {$ENDIF}; +{$endif} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_iconv_fun = function(cd: PSDL_iconv; Const inbuf: PPAnsiChar; inbytesleft: pcsize_t; outbuf: PPAnsiChar; outbytesleft: pcsize_t): csize_t; cdecl; +Var + SDL_iconv : TSDL_iconv_fun = Nil; +{$else} + +function SDL_iconv(cd: PSDL_iconv; Const inbuf: PPAnsiChar; inbytesleft: pcsize_t; outbuf: PPAnsiChar; outbytesleft: pcsize_t): csize_t; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iconv' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlsurface.inc b/units/sdlsurface.inc index 61a458b8..a7c0590d 100644 --- a/units/sdlsurface.inc +++ b/units/sdlsurface.inc @@ -1,543 +1,847 @@ -//from "sdl_surface.h" - -const - {** - * Surface flags - * - * These are the currently supported flags for the ::SDL_surface. - * - * Used internally (read-only). - *} - - SDL_SWSURFACE = 0; {**< Just here for compatibility *} - SDL_PREALLOC = $00000001; {**< Surface uses preallocated memory *} - SDL_RLEACCEL = $00000002; {**< Surface is RLE encoded *} - SDL_DONTFREE = $00000004; {**< Surface is referenced internally *} - SDL_SIMD_ALIGNED = $00000008; {**< Surface uses aligned memory *} - -type - {** - * A collection of pixels used in software blitting. - * - * This structure should be treated as read-only, except for \c pixels, - * which, if not NULL, contains the raw pixel data for the surface. - *} - PPSDL_BlitMap = ^PSDL_BlitMap; - PSDL_BlitMap = type Pointer; - - PPSDL_Surface = ^PSDL_Surface; - PSDL_Surface = ^TSDL_Surface; - TSDL_Surface = record - flags: cuint32; {**< Read-only *} - format: PSDL_PixelFormat; {**< Read-only *} - w, h: cint; {**< Read-only *} - pitch: cint; {**< Read-only *} - pixels: Pointer; {**< Read-write *} - - {** Application data associated with the surface *} - userdata: Pointer; {**< Read-write *} - - {** information needed for surfaces requiring locks *} - locked: cint; {**< Read-only *} - //lock_data: Pointer; {**< Read-only *} // field gone in or before 2.0.14? - - {** list of BlitMap that hold a reference to this surface *} - list_blitmap: Pointer; {**< Private *} - - {** clipping information *} - clip_rect: TSDL_Rect; {**< Read-only *} - - {** info for fast blit mapping to other surfaces *} - map: PSDL_BlitMap; {**< Private *} - - {** Reference count -- used when freeing surface *} - refcount: cint; {**< Read-mostly *} - end; - -// Evaluates to true if the surface needs to be locked before access. -function SDL_MUSTLOCK(Const S:PSDL_Surface):Boolean; - -type - {** - * The type of function used for surface blitting functions. - *} - PPSDL_Blit = ^PSDL_Blit; - PSDL_Blit = ^TSDL_Blit; - TSDL_Blit = function(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; - -type - {** - * \brief The formula used for converting between YUV and RGB - *} - TSDL_YUV_CONVERSION_MODE = type Integer; - -const - SDL_YUV_CONVERSION_JPEG = TSDL_YUV_CONVERSION_MODE(0); {**< Full range JPEG *} - SDL_YUV_CONVERSION_BT601 = TSDL_YUV_CONVERSION_MODE(1); {**< BT.601 (the default) *} - SDL_YUV_CONVERSION_BT709 = TSDL_YUV_CONVERSION_MODE(2); {**< BT.709 *} - SDL_YUV_CONVERSION_AUTOMATIC = TSDL_YUV_CONVERSION_MODE(3); {**< BT.601 for SD content, BT.709 for HD content *} - - {** - * Allocate and free an RGB surface. - * - * If the depth is 4 or 8 bits, an empty palette is allocated for the surface. - * If the depth is greater than 8 bits, the pixel format is set using the - * flags '[RGB]mask'. - * - * If the function runs out of memory, it will return NULL. - * - * \param flags The \c flags are obsolete and should be set to 0. - * \param width The width in pixels of the surface to create. - * \param height The height in pixels of the surface to create. - * \param depth The depth in bits of the surface to create. - * \param Rmask The red mask of the surface to create. - * \param Gmask The green mask of the surface to create. - * \param Bmask The blue mask of the surface to create. - * \param Amask The alpha mask of the surface to create. - *} - -function SDL_CreateRGBSurface(flags: cuint32; width: cint; height: cint; depth: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurface' {$ENDIF} {$ENDIF}; -{* !!! FIXME for 2.1: why does this ask for depth? Format provides that. *} -function SDL_CreateRGBSurfaceWithFormat(flags: cuint32; width, height, depth: cint; format: cuint32):PSDL_Surface; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurfaceWithFormat' {$ENDIF} {$ENDIF}; -function SDL_CreateRGBSurfaceFrom(pixels: Pointer; width: cint; height: cint; depth: cint; pitch: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurfaceFrom' {$ENDIF} {$ENDIF}; -function SDL_CreateRGBSurfaceWithFormatFrom(pixels: Pointer; width, height, depth, pitch: cint; format: cuint32):PSDL_Surface; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurfaceWithFormatFrom' {$ENDIF} {$ENDIF}; -procedure SDL_FreeSurface(surface: PSDL_Surface); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeSurface' {$ENDIF} {$ENDIF}; - - {** - * Set the palette used by a surface. - * - * 0, or -1 if the surface format doesn't use a palette. - * - * A single palette can be shared with many surfaces. - *} - -function SDL_SetSurfacePalette(surface: PSDL_Surface; palette: PSDL_Palette): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfacePalette' {$ENDIF} {$ENDIF}; - - {** - * Sets up a surface for directly accessing the pixels. - * - * Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write - * to and read from surface.pixels, using the pixel format stored in - * surface.format. Once you are done accessing the surface, you should - * use SDL_UnlockSurface() to release it. - * - * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates - * to 0, then you can read and write to the surface at any time, and the - * pixel format of the surface will not change. - * - * No operating system or library calls should be made between lock/unlock - * pairs, as critical system locks may be held during this time. - * - * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. - * - * SDL_UnlockSurface() - *} - -function SDL_LockSurface(surface: PSDL_Surface): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockSurface' {$ENDIF} {$ENDIF}; - - {** SDL_LockSurface() *} - -procedure SDL_UnlockSurface(surface: PSDL_Surface); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnlockSurface' {$ENDIF} {$ENDIF}; - - {** - * Load a surface from a seekable SDL data stream (memory or file). - * - * If freesrc is non-zero, the stream will be closed after being read. - * - * The new surface should be freed with SDL_FreeSurface(). - * - * the new surface, or NULL if there was an error. - *} - -function SDL_LoadBMP_RW(src: PSDL_RWops; freesrc: cint): PSDL_Surface; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadBMP_RW' {$ENDIF} {$ENDIF}; - - {** - * Load a surface from a file. - * - * Convenience macro. - *} - -function SDL_LoadBMP(_file: PAnsiChar): PSDL_Surface; - - {** - * Save a surface to a seekable SDL data stream (memory or file). - * - * Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the - * BMP directly. Other RGB formats with 8-bit or higher get converted to a - * 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit - * surface before they are saved. YUV and paletted 1-bit and 4-bit formats are - * not supported. - * - * If \c freedst is non-zero, the stream will be closed after being written. - * - * \return 0 if successful or -1 if there was an error. - *} - -function SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SaveBMP_RW' {$ENDIF} {$ENDIF}; - - {** - * Save a surface to a file. - * - * Convenience macro. - *} -{ TODO : Check: Why AnsiString instead of PAnsiChar used here? Compare SDL_LoadBMP macro. } -function SDL_SaveBMP(const surface: PSDL_Surface; const filename:AnsiString): cint; - - {** - * Sets the RLE acceleration hint for a surface. - * - * 0 on success, or -1 if the surface is not valid - * - * If RLE is enabled, colorkey and alpha blending blits are much faster, - * but the surface must be locked before directly accessing the pixels. - *} - -function SDL_SetSurfaceRLE(surface: PSDL_Surface; flag: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfaceRLE' {$ENDIF} {$ENDIF}; - -{** - * \brief Returns whether the surface is RLE enabled - * - * \return SDL_TRUE if the surface is RLE enabled, or SDL_FALSE if the surface is NULL or not RLE enabled - *} - function SDL_HasSurfaceRLE(surface: PSDL_Surface): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSurfaceRLE' {$ENDIF} {$ENDIF}; - - {** - * Sets the color key (transparent pixel) in a blittable surface. - * - * surface The surface to update - * flag Non-zero to enable colorkey and 0 to disable colorkey - * key The transparent pixel in the native surface format - * - * 0 on success, or -1 if the surface is not valid - * - * You can pass SDL_RLEACCEL to enable RLE accelerated blits. - *} - -function SDL_SetColorKey(surface: PSDL_Surface; flag: cint; key: cuint32): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetColorKey' {$ENDIF} {$ENDIF}; - -{** - * \brief Returns whether the surface has a color key - * - * \return SDL_TRUE if the surface has a color key, or SDL_FALSE if the surface is NULL or has no color key - *} -function SDL_HasColorKey(surface: PSDL_Surface): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasColorKey' {$ENDIF} {$ENDIF}; - - {** - * Gets the color key (transparent pixel) in a blittable surface. - * - * surface The surface to update - * key A pointer filled in with the transparent pixel in the native - * surface format - * - * 0 on success, or -1 if the surface is not valid or colorkey is not - * enabled. - *} - -function SDL_GetColorKey(surface: PSDL_Surface; key: pcuint32): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetColorKey' {$ENDIF} {$ENDIF}; - - {** - * Set an additional color value used in blit operations. - * - * surface The surface to update. - * r The red color value multiplied into blit operations. - * g The green color value multiplied into blit operations. - * b The blue color value multiplied into blit operations. - * - * 0 on success, or -1 if the surface is not valid. - * - * SDL_GetSurfaceColorMod() - *} - -function SDL_SetSurfaceColorMod(surface: PSDL_Surface; r: cuint8; g: cuint8; b: cuint8): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfaceColorMod' {$ENDIF} {$ENDIF}; - - {** - * Get the additional color value used in blit operations. - * - * surface The surface to query. - * r A pointer filled in with the current red color value. - * g A pointer filled in with the current green color value. - * b A pointer filled in with the current blue color value. - * - * 0 on success, or -1 if the surface is not valid. - * - * SDL_SetSurfaceColorMod() - *} - -function SDL_GetSurfaceColorMod(surface: PSDL_Surface; r: pcuint8; g: pcuint8; b: pcuint8): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetSurfaceColorMod' {$ENDIF} {$ENDIF}; - - {** - * Set an additional alpha value used in blit operations. - * - * surface The surface to update. - * alpha The alpha value multiplied into blit operations. - * - * 0 on success, or -1 if the surface is not valid. - * - * SDL_GetSurfaceAlphaMod() - *} - -function SDL_SetSurfaceAlphaMod(surface: PSDL_Surface; alpha: cuint8): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfaceAlphaMod' {$ENDIF} {$ENDIF}; - - {** - * Get the additional alpha value used in blit operations. - * - * surface The surface to query. - * alpha A pointer filled in with the current alpha value. - * - * 0 on success, or -1 if the surface is not valid. - * - * SDL_SetSurfaceAlphaMod() - *} - -function SDL_GetSurfaceAlphaMod(surface: PSDL_Surface; alpha: pcuint8): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetSurfaceAlphaMod' {$ENDIF} {$ENDIF}; - - {** - * Set the blend mode used for blit operations. - * - * surface The surface to update. - * blendMode ::SDL_BlendMode to use for blit blending. - * - * 0 on success, or -1 if the parameters are not valid. - * - * SDL_GetSurfaceBlendMode() - *} - -function SDL_SetSurfaceBlendMode(surface: PSDL_Surface; blendMode: TSDL_BlendMode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfaceBlendMode' {$ENDIF} {$ENDIF}; - - {** - * Get the blend mode used for blit operations. - * - * surface The surface to query. - * blendMode A pointer filled in with the current blend mode. - * - * 0 on success, or -1 if the surface is not valid. - * - * SDL_SetSurfaceBlendMode() - *} - -function SDL_GetSurfaceBlendMode(surface: PSDL_Surface; blendMode: PSDL_BlendMode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetSurfaceBlendMode' {$ENDIF} {$ENDIF}; - - {** - * Sets the clipping rectangle for the destination surface in a blit. - * - * If the clip rectangle is NULL, clipping will be disabled. - * - * If the clip rectangle doesn't intersect the surface, the function will - * return SDL_FALSE and blits will be completely clipped. Otherwise the - * function returns SDL_TRUE and blits to the surface will be clipped to - * the intersection of the surface area and the clipping rectangle. - * - * Note that blits are automatically clipped to the edges of the source - * and destination surfaces. - *} - -function SDL_SetClipRect(surface: PSDL_Surface; const rect: PSDL_Rect): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetClipRect' {$ENDIF} {$ENDIF}; - - {** - * Gets the clipping rectangle for the destination surface in a blit. - * - * rect must be a pointer to a valid rectangle which will be filled - * with the correct values. - *} - -procedure SDL_GetClipRect(surface: PSDL_Surface; rect: PSDL_Rect); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetClipRect' {$ENDIF} {$ENDIF}; - -{* - * Creates a new surface identical to the existing surface - *} -function SDL_DuplicateSurface(surface: PSDL_Surface): PSDL_Surface; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DuplicateSurface' {$ENDIF} {$ENDIF}; - - {** - * Creates a new surface of the specified format, and then copies and maps - * the given surface to it so the blit of the converted surface will be as - * fast as possible. If this function fails, it returns NULL. - * - * The flags parameter is passed to SDL_CreateRGBSurface() and has those - * semantics. You can also pass SDL_RLEACCEL in the flags parameter and - * SDL will try to RLE accelerate colorkey and alpha blits in the resulting - * surface. - *} - -function SDL_ConvertSurface(src: PSDL_Surface; const fmt: PSDL_PixelFormat; flags: cuint32): PSDL_Surface; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ConvertSurface' {$ENDIF} {$ENDIF}; -function SDL_ConvertSurfaceFormat(src: PSDL_Surface; pixel_format: cuint32; flags: cuint32): PSDL_Surface; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ConvertSurfaceFormat' {$ENDIF} {$ENDIF}; - - {** - * Copy a block of pixels of one format to another format - * - * 0 on success, or -1 if there was an error - *} - -function SDL_ConvertPixels(width: cint; height: cint; src_format: cuint32; const src: Pointer; src_pitch: cint; dst_format: cuint32; dst: Pointer; dst_pitch: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ConvertPixels' {$ENDIF} {$ENDIF}; - - {** - * Performs a fast fill of the given rectangle with color. - * - * If rect is NULL, the whole surface will be filled with color. - * - * The color should be a pixel of the format used by the surface, and - * can be generated by the SDL_MapRGB() function. - * - * 0 on success, or -1 on error. - *} - -function SDL_FillRect(dst: PSDL_Surface; const rect: PSDL_Rect; color: cuint32): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FillRect' {$ENDIF} {$ENDIF}; -function SDL_FillRects(dst: PSDL_Surface; const rects: PSDL_Rect; count: cint; color: cuint32): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FillRects' {$ENDIF} {$ENDIF}; - - {** - * Performs a fast blit from the source surface to the destination surface. - * - * This assumes that the source and destination rectangles are - * the same size. If either \c srcrect or \c dstrect are NULL, the entire - * surface ( src or dst) is copied. The final blit rectangles are saved - * in srcrect and dstrect after all clipping is performed. - * - * If the blit is successful, it returns 0, otherwise it returns -1. - * - * The blit function should not be called on a locked surface. - * - * The blit semantics for surfaces with and without alpha and colorkey - * are defined as follows: - * - RGBA->RGB: - SDL_SRCALPHA set: - alpha-blend (using alpha-channel). - SDL_SRCCOLORKEY ignored. - SDL_SRCALPHA not set: - copy RGB. - if SDL_SRCCOLORKEY set, only copy the pixels matching the - RGB values of the source colour key, ignoring alpha in the - comparison. - - RGB->RGBA: - SDL_SRCALPHA set: - alpha-blend (using the source per-surface alpha value); - set destination alpha to opaque. - SDL_SRCALPHA not set: - copy RGB, set destination alpha to source per-surface alpha value. - both: - if SDL_SRCCOLORKEY set, only copy the pixels matching the - source colour key. - - RGBA->RGBA: - SDL_SRCALPHA set: - alpha-blend (using the source alpha channel) the RGB values; - leave destination alpha untouched. [Note: is this correct?] - SDL_SRCCOLORKEY ignored. - SDL_SRCALPHA not set: - copy all of RGBA to the destination. - if SDL_SRCCOLORKEY set, only copy the pixels matching the - RGB values of the source colour key, ignoring alpha in the - comparison. - - RGB->RGB: - SDL_SRCALPHA set: - alpha-blend (using the source per-surface alpha value). - SDL_SRCALPHA not set: - copy RGB. - both: - if SDL_SRCCOLORKEY set, only copy the pixels matching the - source colour key.r - * - * You should call SDL_BlitSurface() unless you know exactly how SDL - * blitting works internally and how to use the other blit functions. - *} - -(* SDL_surface.h uses #define to change all SDL_BlitSurface() calls into SDL_UpperBlit() calls. * - * Since Pascal macro support is very limited, we workaround by outright pointing SDL_BlitSurface() to SDL_UpperBlit(). *) -function SDL_BlitSurface(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; - external SDL_LibName name {$IF DEFINED(DELPHI) AND DEFINED(MACOS)} '_SDL_UpperBlit' {$ELSE} 'SDL_UpperBlit' {$IFEND}; - - - {** - * This is the public blit function, SDL_BlitSurface(), and it performs - * rectangle validation and clipping before passing it to SDL_LowerBlit() - *} - -function SDL_UpperBlit(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpperBlit' {$ENDIF} {$ENDIF}; - - {** - * This is a semi-private blit function and it performs low-level surface - * blitting only. - *} - -function SDL_LowerBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LowerBlit' {$ENDIF} {$ENDIF}; - - {** - * Perform a fast, low quality, stretch blit between two surfaces of the - * same pixel format. - * - * This function uses a static buffer, and is not thread-safe. - *} - -function SDL_SoftStretch(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; const dstrect: PSDL_Surface): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SoftStretch' {$ENDIF} {$ENDIF}; - -(* SDL_surface.h uses #define to change all SDL_BlitSurfaceScaled() calls into SDL_UpperBlitScaled() calls. * - * Since Pascal macro support is very limited, we workaround by outright pointing SDL_BlitSurfaceScaled() to SDL_UpperBlitScaled(). *) -function SDL_BlitSurfaceScaled(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; - external SDL_LibName name {$IF DEFINED(DELPHI) AND DEFINED(MACOS)} '_SDL_UpperBlitScaled' {$ELSE} 'SDL_UpperBlitScaled' {$IFEND}; - - {** - * This is the public scaled blit function, SDL_BlitScaled(), and it performs - * rectangle validation and clipping before passing it to SDL_LowerBlitScaled() - *} - -function SDL_UpperBlitScaled(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpperBlitScaled' {$ENDIF} {$ENDIF}; - - {** - * This is a semi-private blit function and it performs low-level surface - * scaled blitting only. - *} - -function SDL_LowerBlitScaled(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LowerBlitScaled' {$ENDIF} {$ENDIF}; - -{** - * \brief Set the YUV conversion mode - *} -procedure SDL_SetYUVConversionMode(mode: TSDL_YUV_CONVERSION_MODE); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetYUVConversionMode' {$ENDIF} {$ENDIF}; - -{** - * \brief Get the YUV conversion mode - *} -function SDL_GetYUVConversionMode: TSDL_YUV_CONVERSION_MODE; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetYUVConversionMode' {$ENDIF} {$ENDIF}; - -{** - * \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC - *} -function SDL_GetYUVConversionModeForResolution(width: cint; height: cint): TSDL_YUV_CONVERSION_MODE; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetYUVConversionModeForResolution' {$ENDIF} {$ENDIF}; +//from "sdl_surface.h" + +const + {** + * Surface flags + * + * These are the currently supported flags for the ::SDL_surface. + * + * Used internally (read-only). + *} + + SDL_SWSURFACE = 0; {**< Just here for compatibility *} + SDL_PREALLOC = $00000001; {**< Surface uses preallocated memory *} + SDL_RLEACCEL = $00000002; {**< Surface is RLE encoded *} + SDL_DONTFREE = $00000004; {**< Surface is referenced internally *} + SDL_SIMD_ALIGNED = $00000008; {**< Surface uses aligned memory *} + +type + {** + * A collection of pixels used in software blitting. + * + * This structure should be treated as read-only, except for \c pixels, + * which, if not NULL, contains the raw pixel data for the surface. + *} + PPSDL_BlitMap = ^PSDL_BlitMap; + PSDL_BlitMap = type Pointer; + + PPSDL_Surface = ^PSDL_Surface; + PSDL_Surface = ^TSDL_Surface; + TSDL_Surface = record + flags: cuint32; {**< Read-only *} + format: PSDL_PixelFormat; {**< Read-only *} + w, h: cint; {**< Read-only *} + pitch: cint; {**< Read-only *} + pixels: Pointer; {**< Read-write *} + + {** Application data associated with the surface *} + userdata: Pointer; {**< Read-write *} + + {** information needed for surfaces requiring locks *} + locked: cint; {**< Read-only *} + //lock_data: Pointer; {**< Read-only *} // field gone in or before 2.0.14? + + {** list of BlitMap that hold a reference to this surface *} + list_blitmap: Pointer; {**< Private *} + + {** clipping information *} + clip_rect: TSDL_Rect; {**< Read-only *} + + {** info for fast blit mapping to other surfaces *} + map: PSDL_BlitMap; {**< Private *} + + {** Reference count -- used when freeing surface *} + refcount: cint; {**< Read-mostly *} + end; + +// Evaluates to true if the surface needs to be locked before access. +function SDL_MUSTLOCK(Const S:PSDL_Surface):Boolean; + +type + {** + * The type of function used for surface blitting functions. + *} + PPSDL_Blit = ^PSDL_Blit; + PSDL_Blit = ^TSDL_Blit; + TSDL_Blit = function(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; + +type + {** + * \brief The formula used for converting between YUV and RGB + *} + TSDL_YUV_CONVERSION_MODE = type Integer; + +const + SDL_YUV_CONVERSION_JPEG = TSDL_YUV_CONVERSION_MODE(0); {**< Full range JPEG *} + SDL_YUV_CONVERSION_BT601 = TSDL_YUV_CONVERSION_MODE(1); {**< BT.601 (the default) *} + SDL_YUV_CONVERSION_BT709 = TSDL_YUV_CONVERSION_MODE(2); {**< BT.709 *} + SDL_YUV_CONVERSION_AUTOMATIC = TSDL_YUV_CONVERSION_MODE(3); {**< BT.601 for SD content, BT.709 for HD content *} + + {** + * Allocate and free an RGB surface. + * + * If the depth is 4 or 8 bits, an empty palette is allocated for the surface. + * If the depth is greater than 8 bits, the pixel format is set using the + * flags '[RGB]mask'. + * + * If the function runs out of memory, it will return NULL. + * + * \param flags The \c flags are obsolete and should be set to 0. + * \param width The width in pixels of the surface to create. + * \param height The height in pixels of the surface to create. + * \param depth The depth in bits of the surface to create. + * \param Rmask The red mask of the surface to create. + * \param Gmask The green mask of the surface to create. + * \param Bmask The blue mask of the surface to create. + * \param Amask The alpha mask of the surface to create. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateRGBSurface_fun = function(flags: cuint32; width: cint; height: cint; depth: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl; +Var + SDL_CreateRGBSurface : TSDL_CreateRGBSurface_fun = Nil; +{$else} + +function SDL_CreateRGBSurface(flags: cuint32; width: cint; height: cint; depth: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurface' {$ENDIF} {$ENDIF}; +{$endif} +{* !!! FIXME for 2.1: why does this ask for depth? Format provides that. *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateRGBSurfaceWithFormat_fun = function(flags: cuint32; width, height, depth: cint; format: cuint32):PSDL_Surface; cdecl; +Var + SDL_CreateRGBSurfaceWithFormat : TSDL_CreateRGBSurfaceWithFormat_fun = Nil; +{$else} + +function SDL_CreateRGBSurfaceWithFormat(flags: cuint32; width, height, depth: cint; format: cuint32):PSDL_Surface; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurfaceWithFormat' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateRGBSurfaceFrom_fun = function(pixels: Pointer; width: cint; height: cint; depth: cint; pitch: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl; +Var + SDL_CreateRGBSurfaceFrom : TSDL_CreateRGBSurfaceFrom_fun = Nil; +{$else} + +function SDL_CreateRGBSurfaceFrom(pixels: Pointer; width: cint; height: cint; depth: cint; pitch: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurfaceFrom' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateRGBSurfaceWithFormatFrom_fun = function(pixels: Pointer; width, height, depth, pitch: cint; format: cuint32):PSDL_Surface; cdecl; +Var + SDL_CreateRGBSurfaceWithFormatFrom : TSDL_CreateRGBSurfaceWithFormatFrom_fun = Nil; +{$else} + +function SDL_CreateRGBSurfaceWithFormatFrom(pixels: Pointer; width, height, depth, pitch: cint; format: cuint32):PSDL_Surface; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurfaceWithFormatFrom' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_FreeSurface_proc = procedure(surface: PSDL_Surface); cdecl; +Var + SDL_FreeSurface : TSDL_FreeSurface_proc = Nil; +{$else} + +procedure SDL_FreeSurface(surface: PSDL_Surface); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeSurface' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the palette used by a surface. + * + * 0, or -1 if the surface format doesn't use a palette. + * + * A single palette can be shared with many surfaces. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetSurfacePalette_fun = function(surface: PSDL_Surface; palette: PSDL_Palette): cint; cdecl; +Var + SDL_SetSurfacePalette : TSDL_SetSurfacePalette_fun = Nil; +{$else} + +function SDL_SetSurfacePalette(surface: PSDL_Surface; palette: PSDL_Palette): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfacePalette' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Sets up a surface for directly accessing the pixels. + * + * Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write + * to and read from surface.pixels, using the pixel format stored in + * surface.format. Once you are done accessing the surface, you should + * use SDL_UnlockSurface() to release it. + * + * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates + * to 0, then you can read and write to the surface at any time, and the + * pixel format of the surface will not change. + * + * No operating system or library calls should be made between lock/unlock + * pairs, as critical system locks may be held during this time. + * + * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. + * + * SDL_UnlockSurface() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LockSurface_fun = function(surface: PSDL_Surface): cint; cdecl; +Var + SDL_LockSurface : TSDL_LockSurface_fun = Nil; +{$else} + +function SDL_LockSurface(surface: PSDL_Surface): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockSurface' {$ENDIF} {$ENDIF}; +{$endif} + + {** SDL_LockSurface() *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UnlockSurface_proc = procedure(surface: PSDL_Surface); cdecl; +Var + SDL_UnlockSurface : TSDL_UnlockSurface_proc = Nil; +{$else} + +procedure SDL_UnlockSurface(surface: PSDL_Surface); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnlockSurface' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Load a surface from a seekable SDL data stream (memory or file). + * + * If freesrc is non-zero, the stream will be closed after being read. + * + * The new surface should be freed with SDL_FreeSurface(). + * + * the new surface, or NULL if there was an error. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LoadBMP_RW_fun = function(src: PSDL_RWops; freesrc: cint): PSDL_Surface; cdecl; +Var + SDL_LoadBMP_RW : TSDL_LoadBMP_RW_fun = Nil; +{$else} + +function SDL_LoadBMP_RW(src: PSDL_RWops; freesrc: cint): PSDL_Surface; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadBMP_RW' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Load a surface from a file. + * + * Convenience macro. + *} + +function SDL_LoadBMP(_file: PAnsiChar): PSDL_Surface; + + {** + * Save a surface to a seekable SDL data stream (memory or file). + * + * Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the + * BMP directly. Other RGB formats with 8-bit or higher get converted to a + * 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit + * surface before they are saved. YUV and paletted 1-bit and 4-bit formats are + * not supported. + * + * If \c freedst is non-zero, the stream will be closed after being written. + * + * \return 0 if successful or -1 if there was an error. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SaveBMP_RW_fun = function(surface: PSDL_Surface; dst: PSDL_RWops; freedst: cint): cint; cdecl; +Var + SDL_SaveBMP_RW : TSDL_SaveBMP_RW_fun = Nil; +{$else} + +function SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SaveBMP_RW' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Save a surface to a file. + * + * Convenience macro. + *} +{ TODO : Check: Why AnsiString instead of PAnsiChar used here? Compare SDL_LoadBMP macro. } +function SDL_SaveBMP(const surface: PSDL_Surface; const filename:AnsiString): cint; + + {** + * Sets the RLE acceleration hint for a surface. + * + * 0 on success, or -1 if the surface is not valid + * + * If RLE is enabled, colorkey and alpha blending blits are much faster, + * but the surface must be locked before directly accessing the pixels. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetSurfaceRLE_fun = function(surface: PSDL_Surface; flag: cint): cint; cdecl; +Var + SDL_SetSurfaceRLE : TSDL_SetSurfaceRLE_fun = Nil; +{$else} + +function SDL_SetSurfaceRLE(surface: PSDL_Surface; flag: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfaceRLE' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Returns whether the surface is RLE enabled + * + * \return SDL_TRUE if the surface is RLE enabled, or SDL_FALSE if the surface is NULL or not RLE enabled + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HasSurfaceRLE_fun = function(surface: PSDL_Surface): TSDL_Bool; cdecl; +Var + SDL_HasSurfaceRLE : TSDL_HasSurfaceRLE_fun = Nil; +{$else} + + function SDL_HasSurfaceRLE(surface: PSDL_Surface): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSurfaceRLE' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Sets the color key (transparent pixel) in a blittable surface. + * + * surface The surface to update + * flag Non-zero to enable colorkey and 0 to disable colorkey + * key The transparent pixel in the native surface format + * + * 0 on success, or -1 if the surface is not valid + * + * You can pass SDL_RLEACCEL to enable RLE accelerated blits. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetColorKey_fun = function(surface: PSDL_Surface; flag: cint; key: cuint32): cint; cdecl; +Var + SDL_SetColorKey : TSDL_SetColorKey_fun = Nil; +{$else} + +function SDL_SetColorKey(surface: PSDL_Surface; flag: cint; key: cuint32): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetColorKey' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Returns whether the surface has a color key + * + * \return SDL_TRUE if the surface has a color key, or SDL_FALSE if the surface is NULL or has no color key + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HasColorKey_fun = function(surface: PSDL_Surface): TSDL_Bool; cdecl; +Var + SDL_HasColorKey : TSDL_HasColorKey_fun = Nil; +{$else} + +function SDL_HasColorKey(surface: PSDL_Surface): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasColorKey' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Gets the color key (transparent pixel) in a blittable surface. + * + * surface The surface to update + * key A pointer filled in with the transparent pixel in the native + * surface format + * + * 0 on success, or -1 if the surface is not valid or colorkey is not + * enabled. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetColorKey_fun = function(surface: PSDL_Surface; key: pcuint32): cint; cdecl; +Var + SDL_GetColorKey : TSDL_GetColorKey_fun = Nil; +{$else} + +function SDL_GetColorKey(surface: PSDL_Surface; key: pcuint32): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetColorKey' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set an additional color value used in blit operations. + * + * surface The surface to update. + * r The red color value multiplied into blit operations. + * g The green color value multiplied into blit operations. + * b The blue color value multiplied into blit operations. + * + * 0 on success, or -1 if the surface is not valid. + * + * SDL_GetSurfaceColorMod() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetSurfaceColorMod_fun = function(surface: PSDL_Surface; r: cuint8; g: cuint8; b: cuint8): cint; cdecl; +Var + SDL_SetSurfaceColorMod : TSDL_SetSurfaceColorMod_fun = Nil; +{$else} + +function SDL_SetSurfaceColorMod(surface: PSDL_Surface; r: cuint8; g: cuint8; b: cuint8): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfaceColorMod' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the additional color value used in blit operations. + * + * surface The surface to query. + * r A pointer filled in with the current red color value. + * g A pointer filled in with the current green color value. + * b A pointer filled in with the current blue color value. + * + * 0 on success, or -1 if the surface is not valid. + * + * SDL_SetSurfaceColorMod() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetSurfaceColorMod_fun = function(surface: PSDL_Surface; r: pcuint8; g: pcuint8; b: pcuint8): cint; cdecl; +Var + SDL_GetSurfaceColorMod : TSDL_GetSurfaceColorMod_fun = Nil; +{$else} + +function SDL_GetSurfaceColorMod(surface: PSDL_Surface; r: pcuint8; g: pcuint8; b: pcuint8): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetSurfaceColorMod' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set an additional alpha value used in blit operations. + * + * surface The surface to update. + * alpha The alpha value multiplied into blit operations. + * + * 0 on success, or -1 if the surface is not valid. + * + * SDL_GetSurfaceAlphaMod() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetSurfaceAlphaMod_fun = function(surface: PSDL_Surface; alpha: cuint8): cint; cdecl; +Var + SDL_SetSurfaceAlphaMod : TSDL_SetSurfaceAlphaMod_fun = Nil; +{$else} + +function SDL_SetSurfaceAlphaMod(surface: PSDL_Surface; alpha: cuint8): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfaceAlphaMod' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the additional alpha value used in blit operations. + * + * surface The surface to query. + * alpha A pointer filled in with the current alpha value. + * + * 0 on success, or -1 if the surface is not valid. + * + * SDL_SetSurfaceAlphaMod() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetSurfaceAlphaMod_fun = function(surface: PSDL_Surface; alpha: pcuint8): cint; cdecl; +Var + SDL_GetSurfaceAlphaMod : TSDL_GetSurfaceAlphaMod_fun = Nil; +{$else} + +function SDL_GetSurfaceAlphaMod(surface: PSDL_Surface; alpha: pcuint8): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetSurfaceAlphaMod' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the blend mode used for blit operations. + * + * surface The surface to update. + * blendMode ::SDL_BlendMode to use for blit blending. + * + * 0 on success, or -1 if the parameters are not valid. + * + * SDL_GetSurfaceBlendMode() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetSurfaceBlendMode_fun = function(surface: PSDL_Surface; blendMode: TSDL_BlendMode): cint; cdecl; +Var + SDL_SetSurfaceBlendMode : TSDL_SetSurfaceBlendMode_fun = Nil; +{$else} + +function SDL_SetSurfaceBlendMode(surface: PSDL_Surface; blendMode: TSDL_BlendMode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfaceBlendMode' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the blend mode used for blit operations. + * + * surface The surface to query. + * blendMode A pointer filled in with the current blend mode. + * + * 0 on success, or -1 if the surface is not valid. + * + * SDL_SetSurfaceBlendMode() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetSurfaceBlendMode_fun = function(surface: PSDL_Surface; blendMode: PSDL_BlendMode): cint; cdecl; +Var + SDL_GetSurfaceBlendMode : TSDL_GetSurfaceBlendMode_fun = Nil; +{$else} + +function SDL_GetSurfaceBlendMode(surface: PSDL_Surface; blendMode: PSDL_BlendMode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetSurfaceBlendMode' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Sets the clipping rectangle for the destination surface in a blit. + * + * If the clip rectangle is NULL, clipping will be disabled. + * + * If the clip rectangle doesn't intersect the surface, the function will + * return SDL_FALSE and blits will be completely clipped. Otherwise the + * function returns SDL_TRUE and blits to the surface will be clipped to + * the intersection of the surface area and the clipping rectangle. + * + * Note that blits are automatically clipped to the edges of the source + * and destination surfaces. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetClipRect_fun = function(surface: PSDL_Surface; const rect: PSDL_Rect): TSDL_Bool; cdecl; +Var + SDL_SetClipRect : TSDL_SetClipRect_fun = Nil; +{$else} + +function SDL_SetClipRect(surface: PSDL_Surface; const rect: PSDL_Rect): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetClipRect' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Gets the clipping rectangle for the destination surface in a blit. + * + * rect must be a pointer to a valid rectangle which will be filled + * with the correct values. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetClipRect_proc = procedure(surface: PSDL_Surface; rect: PSDL_Rect); cdecl; +Var + SDL_GetClipRect : TSDL_GetClipRect_proc = Nil; +{$else} + +procedure SDL_GetClipRect(surface: PSDL_Surface; rect: PSDL_Rect); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetClipRect' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Creates a new surface identical to the existing surface + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_DuplicateSurface_fun = function(surface: PSDL_Surface): PSDL_Surface; cdecl; +Var + SDL_DuplicateSurface : TSDL_DuplicateSurface_fun = Nil; +{$else} + +function SDL_DuplicateSurface(surface: PSDL_Surface): PSDL_Surface; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DuplicateSurface' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Creates a new surface of the specified format, and then copies and maps + * the given surface to it so the blit of the converted surface will be as + * fast as possible. If this function fails, it returns NULL. + * + * The flags parameter is passed to SDL_CreateRGBSurface() and has those + * semantics. You can also pass SDL_RLEACCEL in the flags parameter and + * SDL will try to RLE accelerate colorkey and alpha blits in the resulting + * surface. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ConvertSurface_fun = function(src: PSDL_Surface; const fmt: PSDL_PixelFormat; flags: cuint32): PSDL_Surface; cdecl; +Var + SDL_ConvertSurface : TSDL_ConvertSurface_fun = Nil; +{$else} + +function SDL_ConvertSurface(src: PSDL_Surface; const fmt: PSDL_PixelFormat; flags: cuint32): PSDL_Surface; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ConvertSurface' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ConvertSurfaceFormat_fun = function(src: PSDL_Surface; pixel_format: cuint32; flags: cuint32): PSDL_Surface; cdecl; +Var + SDL_ConvertSurfaceFormat : TSDL_ConvertSurfaceFormat_fun = Nil; +{$else} + +function SDL_ConvertSurfaceFormat(src: PSDL_Surface; pixel_format: cuint32; flags: cuint32): PSDL_Surface; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ConvertSurfaceFormat' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Copy a block of pixels of one format to another format + * + * 0 on success, or -1 if there was an error + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ConvertPixels_fun = function(width: cint; height: cint; src_format: cuint32; const src: Pointer; src_pitch: cint; dst_format: cuint32; dst: Pointer; dst_pitch: cint): cint; cdecl; +Var + SDL_ConvertPixels : TSDL_ConvertPixels_fun = Nil; +{$else} + +function SDL_ConvertPixels(width: cint; height: cint; src_format: cuint32; const src: Pointer; src_pitch: cint; dst_format: cuint32; dst: Pointer; dst_pitch: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ConvertPixels' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Performs a fast fill of the given rectangle with color. + * + * If rect is NULL, the whole surface will be filled with color. + * + * The color should be a pixel of the format used by the surface, and + * can be generated by the SDL_MapRGB() function. + * + * 0 on success, or -1 on error. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_FillRect_fun = function(dst: PSDL_Surface; const rect: PSDL_Rect; color: cuint32): cint; cdecl; +Var + SDL_FillRect : TSDL_FillRect_fun = Nil; +{$else} + +function SDL_FillRect(dst: PSDL_Surface; const rect: PSDL_Rect; color: cuint32): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FillRect' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_FillRects_fun = function(dst: PSDL_Surface; const rects: PSDL_Rect; count: cint; color: cuint32): cint; cdecl; +Var + SDL_FillRects : TSDL_FillRects_fun = Nil; +{$else} + +function SDL_FillRects(dst: PSDL_Surface; const rects: PSDL_Rect; count: cint; color: cuint32): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FillRects' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Performs a fast blit from the source surface to the destination surface. + * + * This assumes that the source and destination rectangles are + * the same size. If either \c srcrect or \c dstrect are NULL, the entire + * surface ( src or dst) is copied. The final blit rectangles are saved + * in srcrect and dstrect after all clipping is performed. + * + * If the blit is successful, it returns 0, otherwise it returns -1. + * + * The blit function should not be called on a locked surface. + * + * The blit semantics for surfaces with and without alpha and colorkey + * are defined as follows: + * + RGBA->RGB: + SDL_SRCALPHA set: + alpha-blend (using alpha-channel). + SDL_SRCCOLORKEY ignored. + SDL_SRCALPHA not set: + copy RGB. + if SDL_SRCCOLORKEY set, only copy the pixels matching the + RGB values of the source colour key, ignoring alpha in the + comparison. + + RGB->RGBA: + SDL_SRCALPHA set: + alpha-blend (using the source per-surface alpha value); + set destination alpha to opaque. + SDL_SRCALPHA not set: + copy RGB, set destination alpha to source per-surface alpha value. + both: + if SDL_SRCCOLORKEY set, only copy the pixels matching the + source colour key. + + RGBA->RGBA: + SDL_SRCALPHA set: + alpha-blend (using the source alpha channel) the RGB values; + leave destination alpha untouched. [Note: is this correct?] + SDL_SRCCOLORKEY ignored. + SDL_SRCALPHA not set: + copy all of RGBA to the destination. + if SDL_SRCCOLORKEY set, only copy the pixels matching the + RGB values of the source colour key, ignoring alpha in the + comparison. + + RGB->RGB: + SDL_SRCALPHA set: + alpha-blend (using the source per-surface alpha value). + SDL_SRCALPHA not set: + copy RGB. + both: + if SDL_SRCCOLORKEY set, only copy the pixels matching the + source colour key.r + * + * You should call SDL_BlitSurface() unless you know exactly how SDL + * blitting works internally and how to use the other blit functions. + *} + +(* SDL_surface.h uses #define to change all SDL_BlitSurface() calls into SDL_UpperBlit() calls. * + * Since Pascal macro support is very limited, we workaround by outright pointing SDL_BlitSurface() to SDL_UpperBlit(). *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_BlitSurface_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; +Var + SDL_BlitSurface : TSDL_BlitSurface_fun = Nil; +{$else} + +function SDL_BlitSurface(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; + external SDL_LibName name {$IF DEFINED(DELPHI) AND DEFINED(MACOS)} '_SDL_UpperBlit' {$ELSE} 'SDL_UpperBlit' {$IFEND}; +{$endif} + + + {** + * This is the public blit function, SDL_BlitSurface(), and it performs + * rectangle validation and clipping before passing it to SDL_LowerBlit() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UpperBlit_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; +Var + SDL_UpperBlit : TSDL_UpperBlit_fun = Nil; +{$else} + +function SDL_UpperBlit(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpperBlit' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * This is a semi-private blit function and it performs low-level surface + * blitting only. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LowerBlit_fun = function(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; +Var + SDL_LowerBlit : TSDL_LowerBlit_fun = Nil; +{$else} + +function SDL_LowerBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LowerBlit' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Perform a fast, low quality, stretch blit between two surfaces of the + * same pixel format. + * + * This function uses a static buffer, and is not thread-safe. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SoftStretch_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; const dstrect: PSDL_Surface): cint; cdecl; +Var + SDL_SoftStretch : TSDL_SoftStretch_fun = Nil; +{$else} + +function SDL_SoftStretch(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; const dstrect: PSDL_Surface): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SoftStretch' {$ENDIF} {$ENDIF}; +{$endif} + +(* SDL_surface.h uses #define to change all SDL_BlitSurfaceScaled() calls into SDL_UpperBlitScaled() calls. * + * Since Pascal macro support is very limited, we workaround by outright pointing SDL_BlitSurfaceScaled() to SDL_UpperBlitScaled(). *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_BlitSurfaceScaled_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; +Var + SDL_BlitSurfaceScaled : TSDL_BlitSurfaceScaled_fun = Nil; +{$else} + +function SDL_BlitSurfaceScaled(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; + external SDL_LibName name {$IF DEFINED(DELPHI) AND DEFINED(MACOS)} '_SDL_UpperBlitScaled' {$ELSE} 'SDL_UpperBlitScaled' {$IFEND}; +{$endif} + + {** + * This is the public scaled blit function, SDL_BlitScaled(), and it performs + * rectangle validation and clipping before passing it to SDL_LowerBlitScaled() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UpperBlitScaled_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; +Var + SDL_UpperBlitScaled : TSDL_UpperBlitScaled_fun = Nil; +{$else} + +function SDL_UpperBlitScaled(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpperBlitScaled' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * This is a semi-private blit function and it performs low-level surface + * scaled blitting only. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LowerBlitScaled_fun = function(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; +Var + SDL_LowerBlitScaled : TSDL_LowerBlitScaled_fun = Nil; +{$else} + +function SDL_LowerBlitScaled(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LowerBlitScaled' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Set the YUV conversion mode + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetYUVConversionMode_proc = procedure(mode: TSDL_YUV_CONVERSION_MODE); cdecl; +Var + SDL_SetYUVConversionMode : TSDL_SetYUVConversionMode_proc = Nil; +{$else} + +procedure SDL_SetYUVConversionMode(mode: TSDL_YUV_CONVERSION_MODE); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetYUVConversionMode' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Get the YUV conversion mode + *} +function SDL_GetYUVConversionMode: TSDL_YUV_CONVERSION_MODE; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetYUVConversionMode' {$ENDIF} {$ENDIF}; + +{** + * \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetYUVConversionModeForResolution_fun = function(width: cint; height: cint): TSDL_YUV_CONVERSION_MODE; cdecl; +Var + SDL_GetYUVConversionModeForResolution : TSDL_GetYUVConversionModeForResolution_fun = Nil; +{$else} + +function SDL_GetYUVConversionModeForResolution(width: cint; height: cint): TSDL_YUV_CONVERSION_MODE; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetYUVConversionModeForResolution' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlsystem.inc b/units/sdlsystem.inc index 0aa3cbd0..e770339c 100644 --- a/units/sdlsystem.inc +++ b/units/sdlsystem.inc @@ -1,537 +1,753 @@ -// from "SDL_system.h" - -(* Platform specific functions for Windows *) -{$IF DEFINED(WIN32) OR DEFINED(WIN64)} -type - PPSDL_WindowsMessageHook = ^PSDL_WindowsMessageHook; - PSDL_WindowsMessageHook = ^TSDL_WindowsMessageHook; - TSDL_WindowsMessageHook = procedure(userdata, hWnd: Pointer; mesage: cuint; wParam: cuint64; lParam: cint64); cdecl; - -{** - * Set a callback for every Windows message, run before TranslateMessage(). - * - * \param callback The SDL_WindowsMessageHook function to call. - * \param userdata a pointer to pass to every iteration of `callback` - * - * \since This function is available since SDL 2.0.4. - *} -procedure SDL_SetWindowsMessageHook(callback: TSDL_WindowsMessageHook; userdata: Pointer); cdecl; - external SDL_LibName; - -{** - * Get the D3D9 adapter index that matches the specified display index. - * - * The returned adapter index can be passed to `IDirect3D9::CreateDevice` and - * controls on which monitor a full screen application will appear. - * - * \param displayIndex the display index for which to get the D3D9 adapter - * index - * \returns the D3D9 adapter index on success or a negative error code on - * failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.1. - *} -function SDL_Direct3D9GetAdapterIndex(displayIndex:cint):cint; cdecl; - external SDL_LibName; - -type - PIDirect3DDevice9 = type Pointer; - PID3D11Device = type Pointer; - PID3D12Device = type Pointer; - -{** - * Get the D3D9 device associated with a renderer. - * - * Once you are done using the device, you should release it to avoid a - * resource leak. - * - * \param renderer the renderer from which to get the associated D3D device - * \returns the D3D9 device associated with given renderer or NIL if it is - * not a D3D9 renderer; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.1. - *} -function SDL_RenderGetD3D9Device(renderer:PSDL_Renderer):PIDirect3DDevice9; cdecl; - external SDL_LibName; - -{** - * Get the D3D11 device associated with a renderer. - * - * Once you are done using the device, you should release it to avoid a - * resource leak. - * - * \param renderer the renderer from which to get the associated D3D11 device - * \returns the D3D11 device associated with given renderer or NIL if it is - * not a D3D11 renderer; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.16. - *} -function SDL_RenderGetD3D11Device(renderer:PSDL_Renderer):PID3D11Device; cdecl; - external SDL_LibName; - -{** - * Get the D3D12 device associated with a renderer. - * - * Once you are done using the device, you should release it to avoid a - * resource leak. - * - * \param renderer the renderer from which to get the associated D3D12 device - * \returns the D3D12 device associated with given renderer or NIL if it is - * not a D3D12 renderer; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.24.0. - *} -function SDL_RenderGetD3D12Device(renderer:PSDL_Renderer):PID3D12Device; cdecl; - external SDL_LibName; - -{** - * Get the DXGI Adapter and Output indices for the specified display index. - * - * The DXGI Adapter and Output indices can be passed to `EnumAdapters` and - * `EnumOutputs` respectively to get the objects required to create a DX10 or - * DX11 device and swap chain. - * - * Before SDL 2.0.4 this function did not return a value. - * Since SDL 2.0.4 it returns a TSDL_bool. - * - * \param displayIndex the display index for which to get both indices - * \param adapterIndex a pointer to be filled in with the adapter index - * \param outputIndex a pointer to be filled in with the output index - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. - * - * \since This function is available since SDL 2.0.2. - *} -function SDL_DXGIGetOutputInfo(displayIndex: cint; adapterIndex, outputIndex: pcint): TSDL_Bool; - external SDL_LibName; -{$ENDIF WIN32 OR WIN64} - - -(* Platform specific functions for Linux *) -{$IFDEF LINUX} -{** - * Sets the UNIX nice value for a thread. - * - * This uses setpriority() if possible, and RealtimeKit if available. - * - * \param threadID the Unix thread ID to change priority of. - * \param priority The new, Unix-specific, priority value. - * \returns 0 on success, or -1 on error. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_LinuxSetThreadPriority(threadID: cint64; priority: cint): cint; cdecl; - external SDL_LibName; - -{** - * Sets the priority (not nice level) and scheduling policy for a thread. - * - * This uses setpriority() if possible, and RealtimeKit if available. - * - * \param threadID The Unix thread ID to change priority of. - * \param sdlPriority The new TSDL_ThreadPriority value. - * \param schedPolicy The new scheduling policy (SCHED_FIFO, SCHED_RR, - * SCHED_OTHER, etc...) - * \returns 0 on success, or -1 on error. - * - * \since This function is available since SDL 2.0.18. - *} -function SDL_LinuxSetThreadPriorityAndPolicy(threadID: cint64; sdlPriority, schedPolicy: cint): cint; cdecl; - external SDL_LibName; -{$ENDIF LINUX} - - -(* Platform specific functions for iOS *) -{$IFDEF __IPHONEOS__} -type - PPSDL_iPhoneAnimationCallback = ^PSDL_iPhoneAnimationCallback; - PSDL_iPhoneAnimationCallback = ^TSDL_iPhoneAnimationCallback; - TSDL_iPhoneAnimationCallback = procedure(callbackParam: Pointer); cdecl; - -{** - * Use this function to set the animation callback on Apple iOS. - * - * This function is only available on Apple iOS. - * - * For more information see: - * https://github.com/libsdl-org/SDL/blob/main/docs/README-ios.md - * - * \param window the window for which the animation callback should be set - * \param interval the number of frames after which **callback** will be - * called - * \param callback the function to call for every frame. - * \param callbackParam a pointer that is passed to `callback`. - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_iPhoneSetEventPump - *} -function SDL_iPhoneSetAnimationCallback(window: PSDL_Window; interval: cint; callback: TSDL_iPhoneAnimationCallback; callbackParam: Pointer); cdecl; - external SDL_LibName; - -{** - * Use this function to enable or disable the SDL event pump on Apple iOS. - * - * This function is only available on Apple iOS. - * - * \param enabled SDL_TRUE to enable the event pump, SDL_FALSE to disable it - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_iPhoneSetAnimationCallback - *} -procedure SDL_iPhoneSetEventPump(enabled: TSDL_Bool); cdecl; - external SDL_LibName; -{$ENDIF __IPHONEOS__} - - -(* Platform specific functions for Android *) -{$IFDEF ANDROID} - -{** - * Get the Android Java Native Interface Environment of the current thread. - * - * This is the JNIEnv one needs to access the Java virtual machine from native - * code, and is needed for many Android APIs to be usable from Pascal. - * - * The prototype of the function in SDL's code actually declare a Pointer return - * type, even if the implementation returns a pointer to a JNIEnv. The - * rationale being that the SDL units can avoid using the JNI unit. - * - * \returns a pointer to Java native interface object (JNIEnv) to which the - * current thread is attached, or NIL on error. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AndroidGetActivity - *} -function SDL_AndroidGetJNIEnv(): Pointer; cdecl; - external SDL_LibName; - -(** - * Retrieve the Java instance of the Android activity class. - * - * The prototype of the function in SDL's code actually declares a Pointer - * return type, even if the implementation returns a JObject. The rationale - * being that the SDL units can avoid using the JNI unit. - * - * The JObject returned by the function is a local reference and must be - * released by the caller. See the PushLocalFrame() and PopLocalFrame() or - * DeleteLocalRef() functions of the Java native interface: - * - * https://docs.oracle.com/javase/1.5.0/docs/guide/jni/spec/functions.html - * - * \returns the jobject representing the instance of the Activity class of the - * Android application, or NIL on error. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AndroidGetJNIEnv - *) -function SDL_AndroidGetActivity(): Pointer; cdecl; - external SDL_LibName; - -{** - * Query Android API level of the current device. - * - * - API level 34: Android 14 - * - API level 33: Android 13 - * - API level 32: Android 12L - * - API level 31: Android 12 - * - API level 30: Android 11 - * - API level 29: Android 10 - * - API level 28: Android 9 "Pie" - * - API level 27: Android 8.1 "Oreo" - * - API level 26: Android 8.0 "Oreo" - * - API level 25: Android 7.1 "Nougat" - * - API level 24: Android 7.0 "Nougat" - * - API level 23: Android 6.0 "Marshmallow" - * - API level 22: Android 5.1 "Lollipop" - * - API level 21: Android 5.0 "Lollipop" - * - API level 20: Android 4.4W "KitKat" - * - API level 19: Android 4.4 "KitKat" - * - API level 18: Android 4.3 "Jelly Bean" - * - API level 17: Android 4.2 "Jelly Bean" - * - API level 16: Android 4.1 "Jelly Bean" - * - API level 15: Android 4.0.3 "Ice Cream Sandwich" - * - API level 14: Android 4.0 "Ice Cream Sandwich" - * - API level 13: Android 3.2 "Honeycomb" - * - API level 12: Android 3.1 "Honeycomb" - * - API level 11: Android 3.0 "Honeycomb" - * - API level 10: Android 2.3.3 "Gingerbread" - * - * \returns the Android API level. - * - * \since This function is available since SDL 2.0.12. - *} -function SDL_GetAndroidSDKVersion(): cint; cdecl; - external SDL_LibName; - -{** - * Query if the application is running on Android TV. - * - * \returns SDL_TRUE if this is Android TV, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.8. - *} -function SDL_IsAndroidTV(): TSDL_Bool; cdecl; - external SDL_LibName; - -{** - * Query if the application is running on a Chromebook. - * - * \returns SDL_TRUE if this is a Chromebook, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_IsChromebook(): TSDL_Bool; cdecl; - external SDL_LibName; - -{** - * Query if the application is running on a Samsung DeX docking station. - * - * \returns SDL_TRUE if this is a DeX docking station, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_IsDeXMode(): TSDL_Bool; cdecl; - external SDL_LibName; - -{** - * Trigger the Android system back button behavior. - * - * \since This function is available since SDL 2.0.9. - *} -procedure SDL_AndroidBackButton(); cdecl; - external SDL_LibName; - -{** - See the official Android developer guide for more information: - http://developer.android.com/guide/topics/data/data-storage.html -*} -const - SDL_ANDROID_EXTERNAL_STORAGE_READ = $01; - SDL_ANDROID_EXTERNAL_STORAGE_WRITE = $02; - -{** - * Get the path used for internal storage for this application. - * - * This path is unique to your application and cannot be written to by other - * applications. - * - * Your internal storage path is typically: - * `/data/data/your.app.package/files`. - * - * \returns the path used for internal storage or NIL on failure; - * call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AndroidGetExternalStorageState - *} -function SDL_AndroidGetInternalStoragePath(): PAnsiChar; cdecl; - external SDL_LibName; - -{** - * Get the current state of external storage. - * - * The current state of external storage, a bitmask of these values: - * `SDL_ANDROID_EXTERNAL_STORAGE_READ`, `SDL_ANDROID_EXTERNAL_STORAGE_WRITE`. - * - * If external storage is currently unavailable, this will return 0. - * - * \returns the current state of external storage on success or 0 on failure; - * call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AndroidGetExternalStoragePath - *} -function SDL_AndroidGetExternalStorageState(): cint; cdecl; - external SDL_LibName; - -{** - * Get the path used for external storage for this application. - * - * This path is unique to your application, but is public and can be written - * to by other applications. - * - * Your external storage path is typically: - * `/storage/sdcard0/Android/data/your.app.package/files`. - * - * \returns the path used for external storage for this application on success - * or NIL on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AndroidGetExternalStorageState - *} -function SDL_AndroidGetExternalStoragePath(): PAnsiChar; cdecl; - external SDL_LibName; - -{** - * Request permissions at runtime. - * - * This blocks the calling thread until the permission is granted or denied. - * - * For a full list of possible permission names, consult the Android docs: - * https://developer.android.com/reference/android/Manifest.permission - * - * \param permission The permission to request. - * \returns SDL_TRUE if the permission was granted, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.14. - *} -function SDL_AndroidRequestPermission(const permission: PAnsiChar): TSDL_Bool; cdecl; - external SDL_LibName; - -{** - * Shows an Android toast notification. - * - * Toasts are a sort of lightweight notification that are unique to Android. - * - * https://developer.android.com/guide/topics/ui/notifiers/toasts - * - * Shows toast in UI thread. - * - * For the `gravity` parameter, choose a value from here, or -1 if you don't - * have a preference: - * - * https://developer.android.com/reference/android/view/Gravity - * - * \param message text message to be shown - * \param duration 0=short, 1=long - * \param gravity where the notification should appear on the screen. - * \param xoffset set this parameter only when gravity >=0 - * \param yoffset set this parameter only when gravity >=0 - * \returns 0 if success, -1 if any error occurs. - * - * \since This function is available since SDL 2.0.16. - *} -function SDL_AndroidShowToast(const message: PAnsiChar; duration, gravity, xoffset, yoffset: cint): cint; cdecl; - external SDL_LibName; - -{** - * Send a user command to SDLActivity. - * - * Override "boolean onUnhandledMessage(Message msg)" to handle the message. - * - * \param command user command that must be greater or equal to 0x8000 - * \param param user parameter - * - * \since This function is available since SDL 2.0.22. - *} -function SDL_AndroidSendMessage(command: cUint32; param: cint): cint; cdecl; - external SDL_LibName; -{$ENDIF ANDROID} - - -(* Platform specific functions for WinRT *) -{$IFDEF __WINRT__} -Type - {** WinRT / Windows Phone path types *} - PPSDL_WinRT_Path = ^PSDL_WinRT_Path; - PSDL_WinRT_Path = ^TSDL_WinRT_Path; - TSDL_WinRT_Path = ( - {** The installed app's root directory. - Files here are likely to be read-only. *} - SDL_WINRT_PATH_INSTALLED_LOCATION = 0, - {** The app's local data store. Files may be written here *} - SDL_WINRT_PATH_LOCAL_FOLDER = 1, - {** The app's roaming data store. Unsupported on Windows Phone. - Files written here may be copied to other machines via a network - connection. - *} - SDL_WINRT_PATH_ROAMING_FOLDER = 2, - {** The app's temporary data store. Unsupported on Windows Phone. - Files written here may be deleted at any time. *} - SDL_WINRT_PATH_TEMP_FOLDER = 3 - ); - - TSDL_WinRT_DeviceFamily = ( - {** Unknown family *} - SDL_WINRT_DEVICEFAMILY_UNKNOWN, - {** Desktop family *} - SDL_WINRT_DEVICEFAMILY_DESKTOP, - {** Mobile family (for example smartphone) *} - SDL_WINRT_DEVICEFAMILY_MOBILE, - {** XBox family *} - SDL_WINRT_DEVICEFAMILY_XBOX - ); - - - {** - * \brief Retrieves a WinRT defined path on the local file system - * - * \note Documentation on most app-specific path types on WinRT - * can be found on MSDN, at the URL: - * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx - * - * \param pathType The type of path to retrieve. - * \ret A UCS-2 string (16-bit, wide-char) containing the path, or NULL - * if the path is not available for any reason. Not all paths are - * available on all versions of Windows. This is especially true on - * Windows Phone. Check the documentation for the given - * SDL_WinRT_Path for more information on which path types are - * supported where. - *} -function SDL_WinRTGetFSPathUNICODE(pathType :TSDL_WinRT_Path):PWideChar; - cdecl; external SDL_LibName; - - - {** - * \brief Retrieves a WinRT defined path on the local file system - * - * \note Documentation on most app-specific path types on WinRT - * can be found on MSDN, at the URL: - * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx - * - * \param pathType The type of path to retrieve. - * \ret A UTF-8 string (8-bit, multi-byte) containing the path, or NULL - * if the path is not available for any reason. Not all paths are - * available on all versions of Windows. This is especially true on - * Windows Phone. Check the documentation for the given - * SDL_WinRT_Path for more information on which path types are - * supported where. - *} -function SDL_WinRTGetFSPathUTF8(pathType :TSDL_WinRT_Path):PChar; - cdecl; external SDL_LibName; - - -{** - * Detects the device family of WinRT platform at runtime. - * - * \returns a value from the SDL_WinRT_DeviceFamily enum. - * - * \since This function is available since SDL 2.0.8. - *} -function SDL_WinRTGetDeviceFamily(): TSDL_WinRT_DeviceFamily; - cdecl; external SDL_LibName; -{$ENDIF __WINRT__} - - -{** - * Query if the current device is a tablet. - * - * If SDL can't determine this, it will return SDL_FALSE. - * - * \returns SDL_TRUE if the device is a tablet, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_IsTablet(): TSDL_Bool; cdecl; - external SDL_LibName; - - -{ Functions used by iOS application delegates to notify SDL about state changes } -procedure SDL_OnApplicationWillTerminate(); cdecl; external SDL_LibName; -procedure SDL_OnApplicationDidReceiveMemoryWarning(); cdecl; external SDL_LibName; -procedure SDL_OnApplicationWillResignActive(); cdecl; external SDL_LibName; -procedure SDL_OnApplicationDidEnterBackground(); cdecl; external SDL_LibName; -procedure SDL_OnApplicationWillEnterForeground(); cdecl; external SDL_LibName; -procedure SDL_OnApplicationDidBecomeActive(); cdecl; external SDL_LibName; -{$IFDEF __IPHONEOS__} -procedure SDL_OnApplicationDidChangeStatusBarOrientation(); cdecl; external SDL_LibName; -{$ENDIF} +// from "SDL_system.h" + +(* Platform specific functions for Windows *) +{$IF DEFINED(WIN32) OR DEFINED(WIN64)} +type + PPSDL_WindowsMessageHook = ^PSDL_WindowsMessageHook; + PSDL_WindowsMessageHook = ^TSDL_WindowsMessageHook; + TSDL_WindowsMessageHook = procedure(userdata, hWnd: Pointer; mesage: cuint; wParam: cuint64; lParam: cint64); cdecl; + +{** + * Set a callback for every Windows message, run before TranslateMessage(). + * + * \param callback The SDL_WindowsMessageHook function to call. + * \param userdata a pointer to pass to every iteration of `callback` + * + * \since This function is available since SDL 2.0.4. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowsMessageHook_proc = procedure(callback: TSDL_WindowsMessageHook; userdata: Pointer); cdecl; +Var + SDL_SetWindowsMessageHook : TSDL_SetWindowsMessageHook_proc = Nil; +{$else} + +procedure SDL_SetWindowsMessageHook(callback: TSDL_WindowsMessageHook; userdata: Pointer); cdecl; + external SDL_LibName; +{$endif} + +{** + * Get the D3D9 adapter index that matches the specified display index. + * + * The returned adapter index can be passed to `IDirect3D9::CreateDevice` and + * controls on which monitor a full screen application will appear. + * + * \param displayIndex the display index for which to get the D3D9 adapter + * index + * \returns the D3D9 adapter index on success or a negative error code on + * failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.1. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_Direct3D9GetAdapterIndex_fun = function(displayIndex:cint):cint; cdecl; +Var + SDL_Direct3D9GetAdapterIndex : TSDL_Direct3D9GetAdapterIndex_fun = Nil; +{$else} + +function SDL_Direct3D9GetAdapterIndex(displayIndex:cint):cint; cdecl; + external SDL_LibName; +{$endif} + +type + PIDirect3DDevice9 = type Pointer; + PID3D11Device = type Pointer; + PID3D12Device = type Pointer; + +{** + * Get the D3D9 device associated with a renderer. + * + * Once you are done using the device, you should release it to avoid a + * resource leak. + * + * \param renderer the renderer from which to get the associated D3D device + * \returns the D3D9 device associated with given renderer or NIL if it is + * not a D3D9 renderer; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.1. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderGetD3D9Device_fun = function(renderer:PSDL_Renderer):PIDirect3DDevice9; cdecl; +Var + SDL_RenderGetD3D9Device : TSDL_RenderGetD3D9Device_fun = Nil; +{$else} + +function SDL_RenderGetD3D9Device(renderer:PSDL_Renderer):PIDirect3DDevice9; cdecl; + external SDL_LibName; +{$endif} + +{** + * Get the D3D11 device associated with a renderer. + * + * Once you are done using the device, you should release it to avoid a + * resource leak. + * + * \param renderer the renderer from which to get the associated D3D11 device + * \returns the D3D11 device associated with given renderer or NIL if it is + * not a D3D11 renderer; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.16. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderGetD3D11Device_fun = function(renderer:PSDL_Renderer):PID3D11Device; cdecl; +Var + SDL_RenderGetD3D11Device : TSDL_RenderGetD3D11Device_fun = Nil; +{$else} + +function SDL_RenderGetD3D11Device(renderer:PSDL_Renderer):PID3D11Device; cdecl; + external SDL_LibName; +{$endif} + +{** + * Get the D3D12 device associated with a renderer. + * + * Once you are done using the device, you should release it to avoid a + * resource leak. + * + * \param renderer the renderer from which to get the associated D3D12 device + * \returns the D3D12 device associated with given renderer or NIL if it is + * not a D3D12 renderer; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.24.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderGetD3D12Device_fun = function(renderer:PSDL_Renderer):PID3D12Device; cdecl; +Var + SDL_RenderGetD3D12Device : TSDL_RenderGetD3D12Device_fun = Nil; +{$else} + +function SDL_RenderGetD3D12Device(renderer:PSDL_Renderer):PID3D12Device; cdecl; + external SDL_LibName; +{$endif} + +{** + * Get the DXGI Adapter and Output indices for the specified display index. + * + * The DXGI Adapter and Output indices can be passed to `EnumAdapters` and + * `EnumOutputs` respectively to get the objects required to create a DX10 or + * DX11 device and swap chain. + * + * Before SDL 2.0.4 this function did not return a value. + * Since SDL 2.0.4 it returns a TSDL_bool. + * + * \param displayIndex the display index for which to get both indices + * \param adapterIndex a pointer to be filled in with the adapter index + * \param outputIndex a pointer to be filled in with the output index + * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() + * for more information. + * + * \since This function is available since SDL 2.0.2. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_DXGIGetOutputInfo_fun = function(displayIndex: cint; adapterIndex, outputIndex: pcint): TSDL_Bool; cdecl; +Var + SDL_DXGIGetOutputInfo : TSDL_DXGIGetOutputInfo_fun = Nil; +{$else} + +function SDL_DXGIGetOutputInfo(displayIndex: cint; adapterIndex, outputIndex: pcint): TSDL_Bool; + external SDL_LibName; cdecl; +{$endif} +{$ENDIF WIN32 OR WIN64} + + +(* Platform specific functions for Linux *) +{$IFDEF LINUX} +{** + * Sets the UNIX nice value for a thread. + * + * This uses setpriority() if possible, and RealtimeKit if available. + * + * \param threadID the Unix thread ID to change priority of. + * \param priority The new, Unix-specific, priority value. + * \returns 0 on success, or -1 on error. + * + * \since This function is available since SDL 2.0.9. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LinuxSetThreadPriority_fun = function(threadID: cint64; priority: cint): cint; cdecl; +Var + SDL_LinuxSetThreadPriority : TSDL_LinuxSetThreadPriority_fun = Nil; +{$else} + +function SDL_LinuxSetThreadPriority(threadID: cint64; priority: cint): cint; cdecl; + external SDL_LibName; +{$endif} + +{** + * Sets the priority (not nice level) and scheduling policy for a thread. + * + * This uses setpriority() if possible, and RealtimeKit if available. + * + * \param threadID The Unix thread ID to change priority of. + * \param sdlPriority The new TSDL_ThreadPriority value. + * \param schedPolicy The new scheduling policy (SCHED_FIFO, SCHED_RR, + * SCHED_OTHER, etc...) + * \returns 0 on success, or -1 on error. + * + * \since This function is available since SDL 2.0.18. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LinuxSetThreadPriorityAndPolicy_fun = function(threadID: cint64; sdlPriority, schedPolicy: cint): cint; cdecl; +Var + SDL_LinuxSetThreadPriorityAndPolicy : TSDL_LinuxSetThreadPriorityAndPolicy_fun = Nil; +{$else} + +function SDL_LinuxSetThreadPriorityAndPolicy(threadID: cint64; sdlPriority, schedPolicy: cint): cint; cdecl; + external SDL_LibName; +{$endif} +{$ENDIF LINUX} + + +(* Platform specific functions for iOS *) +{$IFDEF __IPHONEOS__} +type + PPSDL_iPhoneAnimationCallback = ^PSDL_iPhoneAnimationCallback; + PSDL_iPhoneAnimationCallback = ^TSDL_iPhoneAnimationCallback; + TSDL_iPhoneAnimationCallback = procedure(callbackParam: Pointer); cdecl; + +{** + * Use this function to set the animation callback on Apple iOS. + * + * This function is only available on Apple iOS. + * + * For more information see: + * https://github.com/libsdl-org/SDL/blob/main/docs/README-ios.md + * + * \param window the window for which the animation callback should be set + * \param interval the number of frames after which **callback** will be + * called + * \param callback the function to call for every frame. + * \param callbackParam a pointer that is passed to `callback`. + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_iPhoneSetEventPump + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_iPhoneSetAnimationCallback_fun = function(window: PSDL_Window; interval: cint; callback: TSDL_iPhoneAnimationCallback; callbackParam: Pointer); cdecl; +Var + SDL_iPhoneSetAnimationCallback : TSDL_iPhoneSetAnimationCallback_fun = Nil; +{$else} + +function SDL_iPhoneSetAnimationCallback(window: PSDL_Window; interval: cint; callback: TSDL_iPhoneAnimationCallback; callbackParam: Pointer); cdecl; + external SDL_LibName; +{$endif} + +{** + * Use this function to enable or disable the SDL event pump on Apple iOS. + * + * This function is only available on Apple iOS. + * + * \param enabled SDL_TRUE to enable the event pump, SDL_FALSE to disable it + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_iPhoneSetAnimationCallback + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_iPhoneSetEventPump_proc = procedure(enabled: TSDL_Bool); cdecl; +Var + SDL_iPhoneSetEventPump : TSDL_iPhoneSetEventPump_proc = Nil; +{$else} + +procedure SDL_iPhoneSetEventPump(enabled: TSDL_Bool); cdecl; + external SDL_LibName; +{$endif} +{$ENDIF __IPHONEOS__} + + +(* Platform specific functions for Android *) +{$IFDEF ANDROID} + +{** + * Get the Android Java Native Interface Environment of the current thread. + * + * This is the JNIEnv one needs to access the Java virtual machine from native + * code, and is needed for many Android APIs to be usable from Pascal. + * + * The prototype of the function in SDL's code actually declare a Pointer return + * type, even if the implementation returns a pointer to a JNIEnv. The + * rationale being that the SDL units can avoid using the JNI unit. + * + * \returns a pointer to Java native interface object (JNIEnv) to which the + * current thread is attached, or NIL on error. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AndroidGetActivity + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AndroidGetJNIEnv_fun = function(): Pointer; cdecl; +Var + SDL_AndroidGetJNIEnv : TSDL_AndroidGetJNIEnv_fun = Nil; +{$else} + +function SDL_AndroidGetJNIEnv(): Pointer; cdecl; + external SDL_LibName; +{$endif} + +(** + * Retrieve the Java instance of the Android activity class. + * + * The prototype of the function in SDL's code actually declares a Pointer + * return type, even if the implementation returns a JObject. The rationale + * being that the SDL units can avoid using the JNI unit. + * + * The JObject returned by the function is a local reference and must be + * released by the caller. See the PushLocalFrame() and PopLocalFrame() or + * DeleteLocalRef() functions of the Java native interface: + * + * https://docs.oracle.com/javase/1.5.0/docs/guide/jni/spec/functions.html + * + * \returns the jobject representing the instance of the Activity class of the + * Android application, or NIL on error. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AndroidGetJNIEnv + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AndroidGetActivity_fun = function(): Pointer; cdecl; +Var + SDL_AndroidGetActivity : TSDL_AndroidGetActivity_fun = Nil; +{$else} + +function SDL_AndroidGetActivity(): Pointer; cdecl; + external SDL_LibName; +{$endif} + +{** + * Query Android API level of the current device. + * + * - API level 34: Android 14 + * - API level 33: Android 13 + * - API level 32: Android 12L + * - API level 31: Android 12 + * - API level 30: Android 11 + * - API level 29: Android 10 + * - API level 28: Android 9 "Pie" + * - API level 27: Android 8.1 "Oreo" + * - API level 26: Android 8.0 "Oreo" + * - API level 25: Android 7.1 "Nougat" + * - API level 24: Android 7.0 "Nougat" + * - API level 23: Android 6.0 "Marshmallow" + * - API level 22: Android 5.1 "Lollipop" + * - API level 21: Android 5.0 "Lollipop" + * - API level 20: Android 4.4W "KitKat" + * - API level 19: Android 4.4 "KitKat" + * - API level 18: Android 4.3 "Jelly Bean" + * - API level 17: Android 4.2 "Jelly Bean" + * - API level 16: Android 4.1 "Jelly Bean" + * - API level 15: Android 4.0.3 "Ice Cream Sandwich" + * - API level 14: Android 4.0 "Ice Cream Sandwich" + * - API level 13: Android 3.2 "Honeycomb" + * - API level 12: Android 3.1 "Honeycomb" + * - API level 11: Android 3.0 "Honeycomb" + * - API level 10: Android 2.3.3 "Gingerbread" + * + * \returns the Android API level. + * + * \since This function is available since SDL 2.0.12. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetAndroidSDKVersion_fun = function(): cint; cdecl; +Var + SDL_GetAndroidSDKVersion : TSDL_GetAndroidSDKVersion_fun = Nil; +{$else} + +function SDL_GetAndroidSDKVersion(): cint; cdecl; + external SDL_LibName; +{$endif} + +{** + * Query if the application is running on Android TV. + * + * \returns SDL_TRUE if this is Android TV, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.8. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_IsAndroidTV_fun = function(): TSDL_Bool; cdecl; +Var + SDL_IsAndroidTV : TSDL_IsAndroidTV_fun = Nil; +{$else} + +function SDL_IsAndroidTV(): TSDL_Bool; cdecl; + external SDL_LibName; +{$endif} + +{** + * Query if the application is running on a Chromebook. + * + * \returns SDL_TRUE if this is a Chromebook, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.9. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_IsChromebook_fun = function(): TSDL_Bool; cdecl; +Var + SDL_IsChromebook : TSDL_IsChromebook_fun = Nil; +{$else} + +function SDL_IsChromebook(): TSDL_Bool; cdecl; + external SDL_LibName; +{$endif} + +{** + * Query if the application is running on a Samsung DeX docking station. + * + * \returns SDL_TRUE if this is a DeX docking station, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.9. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_IsDeXMode_fun = function(): TSDL_Bool; cdecl; +Var + SDL_IsDeXMode : TSDL_IsDeXMode_fun = Nil; +{$else} + +function SDL_IsDeXMode(): TSDL_Bool; cdecl; + external SDL_LibName; +{$endif} + +{** + * Trigger the Android system back button behavior. + * + * \since This function is available since SDL 2.0.9. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AndroidBackButton_proc = procedure(); cdecl; +Var + SDL_AndroidBackButton : TSDL_AndroidBackButton_proc = Nil; +{$else} + +procedure SDL_AndroidBackButton(); cdecl; + external SDL_LibName; +{$endif} + +{** + See the official Android developer guide for more information: + http://developer.android.com/guide/topics/data/data-storage.html +*} +const + SDL_ANDROID_EXTERNAL_STORAGE_READ = $01; + SDL_ANDROID_EXTERNAL_STORAGE_WRITE = $02; + +{** + * Get the path used for internal storage for this application. + * + * This path is unique to your application and cannot be written to by other + * applications. + * + * Your internal storage path is typically: + * `/data/data/your.app.package/files`. + * + * \returns the path used for internal storage or NIL on failure; + * call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AndroidGetExternalStorageState + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AndroidGetInternalStoragePath_fun = function(): PAnsiChar; cdecl; +Var + SDL_AndroidGetInternalStoragePath : TSDL_AndroidGetInternalStoragePath_fun = Nil; +{$else} + +function SDL_AndroidGetInternalStoragePath(): PAnsiChar; cdecl; + external SDL_LibName; +{$endif} + +{** + * Get the current state of external storage. + * + * The current state of external storage, a bitmask of these values: + * `SDL_ANDROID_EXTERNAL_STORAGE_READ`, `SDL_ANDROID_EXTERNAL_STORAGE_WRITE`. + * + * If external storage is currently unavailable, this will return 0. + * + * \returns the current state of external storage on success or 0 on failure; + * call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AndroidGetExternalStoragePath + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AndroidGetExternalStorageState_fun = function(): cint; cdecl; +Var + SDL_AndroidGetExternalStorageState : TSDL_AndroidGetExternalStorageState_fun = Nil; +{$else} + +function SDL_AndroidGetExternalStorageState(): cint; cdecl; + external SDL_LibName; +{$endif} + +{** + * Get the path used for external storage for this application. + * + * This path is unique to your application, but is public and can be written + * to by other applications. + * + * Your external storage path is typically: + * `/storage/sdcard0/Android/data/your.app.package/files`. + * + * \returns the path used for external storage for this application on success + * or NIL on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AndroidGetExternalStorageState + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AndroidGetExternalStoragePath_fun = function(): PAnsiChar; cdecl; +Var + SDL_AndroidGetExternalStoragePath : TSDL_AndroidGetExternalStoragePath_fun = Nil; +{$else} + +function SDL_AndroidGetExternalStoragePath(): PAnsiChar; cdecl; + external SDL_LibName; +{$endif} + +{** + * Request permissions at runtime. + * + * This blocks the calling thread until the permission is granted or denied. + * + * For a full list of possible permission names, consult the Android docs: + * https://developer.android.com/reference/android/Manifest.permission + * + * \param permission The permission to request. + * \returns SDL_TRUE if the permission was granted, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.14. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AndroidRequestPermission_fun = function(const permission: PAnsiChar): TSDL_Bool; cdecl; +Var + SDL_AndroidRequestPermission : TSDL_AndroidRequestPermission_fun = Nil; +{$else} + +function SDL_AndroidRequestPermission(const permission: PAnsiChar): TSDL_Bool; cdecl; + external SDL_LibName; +{$endif} + +{** + * Shows an Android toast notification. + * + * Toasts are a sort of lightweight notification that are unique to Android. + * + * https://developer.android.com/guide/topics/ui/notifiers/toasts + * + * Shows toast in UI thread. + * + * For the `gravity` parameter, choose a value from here, or -1 if you don't + * have a preference: + * + * https://developer.android.com/reference/android/view/Gravity + * + * \param message text message to be shown + * \param duration 0=short, 1=long + * \param gravity where the notification should appear on the screen. + * \param xoffset set this parameter only when gravity >=0 + * \param yoffset set this parameter only when gravity >=0 + * \returns 0 if success, -1 if any error occurs. + * + * \since This function is available since SDL 2.0.16. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AndroidShowToast_fun = function(const message: PAnsiChar; duration, gravity, xoffset, yoffset: cint): cint; cdecl; +Var + SDL_AndroidShowToast : TSDL_AndroidShowToast_fun = Nil; +{$else} + +function SDL_AndroidShowToast(const message: PAnsiChar; duration, gravity, xoffset, yoffset: cint): cint; cdecl; + external SDL_LibName; +{$endif} + +{** + * Send a user command to SDLActivity. + * + * Override "boolean onUnhandledMessage(Message msg)" to handle the message. + * + * \param command user command that must be greater or equal to 0x8000 + * \param param user parameter + * + * \since This function is available since SDL 2.0.22. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AndroidSendMessage_fun = function(command: cUint32; param: cint): cint; cdecl; +Var + SDL_AndroidSendMessage : TSDL_AndroidSendMessage_fun = Nil; +{$else} + +function SDL_AndroidSendMessage(command: cUint32; param: cint): cint; cdecl; + external SDL_LibName; +{$endif} +{$ENDIF ANDROID} + + +(* Platform specific functions for WinRT *) +{$IFDEF __WINRT__} +Type + {** WinRT / Windows Phone path types *} + PPSDL_WinRT_Path = ^PSDL_WinRT_Path; + PSDL_WinRT_Path = ^TSDL_WinRT_Path; + TSDL_WinRT_Path = ( + {** The installed app's root directory. + Files here are likely to be read-only. *} + SDL_WINRT_PATH_INSTALLED_LOCATION = 0, + {** The app's local data store. Files may be written here *} + SDL_WINRT_PATH_LOCAL_FOLDER = 1, + {** The app's roaming data store. Unsupported on Windows Phone. + Files written here may be copied to other machines via a network + connection. + *} + SDL_WINRT_PATH_ROAMING_FOLDER = 2, + {** The app's temporary data store. Unsupported on Windows Phone. + Files written here may be deleted at any time. *} + SDL_WINRT_PATH_TEMP_FOLDER = 3 + ); + + TSDL_WinRT_DeviceFamily = ( + {** Unknown family *} + SDL_WINRT_DEVICEFAMILY_UNKNOWN, + {** Desktop family *} + SDL_WINRT_DEVICEFAMILY_DESKTOP, + {** Mobile family (for example smartphone) *} + SDL_WINRT_DEVICEFAMILY_MOBILE, + {** XBox family *} + SDL_WINRT_DEVICEFAMILY_XBOX + ); + + + {** + * \brief Retrieves a WinRT defined path on the local file system + * + * \note Documentation on most app-specific path types on WinRT + * can be found on MSDN, at the URL: + * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx + * + * \param pathType The type of path to retrieve. + * \ret A UCS-2 string (16-bit, wide-char) containing the path, or NULL + * if the path is not available for any reason. Not all paths are + * available on all versions of Windows. This is especially true on + * Windows Phone. Check the documentation for the given + * SDL_WinRT_Path for more information on which path types are + * supported where. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WinRTGetFSPathUNICODE_fun = function(pathT +Var + SDL_WinRTGetFSPathUNICODE : TSDL_WinRTGetFSPathUNICODE_fun = Nil; +{$else} + +function SDL_WinRTGetFSPathUNICODE(pathType :TSDL_WinRT_Path):PWideChar; + cdecl; external SDL_LibName; +{$endif} + + + {** + * \brief Retrieves a WinRT defined path on the local file system + * + * \note Documentation on most app-specific path types on WinRT + * can be found on MSDN, at the URL: + * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx + * + * \param pathType The type of path to retrieve. + * \ret A UTF-8 string (8-bit, multi-byte) containing the path, or NULL + * if the path is not available for any reason. Not all paths are + * available on all versions of Windows. This is especially true on + * Windows Phone. Check the documentation for the given + * SDL_WinRT_Path for more information on which path types are + * supported where. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WinRTGetFSPathUTF8_fun = function(pathT +Var + SDL_WinRTGetFSPathUTF8 : TSDL_WinRTGetFSPathUTF8_fun = Nil; +{$else} + +function SDL_WinRTGetFSPathUTF8(pathType :TSDL_WinRT_Path):PChar; + cdecl; external SDL_LibName; +{$endif} + + +{** + * Detects the device family of WinRT platform at runtime. + * + * \returns a value from the SDL_WinRT_DeviceFamily enum. + * + * \since This function is available since SDL 2.0.8. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WinRTGetDeviceFamily_fun = function(): TS +Var + SDL_WinRTGetDeviceFamily : TSDL_WinRTGetDeviceFamily_fun = Nil; +{$else} + +function SDL_WinRTGetDeviceFamily(): TSDL_WinRT_DeviceFamily; + cdecl; external SDL_LibName; +{$endif} +{$ENDIF __WINRT__} + + +{** + * Query if the current device is a tablet. + * + * If SDL can't determine this, it will return SDL_FALSE. + * + * \returns SDL_TRUE if the device is a tablet, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.9. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_IsTablet_fun = function(): TSDL_Bool; cdecl; +Var + SDL_IsTablet : TSDL_IsTablet_fun = Nil; +{$else} + +function SDL_IsTablet(): TSDL_Bool; cdecl; + external SDL_LibName; +{$endif} + + +{ Functions used by iOS application delegates to notify SDL about state changes } +procedure SDL_OnApplicationWillTerminate(); cdecl; external SDL_LibName; +procedure SDL_OnApplicationDidReceiveMemoryWarning(); cdecl; external SDL_LibName; +procedure SDL_OnApplicationWillResignActive(); cdecl; external SDL_LibName; +procedure SDL_OnApplicationDidEnterBackground(); cdecl; external SDL_LibName; +procedure SDL_OnApplicationWillEnterForeground(); cdecl; external SDL_LibName; +procedure SDL_OnApplicationDidBecomeActive(); cdecl; external SDL_LibName; +{$IFDEF __IPHONEOS__} +procedure SDL_OnApplicationDidChangeStatusBarOrientation(); cdecl; external SDL_LibName; +{$ENDIF} diff --git a/units/sdlsyswm.inc b/units/sdlsyswm.inc index 69bcc655..9ef78877 100644 --- a/units/sdlsyswm.inc +++ b/units/sdlsyswm.inc @@ -1,361 +1,369 @@ -// from sdl_syswm.h - -{** - * \brief SDL_syswm.h - * - * Your application has access to a special type of event ::SDL_SYSWMEVENT, - * which contains window-manager specific information and arrives whenever - * an unhandled window event occurs. This event is ignored by default, but - * you can enable it with SDL_EventState(). - *} - -{$IFDEF WINDOWS} - {$DEFINE SDL_VIDEO_DRIVER_WINDOWS} -{$ENDIF} - -{$IFDEF UNIX} - {$IF NOT (DEFINED(DARWIN) OR DEFINED(ANDROID))} - {$DEFINE SDL_VIDEO_DRIVER_X11} - {$IFEND} -{$ENDIF} - -(* - * Disabled because FPC does not ship a DirectFB unit. - * If you have some working DirectFB bindings, feel welcome to enable this and check if it breaks anything. - *) -{$UNDEF SDL_VIDEO_DRIVER_DIRECTFB} - -{$IFDEF DARWIN} - {$DEFINE SDL_VIDEO_DRIVER_COCOA} -{$ENDIF} - -(* - * Disabled because it's a Mac-specific video driver and we have no means of testing it. - * If you own a Mac, feel welcome to enable this and check if it actually compiles and doesn't break anything. - *) -{$UNDEF SDL_VIDEO_DRIVER_UIKIT} - -(* - * Disabled because FPC does not ship a Wayland unit. - * If you have some working Wayland bindings, feel welcome to enable this, - * check if it actually compiles and doesn't break anything. - *) -{$UNDEF SDL_VIDEO_DRIVER_WAYLAND} - -(* - * Disabled because FPC does not ship a Mir unit. - * Also, support for Mir has been removed in SDL 2.0.10. - *) -{$UNDEF SDL_VIDEO_DRIVER_MIR} - -(* - * Disabled because FPC does not support WinRT. - *) -{$UNDEF SDL_VIDEO_DRIVER_WINRT} - -{$IFDEF ANDROID} - {$DEFINE SDL_VIDEO_DRIVER_ANDROID} -{$ENDIF} - -(* - * Disabled because this is an embedded platform and we have no means of testing this. - * If you're actually working with Vivante, feel welcome to enable this - * and check if it compiles and works properly. - *) -{$UNDEF SDL_VIDEO_DRIVER_VIVANTE} - -{$IFDEF OS2} - {$DEFINE SDL_VIDEO_DRIVER_OS2} -{$ENDIF} - -{ SDL2-for-Pascal: Disabled because there are no FPC/Delphi units available. } -{$UNDEF SDL_VIDEO_DRIVER_KMSDRM} - -{$IFDEF HAIKU} - {$DEFINE SDL_VIDEO_DRIVER_HAIKU} -{$ENDIF} - - -{** - * These are the various supported windowing subsystems - *} -type - TSDL_SYSWM_TYPE = type cint; - -const - SDL_SYSWM_UNKNOWN = TSDL_SYSWM_TYPE(0); - SDL_SYSWM_WINDOWS = TSDL_SYSWM_TYPE(1); - SDL_SYSWM_X11 = TSDL_SYSWM_TYPE(2); - SDL_SYSWM_DIRECTFB = TSDL_SYSWM_TYPE(3); - SDL_SYSWM_COCOA = TSDL_SYSWM_TYPE(4); - SDL_SYSWM_UIKIT = TSDL_SYSWM_TYPE(5); - SDL_SYSWM_WAYLAND = TSDL_SYSWM_TYPE(6); - SDL_SYSWM_MIR = TSDL_SYSWM_TYPE(7); // * no longer available, left for API/ABI compatibility. Remove in 2.1! * - SDL_SYSWM_WINRT = TSDL_SYSWM_TYPE(8); - SDL_SYSWM_ANDROID = TSDL_SYSWM_TYPE(9); - SDL_SYSWM_VIVANTE = TSDL_SYSWM_TYPE(10); - SDL_SYSWM_OS2 = TSDL_SYSWM_TYPE(11); - SDL_SYSWM_HAIKU = TSDL_SYSWM_TYPE(12); - SDL_SYSWM_KMSDRM = TSDL_SYSWM_TYPE(13); - SDL_SYSWM_RISCOS = TSDL_SYSWM_TYPE(14); - -/// sdl_syswm.h uses anonymous structs, declared right in SDL_SysWMmsg and SDL_SysWMinfo. -/// Since Pascal does not allow this, we workaround by introducing named types. -type -{$IFDEF SDL_VIDEO_DRIVER_WINDOWS} - __SYSWM_WINDOWS = record - hwnd: HWND; {**< The window for the message } - msg: UINT; {**< The type of message *} - wParam: WPARAM; {**< WORD message parameter *} - lParam: LPARAM; {**< LONG message parameter *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_X11} - __SYSWM_X11 = record - event: {$IFDEF FPC} TXEvent {$ELSE} XEvent {$ENDIF}; - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_DIRECTFB} - __SYSWM_DIRECTFB = record - event: DFBEvent; - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_COCOA} - __SYSWM_COCOA = record - (* No Cocoa window events yet *) - dummy: cint; - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_UIKIT} - __SYSWM_UIKIT = record - (* No UIKit window events yet *) - dummy: cint; - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_VIVANTE} - __SYSWM_VIVANTE = record - (* No Vivante window events yet *) - dummy: cint; - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_OS2} - __SYSWM_OS2 = record - fFrame: Boolean; {**< TRUE if hwnd is a frame window *} - hwnd: HWND; {**< The window receiving the message *} - msg: ULONG; {**< The message identifier *} - mp1: MPARAM; {**< The first first message parameter *} - mp2: MPARAM; {**< The second first message parameter *} - end; -{$ENDIF} - -{** - * The custom window manager information structure. - * - * When this structure is returned, it holds information about which - * low level system it is using, and will be one of SDL_SYSWM_TYPE. - *} - -{$IFDEF SDL_VIDEO_DRIVER_WINDOWS} - __WMINFO_WINDOWS = record - window: HWND; {**< The window handle *} - hdc: HDC; {**< The window device context *} - hinstance: HINST; {**< The instance handle *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_WINRT} - __WMINFO_WINRT = record - window: IInspectable; {**< The WinRT CoreWindow *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_X11} - __WMINFO_X11 = record - display: PDisplay; {**< The X11 display *} - window: TWindow; {**< The X11 window *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_DIRECTFB} - __WMINFO_DIRECTFB = record - dfb: IDirectFB; {**< The directfb main interface *} - window: IDirectFBWindow; {**< The directfb window handle *} - surface: IDirectFBSurface; {**< The directfb client surface *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_COCOA} - __WMINFO_COCOA = record - window: NSWindow; {* The Cocoa window *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_UIKIT} - __WMINFO_UIKIT = record - window: UIWindow; {* The UIKit window *} - framebuffer: GLuint; {* The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. *} - colorbuffer: GLuint; {* The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. *} - resolveFramebuffer: GLuint; {* The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_WAYLAND} - __WMINFO_WAYLAND = record - display: wl_display; {**< Wayland display *} - surface: wl_surface; {**< Wayland surface *} - shell_surface: Pointer; {**< DEPRECATED Wayland shell_surface (window manager handle) *} - egl_window: wl_egl_window; {**< Wayland EGL window (native window) *} - xdg_surface: xdg_surface; {**< Wayland xdg surface (window manager handle) *} - xdg_toplevel: xdg_toplevel; {**< Wayland xdg toplevel role *} - xdg_popup: xdg_popup; {**< Wayland xdg popup role *} - xdg_positioner: xdg_positioner; {**< Wayland xdg positioner, for popup *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_MIR} {* no longer available, left for API/ABI compatibility. Remove in 2.1! *} - __WMINFO_MIR = record - connection: PMirConnection; {**< Mir display server connection *} - surface: PMirSurface; {**< Mir surface *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_ANDROID} - __WMINFO_ANDROID = record - window: Pointer; // PANativeWindow; - surface: Pointer; // PEGLSurface; - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_OS2} - __WMINFO_OS2 = record - hwnd: HWND; {**< The window handle *} - hwndFrame: HWND; {**< The frame window handle *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_VIVANTE} - __WMINFO_VIVANTE = record - display: EGLNativeDisplayType; - window: EGLNativeWindowType; - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_KMSDRM} - __WMINFO_KMSDRM = record - dev_index: cint; {**< Device index (ex: the X in /dev/dri/cardX) *} - drm_fd: cint; {**< DRM FD (unavailable on Vulkan windows) *} - gbm_device: Pointer; // *gbm_dev {**< GBM device (unavailable on Vulkan windows) *} - end; -{$ENDIF} - - - - -{** - * The custom event structure. - *} - PPSDL_SysWMmsg = ^PSDL_SysWMmsg; - PSDL_SysWMmsg = ^TSDL_SysWMmsg; - TSDL_SysWMmsg = record - version: TSDL_version; - case subsystem: TSDL_SYSWM_TYPE of - {$IFDEF SDL_VIDEO_DRIVER_WINDOWS} - SDL_SYSWM_WINDOWS: (win: __SYSWM_WINDOWS); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_X11} - SDL_SYSWM_X11: (x11: __SYSWM_X11); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_DIRECTFB} - SDL_SYSWM_DIRECTFB: (dfb: __SYSWM_DIRECTFB); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_COCOA} - SDL_SYSWM_COCOA: (cocoa: __SYSWM_COCOA); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_UIKIT} - SDL_SYSWM_UIKIT: (uikit: __SYSWM_UIKIT); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_VIVANTE} - SDL_SYSWM_VIVANTE: (vivante: __SYSWM_VIVANTE); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_OS2} - SDL_SYSWM_OS2: (os2: __SYSWM_OS2); - {$ENDIF} - SDL_SYSWM_UNKNOWN: (dummy: integer); - end; - -{** - * The custom window manager information structure. - * - * When this structure is returned, it holds information about which - * low level system it is using, and will be one of SDL_SYSWM_TYPE. - *} - PPSDL_SysWMinfo = ^PSDL_SysWMinfo; - PSDL_SysWMinfo = ^TSDL_SysWMinfo; - TSDL_SysWMinfo = record - version: TSDL_version; - case subsystem: TSDL_SYSWM_TYPE of - {$IFDEF SDL_VIDEO_DRIVER_WINDOWS} - SDL_SYSWM_WINDOWS: (win : __WMINFO_WINDOWS); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_WINRT} - SDL_SYSWM_WINRT: (winrt : __WMINFO_WINRT); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_X11} - SDL_SYSWM_X11: (x11 : __WMINFO_X11); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_DIRECTFB} - SDL_SYSWM_DIRECTFB: (dfb : __WMINFO_DIRECTFB); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_COCOA} - SDL_SYSWM_COCOA: (cocoa : __WMINFO_COCOA); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_UIKIT} - SDL_SYSWM_UIKIT: (uikit : __WMINFO_UIKIT); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_WAYLAND} - SDL_SYSWM_WAYLAND: (wl : __WMINFO_WAYLAND); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_MIR} - SDL_SYSWM_MIR: (mir : __WMINFO_MIR); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_ANDROID} - SDL_SYSWM_ANDROID: (android: __WMINFO_ANDROID); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_VIVANTE} - SDL_SYSWM_VIVANTE: (vivante: __WMINFO_VIVANTE); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_OS2} - SDL_SYSWM_OS2: (os2: __WMINFO_OS2); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_KMSDRM} - SDL_SYSWM_KMSDRM: (kmsdrm: __WMINFO_KMSDRM); - {$ENDIF} - (* Ensure this union is always 64 bytes (8 64-bit pointers) *) - SDL_SYSWM_UNKNOWN: (dummy: array[0..63] of Byte); - end; - -(** - * Get driver-specific information about a window. - * - * You must include SDL_syswm.h for the declaration of SDL_SysWMinfo. - * - * The caller must initialize the `info` structure's version by using - * `SDL_VERSION(&info.version)`, and then this function will fill in the rest - * of the structure with information about the given window. - * - * \param window the window about which information is being requested - * \param info an SDL_SysWMinfo structure filled in with window information - * \returns SDL_TRUE if the function is implemented and the `version` member - * of the `info` struct is valid, or SDL_FALSE if the information - * could not be retrieved; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *) -function SDL_GetWindowWMInfo(window: PSDL_Window; info: PSDL_SysWMinfo): TSDL_bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowWMInfo' {$ENDIF} {$ENDIF}; +// from sdl_syswm.h + +{** + * \brief SDL_syswm.h + * + * Your application has access to a special type of event ::SDL_SYSWMEVENT, + * which contains window-manager specific information and arrives whenever + * an unhandled window event occurs. This event is ignored by default, but + * you can enable it with SDL_EventState(). + *} + +{$IFDEF WINDOWS} + {$DEFINE SDL_VIDEO_DRIVER_WINDOWS} +{$ENDIF} + +{$IFDEF UNIX} + {$IF NOT (DEFINED(DARWIN) OR DEFINED(ANDROID))} + {$DEFINE SDL_VIDEO_DRIVER_X11} + {$IFEND} +{$ENDIF} + +(* + * Disabled because FPC does not ship a DirectFB unit. + * If you have some working DirectFB bindings, feel welcome to enable this and check if it breaks anything. + *) +{$UNDEF SDL_VIDEO_DRIVER_DIRECTFB} + +{$IFDEF DARWIN} + {$DEFINE SDL_VIDEO_DRIVER_COCOA} +{$ENDIF} + +(* + * Disabled because it's a Mac-specific video driver and we have no means of testing it. + * If you own a Mac, feel welcome to enable this and check if it actually compiles and doesn't break anything. + *) +{$UNDEF SDL_VIDEO_DRIVER_UIKIT} + +(* + * Disabled because FPC does not ship a Wayland unit. + * If you have some working Wayland bindings, feel welcome to enable this, + * check if it actually compiles and doesn't break anything. + *) +{$UNDEF SDL_VIDEO_DRIVER_WAYLAND} + +(* + * Disabled because FPC does not ship a Mir unit. + * Also, support for Mir has been removed in SDL 2.0.10. + *) +{$UNDEF SDL_VIDEO_DRIVER_MIR} + +(* + * Disabled because FPC does not support WinRT. + *) +{$UNDEF SDL_VIDEO_DRIVER_WINRT} + +{$IFDEF ANDROID} + {$DEFINE SDL_VIDEO_DRIVER_ANDROID} +{$ENDIF} + +(* + * Disabled because this is an embedded platform and we have no means of testing this. + * If you're actually working with Vivante, feel welcome to enable this + * and check if it compiles and works properly. + *) +{$UNDEF SDL_VIDEO_DRIVER_VIVANTE} + +{$IFDEF OS2} + {$DEFINE SDL_VIDEO_DRIVER_OS2} +{$ENDIF} + +{ SDL2-for-Pascal: Disabled because there are no FPC/Delphi units available. } +{$UNDEF SDL_VIDEO_DRIVER_KMSDRM} + +{$IFDEF HAIKU} + {$DEFINE SDL_VIDEO_DRIVER_HAIKU} +{$ENDIF} + + +{** + * These are the various supported windowing subsystems + *} +type + TSDL_SYSWM_TYPE = type cint; + +const + SDL_SYSWM_UNKNOWN = TSDL_SYSWM_TYPE(0); + SDL_SYSWM_WINDOWS = TSDL_SYSWM_TYPE(1); + SDL_SYSWM_X11 = TSDL_SYSWM_TYPE(2); + SDL_SYSWM_DIRECTFB = TSDL_SYSWM_TYPE(3); + SDL_SYSWM_COCOA = TSDL_SYSWM_TYPE(4); + SDL_SYSWM_UIKIT = TSDL_SYSWM_TYPE(5); + SDL_SYSWM_WAYLAND = TSDL_SYSWM_TYPE(6); + SDL_SYSWM_MIR = TSDL_SYSWM_TYPE(7); // * no longer available, left for API/ABI compatibility. Remove in 2.1! * + SDL_SYSWM_WINRT = TSDL_SYSWM_TYPE(8); + SDL_SYSWM_ANDROID = TSDL_SYSWM_TYPE(9); + SDL_SYSWM_VIVANTE = TSDL_SYSWM_TYPE(10); + SDL_SYSWM_OS2 = TSDL_SYSWM_TYPE(11); + SDL_SYSWM_HAIKU = TSDL_SYSWM_TYPE(12); + SDL_SYSWM_KMSDRM = TSDL_SYSWM_TYPE(13); + SDL_SYSWM_RISCOS = TSDL_SYSWM_TYPE(14); + +/// sdl_syswm.h uses anonymous structs, declared right in SDL_SysWMmsg and SDL_SysWMinfo. +/// Since Pascal does not allow this, we workaround by introducing named types. +type +{$IFDEF SDL_VIDEO_DRIVER_WINDOWS} + __SYSWM_WINDOWS = record + hwnd: HWND; {**< The window for the message } + msg: UINT; {**< The type of message *} + wParam: WPARAM; {**< WORD message parameter *} + lParam: LPARAM; {**< LONG message parameter *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_X11} + __SYSWM_X11 = record + event: {$IFDEF FPC} TXEvent {$ELSE} XEvent {$ENDIF}; + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_DIRECTFB} + __SYSWM_DIRECTFB = record + event: DFBEvent; + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_COCOA} + __SYSWM_COCOA = record + (* No Cocoa window events yet *) + dummy: cint; + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_UIKIT} + __SYSWM_UIKIT = record + (* No UIKit window events yet *) + dummy: cint; + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_VIVANTE} + __SYSWM_VIVANTE = record + (* No Vivante window events yet *) + dummy: cint; + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_OS2} + __SYSWM_OS2 = record + fFrame: Boolean; {**< TRUE if hwnd is a frame window *} + hwnd: HWND; {**< The window receiving the message *} + msg: ULONG; {**< The message identifier *} + mp1: MPARAM; {**< The first first message parameter *} + mp2: MPARAM; {**< The second first message parameter *} + end; +{$ENDIF} + +{** + * The custom window manager information structure. + * + * When this structure is returned, it holds information about which + * low level system it is using, and will be one of SDL_SYSWM_TYPE. + *} + +{$IFDEF SDL_VIDEO_DRIVER_WINDOWS} + __WMINFO_WINDOWS = record + window: HWND; {**< The window handle *} + hdc: HDC; {**< The window device context *} + hinstance: HINST; {**< The instance handle *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_WINRT} + __WMINFO_WINRT = record + window: IInspectable; {**< The WinRT CoreWindow *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_X11} + __WMINFO_X11 = record + display: PDisplay; {**< The X11 display *} + window: TWindow; {**< The X11 window *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_DIRECTFB} + __WMINFO_DIRECTFB = record + dfb: IDirectFB; {**< The directfb main interface *} + window: IDirectFBWindow; {**< The directfb window handle *} + surface: IDirectFBSurface; {**< The directfb client surface *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_COCOA} + __WMINFO_COCOA = record + window: NSWindow; {* The Cocoa window *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_UIKIT} + __WMINFO_UIKIT = record + window: UIWindow; {* The UIKit window *} + framebuffer: GLuint; {* The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. *} + colorbuffer: GLuint; {* The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. *} + resolveFramebuffer: GLuint; {* The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_WAYLAND} + __WMINFO_WAYLAND = record + display: wl_display; {**< Wayland display *} + surface: wl_surface; {**< Wayland surface *} + shell_surface: Pointer; {**< DEPRECATED Wayland shell_surface (window manager handle) *} + egl_window: wl_egl_window; {**< Wayland EGL window (native window) *} + xdg_surface: xdg_surface; {**< Wayland xdg surface (window manager handle) *} + xdg_toplevel: xdg_toplevel; {**< Wayland xdg toplevel role *} + xdg_popup: xdg_popup; {**< Wayland xdg popup role *} + xdg_positioner: xdg_positioner; {**< Wayland xdg positioner, for popup *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_MIR} {* no longer available, left for API/ABI compatibility. Remove in 2.1! *} + __WMINFO_MIR = record + connection: PMirConnection; {**< Mir display server connection *} + surface: PMirSurface; {**< Mir surface *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_ANDROID} + __WMINFO_ANDROID = record + window: Pointer; // PANativeWindow; + surface: Pointer; // PEGLSurface; + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_OS2} + __WMINFO_OS2 = record + hwnd: HWND; {**< The window handle *} + hwndFrame: HWND; {**< The frame window handle *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_VIVANTE} + __WMINFO_VIVANTE = record + display: EGLNativeDisplayType; + window: EGLNativeWindowType; + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_KMSDRM} + __WMINFO_KMSDRM = record + dev_index: cint; {**< Device index (ex: the X in /dev/dri/cardX) *} + drm_fd: cint; {**< DRM FD (unavailable on Vulkan windows) *} + gbm_device: Pointer; // *gbm_dev {**< GBM device (unavailable on Vulkan windows) *} + end; +{$ENDIF} + + + + +{** + * The custom event structure. + *} + PPSDL_SysWMmsg = ^PSDL_SysWMmsg; + PSDL_SysWMmsg = ^TSDL_SysWMmsg; + TSDL_SysWMmsg = record + version: TSDL_version; + case subsystem: TSDL_SYSWM_TYPE of + {$IFDEF SDL_VIDEO_DRIVER_WINDOWS} + SDL_SYSWM_WINDOWS: (win: __SYSWM_WINDOWS); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_X11} + SDL_SYSWM_X11: (x11: __SYSWM_X11); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_DIRECTFB} + SDL_SYSWM_DIRECTFB: (dfb: __SYSWM_DIRECTFB); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_COCOA} + SDL_SYSWM_COCOA: (cocoa: __SYSWM_COCOA); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_UIKIT} + SDL_SYSWM_UIKIT: (uikit: __SYSWM_UIKIT); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_VIVANTE} + SDL_SYSWM_VIVANTE: (vivante: __SYSWM_VIVANTE); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_OS2} + SDL_SYSWM_OS2: (os2: __SYSWM_OS2); + {$ENDIF} + SDL_SYSWM_UNKNOWN: (dummy: integer); + end; + +{** + * The custom window manager information structure. + * + * When this structure is returned, it holds information about which + * low level system it is using, and will be one of SDL_SYSWM_TYPE. + *} + PPSDL_SysWMinfo = ^PSDL_SysWMinfo; + PSDL_SysWMinfo = ^TSDL_SysWMinfo; + TSDL_SysWMinfo = record + version: TSDL_version; + case subsystem: TSDL_SYSWM_TYPE of + {$IFDEF SDL_VIDEO_DRIVER_WINDOWS} + SDL_SYSWM_WINDOWS: (win : __WMINFO_WINDOWS); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_WINRT} + SDL_SYSWM_WINRT: (winrt : __WMINFO_WINRT); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_X11} + SDL_SYSWM_X11: (x11 : __WMINFO_X11); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_DIRECTFB} + SDL_SYSWM_DIRECTFB: (dfb : __WMINFO_DIRECTFB); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_COCOA} + SDL_SYSWM_COCOA: (cocoa : __WMINFO_COCOA); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_UIKIT} + SDL_SYSWM_UIKIT: (uikit : __WMINFO_UIKIT); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_WAYLAND} + SDL_SYSWM_WAYLAND: (wl : __WMINFO_WAYLAND); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_MIR} + SDL_SYSWM_MIR: (mir : __WMINFO_MIR); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_ANDROID} + SDL_SYSWM_ANDROID: (android: __WMINFO_ANDROID); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_VIVANTE} + SDL_SYSWM_VIVANTE: (vivante: __WMINFO_VIVANTE); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_OS2} + SDL_SYSWM_OS2: (os2: __WMINFO_OS2); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_KMSDRM} + SDL_SYSWM_KMSDRM: (kmsdrm: __WMINFO_KMSDRM); + {$ENDIF} + (* Ensure this union is always 64 bytes (8 64-bit pointers) *) + SDL_SYSWM_UNKNOWN: (dummy: array[0..63] of Byte); + end; + +(** + * Get driver-specific information about a window. + * + * You must include SDL_syswm.h for the declaration of SDL_SysWMinfo. + * + * The caller must initialize the `info` structure's version by using + * `SDL_VERSION(&info.version)`, and then this function will fill in the rest + * of the structure with information about the given window. + * + * \param window the window about which information is being requested + * \param info an SDL_SysWMinfo structure filled in with window information + * \returns SDL_TRUE if the function is implemented and the `version` member + * of the `info` struct is valid, or SDL_FALSE if the information + * could not be retrieved; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowWMInfo_fun = function(window: PSDL_Window; info: PSDL_SysWMinfo): TSDL_bool; cdecl; +Var + SDL_GetWindowWMInfo : TSDL_GetWindowWMInfo_fun = Nil; +{$else} + +function SDL_GetWindowWMInfo(window: PSDL_Window; info: PSDL_SysWMinfo): TSDL_bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowWMInfo' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlthread.inc b/units/sdlthread.inc index bd27ec4e..f8083c51 100644 --- a/units/sdlthread.inc +++ b/units/sdlthread.inc @@ -1,418 +1,514 @@ -// based on "sdl_thread.h" - -{** - * \file SDL_thread.h - * - * Header for the SDL thread management routines. - *} - -{* The SDL thread structure, defined in SDL_thread.c *} -type - PSDL_Thread = type Pointer; - - {* The SDL thread ID *} - PPSDL_threadID = ^PSDL_threadID; - PSDL_threadID = ^TSDL_threadID; - TSDL_threadID = culong; - - {* Thread local storage ID, 0 is the invalid ID *} - PPSDL_TLSID = ^PSDL_TLSID; - PSDL_TLSID = ^TSDL_TLSID; - TSDL_TLSID = cuint; - - {** - * The SDL thread priority. - * - * SDL will make system changes as necessary in order to apply the thread priority. - * Code which attempts to control thread state related to priority should be aware - * that calling SDL_SetThreadPriority may alter such state. - * SDL_HINT_THREAD_PRIORITY_POLICY can be used to control aspects of this behavior. - * - * \note On many systems you require special privileges to set high or time critical priority. - *} -type - PPSDL_ThreadPriority = ^PSDL_ThreadPriority; - PSDL_ThreadPriority = ^TSDL_ThreadPriority; - TSDL_ThreadPriority = cint; - -const - SDL_THREAD_PRIORITY_LOW = TSDL_ThreadPriority(0); - SDL_THREAD_PRIORITY_NORMAL = TSDL_ThreadPriority(1); - SDL_THREAD_PRIORITY_HIGH = TSDL_ThreadPriority(2); - SDL_THREAD_PRIORITY_TIME_CRITICAL = TSDL_ThreadPriority(3); - - {** - * The function passed to SDL_CreateThread(). - * - * \param data what was passed as `data` to SDL_CreateThread() - * \returns a value that can be reported through SDL_WaitThread(). - *} -type - PPSDL_ThreadFunction = ^PSDL_ThreadFunction; - PSDL_ThreadFunction = ^TSDL_ThreadFunction; - TSDL_ThreadFunction = function(data: Pointer): cint; cdecl; - -{$IFDEF WINDOWS} - {** - * SDL_thread.h - * - * We compile SDL into a DLL. This means, that it's the DLL which - * creates a new thread for the calling process with the SDL_CreateThread() - * API. There is a problem with this, that only the RTL of the SDL.DLL will - * be initialized for those threads, and not the RTL of the calling - * application! - * - * To solve this, we make a little hack here. - * - * We'll always use the caller's _beginthread() and _endthread() APIs to - * start a new thread. This way, if it's the SDL.DLL which uses this API, - * then the RTL of SDL.DLL will be used to create the new thread, and if it's - * the application, then the RTL of the application will be used. - * - * So, in short: - * Always use the _beginthread() and _endthread() of the calling runtime - * library! - *} -{$DEFINE SDL_PASSED_BEGINTHREAD_ENDTHREAD} - -type - { SDL2-for-Pascal: #todo : Needed? } - {$IFNDEF FPC} - {$IFNDEF DELPHI16UP} - TThreadID = Cardinal; - {$ENDIF} - {$ENDIF} - - { SDL2-for-Pascal #todo : Explanation needed } - TpfnSDL_CurrentBeginThread = function( - SecurityAttributes: Pointer; StackSize: cuint; ThreadFunc: TThreadFunc; - Parameter: Pointer {arg}; CreationFlags: cuint; var ThreadId: TThreadID {threadID}): cuintptr_t; cdecl; - - TpfnSDL_CurrentEndThread = procedure(code: cuint); cdecl; - - -function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PAnsiChar; - data: Pointer; - pfnBeginThread: TpfnSDL_CurrentBeginThread; - pfnEndThread: TpfnSDL_CurrentEndThread): PSDL_Thread; cdecl; overload; - external SDL_LibName; - -function SDL_CreateThreadWithStackSize(fn: TSDL_ThreadFunction; - name: PAnsiChar; const stacksize: csize_t; data: Pointer; - pfnBeginThread: TpfnSDL_CurrentBeginThread; - pfnEndThread: TpfnSDL_CurrentEndThread): PSDL_Thread; cdecl; overload; - external SDL_LibName; - -{ SDL2-For-Pascal: #note : In the C header are two versions - of these macro functions. One for SDL's dynamic API and one without. - We can go with this for the moment. Improvement surely possible. } -function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PAnsiChar; - data: Pointer): PSDL_Thread; overload; - -function SDL_CreateThreadWithStackSize(fn: TSDL_ThreadFunction; name: PAnsiChar; - const stacksize: csize_t; data: Pointer): PSDL_Thread; overload; - - -{ SDL2-For-Pascal: #todo : - The OS2 part of SDL_thread.h is not translated, yet. - The ELSE block is covering this right now. Not sure if the - OS2 platform switch is implemented in Delphi. } -//{$ELSEIF OS2} -//{* -// * just like the windows case above: We compile SDL2 -// * into a dll with Watcom's runtime statically linked. -// *} - -{ ... } - -{$ELSE} - - {** - * Create a thread. - * - * Thread naming is a little complicated: Most systems have very small - * limits for the string length (BeOS has 32 bytes, Linux currently has 16, - * Visual C++ 6.0 has nine!), and possibly other arbitrary rules. You'll - * have to see what happens with your system's debugger. The name should be - * UTF-8 (but using the naming limits of C identifiers is a better bet). - * There are no requirements for thread naming conventions, so long as the - * string is null-terminated UTF-8, but these guidelines are helpful in - * choosing a name: - * - * http://stackoverflow.com/questions/149932/naming-conventions-for-threads - * - * If a system imposes requirements, SDL will try to munge the string for - * it (truncate, etc), but the original string contents will be available - * from SDL_GetThreadName(). - *} -function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PAnsiChar; - data: Pointer): PSDL_Thread; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateThread' {$ENDIF} {$ENDIF}; - -{** - * Create a new thread with a specific stack size. - * - * SDL makes an attempt to report `name` to the system, so that debuggers can - * display it. Not all platforms support this. - * - * Thread naming is a little complicated: Most systems have very small limits - * for the string length (Haiku has 32 bytes, Linux currently has 16, Visual - * C++ 6.0 has _nine_!), and possibly other arbitrary rules. You'll have to - * see what happens with your system's debugger. The name should be UTF-8 (but - * using the naming limits of C identifiers is a better bet). There are no - * requirements for thread naming conventions, so long as the string is - * null-terminated UTF-8, but these guidelines are helpful in choosing a name: - * - * https://stackoverflow.com/questions/149932/naming-conventions-for-threads - * - * If a system imposes requirements, SDL will try to munge the string for it - * (truncate, etc), but the original string contents will be available from - * SDL_GetThreadName(). - * - * The size (in bytes) of the new stack can be specified. Zero means "use the - * system default" which might be wildly different between platforms. x86 - * Linux generally defaults to eight megabytes, an embedded device might be a - * few kilobytes instead. You generally need to specify a stack that is a - * multiple of the system's page size (in many cases, this is 4 kilobytes, but - * check your system documentation). - * - * In SDL 2.1, stack size will be folded into the original SDL_CreateThread - * function, but for backwards compatibility, this is currently a separate - * function. - * - * \param fn the SDL_ThreadFunction function to call in the new thread - * \param name the name of the thread - * \param stacksize the size, in bytes, to allocate for the new thread stack. - * \param data a pointer that is passed to `fn` - * \returns an opaque pointer to the new thread object on success, NULL if the - * new thread could not be created; call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.9. - * - * \sa SDL_WaitThread - *} -function SDL_CreateThreadWithStackSize(fn: TSDL_ThreadFunction; name: PAnsiChar; - stacksize: csize_t; data: Pointer): PSDL_Thread; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateThreadWithStackSize' {$ENDIF} {$ENDIF}; - - -{$ENDIF} - - {** - * Get the thread name as it was specified in SDL_CreateThread(). - * - * This is internal memory, not to be freed by the caller, and remains valid - * until the specified thread is cleaned up by SDL_WaitThread(). - * - * \param thread the thread to query - * \returns a pointer to a UTF-8 string that names the specified thread, or - * NULL if it doesn't have a name. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_CreateThread - *} -function SDL_GetThreadName(thread: PSDL_Thread): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetThreadName' {$ENDIF}{$ENDIF}; - - {** - * Get the thread identifier for the current thread. - * - * This thread identifier is as reported by the underlying operating system. - * If SDL is running on a platform that does not support threads the return - * value will always be zero. - * - * This function also returns a valid thread ID when called from the main - * thread. - * - * \returns the ID of the current thread. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetThreadID - *} -function SDL_ThreadID: TSDL_ThreadID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ThreadID' {$ENDIF}{$ENDIF}; - - {** - * Get the thread identifier for the specified thread. - * - * This thread identifier is as reported by the underlying operating system. - * If SDL is running on a platform that does not support threads the return - * value will always be zero. - * - * \param thread the thread to query - * \returns the ID of the specified thread, or the ID of the current thread if - * `thread` is NULL. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_ThreadID - *} -function SDL_GetThreadID(thread: PSDL_Thread): TSDL_ThreadID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetThreadID' {$ENDIF}{$ENDIF}; - - {** - * Set the priority for the current thread. - * - * Note that some platforms will not let you alter the priority (or at least, - * promote the thread to a higher priority) at all, and some require you to be - * an administrator account. Be prepared for this to fail. - * - * \param priority the SDL_ThreadPriority to set - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *} -function SDL_SetThreadPriority(priority: TSDL_ThreadPriority): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetThreadPriority' {$ENDIF}{$ENDIF}; - - {** - * Wait for a thread to finish. - * - * Threads that haven't been detached will remain (as a "zombie") until this - * function cleans them up. Not doing so is a resource leak. - * - * Once a thread has been cleaned up through this function, the SDL_Thread - * that references it becomes invalid and should not be referenced again. As - * such, only one thread may call SDL_WaitThread() on another. - * - * The return code for the thread function is placed in the area pointed to by - * `status`, if `status` is not NULL. - * - * You may not wait on a thread that has been used in a call to - * SDL_DetachThread(). Use either that function or this one, but not both, or - * behavior is undefined. - * - * It is safe to pass a NULL thread to this function; it is a no-op. - * - * Note that the thread pointer is freed by this function and is not valid - * afterward. - * - * \param thread the SDL_Thread pointer that was returned from the - * SDL_CreateThread() call that started this thread - * \param status pointer to an integer that will receive the value returned - * from the thread function by its 'return', or NULL to not - * receive such value back. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_CreateThread - * \sa SDL_DetachThread - *} -procedure SDL_WaitThread(thread: PSDL_Thread; status: pcint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WaitThread' {$ENDIF}{$ENDIF}; - - {** - * Let a thread clean up on exit without intervention. - * - * A thread may be "detached" to signify that it should not remain until - * another thread has called SDL_WaitThread() on it. Detaching a thread is - * useful for long-running threads that nothing needs to synchronize with or - * further manage. When a detached thread is done, it simply goes away. - * - * There is no way to recover the return code of a detached thread. If you - * need this, don't detach the thread and instead use SDL_WaitThread(). - * - * Once a thread is detached, you should usually assume the SDL_Thread isn't - * safe to reference again, as it will become invalid immediately upon the - * detached thread's exit, instead of remaining until someone has called - * SDL_WaitThread() to finally clean it up. As such, don't detach the same - * thread more than once. - * - * If a thread has already exited when passed to SDL_DetachThread(), it will - * stop waiting for a call to SDL_WaitThread() and clean up immediately. It is - * not safe to detach a thread that might be used with SDL_WaitThread(). - * - * You may not call SDL_WaitThread() on a thread that has been detached. Use - * either that function or this one, but not both, or behavior is undefined. - * - * It is safe to pass NULL to this function; it is a no-op. - * - * \param thread the SDL_Thread pointer that was returned from the - * SDL_CreateThread() call that started this thread - * - * \since This function is available since SDL 2.0.2. - * - * \sa SDL_CreateThread - * \sa SDL_WaitThread - *} -procedure SDL_DetachThread(thread:PSDL_Thread); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DetachThread' {$ENDIF}{$ENDIF}; - - {** - * Create a piece of thread-local storage. - * - * This creates an identifier that is globally visible to all threads but - * refers to data that is thread-specific. - * - * \returns the newly created thread local storage identifier or 0 on error. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_TLSGet - * \sa SDL_TLSSet - *} -function SDL_TLSCreate: TSDL_TLSID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TLSCreate' {$ENDIF} {$ENDIF}; - - {** - * Get the current thread's value associated with a thread local storage ID. - * - * \param id the thread local storage ID - * \returns the value associated with the ID for the current thread or NULL if - * no value has been set; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_TLSCreate - * \sa SDL_TLSSet - *} -function SDL_TLSGet(id: TSDL_TLSID): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TLSGet' {$ENDIF} {$ENDIF}; - -type - { SDL2-For-Pascal: This function pointer is introduced to specifiy the - destructor pointer in the SDL_TLSSet function - according to C headers. - - The TTLSDestructor type itself is not defined - by the original SDL2 headers. } - TTLSDestructor = procedure(value: Pointer); cdecl; - - {** - * Set the current thread's value associated with a thread local storage ID. - * - * The function prototype for `destructor` is: - * - * ```c - * void destructor(void *value) - * ``` - * - * where its parameter `value` is what was passed as `value` to SDL_TLSSet(). - * - * \param id the thread local storage ID - * \param value the value to associate with the ID for the current thread - * \param destructor a function called when the thread exits, to free the - * value - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_TLSCreate - * \sa SDL_TLSGet - *} -function SDL_TLSSet(id: TSDL_TLSID; const value: Pointer; destructor_: TTLSDestructor): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TLSSet' {$ENDIF} {$ENDIF}; - -{** - * Cleanup all TLS data for this thread. - * - * \since This function is available since SDL 2.0.16. - *} -procedure SDL_TLSCleanup; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TLSCleanup' {$ENDIF} {$ENDIF}; - +// based on "sdl_thread.h" + +{** + * \file SDL_thread.h + * + * Header for the SDL thread management routines. + *} + +{* The SDL thread structure, defined in SDL_thread.c *} +type + PSDL_Thread = type Pointer; + + {* The SDL thread ID *} + PPSDL_threadID = ^PSDL_threadID; + PSDL_threadID = ^TSDL_threadID; + TSDL_threadID = culong; + + {* Thread local storage ID, 0 is the invalid ID *} + PPSDL_TLSID = ^PSDL_TLSID; + PSDL_TLSID = ^TSDL_TLSID; + TSDL_TLSID = cuint; + + {** + * The SDL thread priority. + * + * SDL will make system changes as necessary in order to apply the thread priority. + * Code which attempts to control thread state related to priority should be aware + * that calling SDL_SetThreadPriority may alter such state. + * SDL_HINT_THREAD_PRIORITY_POLICY can be used to control aspects of this behavior. + * + * \note On many systems you require special privileges to set high or time critical priority. + *} +type + PPSDL_ThreadPriority = ^PSDL_ThreadPriority; + PSDL_ThreadPriority = ^TSDL_ThreadPriority; + TSDL_ThreadPriority = cint; + +const + SDL_THREAD_PRIORITY_LOW = TSDL_ThreadPriority(0); + SDL_THREAD_PRIORITY_NORMAL = TSDL_ThreadPriority(1); + SDL_THREAD_PRIORITY_HIGH = TSDL_ThreadPriority(2); + SDL_THREAD_PRIORITY_TIME_CRITICAL = TSDL_ThreadPriority(3); + + {** + * The function passed to SDL_CreateThread(). + * + * \param data what was passed as `data` to SDL_CreateThread() + * \returns a value that can be reported through SDL_WaitThread(). + *} +type + PPSDL_ThreadFunction = ^PSDL_ThreadFunction; + PSDL_ThreadFunction = ^TSDL_ThreadFunction; + TSDL_ThreadFunction = function(data: Pointer): cint; cdecl; + +{$IFDEF WINDOWS} + {** + * SDL_thread.h + * + * We compile SDL into a DLL. This means, that it's the DLL which + * creates a new thread for the calling process with the SDL_CreateThread() + * API. There is a problem with this, that only the RTL of the SDL.DLL will + * be initialized for those threads, and not the RTL of the calling + * application! + * + * To solve this, we make a little hack here. + * + * We'll always use the caller's _beginthread() and _endthread() APIs to + * start a new thread. This way, if it's the SDL.DLL which uses this API, + * then the RTL of SDL.DLL will be used to create the new thread, and if it's + * the application, then the RTL of the application will be used. + * + * So, in short: + * Always use the _beginthread() and _endthread() of the calling runtime + * library! + *} +{$DEFINE SDL_PASSED_BEGINTHREAD_ENDTHREAD} + +type + { SDL2-for-Pascal: #todo : Needed? } + {$IFNDEF FPC} + {$IFNDEF DELPHI16UP} + TThreadID = Cardinal; + {$ENDIF} + {$ENDIF} + + { SDL2-for-Pascal #todo : Explanation needed } + TpfnSDL_CurrentBeginThread = function( + SecurityAttributes: Pointer; StackSize: cuint; ThreadFunc: TThreadFunc; + Parameter: Pointer {arg}; CreationFlags: cuint; var ThreadId: TThreadID {threadID}): cuintptr_t; cdecl; + + TpfnSDL_CurrentEndThread = procedure(code: cuint); cdecl; + + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateThread_fun = function(fn: TSDL_ThreadFunction; name: PAnsiChar; + data: Pointer; + pfnBeginThread: TpfnSDL_CurrentBeginThread; + pfnEndThread: TpfnSDL_CurrentEndThread): PSDL_Thread; cdecl; +Var + SDL_CreateThread : TSDL_CreateThread_fun = Nil; +{$else} + +function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PAnsiChar; + data: Pointer; + pfnBeginThread: TpfnSDL_CurrentBeginThread; + pfnEndThread: TpfnSDL_CurrentEndThread): PSDL_Thread; cdecl; overload; + external SDL_LibName; +{$endif} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateThreadWithStackSize_fun = function(fn: TSDL_ThreadFunction; + name: PAnsiChar; const stacksize: csize_t; data: Pointer; + pfnBeginThread: TpfnSDL_CurrentBeginThread; + pfnEndThread: TpfnSDL_CurrentEndThread): PSDL_Thread; cdecl; +Var + SDL_CreateThreadWithStackSize : TSDL_CreateThreadWithStackSize_fun = Nil; +{$else} + +function SDL_CreateThreadWithStackSize(fn: TSDL_ThreadFunction; + name: PAnsiChar; const stacksize: csize_t; data: Pointer; + pfnBeginThread: TpfnSDL_CurrentBeginThread; + pfnEndThread: TpfnSDL_CurrentEndThread): PSDL_Thread; cdecl; overload; + external SDL_LibName; +{$endif} + +{ SDL2-For-Pascal: #note : In the C header are two versions + of these macro functions. One for SDL's dynamic API and one without. + We can go with this for the moment. Improvement surely possible. } +function SDL_CreateThread2(fn: TSDL_ThreadFunction; name: PAnsiChar; + data: Pointer): PSDL_Thread; overload; + +function SDL_CreateThreadWithStackSize2(fn: TSDL_ThreadFunction; name: PAnsiChar; + const stacksize: csize_t; data: Pointer): PSDL_Thread; overload; + + +{ SDL2-For-Pascal: #todo : + The OS2 part of SDL_thread.h is not translated, yet. + The ELSE block is covering this right now. Not sure if the + OS2 platform switch is implemented in Delphi. } +//{$ELSEIF OS2} +//{* +// * just like the windows case above: We compile SDL2 +// * into a dll with Watcom's runtime statically linked. +// *} + +{ ... } + +{$ELSE} + + {** + * Create a thread. + * + * Thread naming is a little complicated: Most systems have very small + * limits for the string length (BeOS has 32 bytes, Linux currently has 16, + * Visual C++ 6.0 has nine!), and possibly other arbitrary rules. You'll + * have to see what happens with your system's debugger. The name should be + * UTF-8 (but using the naming limits of C identifiers is a better bet). + * There are no requirements for thread naming conventions, so long as the + * string is null-terminated UTF-8, but these guidelines are helpful in + * choosing a name: + * + * http://stackoverflow.com/questions/149932/naming-conventions-for-threads + * + * If a system imposes requirements, SDL will try to munge the string for + * it (truncate, etc), but the original string contents will be available + * from SDL_GetThreadName(). + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateThread_fun = function(fn: TSDL_ThreadFunction; name: PAnsiChar; + data: Pointer): PSDL_Thread; cdecl; +Var + SDL_CreateThread : TSDL_CreateThread_fun = Nil; +{$else} + +function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PAnsiChar; + data: Pointer): PSDL_Thread; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateThread' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Create a new thread with a specific stack size. + * + * SDL makes an attempt to report `name` to the system, so that debuggers can + * display it. Not all platforms support this. + * + * Thread naming is a little complicated: Most systems have very small limits + * for the string length (Haiku has 32 bytes, Linux currently has 16, Visual + * C++ 6.0 has _nine_!), and possibly other arbitrary rules. You'll have to + * see what happens with your system's debugger. The name should be UTF-8 (but + * using the naming limits of C identifiers is a better bet). There are no + * requirements for thread naming conventions, so long as the string is + * null-terminated UTF-8, but these guidelines are helpful in choosing a name: + * + * https://stackoverflow.com/questions/149932/naming-conventions-for-threads + * + * If a system imposes requirements, SDL will try to munge the string for it + * (truncate, etc), but the original string contents will be available from + * SDL_GetThreadName(). + * + * The size (in bytes) of the new stack can be specified. Zero means "use the + * system default" which might be wildly different between platforms. x86 + * Linux generally defaults to eight megabytes, an embedded device might be a + * few kilobytes instead. You generally need to specify a stack that is a + * multiple of the system's page size (in many cases, this is 4 kilobytes, but + * check your system documentation). + * + * In SDL 2.1, stack size will be folded into the original SDL_CreateThread + * function, but for backwards compatibility, this is currently a separate + * function. + * + * \param fn the SDL_ThreadFunction function to call in the new thread + * \param name the name of the thread + * \param stacksize the size, in bytes, to allocate for the new thread stack. + * \param data a pointer that is passed to `fn` + * \returns an opaque pointer to the new thread object on success, NULL if the + * new thread could not be created; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.9. + * + * \sa SDL_WaitThread + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateThreadWithStackSize_fun = function(fn: TSDL_ThreadFunction; name: PAnsiChar; + stacksize: csize_t; data: Pointer): PSDL_Thread; cdecl; +Var + SDL_CreateThreadWithStackSize : TSDL_CreateThreadWithStackSize_fun = Nil; +{$else} + +function SDL_CreateThreadWithStackSize(fn: TSDL_ThreadFunction; name: PAnsiChar; + stacksize: csize_t; data: Pointer): PSDL_Thread; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateThreadWithStackSize' {$ENDIF} {$ENDIF}; +{$endif} + + +{$ENDIF} + + {** + * Get the thread name as it was specified in SDL_CreateThread(). + * + * This is internal memory, not to be freed by the caller, and remains valid + * until the specified thread is cleaned up by SDL_WaitThread(). + * + * \param thread the thread to query + * \returns a pointer to a UTF-8 string that names the specified thread, or + * NULL if it doesn't have a name. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_CreateThread + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetThreadName_fun = function(thread: PSDL_Thread): PAnsiChar; cdecl; +Var + SDL_GetThreadName : TSDL_GetThreadName_fun = Nil; +{$else} + +function SDL_GetThreadName(thread: PSDL_Thread): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetThreadName' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Get the thread identifier for the current thread. + * + * This thread identifier is as reported by the underlying operating system. + * If SDL is running on a platform that does not support threads the return + * value will always be zero. + * + * This function also returns a valid thread ID when called from the main + * thread. + * + * \returns the ID of the current thread. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetThreadID + *} +function SDL_ThreadID: TSDL_ThreadID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ThreadID' {$ENDIF}{$ENDIF}; + + {** + * Get the thread identifier for the specified thread. + * + * This thread identifier is as reported by the underlying operating system. + * If SDL is running on a platform that does not support threads the return + * value will always be zero. + * + * \param thread the thread to query + * \returns the ID of the specified thread, or the ID of the current thread if + * `thread` is NULL. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_ThreadID + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetThreadID_fun = function(thread: PSDL_Thread): TSDL_ThreadID; cdecl; +Var + SDL_GetThreadID : TSDL_GetThreadID_fun = Nil; +{$else} + +function SDL_GetThreadID(thread: PSDL_Thread): TSDL_ThreadID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetThreadID' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Set the priority for the current thread. + * + * Note that some platforms will not let you alter the priority (or at least, + * promote the thread to a higher priority) at all, and some require you to be + * an administrator account. Be prepared for this to fail. + * + * \param priority the SDL_ThreadPriority to set + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetThreadPriority_fun = function(priority: TSDL_ThreadPriority): cint; cdecl; +Var + SDL_SetThreadPriority : TSDL_SetThreadPriority_fun = Nil; +{$else} + +function SDL_SetThreadPriority(priority: TSDL_ThreadPriority): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetThreadPriority' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Wait for a thread to finish. + * + * Threads that haven't been detached will remain (as a "zombie") until this + * function cleans them up. Not doing so is a resource leak. + * + * Once a thread has been cleaned up through this function, the SDL_Thread + * that references it becomes invalid and should not be referenced again. As + * such, only one thread may call SDL_WaitThread() on another. + * + * The return code for the thread function is placed in the area pointed to by + * `status`, if `status` is not NULL. + * + * You may not wait on a thread that has been used in a call to + * SDL_DetachThread(). Use either that function or this one, but not both, or + * behavior is undefined. + * + * It is safe to pass a NULL thread to this function; it is a no-op. + * + * Note that the thread pointer is freed by this function and is not valid + * afterward. + * + * \param thread the SDL_Thread pointer that was returned from the + * SDL_CreateThread() call that started this thread + * \param status pointer to an integer that will receive the value returned + * from the thread function by its 'return', or NULL to not + * receive such value back. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_CreateThread + * \sa SDL_DetachThread + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WaitThread_proc = procedure(thread: PSDL_Thread; status: pcint); cdecl; +Var + SDL_WaitThread : TSDL_WaitThread_proc = Nil; +{$else} + +procedure SDL_WaitThread(thread: PSDL_Thread; status: pcint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WaitThread' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Let a thread clean up on exit without intervention. + * + * A thread may be "detached" to signify that it should not remain until + * another thread has called SDL_WaitThread() on it. Detaching a thread is + * useful for long-running threads that nothing needs to synchronize with or + * further manage. When a detached thread is done, it simply goes away. + * + * There is no way to recover the return code of a detached thread. If you + * need this, don't detach the thread and instead use SDL_WaitThread(). + * + * Once a thread is detached, you should usually assume the SDL_Thread isn't + * safe to reference again, as it will become invalid immediately upon the + * detached thread's exit, instead of remaining until someone has called + * SDL_WaitThread() to finally clean it up. As such, don't detach the same + * thread more than once. + * + * If a thread has already exited when passed to SDL_DetachThread(), it will + * stop waiting for a call to SDL_WaitThread() and clean up immediately. It is + * not safe to detach a thread that might be used with SDL_WaitThread(). + * + * You may not call SDL_WaitThread() on a thread that has been detached. Use + * either that function or this one, but not both, or behavior is undefined. + * + * It is safe to pass NULL to this function; it is a no-op. + * + * \param thread the SDL_Thread pointer that was returned from the + * SDL_CreateThread() call that started this thread + * + * \since This function is available since SDL 2.0.2. + * + * \sa SDL_CreateThread + * \sa SDL_WaitThread + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_DetachThread_proc = procedure(thread:PSDL_Thread); cdecl; +Var + SDL_DetachThread : TSDL_DetachThread_proc = Nil; +{$else} + +procedure SDL_DetachThread(thread:PSDL_Thread); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DetachThread' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Create a piece of thread-local storage. + * + * This creates an identifier that is globally visible to all threads but + * refers to data that is thread-specific. + * + * \returns the newly created thread local storage identifier or 0 on error. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_TLSGet + * \sa SDL_TLSSet + *} +function SDL_TLSCreate: TSDL_TLSID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TLSCreate' {$ENDIF} {$ENDIF}; + + {** + * Get the current thread's value associated with a thread local storage ID. + * + * \param id the thread local storage ID + * \returns the value associated with the ID for the current thread or NULL if + * no value has been set; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_TLSCreate + * \sa SDL_TLSSet + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_TLSGet_fun = function(id: TSDL_TLSID): Pointer; cdecl; +Var + SDL_TLSGet : TSDL_TLSGet_fun = Nil; +{$else} + +function SDL_TLSGet(id: TSDL_TLSID): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TLSGet' {$ENDIF} {$ENDIF}; +{$endif} + +type + { SDL2-For-Pascal: This function pointer is introduced to specifiy the + destructor pointer in the SDL_TLSSet function + according to C headers. + + The TTLSDestructor type itself is not defined + by the original SDL2 headers. } + TTLSDestructor = procedure(value: Pointer); cdecl; + + {** + * Set the current thread's value associated with a thread local storage ID. + * + * The function prototype for `destructor` is: + * + * ```c + * void destructor(void *value) + * ``` + * + * where its parameter `value` is what was passed as `value` to SDL_TLSSet(). + * + * \param id the thread local storage ID + * \param value the value to associate with the ID for the current thread + * \param destructor a function called when the thread exits, to free the + * value + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_TLSCreate + * \sa SDL_TLSGet + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_TLSSet_fun = function(id: TSDL_TLSID; const value: Pointer; destructor_: TTLSDestructor): cint; cdecl; +Var + SDL_TLSSet : TSDL_TLSSet_fun = Nil; +{$else} + +function SDL_TLSSet(id: TSDL_TLSID; const value: Pointer; destructor_: TTLSDestructor): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TLSSet' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Cleanup all TLS data for this thread. + * + * \since This function is available since SDL 2.0.16. + *} +procedure SDL_TLSCleanup; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TLSCleanup' {$ENDIF} {$ENDIF}; + diff --git a/units/sdltimer.inc b/units/sdltimer.inc index ea336c91..0d7d3e7b 100644 --- a/units/sdltimer.inc +++ b/units/sdltimer.inc @@ -1,89 +1,113 @@ -// based on "sdl_timer.h" (2.0.14) - -{** - * Get the number of milliseconds since the SDL library initialization. - * - * This value wraps if the program runs for more than ~49 days. - *} -function SDL_GetTicks: cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTicks' {$ENDIF} {$ENDIF}; - -{** - * Get the number of milliseconds since SDL library initialization. - * - * Note that you should not use the SDL_TICKS_PASSED macro with values - * returned by this function, as that macro does clever math to compensate for - * the 32-bit overflow every ~49 days that SDL_GetTicks() suffers from. 64-bit - * values from this function can be safely compared directly. - *} -function SDL_GetTicks64: cuint64; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTicks64' {$ENDIF} {$ENDIF}; - -{** - * \brief Compare SDL ticks values, and return true if A has passed B - * - * e.g. if you want to wait 100 ms, you could do this: - * Uint32 timeout = SDL_GetTicks() + 100; - * while (!SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) [ - * ... do work until timeout has elapsed - * ] - *} -// #define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0) -{ Type conversion unnecessary bc. types are declared in func. param. list! } -function SDL_TICKS_PASSED(const A, B: cint32): Boolean; - -{** - * Get the current value of the high resolution counter - *} -function SDL_GetPerformanceCounter: cuint64; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPerformanceCounter' {$ENDIF} {$ENDIF}; - -{** - * Get the count per second of the high resolution counter - *} -function SDL_GetPerformanceFrequency: cuint64; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPerformanceFrequency' {$ENDIF} {$ENDIF}; - -{** - * Wait a specified number of milliseconds before returning. - *} -procedure SDL_Delay(ms: cuint32); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Delay' {$ENDIF} {$ENDIF}; - -type - {** - * Function prototype for the timer callback function. - * - * The callback function is passed the current timer interval and returns - * the next timer interval. If the returned value is the same as the one - * passed in, the periodic alarm continues, otherwise a new alarm is - * scheduled. If the callback returns 0, the periodic alarm is cancelled. - *} - PPSDL_TimerCallback = ^PSDL_TimerCallback; - PSDL_TimerCallback = ^TSDL_TimerCallback; - TSDL_TimerCallback = function(interval: cuint32; param: Pointer): cuint32; cdecl; - - {** - * Definition of the timer ID type. - *} - PPSDL_TimerID = ^PSDL_TimerID; - PSDL_TimerID = ^TSDL_TimerID; - TSDL_TimerID = cint; - -{** - * Add a new timer to the pool of timers already running. - * - * A timer ID, or NULL when an error occurs. - *} -function SDL_AddTimer(interval: cuint32; callback: TSDL_TimerCallback; param: Pointer): TSDL_TimerID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AddTimer' {$ENDIF} {$ENDIF}; - -{** - * Remove a timer knowing its ID. - * - * A boolean value indicating success or failure. - * - * It is not safe to remove a timer multiple times. - *} -function SDL_RemoveTimer(id: TSDL_TimerID): Boolean; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RemoveTimer' {$ENDIF} {$ENDIF}; +// based on "sdl_timer.h" (2.0.14) + +{** + * Get the number of milliseconds since the SDL library initialization. + * + * This value wraps if the program runs for more than ~49 days. + *} +function SDL_GetTicks: cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTicks' {$ENDIF} {$ENDIF}; + +{** + * Get the number of milliseconds since SDL library initialization. + * + * Note that you should not use the SDL_TICKS_PASSED macro with values + * returned by this function, as that macro does clever math to compensate for + * the 32-bit overflow every ~49 days that SDL_GetTicks() suffers from. 64-bit + * values from this function can be safely compared directly. + *} +function SDL_GetTicks64: cuint64; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTicks64' {$ENDIF} {$ENDIF}; + +{** + * \brief Compare SDL ticks values, and return true if A has passed B + * + * e.g. if you want to wait 100 ms, you could do this: + * Uint32 timeout = SDL_GetTicks() + 100; + * while (!SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) [ + * ... do work until timeout has elapsed + * ] + *} +// #define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0) +{ Type conversion unnecessary bc. types are declared in func. param. list! } +function SDL_TICKS_PASSED(const A, B: cint32): Boolean; + +{** + * Get the current value of the high resolution counter + *} +function SDL_GetPerformanceCounter: cuint64; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPerformanceCounter' {$ENDIF} {$ENDIF}; + +{** + * Get the count per second of the high resolution counter + *} +function SDL_GetPerformanceFrequency: cuint64; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPerformanceFrequency' {$ENDIF} {$ENDIF}; + +{** + * Wait a specified number of milliseconds before returning. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_Delay_proc = procedure(ms: cuint32); cdecl; +Var + SDL_Delay : TSDL_Delay_proc = Nil; +{$else} + +procedure SDL_Delay(ms: cuint32); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Delay' {$ENDIF} {$ENDIF}; +{$endif} + +type + {** + * Function prototype for the timer callback function. + * + * The callback function is passed the current timer interval and returns + * the next timer interval. If the returned value is the same as the one + * passed in, the periodic alarm continues, otherwise a new alarm is + * scheduled. If the callback returns 0, the periodic alarm is cancelled. + *} + PPSDL_TimerCallback = ^PSDL_TimerCallback; + PSDL_TimerCallback = ^TSDL_TimerCallback; + TSDL_TimerCallback = function(interval: cuint32; param: Pointer): cuint32; cdecl; + + {** + * Definition of the timer ID type. + *} + PPSDL_TimerID = ^PSDL_TimerID; + PSDL_TimerID = ^TSDL_TimerID; + TSDL_TimerID = cint; + +{** + * Add a new timer to the pool of timers already running. + * + * A timer ID, or NULL when an error occurs. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AddTimer_fun = function(interval: cuint32; callback: TSDL_TimerCallback; param: Pointer): TSDL_TimerID; cdecl; +Var + SDL_AddTimer : TSDL_AddTimer_fun = Nil; +{$else} + +function SDL_AddTimer(interval: cuint32; callback: TSDL_TimerCallback; param: Pointer): TSDL_TimerID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AddTimer' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Remove a timer knowing its ID. + * + * A boolean value indicating success or failure. + * + * It is not safe to remove a timer multiple times. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RemoveTimer_fun = function(id: TSDL_TimerID): Boolean; cdecl; +Var + SDL_RemoveTimer : TSDL_RemoveTimer_fun = Nil; +{$else} + +function SDL_RemoveTimer(id: TSDL_TimerID): Boolean; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RemoveTimer' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdltouch.inc b/units/sdltouch.inc index bcb1079f..e3bd5b96 100644 --- a/units/sdltouch.inc +++ b/units/sdltouch.inc @@ -1,80 +1,128 @@ -//from "sdl_touch.h" - -type - PPSDL_TouchID = ^PSDL_TouchID; - PSDL_TouchID = ^TSDL_TouchID; - TSDL_TouchID = type cint64; - - PPSDL_FingerID = ^PSDL_FingerID; - PSDL_FingerID = ^TSDL_FingerID; - TSDL_FingerID = type cint64; - - PPSDL_TouchDeviceType = ^PSDL_TouchDeviceType; - PSDL_TouchDeviceType = ^TSDL_TouchDeviceType; - TSDL_TouchDeviceType = type cint; - -const - SDL_TOUCH_DEVICE_INVALID = TSDL_TouchDeviceType(-1); - SDL_TOUCH_DEVICE_DIRECT = TSDL_TouchDeviceType(0); {* touch screen with window-relative coordinates *} - SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE = TSDL_TouchDeviceType(1); {* trackpad with absolute device coordinates *} - SDL_TOUCH_DEVICE_INDIRECT_RELATIVE = TSDL_TouchDeviceType(2); {* trackpad with relative device coordinates *} - -type - PPSDL_Finger = ^PSDL_Finger; - PSDL_Finger = ^TSDL_Finger; - TSDL_Finger = record - id: TSDL_FingerID; - x: cfloat; - y: cfloat; - pressure: cfloat; - end; - -const - {* Used as the device ID for mouse events simulated with touch input *} - SDL_TOUCH_MOUSEID = cuint32(-1); - {* Used as the SDL_TouchID for touch events simulated with mouse input *} - SDL_MOUSE_TOUCHID = TSDL_TouchID(-1); - - {* Function prototypes *} - - {** - * Get the number of registered touch devices. - *} -function SDL_GetNumTouchDevices(): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumTouchDevices' {$ENDIF} {$ENDIF}; - - {** - * Get the touch ID with the given index, or 0 if the index is invalid. - *} -function SDL_GetTouchDevice(index: cint): TSDL_TouchID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTouchDevice' {$ENDIF} {$ENDIF}; - -{** - * Get the touch device name as reported from the driver, - * or NIL if the index is invalid. - * - * \since This function is available since SDL 2.0.22. - *} -function SDL_GetTouchName(index: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTouchName' {$ENDIF} {$ENDIF}; - -{** - * Get the type of the given touch device. - * - * \since This function is available since SDL 2.0.10. - *} -function SDL_GetTouchDeviceType(touchID: TSDL_TouchID): TSDL_TouchDeviceType; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTouchDeviceType' {$ENDIF} {$ENDIF}; - - {** - * Get the number of active fingers for a given touch device. - *} -function SDL_GetNumTouchFingers(touchID: TSDL_TouchID): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumTouchFingers' {$ENDIF} {$ENDIF}; - - {** - * Get the finger object of the given touch, with the given index. - *} -function SDL_GetTouchFinger(touchID: TSDL_TouchID; index: cint): PSDL_Finger; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTouchFinger' {$ENDIF} {$ENDIF}; - +//from "sdl_touch.h" + +type + PPSDL_TouchID = ^PSDL_TouchID; + PSDL_TouchID = ^TSDL_TouchID; + TSDL_TouchID = type cint64; + + PPSDL_FingerID = ^PSDL_FingerID; + PSDL_FingerID = ^TSDL_FingerID; + TSDL_FingerID = type cint64; + + PPSDL_TouchDeviceType = ^PSDL_TouchDeviceType; + PSDL_TouchDeviceType = ^TSDL_TouchDeviceType; + TSDL_TouchDeviceType = type cint; + +const + SDL_TOUCH_DEVICE_INVALID = TSDL_TouchDeviceType(-1); + SDL_TOUCH_DEVICE_DIRECT = TSDL_TouchDeviceType(0); {* touch screen with window-relative coordinates *} + SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE = TSDL_TouchDeviceType(1); {* trackpad with absolute device coordinates *} + SDL_TOUCH_DEVICE_INDIRECT_RELATIVE = TSDL_TouchDeviceType(2); {* trackpad with relative device coordinates *} + +type + PPSDL_Finger = ^PSDL_Finger; + PSDL_Finger = ^TSDL_Finger; + TSDL_Finger = record + id: TSDL_FingerID; + x: cfloat; + y: cfloat; + pressure: cfloat; + end; + +const + {* Used as the device ID for mouse events simulated with touch input *} + SDL_TOUCH_MOUSEID = cuint32(-1); + {* Used as the SDL_TouchID for touch events simulated with mouse input *} + SDL_MOUSE_TOUCHID = TSDL_TouchID(-1); + + {* Function prototypes *} + + {** + * Get the number of registered touch devices. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetNumTouchDevices_fun = function(): cint; cdecl; +Var + SDL_GetNumTouchDevices : TSDL_GetNumTouchDevices_fun = Nil; +{$else} + +function SDL_GetNumTouchDevices(): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumTouchDevices' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the touch ID with the given index, or 0 if the index is invalid. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetTouchDevice_fun = function(index: cint): TSDL_TouchID; cdecl; +Var + SDL_GetTouchDevice : TSDL_GetTouchDevice_fun = Nil; +{$else} + +function SDL_GetTouchDevice(index: cint): TSDL_TouchID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTouchDevice' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the touch device name as reported from the driver, + * or NIL if the index is invalid. + * + * \since This function is available since SDL 2.0.22. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetTouchName_fun = function(index: cint): PAnsiChar; cdecl; +Var + SDL_GetTouchName : TSDL_GetTouchName_fun = Nil; +{$else} + +function SDL_GetTouchName(index: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTouchName' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the type of the given touch device. + * + * \since This function is available since SDL 2.0.10. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetTouchDeviceType_fun = function(touchID: TSDL_TouchID): TSDL_TouchDeviceType; cdecl; +Var + SDL_GetTouchDeviceType : TSDL_GetTouchDeviceType_fun = Nil; +{$else} + +function SDL_GetTouchDeviceType(touchID: TSDL_TouchID): TSDL_TouchDeviceType; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTouchDeviceType' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the number of active fingers for a given touch device. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetNumTouchFingers_fun = function(touchID: TSDL_TouchID): cint; cdecl; +Var + SDL_GetNumTouchFingers : TSDL_GetNumTouchFingers_fun = Nil; +{$else} + +function SDL_GetNumTouchFingers(touchID: TSDL_TouchID): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumTouchFingers' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the finger object of the given touch, with the given index. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetTouchFinger_fun = function(touchID: TSDL_TouchID; index: cint): PSDL_Finger; cdecl; +Var + SDL_GetTouchFinger : TSDL_GetTouchFinger_fun = Nil; +{$else} + +function SDL_GetTouchFinger(touchID: TSDL_TouchID; index: cint): PSDL_Finger; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTouchFinger' {$ENDIF} {$ENDIF}; +{$endif} + diff --git a/units/sdltypes.inc b/units/sdltypes.inc index 85b30bc1..71629f60 100644 --- a/units/sdltypes.inc +++ b/units/sdltypes.inc @@ -1,10 +1,10 @@ -//types from SDLtypes.h - -{** - * \file SDL_types.h - * - * \deprecated - *} - -{* DEPRECATED *} -//#include "SDL_stdinc.h" +//types from SDLtypes.h + +{** + * \file SDL_types.h + * + * \deprecated + *} + +{* DEPRECATED *} +//#include "SDL_stdinc.h" diff --git a/units/sdlversion.inc b/units/sdlversion.inc index a187840c..0a6e01bc 100644 --- a/units/sdlversion.inc +++ b/units/sdlversion.inc @@ -1,126 +1,134 @@ -// based on "sdl_version.h" (2.0.14) - -{** - * \file SDL_version.h - * - * This header defines the current SDL version. - *} - - {** - * Information the version of SDL in use. - * - * Represents the library's version as three levels: major revision - * (increments with massive changes, additions, and enhancements), - * minor revision (increments with backwards-compatible changes to the - * major revision), and patchlevel (increments with fixes to the minor - * revision). - * - * SDL_VERSION - * SDL_GetVersion - *} -type - PPSDL_Version = ^PSDL_Version; - PSDL_Version = ^TSDL_Version; - TSDL_Version = record - major, {**< major version *} - minor, {**< minor version *} - patch: cuint8; {**< update version *} - end; - -{* - Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL - - Last updated when TSDL_FPoint and TSDL_FRect were added. -*} -const - SDL_MAJOR_VERSION = 2; - SDL_MINOR_VERSION = 0; - SDL_PATCHLEVEL = 10; - -{** - * Macro to determine SDL version program was compiled against. - * - * This macro fills in a SDL_version structure with the version of the - * library you compiled against. This is determined by what header the - * compiler uses. Note that if you dynamically linked the library, you might - * have a slightly newer or older version at runtime. That version can be - * determined with SDL_GetVersion(), which, unlike SDL_VERSION(), - * is not a macro. - * - * x An instance on TSDL_Version to fill with version data. - * - * SDL_version - * SDL_GetVersion - *} -procedure SDL_VERSION(out x: TSDL_Version); - -{** - * This macro turns the version numbers into a numeric value: - * - * (1,2,3) -> (1203) - * - * - * This assumes that there will never be more than 100 patchlevels. - *} -function SDL_VERSIONNUM(X,Y,Z: cuint8): Cardinal; - -{** - * This is the version number macro for the current SDL version. - *} -function SDL_COMPILEDVERSION: Cardinal; - -{** - * This macro will evaluate to true if compiled with SDL at least X.Y.Z. - *} -function SDL_VERSION_ATLEAST(X,Y,Z: cuint8): Boolean; - -{** - * Get the version of SDL that is linked against your program. - * - * If you are linking to SDL dynamically, then it is possible that the - * current version will be different than the version you compiled against. - * This function returns the current version, while SDL_VERSION() is a - * macro that tells you what version you compiled with. - * - * - * compiled: TSDL_Version; - * linked: TSDL_Version; - * - * SDL_VERSION(@compiled); - * SDL_GetVersion(@linked); - * WriteLn('We compiled against SDL version: ' + - * IntToStr(compiled.major) + - * IntToStr(compiled.minor) + - * IntToStr(compiled.patch)); - * WriteLn('But we linked against SDL version:' + - * IntToStr(compiled.major) + - * IntToStr(compiled.minor) + - * IntToStr(compiled.patch)); - * - * - * This function may be called safely at any time, even before SDL_Init(). - * - * SDL_VERSION - *} -procedure SDL_GetVersion(ver: PSDL_Version); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetVersion' {$ENDIF} {$ENDIF}; - -{** - * Get the code revision of SDL that is linked against your program. - * - * Returns an arbitrary string (a hash value) uniquely identifying the - * exact revision of the SDL library in use, and is only useful in comparing - * against other revisions. It is NOT an incrementing number. - *} -function SDL_GetRevision: PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRevision' {$ENDIF} {$ENDIF}; - -{** - * Get the revision number of SDL that is linked against your program. - * - * Returns a number uniquely identifying the exact revision of the SDL - * library in use. It is an incrementing number based on commits to - * hg.libsdl.org. - *} -function SDL_GetRevisionNumber: cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRevisionNumber' {$ENDIF} {$ENDIF}; +// based on "sdl_version.h" (2.0.14) + +{** + * \file SDL_version.h + * + * This header defines the current SDL version. + *} + + {** + * Information the version of SDL in use. + * + * Represents the library's version as three levels: major revision + * (increments with massive changes, additions, and enhancements), + * minor revision (increments with backwards-compatible changes to the + * major revision), and patchlevel (increments with fixes to the minor + * revision). + * + * SDL_VERSION + * SDL_GetVersion + *} +type + PPSDL_Version = ^PSDL_Version; + PSDL_Version = ^TSDL_Version; + TSDL_Version = record + major, {**< major version *} + minor, {**< minor version *} + patch: cuint8; {**< update version *} + end; + +{* + Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL + + Last updated when TSDL_FPoint and TSDL_FRect were added. +*} +const + SDL_MAJOR_VERSION = 2; + SDL_MINOR_VERSION = 0; + SDL_PATCHLEVEL = 10; + +{** + * Macro to determine SDL version program was compiled against. + * + * This macro fills in a SDL_version structure with the version of the + * library you compiled against. This is determined by what header the + * compiler uses. Note that if you dynamically linked the library, you might + * have a slightly newer or older version at runtime. That version can be + * determined with SDL_GetVersion(), which, unlike SDL_VERSION(), + * is not a macro. + * + * x An instance on TSDL_Version to fill with version data. + * + * SDL_version + * SDL_GetVersion + *} +procedure SDL_VERSION(out x: TSDL_Version); + +{** + * This macro turns the version numbers into a numeric value: + * + * (1,2,3) -> (1203) + * + * + * This assumes that there will never be more than 100 patchlevels. + *} +function SDL_VERSIONNUM(X,Y,Z: cuint8): Cardinal; + +{** + * This is the version number macro for the current SDL version. + *} +function SDL_COMPILEDVERSION: Cardinal; + +{** + * This macro will evaluate to true if compiled with SDL at least X.Y.Z. + *} +function SDL_VERSION_ATLEAST(X,Y,Z: cuint8): Boolean; + +{** + * Get the version of SDL that is linked against your program. + * + * If you are linking to SDL dynamically, then it is possible that the + * current version will be different than the version you compiled against. + * This function returns the current version, while SDL_VERSION() is a + * macro that tells you what version you compiled with. + * + * + * compiled: TSDL_Version; + * linked: TSDL_Version; + * + * SDL_VERSION(@compiled); + * SDL_GetVersion(@linked); + * WriteLn('We compiled against SDL version: ' + + * IntToStr(compiled.major) + + * IntToStr(compiled.minor) + + * IntToStr(compiled.patch)); + * WriteLn('But we linked against SDL version:' + + * IntToStr(compiled.major) + + * IntToStr(compiled.minor) + + * IntToStr(compiled.patch)); + * + * + * This function may be called safely at any time, even before SDL_Init(). + * + * SDL_VERSION + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetVersion_proc = procedure(ver: PSDL_Version); cdecl; +Var + SDL_GetVersion : TSDL_GetVersion_proc = Nil; +{$else} + +procedure SDL_GetVersion(ver: PSDL_Version); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetVersion' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the code revision of SDL that is linked against your program. + * + * Returns an arbitrary string (a hash value) uniquely identifying the + * exact revision of the SDL library in use, and is only useful in comparing + * against other revisions. It is NOT an incrementing number. + *} +function SDL_GetRevision: PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRevision' {$ENDIF} {$ENDIF}; + +{** + * Get the revision number of SDL that is linked against your program. + * + * Returns a number uniquely identifying the exact revision of the SDL + * library in use. It is an incrementing number based on commits to + * hg.libsdl.org. + *} +function SDL_GetRevisionNumber: cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRevisionNumber' {$ENDIF} {$ENDIF}; diff --git a/units/sdlvideo.inc b/units/sdlvideo.inc index 9c39010e..0f3ca1fc 100644 --- a/units/sdlvideo.inc +++ b/units/sdlvideo.inc @@ -1,1535 +1,2223 @@ -// from "sdl_video.h" - - -type - PPSDL_Window = ^PSDL_Window; - PSDL_Window = type Pointer; - - {** - * The structure that defines a display mode - * - * SDL_GetNumDisplayModes() - * SDL_GetDisplayMode() - * SDL_GetDesktopDisplayMode() - * SDL_GetCurrentDisplayMode() - * SDL_GetClosestDisplayMode() - * SDL_SetWindowDisplayMode() - * SDL_GetWindowDisplayMode() - *} - PPSDL_DisplayMode = ^PSDL_DisplayMode; - PSDL_DisplayMode = ^TSDL_DisplayMode; - TSDL_DisplayMode = record - format: cuint32; {**< pixel format *} - w: cint; {**< width *} - h: cint; {**< height *} - refresh_rate: cint; {**< refresh rate (or zero for unspecified) *} - driverdata: Pointer; {**< driver-specific data, initialize to 0 *} - end; - -{** - * The flags on a window - * - * SDL_GetWindowFlags() - *} -type - PPSDL_WindowFlags = ^PSDL_WindowFlags; - PSDL_WindowFlags = ^TSDL_WindowFlags; - TSDL_WindowFlags = type cuint; - -const - SDL_WINDOW_FULLSCREEN = TSDL_WindowFlags($00000001); {**< fullscreen window *} - SDL_WINDOW_OPENGL = TSDL_WindowFlags($00000002); {**< window usable with OpenGL context *} - SDL_WINDOW_SHOWN = TSDL_WindowFlags($00000004); {**< window is visible *} - SDL_WINDOW_HIDDEN = TSDL_WindowFlags($00000008); {**< window is not visible *} - SDL_WINDOW_BORDERLESS = TSDL_WindowFlags($00000010); {**< no window decoration *} - SDL_WINDOW_RESIZABLE = TSDL_WindowFlags($00000020); {**< window can be resized *} - SDL_WINDOW_MINIMIZED = TSDL_WindowFlags($00000040); {**< window is minimized *} - SDL_WINDOW_MAXIMIZED = TSDL_WindowFlags($00000080); {**< window is maximized *} - SDL_WINDOW_MOUSE_GRABBED = TSDL_WindowFlags($00000100); {**< window has grabbed mouse input *} - SDL_WINDOW_INPUT_FOCUS = TSDL_WindowFlags($00000200); {**< window has input focus *} - SDL_WINDOW_MOUSE_FOCUS = TSDL_WindowFlags($00000400); {**< window has mouse focus *} - SDL_WINDOW_FULLSCREEN_DESKTOP = TSDL_WindowFlags(SDL_WINDOW_FULLSCREEN or $00001000); - SDL_WINDOW_FOREIGN = TSDL_WindowFlags($00000800); {**< window not created by SDL *} - SDL_WINDOW_ALLOW_HIGHDPI = TSDL_WindowFlags($00002000); {**< window should be created in high-DPI mode if supported. - On macOS NSHighResolutionCapable must be set true in the - application's Info.plist for this to have any effect. *} - SDL_WINDOW_MOUSE_CAPTURE = TSDL_WindowFlags($00004000); {**< window has mouse captured (unrelated to MOUSE_GRABBED) *} - SDL_WINDOW_ALWAYS_ON_TOP = TSDL_WindowFlags($00008000); {**< window should always be above others *} - SDL_WINDOW_SKIP_TASKBAR = TSDL_WindowFlags($00010000); {**< window should not be added to the taskbar *} - SDL_WINDOW_UTILITY = TSDL_WindowFlags($00020000); {**< window should be treated as a utility window *} - SDL_WINDOW_TOOLTIP = TSDL_WindowFlags($00040000); {**< window should be treated as a tooltip *} - SDL_WINDOW_POPUP_MENU = TSDL_WindowFlags($00080000); {**< window should be treated as a popup menu *} - SDL_WINDOW_KEYBOARD_GRABBED = TSDL_WindowFlags($00100000); {**< window has grabbed keyboard input *} - SDL_WINDOW_VULKAN = TSDL_WindowFlags($10000000); {**< window usable for Vulkan surface *} - SDL_WINDOW_METAL = TSDL_WindowFlags($20000000); {**< window usable for Metal view *} - - SDL_WINDOW_INPUT_GRABBED = SDL_WINDOW_MOUSE_GRABBED; {**< equivalent to SDL_WINDOW_MOUSE_GRABBED for compatibility *} - - {** - * Used to indicate that you don't care what the window position is. - *} -const SDL_WINDOWPOS_UNDEFINED_MASK = $1FFF0000; -function SDL_WINDOWPOS_UNDEFINED_DISPLAY(X: Variant): Variant; -const SDL_WINDOWPOS_UNDEFINED = SDL_WINDOWPOS_UNDEFINED_MASK or 0; -function SDL_WINDOWPOS_ISUNDEFINED(X: Variant): Variant; - - - {** - * Used to indicate that the window position should be centered. - *} -const SDL_WINDOWPOS_CENTERED_MASK = $2FFF0000; -function SDL_WINDOWPOS_CENTERED_DISPLAY(X: Variant): Variant; -const SDL_WINDOWPOS_CENTERED = SDL_WINDOWPOS_CENTERED_MASK or 0; -function SDL_WINDOWPOS_ISCENTERED(X: Variant): Variant; - - {** - * Event subtype for window events - *} -type - PPSDL_WindowEventID = ^PSDL_WindowEventID; - PSDL_WindowEventID = ^TSDL_WindowEventID; - TSDL_WindowEventID = type cint; -const - SDL_WINDOWEVENT_NONE = TSDL_WindowEventID(0); {**< Never used *} - SDL_WINDOWEVENT_SHOWN = TSDL_WindowEventID(1); {**< Window has been shown *} - SDL_WINDOWEVENT_HIDDEN = TSDL_WindowEventID(2); {**< Window has been hidden *} - SDL_WINDOWEVENT_EXPOSED = TSDL_WindowEventID(3); {**< Window has been exposed and should be redrawn *} - SDL_WINDOWEVENT_MOVED = TSDL_WindowEventID(4); {**< Window has been moved to data1; data2 *} - SDL_WINDOWEVENT_RESIZED = TSDL_WindowEventID(5); {**< Window has been resized to data1xdata2 *} - SDL_WINDOWEVENT_SIZE_CHANGED = TSDL_WindowEventID(6); {**< The window size has changed; either as a result of an API call or through the system or user changing the window size. *} - SDL_WINDOWEVENT_MINIMIZED = TSDL_WindowEventID(7); {**< Window has been minimized *} - SDL_WINDOWEVENT_MAXIMIZED = TSDL_WindowEventID(8); {**< Window has been maximized *} - SDL_WINDOWEVENT_RESTORED = TSDL_WindowEventID(9); {**< Window has been restored to normal size and position *} - SDL_WINDOWEVENT_ENTER = TSDL_WindowEventID(10); {**< Window has gained mouse focus *} - SDL_WINDOWEVENT_LEAVE = TSDL_WindowEventID(11); {**< Window has lost mouse focus *} - SDL_WINDOWEVENT_FOCUS_GAINED = TSDL_WindowEventID(12); {**< Window has gained keyboard focus *} - SDL_WINDOWEVENT_FOCUS_LOST = TSDL_WindowEventID(13); {**< Window has lost keyboard focus *} - SDL_WINDOWEVENT_CLOSE = TSDL_WindowEventID(14); {**< The window manager requests that the window be closed *} - SDL_WINDOWEVENT_TAKE_FOCUS = TSDL_WindowEventID(15); {**< Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore) *} - SDL_WINDOWEVENT_HIT_TEST = TSDL_WindowEventID(16); {**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. *} - SDL_WINDOWEVENT_ICCPROF_CHANGED = TSDL_WindowEventID(17); {**< The ICC profile of the window's display has changed. *} - SDL_WINDOWEVENT_DISPLAY_CHANGED = TSDL_WindowEventID(18); {**< Window has been moved to display data1. *} - -{** - * \brief Event subtype for display events - *} -type - PPSDL_DisplayEventID = ^PSDL_DisplayEventID; - PSDL_DisplayEventID = ^TSDL_DisplayEventID; - TSDL_DisplayEventID = type Integer; - -const - SDL_DISPLAYEVENT_NONE = TSDL_DisplayEventID(0); {**< Never used *} - SDL_DISPLAYEVENT_ORIENTATION = TSDL_DisplayEventID(1); {**< Display orientation has changed to data1 *} - SDL_DISPLAYEVENT_CONNECTED = TSDL_DisplayEventID(2); {**< Display has been added to the system *} - SDL_DISPLAYEVENT_DISCONNECTED = TSDL_DisplayEventID(3); {**< Display has been removed from the system *} - -type - PPSDL_DisplayOrientation = ^PSDL_DisplayOrientation; - PSDL_DisplayOrientation = ^TSDL_DisplayOrientation; - TSDL_DisplayOrientation = type Integer; - -const - SDL_ORIENTATION_UNKNOWN = TSDL_DisplayOrientation(0); {**< The display orientation can't be determined *} - SDL_ORIENTATION_LANDSCAPE = TSDL_DisplayOrientation(1); {**< The display is in landscape mode, with the right side up, relative to portrait mode *} - SDL_ORIENTATION_LANDSCAPE_FLIPPED = TSDL_DisplayOrientation(2); {**< The display is in landscape mode, with the left side up, relative to portrait mode *} - SDL_ORIENTATION_PORTRAIT = TSDL_DisplayOrientation(3); {**< The display is in portrait mode *} - SDL_ORIENTATION_PORTRAIT_FLIPPED = TSDL_DisplayOrientation(4); {**< The display is in portrait mode, upside down *} - - {** - * \brief Window flash operation - *} -type - PPSDL_FlashOperation = ^PSDL_FlashOperation; - PSDL_FlashOperation = ^TSDL_FlashOperation; - TSDL_FlashOperation = type Integer; - -const - SDL_FLASH_CANCEL = TSDL_FlashOperation(0); {**< Cancel any window flash state *} - SDL_FLASH_BRIEFLY = TSDL_FlashOperation(1); {**< Flash the window briefly to get attention *} - SDL_FLASH_UNTIL_FOCUSED = TSDL_FlashOperation(2); {**< Flash the window until it gets focus *} - - {** - * An opaque handle to an OpenGL context. - *} -type - PPSDL_GLContext = ^PSDL_GLContext; - PSDL_GLContext = ^TSDL_GLContext; - TSDL_GLContext = Pointer; - - {** - * OpenGL configuration attributes - *} -type - PPSDL_GLattr = ^PSDL_GLattr; - PSDL_GLattr = ^TSDL_GLattr; - TSDL_GLattr = type Integer; - -const - SDL_GL_RED_SIZE = TSDL_GLattr(0); - SDL_GL_GREEN_SIZE = TSDL_GLattr(1); - SDL_GL_BLUE_SIZE = TSDL_GLattr(2); - SDL_GL_ALPHA_SIZE = TSDL_GLattr(3); - SDL_GL_BUFFER_SIZE = TSDL_GLattr(4); - SDL_GL_DOUBLEBUFFER = TSDL_GLattr(5); - SDL_GL_DEPTH_SIZE = TSDL_GLattr(6); - SDL_GL_STENCIL_SIZE = TSDL_GLattr(7); - SDL_GL_ACCUM_RED_SIZE = TSDL_GLattr(8); - SDL_GL_ACCUM_GREEN_SIZE = TSDL_GLattr(9); - SDL_GL_ACCUM_BLUE_SIZE = TSDL_GLattr(10); - SDL_GL_ACCUM_ALPHA_SIZE = TSDL_GLattr(11); - SDL_GL_STEREO = TSDL_GLattr(12); - SDL_GL_MULTISAMPLEBUFFERS = TSDL_GLattr(13); - SDL_GL_MULTISAMPLESAMPLES = TSDL_GLattr(14); - SDL_GL_ACCELERATED_VISUAL = TSDL_GLattr(15); - SDL_GL_RETAINED_BACKING = TSDL_GLattr(16); - SDL_GL_CONTEXT_MAJOR_VERSION = TSDL_GLattr(17); - SDL_GL_CONTEXT_MINOR_VERSION = TSDL_GLattr(18); - SDL_GL_CONTEXT_EGL = TSDL_GLattr(19); - SDL_GL_CONTEXT_FLAGS = TSDL_GLattr(20); - SDL_GL_CONTEXT_PROFILE_MASK = TSDL_GLattr(21); - SDL_GL_SHARE_WITH_CURRENT_CONTEXT = TSDL_GLattr(22); - SDL_GL_FRAMEBUFFER_SRGB_CAPABLE = TSDL_GLattr(23); - SDL_GL_CONTEXT_RELEASE_BEHAVIOR = TSDL_GLattr(24); - SDL_GL_CONTEXT_RESET_NOTIFICATION = TSDL_GLattr(25); - SDL_GL_CONTEXT_NO_ERROR = TSDL_GLattr(26); - SDL_GL_FLOATBUFFERS = TSDL_GLattr(27); - -type - PPSDL_GLprofile = ^PSDL_GLprofile; - PSDL_GLprofile = ^TSDL_GLprofile; - TSDL_GLprofile = type Integer; - -const - SDL_GL_CONTEXT_PROFILE_CORE = TSDL_GLprofile($0001); - SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = TSDL_GLprofile($0002); - SDL_GL_CONTEXT_PROFILE_ES = TSDL_GLprofile($0004); - -type - PPSDL_GLcontextFlag = ^PSDL_GLcontextFlag; - PSDL_GLcontextFlag = ^TSDL_GLcontextFlag; - TSDL_GLcontextFlag = type Integer; - -const - SDL_GL_CONTEXT_DEBUG_FLAG = TSDL_GLcontextFlag($0001); - SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = TSDL_GLcontextFlag($0002); - SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = TSDL_GLcontextFlag($0004); - SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = TSDL_GLcontextFlag($0008); - -type - PPSDL_GLcontextReleaseFlag = ^PSDL_GLcontextReleaseFlag; - PSDL_GLcontextReleaseFlag = ^TSDL_GLcontextReleaseFlag; - TSDL_GLcontextReleaseFlag = type Integer; - -const - SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = TSDL_GLcontextReleaseFlag($0000); - SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = TSDL_GLcontextReleaseFlag($0001); - -type - PPSDL_GLContextResetNotification = ^PSDL_GLContextResetNotification; - PSDL_GLContextResetNotification = ^TSDL_GLContextResetNotification; - TSDL_GLContextResetNotification = type Integer; - -const - SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = TSDL_GLContextResetNotification($0000); - SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = TSDL_GLContextResetNotification($0001); - - {* Function prototypes *} - - {** - * Get the number of video drivers compiled into SDL - * - * SDL_GetVideoDriver() - *} - -function SDL_GetNumVideoDrivers: cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumVideoDrivers' {$ENDIF} {$ENDIF}; - - {** - * Get the name of a built in video driver. - * - * The video drivers are presented in the order in which they are - * normally checked during initialization. - * - * SDL_GetNumVideoDrivers() - *} - -function SDL_GetVideoDriver(index: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetVideoDriver' {$ENDIF} {$ENDIF}; - - {** - * Initialize the video subsystem, optionally specifying a video driver. - * - * driver_name Initialize a specific driver by name, or nil for the - * default video driver. - * - * 0 on success, -1 on error - * - * This function initializes the video subsystem; setting up a connection - * to the window manager, etc, and determines the available display modes - * and pixel formats, but does not initialize a window or graphics mode. - * - * SDL_VideoQuit() - *} - -function SDL_VideoInit(const driver_name: PAnsiChar): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_VideoInit' {$ENDIF} {$ENDIF}; - - {** - * Shuts down the video subsystem. - * - * function closes all windows, and restores the original video mode. - * - * SDL_VideoInit() - *} -procedure SDL_VideoQuit; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_VideoQuit' {$ENDIF} {$ENDIF}; - - {** - * Returns the name of the currently initialized video driver. - * - * The name of the current video driver or nil if no driver - * has been initialized - * - * SDL_GetNumVideoDrivers() - * SDL_GetVideoDriver() - *} - -function SDL_GetCurrentVideoDriver: PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCurrentVideoDriver' {$ENDIF} {$ENDIF}; - - {** - * Returns the number of available video displays. - * - * SDL_GetDisplayBounds() - *} - -function SDL_GetNumVideoDisplays: cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumVideoDisplays' {$ENDIF} {$ENDIF}; - - {** - * Get the name of a display in UTF-8 encoding - * - * The name of a display, or nil for an invalid display index. - * - * SDL_GetNumVideoDisplays() - *} - -function SDL_GetDisplayName(displayIndex: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayName' {$ENDIF} {$ENDIF}; - - {** - * Get the desktop area represented by a display, with the primary - * display located at 0,0 - * - * 0 on success, or -1 if the index is out of range. - * - * SDL_GetNumVideoDisplays() - *} - -function SDL_GetDisplayBounds(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayBounds' {$ENDIF} {$ENDIF}; - -{** - * \brief Get the usable desktop area represented by a display, with the - * primary display located at 0,0 - * - * This is the same area as SDL_GetDisplayBounds() reports, but with portions - * reserved by the system removed. For example, on Mac OS X, this subtracts - * the area occupied by the menu bar and dock. - * - * Setting a window to be fullscreen generally bypasses these unusable areas, - * so these are good guidelines for the maximum space available to a - * non-fullscreen window. - * - * \return 0 on success, or -1 if the index is out of range. - * - * \sa SDL_GetDisplayBounds() - * \sa SDL_GetNumVideoDisplays() - *} -function SDL_GetDisplayUsableBounds(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayUsableBounds' {$ENDIF} {$ENDIF}; - - {** - * \brief Get the dots/pixels-per-inch for a display - * - * \note Diagonal, horizontal and vertical DPI can all be optionally - * returned if the parameter is non-NULL. - * - * \return 0 on success, or -1 if no DPI information is available or the index is out of range. - * - * \sa SDL_GetNumVideoDisplays() - *} -function SDL_GetDisplayDPI(displayIndex: cint; ddpi, hdpi, vdpi: pcfloat): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayDPI' {$ENDIF} {$ENDIF}; - -{** - * \brief Get the orientation of a display - * - * \return The orientation of the display, or SDL_ORIENTATION_UNKNOWN if it isn't available. - * - * \sa SDL_GetNumVideoDisplays() - *} -function SDL_GetDisplayOrientation(displayIndex: cint): TSDL_DisplayOrientation; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayOrientation' {$ENDIF} {$ENDIF}; - - {** - * Returns the number of available display modes. - * - * SDL_GetDisplayMode() - *} - -function SDL_GetNumDisplayModes(displayIndex: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumDisplayModes' {$ENDIF} {$ENDIF}; - - {** - * Fill in information about a specific display mode. - * - * The display modes are sorted in this priority: - * bits per pixel -> more colors to fewer colors - * width -> largest to smallest - * height -> largest to smallest - * refresh rate -> highest to lowest - * - * SDL_GetNumDisplayModes() - *} - -function SDL_GetDisplayMode(displayIndex: cint; modeIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayMode' {$ENDIF} {$ENDIF}; - - {** - * Fill in information about the desktop display mode. - *} - -function SDL_GetDesktopDisplayMode(displayIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDesktopDisplayMode' {$ENDIF} {$ENDIF}; - - {** - * Fill in information about the current display mode. - *} - -function SDL_GetCurrentDisplayMode(displayIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCurrentDisplayIndex' {$ENDIF} {$ENDIF}; - - {** - * Get the closest match to the requested display mode. - * - * mode The desired display mode - * closest A pointer to a display mode to be filled in with the closest - * match of the available display modes. - * - * The passed in value closest, or nil if no matching video mode - * was available. - * - * The available display modes are scanned, and closest is filled in with the - * closest mode matching the requested mode and returned. The mode format and - * refresh_rate default to the desktop mode if they are 0. The modes are - * scanned with size being first priority, format being second priority, and - * finally checking the refresh_rate. If all the available modes are too - * small, then nil is returned. - * - * SDL_GetNumDisplayModes() - * SDL_GetDisplayMode() - *} - -function SDL_GetClosestDisplayMode(displayIndex: cint; const mode: PSDL_DisplayMode; closest: PSDL_DisplayMode): PSDL_DisplayMode; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetClosestDisplayMode' {$ENDIF} {$ENDIF}; - -{** - * Get the index of the display containing a point - * - * \param point the point to query - * \returns the index of the display containing the point or a negative error - * code on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_GetDisplayBounds - * \sa SDL_GetNumVideoDisplays - *} -function SDL_GetPointDisplayIndex(const point: PSDL_Point): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPointDisplayIndex' {$ENDIF} {$ENDIF}; - -{** - * Get the index of the display primarily containing a rect - * - * \param rect the rect to query - * \returns the index of the display entirely containing the rect or closest - * to the center of the rect on success or a negative error code on - * failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_GetDisplayBounds - * \sa SDL_GetNumVideoDisplays - *} -function SDL_GetRectDisplayIndex(const rect: PSDL_Rect): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRectDisplayIndex' {$ENDIF} {$ENDIF}; - - {** - * Get the display index associated with a window. - * - * the display index of the display containing the center of the - * window, or -1 on error. - *} - -function SDL_GetWindowDisplayIndex(window: PSDL_Window): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowDisplayIndex' {$ENDIF} {$ENDIF}; - - {** - * Set the display mode used when a fullscreen window is visible. - * - * By default the window's dimensions and the desktop format and refresh rate - * are used. - * - * mode The mode to use, or nil for the default mode. - * - * 0 on success, or -1 if setting the display mode failed. - * - * SDL_GetWindowDisplayMode() - * SDL_SetWindowFullscreen() - *} - -function SDL_SetWindowDisplayMode(window: PSDL_Window; const mode: PSDL_DisplayMode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowDisplayMode' {$ENDIF} {$ENDIF}; - - {** - * Fill in information about the display mode used when a fullscreen - * window is visible. - * - * SDL_SetWindowDisplayMode() - * SDL_SetWindowFullscreen() - *} - -function SDL_GetWindowDisplayMode(window: PSDL_Window; mode: PSDL_DisplayMode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowDisplayMode' {$ENDIF} {$ENDIF}; - -{** - * Get the raw ICC profile data for the screen the window is currently on. - * - * Data returned should be freed with SDL_free(). - * - * \param window the window to query - * \param size the size of the ICC profile - * \returns the raw ICC profile data on success or NIL on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.18. - *} -function SDL_GetWindowICCProfile(window: PSDL_Window; size: pcsize_t): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowICCProfile' {$ENDIF} {$ENDIF}; - - {** - * Get the pixel format associated with the window. - *} - -function SDL_GetWindowPixelFormat(window: PSDL_Window): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowPixelFormat' {$ENDIF} {$ENDIF}; - - {** - * \brief Create a window with the specified position, dimensions, and flags. - * - * \param title The title of the window, in UTF-8 encoding. - * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or - * ::SDL_WINDOWPOS_UNDEFINED. - * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or - * ::SDL_WINDOWPOS_UNDEFINED. - * \param w The width of the window, in screen coordinates. - * \param h The height of the window, in screen coordinates. - * \param flags The flags for the window, a mask of any of the following: - * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL, - * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS, - * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED, - * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED, - * ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN. - * - * \return The created window, or NULL if window creation failed. - * - * If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size - * in pixels may differ from its size in screen coordinates on platforms with - * high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query - * the client area's size in screen coordinates, and SDL_GL_GetDrawableSize(), - * SDL_Vulkan_GetDrawableSize(), or SDL_GetRendererOutputSize() to query the - * drawable size in pixels. - * - * If the window is created with any of the SDL_WINDOW_OPENGL or - * SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function - * (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the - * corresponding UnloadLibrary function is called by SDL_DestroyWindow(). - * - * If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver, - * SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail. - * - * \note On non-Apple devices, SDL requires you to either not link to the - * Vulkan loader or link to a dynamic library version. This limitation - * may be removed in a future version of SDL. - * - * \sa SDL_DestroyWindow() - * \sa SDL_GL_LoadLibrary() - * \sa SDL_Vulkan_LoadLibrary() - *} - -function SDL_CreateWindow(const title: PAnsiChar; x: cint; y: cint; w: cint; h: cint; flags: TSDL_WindowFlags): PSDL_Window; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateWindow' {$ENDIF} {$ENDIF}; - - {** - * Create an SDL window from an existing native window. - * - * data A pointer to driver-dependent window creation data - * - * The id of the window created, or zero if window creation failed. - * - * SDL_DestroyWindow() - *} - -function SDL_CreateWindowFrom(const data: Pointer): PSDL_Window; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateWindowFrom' {$ENDIF} {$ENDIF}; - - {** - * Get the numeric ID of a window, for logging purposes. - *} - -function SDL_GetWindowID(window: PSDL_Window): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowID' {$ENDIF} {$ENDIF}; - - {** - * Get a window from a stored ID, or nil if it doesn't exist. - *} - -function SDL_GetWindowFromID(id: cuint32): PSDL_Window; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowFromID' {$ENDIF} {$ENDIF}; - - {** - * Get the window flags. - *} - -function SDL_GetWindowFlags(window: PSDL_Window): TSDL_WindowFlags; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowFlags' {$ENDIF} {$ENDIF}; - - {** - * Set the title of a window, in UTF-8 format. - * - * SDL_GetWindowTitle() - *} - -procedure SDL_SetWindowTitle(window: PSDL_Window; const title: PAnsiChar); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowTitle' {$ENDIF} {$ENDIF}; - - {** - * Get the title of a window, in UTF-8 format. - * - * SDL_SetWindowTitle() - *} - -function SDL_GetWindowTitle(window: PSDL_Window): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowTitle' {$ENDIF} {$ENDIF}; - - {** - * Set the icon for a window. - * - * icon The icon for the window. - *} - -procedure SDL_SetWindowIcon(window: PSDL_Window; icon: PSDL_Surface); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowIcon' {$ENDIF} {$ENDIF}; - - {** - * Associate an arbitrary named pointer with a window. - * - * window The window to associate with the pointer. - * name The name of the pointer. - * userdata The associated pointer. - * - * The previous value associated with 'name' - * - * The name is case-sensitive. - * - * SDL_GetWindowData() - *} - -function SDL_SetWindowData(window: PSDL_Window; const name: PAnsiChar; userdata: Pointer): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowData' {$ENDIF} {$ENDIF}; - - {** - * Retrieve the data pointer associated with a window. - * - * window The window to query. - * name The name of the pointer. - * - * The value associated with 'name' - * - * SDL_SetWindowData() - *} - -function SDL_GetWindowData(window: PSDL_Window; const name: PAnsiChar): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowData' {$ENDIF} {$ENDIF}; - - {** - * Set the position of a window. - * - * window The window to reposition. - * x The x coordinate of the window, SDL_WINDOWPOS_CENTERED, or - * SDL_WINDOWPOS_UNDEFINED. - * y The y coordinate of the window, SDL_WINDOWPOS_CENTERED, or - * SDL_WINDOWPOS_UNDEFINED. - * - * The window coordinate origin is the upper left of the display. - * - * SDL_GetWindowPosition() - *} - -procedure SDL_SetWindowPosition(window: PSDL_Window; x: cint; y: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowPosition' {$ENDIF} {$ENDIF}; - - {** - * Get the position of a window. - * - * x Pointer to variable for storing the x position, may be nil - * y Pointer to variable for storing the y position, may be nil - * - * SDL_SetWindowPosition() - *} - -procedure SDL_GetWindowPosition(window: PSDL_Window; x: pcint; y: pcint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowPosition' {$ENDIF} {$ENDIF}; - - {** - * Set the size of a window's client area. - * - * w The width of the window, must be >0 - * h The height of the window, must be >0 - * - * You can't change the size of a fullscreen window, it automatically - * matches the size of the display mode. - * - * SDL_GetWindowSize() - *} - -procedure SDL_SetWindowSize(window: PSDL_Window; w: cint; h: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowSize' {$ENDIF} {$ENDIF}; - - {** - * Get the size of a window's client area. - * - * w Pointer to variable for storing the width, may be nil - * h Pointer to variable for storing the height, may be nil - * - * SDL_SetWindowSize() - *} - -procedure SDL_GetWindowSize(window: PSDL_Window; w: pcint; h: pcint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowSize' {$ENDIF} {$ENDIF}; - - {** - * \brief Get the size of a window's borders (decorations) around the client area. - * - * \param window The window to query. - * \param top Pointer to variable for storing the size of the top border. NULL is permitted. - * \param left Pointer to variable for storing the size of the left border. NULL is permitted. - * \param bottom Pointer to variable for storing the size of the bottom border. NULL is permitted. - * \param right Pointer to variable for storing the size of the right border. NULL is permitted. - * - * \return 0 on success, or -1 if getting this information is not supported. - * - * \note if this function fails (returns -1), the size values will be - * initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as - * if the window in question was borderless. - *} -function SDL_GetWindowBordersSize(window: PSDL_Window; top, left, bottom, right: pcint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowBordersSize' {$ENDIF} {$ENDIF}; - - {** - * Get the size of a window in pixels. - * - * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI - * drawable, i.e. the window was created with `SDL_WINDOW_ALLOW_HIGHDPI` on a - * platform with high-DPI support (Apple calls this "Retina"), and not - * disabled by the `SDL_HINT_VIDEO_HIGHDPI_DISABLED` hint. - * - * \param window the window from which the drawable size should be queried - * \param w a pointer to variable for storing the width in pixels, may be NIL - * \param h a pointer to variable for storing the height in pixels, may be - * NIL - * - * \since This function is available since SDL 2.26.0. - * - * \sa SDL_CreateWindow - * \sa SDL_GetWindowSize - *} -procedure SDL_GetWindowSizeInPixels(window: PSDL_Window; w, h: pcuint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowSizeInPixels' {$ENDIF} {$ENDIF}; - - {** - * Set the minimum size of a window's client area. - * - * min_w The minimum width of the window, must be >0 - * min_h The minimum height of the window, must be >0 - * - * You can't change the minimum size of a fullscreen window, it - * automatically matches the size of the display mode. - * - * SDL_GetWindowMinimumSize() - * SDL_SetWindowMaximumSize() - *} - -procedure SDL_SetWindowMinimumSize(window: PSDL_Window; min_w: cint; min_h: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowMinimumSize' {$ENDIF} {$ENDIF}; - - {** - * Get the minimum size of a window's client area. - * - * w Pointer to variable for storing the minimum width, may be nil - * h Pointer to variable for storing the minimum height, may be nil - * - * SDL_GetWindowMaximumSize() - * SDL_SetWindowMinimumSize() - *} - -procedure SDL_GetWindowMinimumSize(window: PSDL_Window; w: pcint; h: pcint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowMinimumSize' {$ENDIF} {$ENDIF}; - - {** - * Set the maximum size of a window's client area. - * - * max_w The maximum width of the window, must be >0 - * max_h The maximum height of the window, must be >0 - * - * You can't change the maximum size of a fullscreen window, it - * automatically matches the size of the display mode. - * - * SDL_GetWindowMaximumSize() - * SDL_SetWindowMinimumSize() - *} - -procedure SDL_SetWindowMaximumSize(window: PSDL_Window; max_w: cint; max_h: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowMaximumSize' {$ENDIF} {$ENDIF}; - - {** - * Get the maximum size of a window's client area. - * - * w Pointer to variable for storing the maximum width, may be nil - * h Pointer to variable for storing the maximum height, may be nil - * - * SDL_GetWindowMinimumSize() - * SDL_SetWindowMaximumSize() - *} - -procedure SDL_GetWindowMaximumSize(window: PSDL_Window; w: pcint; h: pcint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowMaximumSize' {$ENDIF} {$ENDIF}; - - {** - * Set the border state of a window. - * - * This will add or remove the window's SDL_WINDOW_BORDERLESS flag and - * add or remove the border from the actual window. This is a no-op if the - * window's border already matches the requested state. - * - * window The window of which to change the border state. - * bordered SDL_FALSE to remove border, SDL_TRUE to add border. - * - * You can't change the border state of a fullscreen window. - * - * SDL_GetWindowFlags() - *} - -procedure SDL_SetWindowBordered(window: PSDL_Window; bordered: TSDL_Bool); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowBordered' {$ENDIF} {$ENDIF}; - - {** - * \brief Set the user-resizable state of a window. - * - * This will add or remove the window's SDL_WINDOW_RESIZABLE flag and - * allow/disallow user resizing of the window. This is a no-op if the - * window's resizable state already matches the requested state. - * - * \param window The window of which to change the resizable state. - * \param resizable SDL_TRUE to allow resizing, SDL_FALSE to disallow. - * - * \note You can't change the resizable state of a fullscreen window. - * - * \sa SDL_GetWindowFlags() - *} -procedure SDL_SetWindowResizable(window: PSDL_Window; resizable: TSDL_Bool); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowResizable' {$ENDIF} {$ENDIF}; - -{** - * Set the window to always be above the others. - * - * This will add or remove the window's `SDL_WINDOW_ALWAYS_ON_TOP` flag. This - * will bring the window to the front and keep the window above the rest. - * - * \param window The window of which to change the always on top state - * \param on_top SDL_TRUE to set the window always on top, SDL_FALSE to - * disable - * - * \since This function is available since SDL 2.0.16. - * - * \sa SDL_GetWindowFlags - *} -procedure SDL_SetWindowAlwaysOnTop(window: PSDL_Window; on_top: TSDL_Bool); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowAlwaysOnTop' {$ENDIF} {$ENDIF}; - - {** - * Show a window. - * - * SDL_HideWindow() - *} - -procedure SDL_ShowWindow(window: PSDL_Window); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ShowWindow' {$ENDIF} {$ENDIF}; - - {** - * Hide a window. - * - * SDL_ShowWindow() - *} - -procedure SDL_HideWindow(window: PSDL_Window); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HideWindow' {$ENDIF} {$ENDIF}; - - {** - * Raise a window above other windows and set the input focus. - *} - -procedure SDL_RaiseWindow(window: PSDL_Window); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RaiseWindow' {$ENDIF} {$ENDIF}; - - {** - * Make a window as large as possible. - * - * SDL_RestoreWindow() - *} - -procedure SDL_MaximizeWindow(window: PSDL_Window); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MaximizeWindow' {$ENDIF} {$ENDIF}; - - {** - * Minimize a window to an iconic representation. - * - * SDL_RestoreWindow() - *} - -procedure SDL_MinimizeWindow(window: PSDL_Window); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MinimizeWindow' {$ENDIF} {$ENDIF}; - - {** - * Restore the size and position of a minimized or maximized window. - * - * SDL_MaximizeWindow() - * SDL_MinimizeWindow() - *} - -procedure SDL_RestoreWindow(window: PSDL_Window); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RestoreWindow' {$ENDIF} {$ENDIF}; - - {** - * Set a window's fullscreen state. - * - * 0 on success, or -1 if setting the display mode failed. - * - * SDL_SetWindowDisplayMode() - * SDL_GetWindowDisplayMode() - *} - -function SDL_SetWindowFullscreen(window: PSDL_Window; flags: TSDL_WindowFlags): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowFullscreen' {$ENDIF} {$ENDIF}; - - {** - * Return whether the window has a surface associated with it. - * - * \returns SDL_TRUE if there is a surface associated with the window, or - * SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.28.0. - * - * \sa SDL_GetWindowSurface - *} -function SDL_HasWindowSurface(window: PSDL_Window): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasWindowSurface' {$ENDIF} {$ENDIF}; - - {** - * Get the SDL surface associated with the window. - * - * The window's framebuffer surface, or nil on error. - * - * A new surface will be created with the optimal format for the window, - * if necessary. This surface will be freed when the window is destroyed. - * - * You may not combine this with 3D or the rendering API on this window. - * - * SDL_UpdateWindowSurface() - * SDL_UpdateWindowSurfaceRects() - *} - -function SDL_GetWindowSurface(window: PSDL_Window): PSDL_Surface; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowSurface' {$ENDIF} {$ENDIF}; - - {** - * Copy the window surface to the screen. - * - * 0 on success, or -1 on error. - * - * SDL_GetWindowSurface() - * SDL_UpdateWindowSurfaceRects() - *} - -function SDL_UpdateWindowSurface(window: PSDL_Window): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateWindowSurface' {$ENDIF} {$ENDIF}; - - {** - * Copy a number of rectangles on the window surface to the screen. - * - * 0 on success, or -1 on error. - * - * SDL_GetWindowSurface() - * SDL_UpdateWindowSurfaceRect() - *} - -function SDL_UpdateWindowSurfaceRects(window: PSDL_Window; rects: PSDL_Rect; numrects: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateWindowSurfaceRects' {$ENDIF} {$ENDIF}; - - {** - * Destroy the surface associated with the window. - * - * \param window the window to update - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.28.0. - * - * \sa SDL_GetWindowSurface - * \sa SDL_HasWindowSurface - *} -function SDL_DestroyWindowSurface(window: PSDL_Window): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyWindowSurface' {$ENDIF} {$ENDIF}; - - {** - * Set a window's input grab mode. - * - * grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input. - * - * SDL_GetWindowGrab() - *} - -procedure SDL_SetWindowGrab(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowGrab' {$ENDIF} {$ENDIF}; - - {** - * Get a window's input grab mode. - * - * This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise. - * - * SDL_SetWindowGrab() - *} - -function SDL_GetWindowGrab(window: PSDL_Window): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowGrab' {$ENDIF} {$ENDIF}; - -{** - * Set a window's keyboard grab mode. - * - * Keyboard grab enables capture of system keyboard shortcuts like Alt+Tab or - * the Meta/Super key. Note that not all system keyboard shortcuts can be - * captured by applications (one example is Ctrl+Alt+Del on Windows). - * - * This is primarily intended for specialized applications such as VNC clients - * or VM frontends. Normal games should not use keyboard grab. - * - * When keyboard grab is enabled, SDL will continue to handle Alt+Tab when the - * window is full-screen to ensure the user is not trapped in your - * application. If you have a custom keyboard shortcut to exit fullscreen - * mode, you may suppress this behavior with - * `SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED`. - * - * If the caller enables a grab while another window is currently grabbed, the - * other window loses its grab in favor of the caller's window. - * - * \param window The window for which the keyboard grab mode should be set. - * \param grabbed This is SDL_TRUE to grab keyboard, and SDL_FALSE to release. - * - * \since This function is available since SDL 2.0.16. - * - * \sa SDL_GetWindowKeyboardGrab - * \sa SDL_SetWindowMouseGrab - * \sa SDL_SetWindowGrab - *} -procedure SDL_SetWindowKeyboardGrab(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowKeyboardGrab' {$ENDIF} {$ENDIF}; - - {** - * Get a window's keyboard grab mode. - * - * Returns SDL_TRUE if keyboard is grabbed, and SDL_FALSE otherwise. - * - * SDL_SetWindowKeyboardGrab() - *} - -function SDL_GetWindowKeyboardGrab(window: PSDL_Window): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowKeyboardGrab' {$ENDIF} {$ENDIF}; - - {** - * Set a window's mouse grab mode. - * - * window The window for which the mouse grab mode should be set. - * grabbed This is SDL_TRUE to grab mouse, and SDL_FALSE to release. - * - * SDL_GetWindowMouseGrab() - *} - -procedure SDL_SetWindowMouseGrab(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowMouseGrab' {$ENDIF} {$ENDIF}; - - {** - * Get a window's mouse grab mode. - * - * Returns SDL_TRUE if mouse is grabbed, and SDL_FALSE otherwise. - * - * SDL_SetWindowMouseGrab() - *} - -function SDL_GetWindowMouseGrab(window: PSDL_Window): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowMouseGrab' {$ENDIF} {$ENDIF}; - - {** - * Confines the cursor to the specified area of a window. - * - * window The window that will be associated with the barrier. - * rect A rectangle area in window-relative coordinates. If NULL the barrier for the specified window will be destroyed. - * - * SDL_GetWindowMouseRect() - *} - -procedure SDL_SetWindowMouseRect(window: PSDL_Window; rect: PSDL_Rect); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowMouseRect' {$ENDIF} {$ENDIF}; - - {** - * Get the mouse confinement rectangle of a window. - * - * Returns A pointer to the mouse confinement rectangle of a window, or NULL if there isn't one. - * - * SDL_SetWindowMouseRect() - *} - -function SDL_GetWindowMouseRect(window: PSDL_Window): PSDL_Rect; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowMouseRect' {$ENDIF} {$ENDIF}; - - {** - * \brief Get the window that currently has an input grab enabled. - * - * \return This returns the window if input is grabbed, and NULL otherwise. - * - * \sa SDL_SetWindowGrab() - *} -function SDL_GetGrabbedWindow(): PSDL_Window; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetGrabbedWindow' {$ENDIF} {$ENDIF}; - - {** - * Set the brightness (gamma correction) for a window. - * - * 0 on success, or -1 if setting the brightness isn't supported. - * - * SDL_GetWindowBrightness() - * SDL_SetWindowGammaRamp() - *} - -function SDL_SetWindowBrightness(window: PSDL_Window; brightness: cfloat): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowBrightness' {$ENDIF} {$ENDIF}; - - {** - * Get the brightness (gamma correction) for a window. - * - * The last brightness value passed to SDL_SetWindowBrightness() - * - * SDL_SetWindowBrightness() - *} - -function SDL_GetWindowBrightness(window: PSDL_Window): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowBrightness' {$ENDIF} {$ENDIF}; - - {** - * \brief Set the opacity for a window - * - * \param window The window which will be made transparent or opaque - * \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be - * clamped internally between 0.0f and 1.0f. - * - * \return 0 on success, or -1 if setting the opacity isn't supported. - * - * \sa SDL_GetWindowOpacity() - *} -function SDL_SetWindowOpacity(window: PSDL_Window; opacity: cfloat): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowOpacity' {$ENDIF} {$ENDIF}; - - {** - * \brief Get the opacity of a window. - * - * If transparency isn't supported on this platform, opacity will be reported - * as 1.0f without error. - * - * \param window The window in question. - * \param out_opacity Opacity (0.0f - transparent, 1.0f - opaque) - * - * \return 0 on success, or -1 on error (invalid window, etc). - * - * \sa SDL_SetWindowOpacity() - *} -function SDL_GetWindowOpacity(window: PSDL_Window; out_opacity: pcfloat): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowOpacity' {$ENDIF} {$ENDIF}; - - {** - * \brief Sets the window as a modal for another window - * - * \param modal_window The window that should be modal - * \param parent_window The parent window - * - * \return 0 on success, or -1 otherwise. - *} -function SDL_SetWindowModalFor(modal_window, parent_window: PSDL_Window): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowModalFor' {$ENDIF} {$ENDIF}; - - {** - * \brief Explicitly sets input focus to the window. - * - * You almost certainly want SDL_RaiseWindow() instead of this function. Use - * this with caution, as you might give focus to a window that's completely - * obscured by other windows. - * - * \param window The window that should get the input focus - * - * \return 0 on success, or -1 otherwise. - * \sa SDL_RaiseWindow() - *} -function SDL_SetWindowInputFocus(window: PSDL_Window): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowInputFocus' {$ENDIF} {$ENDIF}; - - {** - * Set the gamma ramp for a window. - * - * red The translation table for the red channel, or nil. - * green The translation table for the green channel, or nil. - * blue The translation table for the blue channel, or nil. - * - * 0 on success, or -1 if gamma ramps are unsupported. - * - * Set the gamma translation table for the red, green, and blue channels - * of the video hardware. Each table is an array of 256 16-bit quantities, - * representing a mapping between the input and output for that channel. - * The input is the index into the array, and the output is the 16-bit - * gamma value at that index, scaled to the output color precision. - * - * SDL_GetWindowGammaRamp() - *} - -function SDL_SetWindowGammaRamp(window: PSDL_Window; const red: pcuint16; const green: pcuint16; const blue: pcuint16): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowGammaRamp' {$ENDIF} {$ENDIF}; - - {** - * Get the gamma ramp for a window. - * - * red A pointer to a 256 element array of 16-bit quantities to hold - * the translation table for the red channel, or nil. - * green A pointer to a 256 element array of 16-bit quantities to hold - * the translation table for the green channel, or nil. - * blue A pointer to a 256 element array of 16-bit quantities to hold - * the translation table for the blue channel, or nil. - * - * 0 on success, or -1 if gamma ramps are unsupported. - * - * SDL_SetWindowGammaRamp() - *} - -function SDL_GetWindowGammaRamp(window: PSDL_Window; red: pcuint16; green: pcuint16; blue: pcuint16): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowGammaRamp' {$ENDIF} {$ENDIF}; - -{** - * \brief Possible return values from the SDL_HitTest callback. - * - * \sa SDL_HitTest - *} -type - PPSDL_HitTestResult = ^PSDL_HitTestResult; - PSDL_HitTestResult = ^TSDL_HitTestResult; - TSDL_HitTestResult = type Integer; - -const - SDL_HITTEST_NORMAL = TSDL_HitTestResult(0); {**< Region is normal. No special properties. *} - SDL_HITTEST_DRAGGABLE = TSDL_HitTestResult(1); {**< Region can drag entire window. *} - SDL_HITTEST_RESIZE_TOPLEFT = TSDL_HitTestResult(2); - SDL_HITTEST_RESIZE_TOP = TSDL_HitTestResult(3); - SDL_HITTEST_RESIZE_TOPRIGHT = TSDL_HitTestResult(4); - SDL_HITTEST_RESIZE_RIGHT = TSDL_HitTestResult(5); - SDL_HITTEST_RESIZE_BOTTOMRIGHT = TSDL_HitTestResult(6); - SDL_HITTEST_RESIZE_BOTTOM = TSDL_HitTestResult(7); - SDL_HITTEST_RESIZE_BOTTOMLEFT = TSDL_HitTestResult(8); - SDL_HITTEST_RESIZE_LEFT = TSDL_HitTestResult(9); - - {** - * \brief Callback used for hit-testing. - * - * \sa SDL_SetWindowHitTest - *} -type - PPSDL_HitTest = ^PSDL_HitTest; - PSDL_HitTest = ^TSDL_HitTest; - TSDL_HitTest = function(win: PSDL_Window; const area: PSDL_Point; data: Pointer): TSDL_HitTestResult; cdecl; - - {** - * \brief Provide a callback that decides if a window region has special properties. - * - * Normally windows are dragged and resized by decorations provided by the - * system window manager (a title bar, borders, etc), but for some apps, it - * makes sense to drag them from somewhere else inside the window itself; for - * example, one might have a borderless window that wants to be draggable - * from any part, or simulate its own title bar, etc. - * - * This function lets the app provide a callback that designates pieces of - * a given window as special. This callback is run during event processing - * if we need to tell the OS to treat a region of the window specially; the - * use of this callback is known as "hit testing." - * - * Mouse input may not be delivered to your application if it is within - * a special area; the OS will often apply that input to moving the window or - * resizing the window and not deliver it to the application. - * - * Specifying NULL for a callback disables hit-testing. Hit-testing is - * disabled by default. - * - * Platforms that don't support this functionality will return -1 - * unconditionally, even if you're attempting to disable hit-testing. - * - * Your callback may fire at any time, and its firing does not indicate any - * specific behavior (for example, on Windows, this certainly might fire - * when the OS is deciding whether to drag your window, but it fires for lots - * of other reasons, too, some unrelated to anything you probably care about - * _and when the mouse isn't actually at the location it is testing_). - * Since this can fire at any time, you should try to keep your callback - * efficient, devoid of allocations, etc. - * - * \param window The window to set hit-testing on. - * \param callback The callback to call when doing a hit-test. - * \param callback_data An app-defined void pointer passed to the callback. - * \return 0 on success, -1 on error (including unsupported). - *} -function SDL_SetWindowHitTest(window: PSDL_Window; callback: TSDL_HitTest; callback_data: Pointer): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowHitTest' {$ENDIF} {$ENDIF}; - - {** - * Request a window to demand attention from the user. - * - * \param window the window to be flashed - * \param operation the flash operation - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.16. - *} -function SDL_FlashWindow(window: PSDL_Window; operation: TSDL_FlashOperation): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FlashWindow' {$ENDIF} {$ENDIF}; - - {** - * Destroy a window. - *} - -procedure SDL_DestroyWindow(window: PSDL_Window); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyWindow' {$ENDIF} {$ENDIF}; - - {** - * Returns whether the screensaver is currently enabled (default on). - * - * SDL_EnableScreenSaver() - * SDL_DisableScreenSaver() - *} - -function SDL_IsScreenSaverEnabled: TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsScreenSaverEnabled' {$ENDIF} {$ENDIF}; - - {** - * Allow the screen to be blanked by a screensaver - * - * SDL_IsScreenSaverEnabled() - * SDL_DisableScreenSaver() - *} - -procedure SDL_EnableScreenSaver; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EnableScreenSaver' {$ENDIF} {$ENDIF}; - - {** - * Prevent the screen from being blanked by a screensaver - * - * SDL_IsScreenSaverEnabled() - * SDL_EnableScreenSaver() - *} - -procedure SDL_DisableScreenSaver; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DisableScreenSaver' {$ENDIF} {$ENDIF}; - - {** - * OpenGL support functions - *} - - {** - * Dynamically load an OpenGL library. - * - * path The platform dependent OpenGL library name, or nil to open the - * default OpenGL library. - * - * 0 on success, or -1 if the library couldn't be loaded. - * - * This should be done after initializing the video driver, but before - * creating any OpenGL windows. If no OpenGL library is loaded, the default - * library will be loaded upon creation of the first OpenGL window. - * - * If you do this, you need to retrieve all of the GL functions used in - * your program from the dynamic library using SDL_GL_GetProcAddress(). - * - * SDL_GL_GetProcAddress() - * SDL_GL_UnloadLibrary() - *} - -function SDL_GL_LoadLibrary(const path: PAnsiChar): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_LoadLibrary' {$ENDIF} {$ENDIF}; - - {** - * Get the address of an OpenGL function. - *} - -function SDL_GL_GetProcAddress(const proc: PAnsiChar): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetProcAddress' {$ENDIF} {$ENDIF}; - - {** - * Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary(). - * - * SDL_GL_LoadLibrary() - *} - -procedure SDL_GL_UnloadLibrary; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_UnloadLibrary' {$ENDIF} {$ENDIF}; - - {** - * Return true if an OpenGL extension is supported for the current - * context. - *} - -function SDL_GL_ExtensionSupported(const extension: PAnsiChar): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_ExtensionSupported' {$ENDIF} {$ENDIF}; - - {** - * Reset all previously set OpenGL context attributes to their default values - *} -procedure SDL_GL_ResetAttributes(); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_ResetAttributes' {$ENDIF} {$ENDIF}; - - {** - * Set an OpenGL window attribute before window creation. - *} - -function SDL_GL_SetAttribute(attr: TSDL_GLattr; value: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_SetAttribute' {$ENDIF} {$ENDIF}; - - {** - * Get the actual value for an attribute from the current context. - *} - -function SDL_GL_GetAttribute(attr: TSDL_GLattr; value: pcint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetAttribute' {$ENDIF} {$ENDIF}; - - {** - * Create an OpenGL context for use with an OpenGL window, and make it - * current. - * - * SDL_GL_DeleteContext() - *} - -function SDL_GL_CreateContext(window: PSDL_Window): TSDL_GLContext; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_CreateContext' {$ENDIF} {$ENDIF}; - - {** - * Set up an OpenGL context for rendering into an OpenGL window. - * - * The context must have been created with a compatible window. - *} - -function SDL_GL_MakeCurrent(window: PSDL_Window; context: TSDL_GLContext): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_MakeCurrent' {$ENDIF} {$ENDIF}; - - {** - * Get the currently active OpenGL window. - *} -function SDL_GL_GetCurrentWindow: PSDL_Window; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetCurrentWindow' {$ENDIF} {$ENDIF}; - - {** - * Get the currently active OpenGL context. - *} -function SDL_GL_GetCurrentContext: TSDL_GLContext; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetCurrentContext' {$ENDIF} {$ENDIF}; - - {** - * Get the size of a window's underlying drawable in pixels (for use - * with glViewport). - * - * window Window from which the drawable size should be queried - * w Pointer to variable for storing the width in pixels, may be NULL - * h Pointer to variable for storing the height in pixels, may be NULL - * - * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI - * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a - * platform with high-DPI support (Apple calls this "Retina"), and not disabled - * by the SDL_HINT_VIDEO_HIGHDPI_DISABLED hint. - * - * SDL_GetWindowSize() - * SDL_CreateWindow() - *} - -procedure SDL_GL_GetDrawableSize(window: PSDL_Window; w: pcint; h: pcint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetDrawableSize' {$ENDIF} {$ENDIF}; - - {** - * Set the swap interval for the current OpenGL context. - * - * interval 0 for immediate updates, 1 for updates synchronized with the - * vertical retrace. If the system supports it, you may - * specify -1 to allow late swaps to happen immediately - * instead of waiting for the next retrace. - * - * 0 on success, or -1 if setting the swap interval is not supported. - * - * SDL_GL_GetSwapInterval() - *} - -function SDL_GL_SetSwapInterval(interval: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_SetSwapInterval' {$ENDIF} {$ENDIF}; - - {** - * Get the swap interval for the current OpenGL context. - * - * 0 if there is no vertical retrace synchronization, 1 if the buffer - * swap is synchronized with the vertical retrace, and -1 if late - * swaps happen immediately instead of waiting for the next retrace. - * If the system can't determine the swap interval, or there isn't a - * valid current context, this will return 0 as a safe default. - * - * SDL_GL_SetSwapInterval() - *} - -function SDL_GL_GetSwapInterval: cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetSwapInterval' {$ENDIF} {$ENDIF}; - - {** - * Swap the OpenGL buffers for a window, if double-buffering is - * supported. - *} - -procedure SDL_GL_SwapWindow(window: PSDL_Window); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_SwapWindow' {$ENDIF} {$ENDIF}; - - {** - * Delete an OpenGL context. - * - * SDL_GL_CreateContext() - *} - -procedure SDL_GL_DeleteContext(context: TSDL_GLContext); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_DeleteContext' {$ENDIF} {$ENDIF}; - - {*OpenGL support functions*} +// from "sdl_video.h" + + +type + PPSDL_Window = ^PSDL_Window; + PSDL_Window = type Pointer; + + {** + * The structure that defines a display mode + * + * SDL_GetNumDisplayModes() + * SDL_GetDisplayMode() + * SDL_GetDesktopDisplayMode() + * SDL_GetCurrentDisplayMode() + * SDL_GetClosestDisplayMode() + * SDL_SetWindowDisplayMode() + * SDL_GetWindowDisplayMode() + *} + PPSDL_DisplayMode = ^PSDL_DisplayMode; + PSDL_DisplayMode = ^TSDL_DisplayMode; + TSDL_DisplayMode = record + format: cuint32; {**< pixel format *} + w: cint; {**< width *} + h: cint; {**< height *} + refresh_rate: cint; {**< refresh rate (or zero for unspecified) *} + driverdata: Pointer; {**< driver-specific data, initialize to 0 *} + end; + +{** + * The flags on a window + * + * SDL_GetWindowFlags() + *} +type + PPSDL_WindowFlags = ^PSDL_WindowFlags; + PSDL_WindowFlags = ^TSDL_WindowFlags; + TSDL_WindowFlags = type cuint; + +const + SDL_WINDOW_FULLSCREEN = TSDL_WindowFlags($00000001); {**< fullscreen window *} + SDL_WINDOW_OPENGL = TSDL_WindowFlags($00000002); {**< window usable with OpenGL context *} + SDL_WINDOW_SHOWN = TSDL_WindowFlags($00000004); {**< window is visible *} + SDL_WINDOW_HIDDEN = TSDL_WindowFlags($00000008); {**< window is not visible *} + SDL_WINDOW_BORDERLESS = TSDL_WindowFlags($00000010); {**< no window decoration *} + SDL_WINDOW_RESIZABLE = TSDL_WindowFlags($00000020); {**< window can be resized *} + SDL_WINDOW_MINIMIZED = TSDL_WindowFlags($00000040); {**< window is minimized *} + SDL_WINDOW_MAXIMIZED = TSDL_WindowFlags($00000080); {**< window is maximized *} + SDL_WINDOW_MOUSE_GRABBED = TSDL_WindowFlags($00000100); {**< window has grabbed mouse input *} + SDL_WINDOW_INPUT_FOCUS = TSDL_WindowFlags($00000200); {**< window has input focus *} + SDL_WINDOW_MOUSE_FOCUS = TSDL_WindowFlags($00000400); {**< window has mouse focus *} + SDL_WINDOW_FULLSCREEN_DESKTOP = TSDL_WindowFlags(SDL_WINDOW_FULLSCREEN or $00001000); + SDL_WINDOW_FOREIGN = TSDL_WindowFlags($00000800); {**< window not created by SDL *} + SDL_WINDOW_ALLOW_HIGHDPI = TSDL_WindowFlags($00002000); {**< window should be created in high-DPI mode if supported. + On macOS NSHighResolutionCapable must be set true in the + application's Info.plist for this to have any effect. *} + SDL_WINDOW_MOUSE_CAPTURE = TSDL_WindowFlags($00004000); {**< window has mouse captured (unrelated to MOUSE_GRABBED) *} + SDL_WINDOW_ALWAYS_ON_TOP = TSDL_WindowFlags($00008000); {**< window should always be above others *} + SDL_WINDOW_SKIP_TASKBAR = TSDL_WindowFlags($00010000); {**< window should not be added to the taskbar *} + SDL_WINDOW_UTILITY = TSDL_WindowFlags($00020000); {**< window should be treated as a utility window *} + SDL_WINDOW_TOOLTIP = TSDL_WindowFlags($00040000); {**< window should be treated as a tooltip *} + SDL_WINDOW_POPUP_MENU = TSDL_WindowFlags($00080000); {**< window should be treated as a popup menu *} + SDL_WINDOW_KEYBOARD_GRABBED = TSDL_WindowFlags($00100000); {**< window has grabbed keyboard input *} + SDL_WINDOW_VULKAN = TSDL_WindowFlags($10000000); {**< window usable for Vulkan surface *} + SDL_WINDOW_METAL = TSDL_WindowFlags($20000000); {**< window usable for Metal view *} + + SDL_WINDOW_INPUT_GRABBED = SDL_WINDOW_MOUSE_GRABBED; {**< equivalent to SDL_WINDOW_MOUSE_GRABBED for compatibility *} + + {** + * Used to indicate that you don't care what the window position is. + *} +const SDL_WINDOWPOS_UNDEFINED_MASK = $1FFF0000; +function SDL_WINDOWPOS_UNDEFINED_DISPLAY(X: Variant): Variant; +const SDL_WINDOWPOS_UNDEFINED = SDL_WINDOWPOS_UNDEFINED_MASK or 0; +function SDL_WINDOWPOS_ISUNDEFINED(X: Variant): Variant; + + + {** + * Used to indicate that the window position should be centered. + *} +const SDL_WINDOWPOS_CENTERED_MASK = $2FFF0000; +function SDL_WINDOWPOS_CENTERED_DISPLAY(X: Variant): Variant; +const SDL_WINDOWPOS_CENTERED = SDL_WINDOWPOS_CENTERED_MASK or 0; +function SDL_WINDOWPOS_ISCENTERED(X: Variant): Variant; + + {** + * Event subtype for window events + *} +type + PPSDL_WindowEventID = ^PSDL_WindowEventID; + PSDL_WindowEventID = ^TSDL_WindowEventID; + TSDL_WindowEventID = type cint; +const + SDL_WINDOWEVENT_NONE = TSDL_WindowEventID(0); {**< Never used *} + SDL_WINDOWEVENT_SHOWN = TSDL_WindowEventID(1); {**< Window has been shown *} + SDL_WINDOWEVENT_HIDDEN = TSDL_WindowEventID(2); {**< Window has been hidden *} + SDL_WINDOWEVENT_EXPOSED = TSDL_WindowEventID(3); {**< Window has been exposed and should be redrawn *} + SDL_WINDOWEVENT_MOVED = TSDL_WindowEventID(4); {**< Window has been moved to data1; data2 *} + SDL_WINDOWEVENT_RESIZED = TSDL_WindowEventID(5); {**< Window has been resized to data1xdata2 *} + SDL_WINDOWEVENT_SIZE_CHANGED = TSDL_WindowEventID(6); {**< The window size has changed; either as a result of an API call or through the system or user changing the window size. *} + SDL_WINDOWEVENT_MINIMIZED = TSDL_WindowEventID(7); {**< Window has been minimized *} + SDL_WINDOWEVENT_MAXIMIZED = TSDL_WindowEventID(8); {**< Window has been maximized *} + SDL_WINDOWEVENT_RESTORED = TSDL_WindowEventID(9); {**< Window has been restored to normal size and position *} + SDL_WINDOWEVENT_ENTER = TSDL_WindowEventID(10); {**< Window has gained mouse focus *} + SDL_WINDOWEVENT_LEAVE = TSDL_WindowEventID(11); {**< Window has lost mouse focus *} + SDL_WINDOWEVENT_FOCUS_GAINED = TSDL_WindowEventID(12); {**< Window has gained keyboard focus *} + SDL_WINDOWEVENT_FOCUS_LOST = TSDL_WindowEventID(13); {**< Window has lost keyboard focus *} + SDL_WINDOWEVENT_CLOSE = TSDL_WindowEventID(14); {**< The window manager requests that the window be closed *} + SDL_WINDOWEVENT_TAKE_FOCUS = TSDL_WindowEventID(15); {**< Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore) *} + SDL_WINDOWEVENT_HIT_TEST = TSDL_WindowEventID(16); {**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. *} + SDL_WINDOWEVENT_ICCPROF_CHANGED = TSDL_WindowEventID(17); {**< The ICC profile of the window's display has changed. *} + SDL_WINDOWEVENT_DISPLAY_CHANGED = TSDL_WindowEventID(18); {**< Window has been moved to display data1. *} + +{** + * \brief Event subtype for display events + *} +type + PPSDL_DisplayEventID = ^PSDL_DisplayEventID; + PSDL_DisplayEventID = ^TSDL_DisplayEventID; + TSDL_DisplayEventID = type Integer; + +const + SDL_DISPLAYEVENT_NONE = TSDL_DisplayEventID(0); {**< Never used *} + SDL_DISPLAYEVENT_ORIENTATION = TSDL_DisplayEventID(1); {**< Display orientation has changed to data1 *} + SDL_DISPLAYEVENT_CONNECTED = TSDL_DisplayEventID(2); {**< Display has been added to the system *} + SDL_DISPLAYEVENT_DISCONNECTED = TSDL_DisplayEventID(3); {**< Display has been removed from the system *} + +type + PPSDL_DisplayOrientation = ^PSDL_DisplayOrientation; + PSDL_DisplayOrientation = ^TSDL_DisplayOrientation; + TSDL_DisplayOrientation = type Integer; + +const + SDL_ORIENTATION_UNKNOWN = TSDL_DisplayOrientation(0); {**< The display orientation can't be determined *} + SDL_ORIENTATION_LANDSCAPE = TSDL_DisplayOrientation(1); {**< The display is in landscape mode, with the right side up, relative to portrait mode *} + SDL_ORIENTATION_LANDSCAPE_FLIPPED = TSDL_DisplayOrientation(2); {**< The display is in landscape mode, with the left side up, relative to portrait mode *} + SDL_ORIENTATION_PORTRAIT = TSDL_DisplayOrientation(3); {**< The display is in portrait mode *} + SDL_ORIENTATION_PORTRAIT_FLIPPED = TSDL_DisplayOrientation(4); {**< The display is in portrait mode, upside down *} + + {** + * \brief Window flash operation + *} +type + PPSDL_FlashOperation = ^PSDL_FlashOperation; + PSDL_FlashOperation = ^TSDL_FlashOperation; + TSDL_FlashOperation = type Integer; + +const + SDL_FLASH_CANCEL = TSDL_FlashOperation(0); {**< Cancel any window flash state *} + SDL_FLASH_BRIEFLY = TSDL_FlashOperation(1); {**< Flash the window briefly to get attention *} + SDL_FLASH_UNTIL_FOCUSED = TSDL_FlashOperation(2); {**< Flash the window until it gets focus *} + + {** + * An opaque handle to an OpenGL context. + *} +type + PPSDL_GLContext = ^PSDL_GLContext; + PSDL_GLContext = ^TSDL_GLContext; + TSDL_GLContext = Pointer; + + {** + * OpenGL configuration attributes + *} +type + PPSDL_GLattr = ^PSDL_GLattr; + PSDL_GLattr = ^TSDL_GLattr; + TSDL_GLattr = type Integer; + +const + SDL_GL_RED_SIZE = TSDL_GLattr(0); + SDL_GL_GREEN_SIZE = TSDL_GLattr(1); + SDL_GL_BLUE_SIZE = TSDL_GLattr(2); + SDL_GL_ALPHA_SIZE = TSDL_GLattr(3); + SDL_GL_BUFFER_SIZE = TSDL_GLattr(4); + SDL_GL_DOUBLEBUFFER = TSDL_GLattr(5); + SDL_GL_DEPTH_SIZE = TSDL_GLattr(6); + SDL_GL_STENCIL_SIZE = TSDL_GLattr(7); + SDL_GL_ACCUM_RED_SIZE = TSDL_GLattr(8); + SDL_GL_ACCUM_GREEN_SIZE = TSDL_GLattr(9); + SDL_GL_ACCUM_BLUE_SIZE = TSDL_GLattr(10); + SDL_GL_ACCUM_ALPHA_SIZE = TSDL_GLattr(11); + SDL_GL_STEREO = TSDL_GLattr(12); + SDL_GL_MULTISAMPLEBUFFERS = TSDL_GLattr(13); + SDL_GL_MULTISAMPLESAMPLES = TSDL_GLattr(14); + SDL_GL_ACCELERATED_VISUAL = TSDL_GLattr(15); + SDL_GL_RETAINED_BACKING = TSDL_GLattr(16); + SDL_GL_CONTEXT_MAJOR_VERSION = TSDL_GLattr(17); + SDL_GL_CONTEXT_MINOR_VERSION = TSDL_GLattr(18); + SDL_GL_CONTEXT_EGL = TSDL_GLattr(19); + SDL_GL_CONTEXT_FLAGS = TSDL_GLattr(20); + SDL_GL_CONTEXT_PROFILE_MASK = TSDL_GLattr(21); + SDL_GL_SHARE_WITH_CURRENT_CONTEXT = TSDL_GLattr(22); + SDL_GL_FRAMEBUFFER_SRGB_CAPABLE = TSDL_GLattr(23); + SDL_GL_CONTEXT_RELEASE_BEHAVIOR = TSDL_GLattr(24); + SDL_GL_CONTEXT_RESET_NOTIFICATION = TSDL_GLattr(25); + SDL_GL_CONTEXT_NO_ERROR = TSDL_GLattr(26); + SDL_GL_FLOATBUFFERS = TSDL_GLattr(27); + +type + PPSDL_GLprofile = ^PSDL_GLprofile; + PSDL_GLprofile = ^TSDL_GLprofile; + TSDL_GLprofile = type Integer; + +const + SDL_GL_CONTEXT_PROFILE_CORE = TSDL_GLprofile($0001); + SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = TSDL_GLprofile($0002); + SDL_GL_CONTEXT_PROFILE_ES = TSDL_GLprofile($0004); + +type + PPSDL_GLcontextFlag = ^PSDL_GLcontextFlag; + PSDL_GLcontextFlag = ^TSDL_GLcontextFlag; + TSDL_GLcontextFlag = type Integer; + +const + SDL_GL_CONTEXT_DEBUG_FLAG = TSDL_GLcontextFlag($0001); + SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = TSDL_GLcontextFlag($0002); + SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = TSDL_GLcontextFlag($0004); + SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = TSDL_GLcontextFlag($0008); + +type + PPSDL_GLcontextReleaseFlag = ^PSDL_GLcontextReleaseFlag; + PSDL_GLcontextReleaseFlag = ^TSDL_GLcontextReleaseFlag; + TSDL_GLcontextReleaseFlag = type Integer; + +const + SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = TSDL_GLcontextReleaseFlag($0000); + SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = TSDL_GLcontextReleaseFlag($0001); + +type + PPSDL_GLContextResetNotification = ^PSDL_GLContextResetNotification; + PSDL_GLContextResetNotification = ^TSDL_GLContextResetNotification; + TSDL_GLContextResetNotification = type Integer; + +const + SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = TSDL_GLContextResetNotification($0000); + SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = TSDL_GLContextResetNotification($0001); + + {* Function prototypes *} + + {** + * Get the number of video drivers compiled into SDL + * + * SDL_GetVideoDriver() + *} + +function SDL_GetNumVideoDrivers: cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumVideoDrivers' {$ENDIF} {$ENDIF}; + + {** + * Get the name of a built in video driver. + * + * The video drivers are presented in the order in which they are + * normally checked during initialization. + * + * SDL_GetNumVideoDrivers() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetVideoDriver_fun = function(index: cint): PAnsiChar; cdecl; +Var + SDL_GetVideoDriver : TSDL_GetVideoDriver_fun = Nil; +{$else} + +function SDL_GetVideoDriver(index: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetVideoDriver' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Initialize the video subsystem, optionally specifying a video driver. + * + * driver_name Initialize a specific driver by name, or nil for the + * default video driver. + * + * 0 on success, -1 on error + * + * This function initializes the video subsystem; setting up a connection + * to the window manager, etc, and determines the available display modes + * and pixel formats, but does not initialize a window or graphics mode. + * + * SDL_VideoQuit() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_VideoInit_fun = function(const driver_name: PAnsiChar): cint; cdecl; +Var + SDL_VideoInit : TSDL_VideoInit_fun = Nil; +{$else} + +function SDL_VideoInit(const driver_name: PAnsiChar): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_VideoInit' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Shuts down the video subsystem. + * + * function closes all windows, and restores the original video mode. + * + * SDL_VideoInit() + *} +procedure SDL_VideoQuit; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_VideoQuit' {$ENDIF} {$ENDIF}; + + {** + * Returns the name of the currently initialized video driver. + * + * The name of the current video driver or nil if no driver + * has been initialized + * + * SDL_GetNumVideoDrivers() + * SDL_GetVideoDriver() + *} + +function SDL_GetCurrentVideoDriver: PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCurrentVideoDriver' {$ENDIF} {$ENDIF}; + + {** + * Returns the number of available video displays. + * + * SDL_GetDisplayBounds() + *} + +function SDL_GetNumVideoDisplays: cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumVideoDisplays' {$ENDIF} {$ENDIF}; + + {** + * Get the name of a display in UTF-8 encoding + * + * The name of a display, or nil for an invalid display index. + * + * SDL_GetNumVideoDisplays() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetDisplayName_fun = function(displayIndex: cint): PAnsiChar; cdecl; +Var + SDL_GetDisplayName : TSDL_GetDisplayName_fun = Nil; +{$else} + +function SDL_GetDisplayName(displayIndex: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayName' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the desktop area represented by a display, with the primary + * display located at 0,0 + * + * 0 on success, or -1 if the index is out of range. + * + * SDL_GetNumVideoDisplays() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetDisplayBounds_fun = function(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; +Var + SDL_GetDisplayBounds : TSDL_GetDisplayBounds_fun = Nil; +{$else} + +function SDL_GetDisplayBounds(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayBounds' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Get the usable desktop area represented by a display, with the + * primary display located at 0,0 + * + * This is the same area as SDL_GetDisplayBounds() reports, but with portions + * reserved by the system removed. For example, on Mac OS X, this subtracts + * the area occupied by the menu bar and dock. + * + * Setting a window to be fullscreen generally bypasses these unusable areas, + * so these are good guidelines for the maximum space available to a + * non-fullscreen window. + * + * \return 0 on success, or -1 if the index is out of range. + * + * \sa SDL_GetDisplayBounds() + * \sa SDL_GetNumVideoDisplays() + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetDisplayUsableBounds_fun = function(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; +Var + SDL_GetDisplayUsableBounds : TSDL_GetDisplayUsableBounds_fun = Nil; +{$else} + +function SDL_GetDisplayUsableBounds(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayUsableBounds' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * \brief Get the dots/pixels-per-inch for a display + * + * \note Diagonal, horizontal and vertical DPI can all be optionally + * returned if the parameter is non-NULL. + * + * \return 0 on success, or -1 if no DPI information is available or the index is out of range. + * + * \sa SDL_GetNumVideoDisplays() + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetDisplayDPI_fun = function(displayIndex: cint; ddpi, hdpi, vdpi: pcfloat): cint; cdecl; +Var + SDL_GetDisplayDPI : TSDL_GetDisplayDPI_fun = Nil; +{$else} + +function SDL_GetDisplayDPI(displayIndex: cint; ddpi, hdpi, vdpi: pcfloat): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayDPI' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Get the orientation of a display + * + * \return The orientation of the display, or SDL_ORIENTATION_UNKNOWN if it isn't available. + * + * \sa SDL_GetNumVideoDisplays() + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetDisplayOrientation_fun = function(displayIndex: cint): TSDL_DisplayOrientation; cdecl; +Var + SDL_GetDisplayOrientation : TSDL_GetDisplayOrientation_fun = Nil; +{$else} + +function SDL_GetDisplayOrientation(displayIndex: cint): TSDL_DisplayOrientation; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayOrientation' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Returns the number of available display modes. + * + * SDL_GetDisplayMode() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetNumDisplayModes_fun = function(displayIndex: cint): cint; cdecl; +Var + SDL_GetNumDisplayModes : TSDL_GetNumDisplayModes_fun = Nil; +{$else} + +function SDL_GetNumDisplayModes(displayIndex: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumDisplayModes' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Fill in information about a specific display mode. + * + * The display modes are sorted in this priority: + * bits per pixel -> more colors to fewer colors + * width -> largest to smallest + * height -> largest to smallest + * refresh rate -> highest to lowest + * + * SDL_GetNumDisplayModes() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetDisplayMode_fun = function(displayIndex: cint; modeIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; +Var + SDL_GetDisplayMode : TSDL_GetDisplayMode_fun = Nil; +{$else} + +function SDL_GetDisplayMode(displayIndex: cint; modeIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayMode' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Fill in information about the desktop display mode. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetDesktopDisplayMode_fun = function(displayIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; +Var + SDL_GetDesktopDisplayMode : TSDL_GetDesktopDisplayMode_fun = Nil; +{$else} + +function SDL_GetDesktopDisplayMode(displayIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDesktopDisplayMode' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Fill in information about the current display mode. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetCurrentDisplayMode_fun = function(displayIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; +Var + SDL_GetCurrentDisplayMode : TSDL_GetCurrentDisplayMode_fun = Nil; +{$else} + +function SDL_GetCurrentDisplayMode(displayIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCurrentDisplayIndex' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the closest match to the requested display mode. + * + * mode The desired display mode + * closest A pointer to a display mode to be filled in with the closest + * match of the available display modes. + * + * The passed in value closest, or nil if no matching video mode + * was available. + * + * The available display modes are scanned, and closest is filled in with the + * closest mode matching the requested mode and returned. The mode format and + * refresh_rate default to the desktop mode if they are 0. The modes are + * scanned with size being first priority, format being second priority, and + * finally checking the refresh_rate. If all the available modes are too + * small, then nil is returned. + * + * SDL_GetNumDisplayModes() + * SDL_GetDisplayMode() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetClosestDisplayMode_fun = function(displayIndex: cint; const mode: PSDL_DisplayMode; closest: PSDL_DisplayMode): PSDL_DisplayMode; cdecl; +Var + SDL_GetClosestDisplayMode : TSDL_GetClosestDisplayMode_fun = Nil; +{$else} + +function SDL_GetClosestDisplayMode(displayIndex: cint; const mode: PSDL_DisplayMode; closest: PSDL_DisplayMode): PSDL_DisplayMode; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetClosestDisplayMode' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the index of the display containing a point + * + * \param point the point to query + * \returns the index of the display containing the point or a negative error + * code on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GetDisplayBounds + * \sa SDL_GetNumVideoDisplays + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetPointDisplayIndex_fun = function(const point: PSDL_Point): cint; cdecl; +Var + SDL_GetPointDisplayIndex : TSDL_GetPointDisplayIndex_fun = Nil; +{$else} + +function SDL_GetPointDisplayIndex(const point: PSDL_Point): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPointDisplayIndex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the index of the display primarily containing a rect + * + * \param rect the rect to query + * \returns the index of the display entirely containing the rect or closest + * to the center of the rect on success or a negative error code on + * failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GetDisplayBounds + * \sa SDL_GetNumVideoDisplays + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetRectDisplayIndex_fun = function(const rect: PSDL_Rect): cint; cdecl; +Var + SDL_GetRectDisplayIndex : TSDL_GetRectDisplayIndex_fun = Nil; +{$else} + +function SDL_GetRectDisplayIndex(const rect: PSDL_Rect): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRectDisplayIndex' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the display index associated with a window. + * + * the display index of the display containing the center of the + * window, or -1 on error. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowDisplayIndex_fun = function(window: PSDL_Window): cint; cdecl; +Var + SDL_GetWindowDisplayIndex : TSDL_GetWindowDisplayIndex_fun = Nil; +{$else} + +function SDL_GetWindowDisplayIndex(window: PSDL_Window): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowDisplayIndex' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the display mode used when a fullscreen window is visible. + * + * By default the window's dimensions and the desktop format and refresh rate + * are used. + * + * mode The mode to use, or nil for the default mode. + * + * 0 on success, or -1 if setting the display mode failed. + * + * SDL_GetWindowDisplayMode() + * SDL_SetWindowFullscreen() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowDisplayMode_fun = function(window: PSDL_Window; const mode: PSDL_DisplayMode): cint; cdecl; +Var + SDL_SetWindowDisplayMode : TSDL_SetWindowDisplayMode_fun = Nil; +{$else} + +function SDL_SetWindowDisplayMode(window: PSDL_Window; const mode: PSDL_DisplayMode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowDisplayMode' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Fill in information about the display mode used when a fullscreen + * window is visible. + * + * SDL_SetWindowDisplayMode() + * SDL_SetWindowFullscreen() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowDisplayMode_fun = function(window: PSDL_Window; mode: PSDL_DisplayMode): cint; cdecl; +Var + SDL_GetWindowDisplayMode : TSDL_GetWindowDisplayMode_fun = Nil; +{$else} + +function SDL_GetWindowDisplayMode(window: PSDL_Window; mode: PSDL_DisplayMode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowDisplayMode' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the raw ICC profile data for the screen the window is currently on. + * + * Data returned should be freed with SDL_free(). + * + * \param window the window to query + * \param size the size of the ICC profile + * \returns the raw ICC profile data on success or NIL on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.18. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowICCProfile_fun = function(window: PSDL_Window; size: pcsize_t): Pointer; cdecl; +Var + SDL_GetWindowICCProfile : TSDL_GetWindowICCProfile_fun = Nil; +{$else} + +function SDL_GetWindowICCProfile(window: PSDL_Window; size: pcsize_t): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowICCProfile' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the pixel format associated with the window. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowPixelFormat_fun = function(window: PSDL_Window): cuint32; cdecl; +Var + SDL_GetWindowPixelFormat : TSDL_GetWindowPixelFormat_fun = Nil; +{$else} + +function SDL_GetWindowPixelFormat(window: PSDL_Window): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowPixelFormat' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * \brief Create a window with the specified position, dimensions, and flags. + * + * \param title The title of the window, in UTF-8 encoding. + * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or + * ::SDL_WINDOWPOS_UNDEFINED. + * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or + * ::SDL_WINDOWPOS_UNDEFINED. + * \param w The width of the window, in screen coordinates. + * \param h The height of the window, in screen coordinates. + * \param flags The flags for the window, a mask of any of the following: + * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL, + * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS, + * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED, + * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED, + * ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN. + * + * \return The created window, or NULL if window creation failed. + * + * If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size + * in pixels may differ from its size in screen coordinates on platforms with + * high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query + * the client area's size in screen coordinates, and SDL_GL_GetDrawableSize(), + * SDL_Vulkan_GetDrawableSize(), or SDL_GetRendererOutputSize() to query the + * drawable size in pixels. + * + * If the window is created with any of the SDL_WINDOW_OPENGL or + * SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function + * (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the + * corresponding UnloadLibrary function is called by SDL_DestroyWindow(). + * + * If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver, + * SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail. + * + * \note On non-Apple devices, SDL requires you to either not link to the + * Vulkan loader or link to a dynamic library version. This limitation + * may be removed in a future version of SDL. + * + * \sa SDL_DestroyWindow() + * \sa SDL_GL_LoadLibrary() + * \sa SDL_Vulkan_LoadLibrary() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateWindow_fun = function(const title: PAnsiChar; x: cint; y: cint; w: cint; h: cint; flags: TSDL_WindowFlags): PSDL_Window; cdecl; +Var + SDL_CreateWindow : TSDL_CreateWindow_fun = Nil; +{$else} + +function SDL_CreateWindow(const title: PAnsiChar; x: cint; y: cint; w: cint; h: cint; flags: TSDL_WindowFlags): PSDL_Window; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateWindow' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Create an SDL window from an existing native window. + * + * data A pointer to driver-dependent window creation data + * + * The id of the window created, or zero if window creation failed. + * + * SDL_DestroyWindow() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateWindowFrom_fun = function(const data: Pointer): PSDL_Window; cdecl; +Var + SDL_CreateWindowFrom : TSDL_CreateWindowFrom_fun = Nil; +{$else} + +function SDL_CreateWindowFrom(const data: Pointer): PSDL_Window; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateWindowFrom' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the numeric ID of a window, for logging purposes. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowID_fun = function(window: PSDL_Window): cuint32; cdecl; +Var + SDL_GetWindowID : TSDL_GetWindowID_fun = Nil; +{$else} + +function SDL_GetWindowID(window: PSDL_Window): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowID' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get a window from a stored ID, or nil if it doesn't exist. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowFromID_fun = function(id: cuint32): PSDL_Window; cdecl; +Var + SDL_GetWindowFromID : TSDL_GetWindowFromID_fun = Nil; +{$else} + +function SDL_GetWindowFromID(id: cuint32): PSDL_Window; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowFromID' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the window flags. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowFlags_fun = function(window: PSDL_Window): TSDL_WindowFlags; cdecl; +Var + SDL_GetWindowFlags : TSDL_GetWindowFlags_fun = Nil; +{$else} + +function SDL_GetWindowFlags(window: PSDL_Window): TSDL_WindowFlags; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowFlags' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the title of a window, in UTF-8 format. + * + * SDL_GetWindowTitle() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowTitle_proc = procedure(window: PSDL_Window; const title: PAnsiChar); cdecl; +Var + SDL_SetWindowTitle : TSDL_SetWindowTitle_proc = Nil; +{$else} + +procedure SDL_SetWindowTitle(window: PSDL_Window; const title: PAnsiChar); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowTitle' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the title of a window, in UTF-8 format. + * + * SDL_SetWindowTitle() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowTitle_fun = function(window: PSDL_Window): PAnsiChar; cdecl; +Var + SDL_GetWindowTitle : TSDL_GetWindowTitle_fun = Nil; +{$else} + +function SDL_GetWindowTitle(window: PSDL_Window): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowTitle' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the icon for a window. + * + * icon The icon for the window. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowIcon_proc = procedure(window: PSDL_Window; icon: PSDL_Surface); cdecl; +Var + SDL_SetWindowIcon : TSDL_SetWindowIcon_proc = Nil; +{$else} + +procedure SDL_SetWindowIcon(window: PSDL_Window; icon: PSDL_Surface); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowIcon' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Associate an arbitrary named pointer with a window. + * + * window The window to associate with the pointer. + * name The name of the pointer. + * userdata The associated pointer. + * + * The previous value associated with 'name' + * + * The name is case-sensitive. + * + * SDL_GetWindowData() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowData_fun = function(window: PSDL_Window; const name: PAnsiChar; userdata: Pointer): Pointer; cdecl; +Var + SDL_SetWindowData : TSDL_SetWindowData_fun = Nil; +{$else} + +function SDL_SetWindowData(window: PSDL_Window; const name: PAnsiChar; userdata: Pointer): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowData' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Retrieve the data pointer associated with a window. + * + * window The window to query. + * name The name of the pointer. + * + * The value associated with 'name' + * + * SDL_SetWindowData() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowData_fun = function(window: PSDL_Window; const name: PAnsiChar): Pointer; cdecl; +Var + SDL_GetWindowData : TSDL_GetWindowData_fun = Nil; +{$else} + +function SDL_GetWindowData(window: PSDL_Window; const name: PAnsiChar): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowData' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the position of a window. + * + * window The window to reposition. + * x The x coordinate of the window, SDL_WINDOWPOS_CENTERED, or + * SDL_WINDOWPOS_UNDEFINED. + * y The y coordinate of the window, SDL_WINDOWPOS_CENTERED, or + * SDL_WINDOWPOS_UNDEFINED. + * + * The window coordinate origin is the upper left of the display. + * + * SDL_GetWindowPosition() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowPosition_proc = procedure(window: PSDL_Window; x: cint; y: cint); cdecl; +Var + SDL_SetWindowPosition : TSDL_SetWindowPosition_proc = Nil; +{$else} + +procedure SDL_SetWindowPosition(window: PSDL_Window; x: cint; y: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowPosition' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the position of a window. + * + * x Pointer to variable for storing the x position, may be nil + * y Pointer to variable for storing the y position, may be nil + * + * SDL_SetWindowPosition() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowPosition_proc = procedure(window: PSDL_Window; x: pcint; y: pcint); cdecl; +Var + SDL_GetWindowPosition : TSDL_GetWindowPosition_proc = Nil; +{$else} + +procedure SDL_GetWindowPosition(window: PSDL_Window; x: pcint; y: pcint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowPosition' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the size of a window's client area. + * + * w The width of the window, must be >0 + * h The height of the window, must be >0 + * + * You can't change the size of a fullscreen window, it automatically + * matches the size of the display mode. + * + * SDL_GetWindowSize() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowSize_proc = procedure(window: PSDL_Window; w: cint; h: cint); cdecl; +Var + SDL_SetWindowSize : TSDL_SetWindowSize_proc = Nil; +{$else} + +procedure SDL_SetWindowSize(window: PSDL_Window; w: cint; h: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowSize' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the size of a window's client area. + * + * w Pointer to variable for storing the width, may be nil + * h Pointer to variable for storing the height, may be nil + * + * SDL_SetWindowSize() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowSize_proc = procedure(window: PSDL_Window; w: pcint; h: pcint); cdecl; +Var + SDL_GetWindowSize : TSDL_GetWindowSize_proc = Nil; +{$else} + +procedure SDL_GetWindowSize(window: PSDL_Window; w: pcint; h: pcint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowSize' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * \brief Get the size of a window's borders (decorations) around the client area. + * + * \param window The window to query. + * \param top Pointer to variable for storing the size of the top border. NULL is permitted. + * \param left Pointer to variable for storing the size of the left border. NULL is permitted. + * \param bottom Pointer to variable for storing the size of the bottom border. NULL is permitted. + * \param right Pointer to variable for storing the size of the right border. NULL is permitted. + * + * \return 0 on success, or -1 if getting this information is not supported. + * + * \note if this function fails (returns -1), the size values will be + * initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as + * if the window in question was borderless. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowBordersSize_fun = function(window: PSDL_Window; top, left, bottom, right: pcint): cint; cdecl; +Var + SDL_GetWindowBordersSize : TSDL_GetWindowBordersSize_fun = Nil; +{$else} + +function SDL_GetWindowBordersSize(window: PSDL_Window; top, left, bottom, right: pcint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowBordersSize' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the size of a window in pixels. + * + * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI + * drawable, i.e. the window was created with `SDL_WINDOW_ALLOW_HIGHDPI` on a + * platform with high-DPI support (Apple calls this "Retina"), and not + * disabled by the `SDL_HINT_VIDEO_HIGHDPI_DISABLED` hint. + * + * \param window the window from which the drawable size should be queried + * \param w a pointer to variable for storing the width in pixels, may be NIL + * \param h a pointer to variable for storing the height in pixels, may be + * NIL + * + * \since This function is available since SDL 2.26.0. + * + * \sa SDL_CreateWindow + * \sa SDL_GetWindowSize + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowSizeInPixels_proc = procedure(window: PSDL_Window; w, h: pcuint); cdecl; +Var + SDL_GetWindowSizeInPixels : TSDL_GetWindowSizeInPixels_proc = Nil; +{$else} + +procedure SDL_GetWindowSizeInPixels(window: PSDL_Window; w, h: pcuint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowSizeInPixels' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the minimum size of a window's client area. + * + * min_w The minimum width of the window, must be >0 + * min_h The minimum height of the window, must be >0 + * + * You can't change the minimum size of a fullscreen window, it + * automatically matches the size of the display mode. + * + * SDL_GetWindowMinimumSize() + * SDL_SetWindowMaximumSize() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowMinimumSize_proc = procedure(window: PSDL_Window; min_w: cint; min_h: cint); cdecl; +Var + SDL_SetWindowMinimumSize : TSDL_SetWindowMinimumSize_proc = Nil; +{$else} + +procedure SDL_SetWindowMinimumSize(window: PSDL_Window; min_w: cint; min_h: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowMinimumSize' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the minimum size of a window's client area. + * + * w Pointer to variable for storing the minimum width, may be nil + * h Pointer to variable for storing the minimum height, may be nil + * + * SDL_GetWindowMaximumSize() + * SDL_SetWindowMinimumSize() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowMinimumSize_proc = procedure(window: PSDL_Window; w: pcint; h: pcint); cdecl; +Var + SDL_GetWindowMinimumSize : TSDL_GetWindowMinimumSize_proc = Nil; +{$else} + +procedure SDL_GetWindowMinimumSize(window: PSDL_Window; w: pcint; h: pcint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowMinimumSize' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the maximum size of a window's client area. + * + * max_w The maximum width of the window, must be >0 + * max_h The maximum height of the window, must be >0 + * + * You can't change the maximum size of a fullscreen window, it + * automatically matches the size of the display mode. + * + * SDL_GetWindowMaximumSize() + * SDL_SetWindowMinimumSize() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowMaximumSize_proc = procedure(window: PSDL_Window; max_w: cint; max_h: cint); cdecl; +Var + SDL_SetWindowMaximumSize : TSDL_SetWindowMaximumSize_proc = Nil; +{$else} + +procedure SDL_SetWindowMaximumSize(window: PSDL_Window; max_w: cint; max_h: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowMaximumSize' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the maximum size of a window's client area. + * + * w Pointer to variable for storing the maximum width, may be nil + * h Pointer to variable for storing the maximum height, may be nil + * + * SDL_GetWindowMinimumSize() + * SDL_SetWindowMaximumSize() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowMaximumSize_proc = procedure(window: PSDL_Window; w: pcint; h: pcint); cdecl; +Var + SDL_GetWindowMaximumSize : TSDL_GetWindowMaximumSize_proc = Nil; +{$else} + +procedure SDL_GetWindowMaximumSize(window: PSDL_Window; w: pcint; h: pcint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowMaximumSize' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the border state of a window. + * + * This will add or remove the window's SDL_WINDOW_BORDERLESS flag and + * add or remove the border from the actual window. This is a no-op if the + * window's border already matches the requested state. + * + * window The window of which to change the border state. + * bordered SDL_FALSE to remove border, SDL_TRUE to add border. + * + * You can't change the border state of a fullscreen window. + * + * SDL_GetWindowFlags() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowBordered_proc = procedure(window: PSDL_Window; bordered: TSDL_Bool); cdecl; +Var + SDL_SetWindowBordered : TSDL_SetWindowBordered_proc = Nil; +{$else} + +procedure SDL_SetWindowBordered(window: PSDL_Window; bordered: TSDL_Bool); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowBordered' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * \brief Set the user-resizable state of a window. + * + * This will add or remove the window's SDL_WINDOW_RESIZABLE flag and + * allow/disallow user resizing of the window. This is a no-op if the + * window's resizable state already matches the requested state. + * + * \param window The window of which to change the resizable state. + * \param resizable SDL_TRUE to allow resizing, SDL_FALSE to disallow. + * + * \note You can't change the resizable state of a fullscreen window. + * + * \sa SDL_GetWindowFlags() + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowResizable_proc = procedure(window: PSDL_Window; resizable: TSDL_Bool); cdecl; +Var + SDL_SetWindowResizable : TSDL_SetWindowResizable_proc = Nil; +{$else} + +procedure SDL_SetWindowResizable(window: PSDL_Window; resizable: TSDL_Bool); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowResizable' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Set the window to always be above the others. + * + * This will add or remove the window's `SDL_WINDOW_ALWAYS_ON_TOP` flag. This + * will bring the window to the front and keep the window above the rest. + * + * \param window The window of which to change the always on top state + * \param on_top SDL_TRUE to set the window always on top, SDL_FALSE to + * disable + * + * \since This function is available since SDL 2.0.16. + * + * \sa SDL_GetWindowFlags + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowAlwaysOnTop_proc = procedure(window: PSDL_Window; on_top: TSDL_Bool); cdecl; +Var + SDL_SetWindowAlwaysOnTop : TSDL_SetWindowAlwaysOnTop_proc = Nil; +{$else} + +procedure SDL_SetWindowAlwaysOnTop(window: PSDL_Window; on_top: TSDL_Bool); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowAlwaysOnTop' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Show a window. + * + * SDL_HideWindow() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ShowWindow_proc = procedure(window: PSDL_Window); cdecl; +Var + SDL_ShowWindow : TSDL_ShowWindow_proc = Nil; +{$else} + +procedure SDL_ShowWindow(window: PSDL_Window); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ShowWindow' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Hide a window. + * + * SDL_ShowWindow() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HideWindow_proc = procedure(window: PSDL_Window); cdecl; +Var + SDL_HideWindow : TSDL_HideWindow_proc = Nil; +{$else} + +procedure SDL_HideWindow(window: PSDL_Window); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HideWindow' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Raise a window above other windows and set the input focus. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RaiseWindow_proc = procedure(window: PSDL_Window); cdecl; +Var + SDL_RaiseWindow : TSDL_RaiseWindow_proc = Nil; +{$else} + +procedure SDL_RaiseWindow(window: PSDL_Window); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RaiseWindow' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Make a window as large as possible. + * + * SDL_RestoreWindow() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_MaximizeWindow_proc = procedure(window: PSDL_Window); cdecl; +Var + SDL_MaximizeWindow : TSDL_MaximizeWindow_proc = Nil; +{$else} + +procedure SDL_MaximizeWindow(window: PSDL_Window); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MaximizeWindow' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Minimize a window to an iconic representation. + * + * SDL_RestoreWindow() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_MinimizeWindow_proc = procedure(window: PSDL_Window); cdecl; +Var + SDL_MinimizeWindow : TSDL_MinimizeWindow_proc = Nil; +{$else} + +procedure SDL_MinimizeWindow(window: PSDL_Window); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MinimizeWindow' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Restore the size and position of a minimized or maximized window. + * + * SDL_MaximizeWindow() + * SDL_MinimizeWindow() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RestoreWindow_proc = procedure(window: PSDL_Window); cdecl; +Var + SDL_RestoreWindow : TSDL_RestoreWindow_proc = Nil; +{$else} + +procedure SDL_RestoreWindow(window: PSDL_Window); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RestoreWindow' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set a window's fullscreen state. + * + * 0 on success, or -1 if setting the display mode failed. + * + * SDL_SetWindowDisplayMode() + * SDL_GetWindowDisplayMode() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowFullscreen_fun = function(window: PSDL_Window; flags: TSDL_WindowFlags): cint; cdecl; +Var + SDL_SetWindowFullscreen : TSDL_SetWindowFullscreen_fun = Nil; +{$else} + +function SDL_SetWindowFullscreen(window: PSDL_Window; flags: TSDL_WindowFlags): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowFullscreen' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Return whether the window has a surface associated with it. + * + * \returns SDL_TRUE if there is a surface associated with the window, or + * SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.28.0. + * + * \sa SDL_GetWindowSurface + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HasWindowSurface_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; +Var + SDL_HasWindowSurface : TSDL_HasWindowSurface_fun = Nil; +{$else} + +function SDL_HasWindowSurface(window: PSDL_Window): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasWindowSurface' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the SDL surface associated with the window. + * + * The window's framebuffer surface, or nil on error. + * + * A new surface will be created with the optimal format for the window, + * if necessary. This surface will be freed when the window is destroyed. + * + * You may not combine this with 3D or the rendering API on this window. + * + * SDL_UpdateWindowSurface() + * SDL_UpdateWindowSurfaceRects() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowSurface_fun = function(window: PSDL_Window): PSDL_Surface; cdecl; +Var + SDL_GetWindowSurface : TSDL_GetWindowSurface_fun = Nil; +{$else} + +function SDL_GetWindowSurface(window: PSDL_Window): PSDL_Surface; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowSurface' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Copy the window surface to the screen. + * + * 0 on success, or -1 on error. + * + * SDL_GetWindowSurface() + * SDL_UpdateWindowSurfaceRects() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UpdateWindowSurface_fun = function(window: PSDL_Window): cint; cdecl; +Var + SDL_UpdateWindowSurface : TSDL_UpdateWindowSurface_fun = Nil; +{$else} + +function SDL_UpdateWindowSurface(window: PSDL_Window): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateWindowSurface' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Copy a number of rectangles on the window surface to the screen. + * + * 0 on success, or -1 on error. + * + * SDL_GetWindowSurface() + * SDL_UpdateWindowSurfaceRect() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UpdateWindowSurfaceRects_fun = function(window: PSDL_Window; rects: PSDL_Rect; numrects: cint): cint; cdecl; +Var + SDL_UpdateWindowSurfaceRects : TSDL_UpdateWindowSurfaceRects_fun = Nil; +{$else} + +function SDL_UpdateWindowSurfaceRects(window: PSDL_Window; rects: PSDL_Rect; numrects: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateWindowSurfaceRects' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Destroy the surface associated with the window. + * + * \param window the window to update + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.28.0. + * + * \sa SDL_GetWindowSurface + * \sa SDL_HasWindowSurface + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_DestroyWindowSurface_fun = function(window: PSDL_Window): cint; cdecl; +Var + SDL_DestroyWindowSurface : TSDL_DestroyWindowSurface_fun = Nil; +{$else} + +function SDL_DestroyWindowSurface(window: PSDL_Window): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyWindowSurface' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set a window's input grab mode. + * + * grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input. + * + * SDL_GetWindowGrab() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowGrab_proc = procedure(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; +Var + SDL_SetWindowGrab : TSDL_SetWindowGrab_proc = Nil; +{$else} + +procedure SDL_SetWindowGrab(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowGrab' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get a window's input grab mode. + * + * This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise. + * + * SDL_SetWindowGrab() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowGrab_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; +Var + SDL_GetWindowGrab : TSDL_GetWindowGrab_fun = Nil; +{$else} + +function SDL_GetWindowGrab(window: PSDL_Window): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowGrab' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Set a window's keyboard grab mode. + * + * Keyboard grab enables capture of system keyboard shortcuts like Alt+Tab or + * the Meta/Super key. Note that not all system keyboard shortcuts can be + * captured by applications (one example is Ctrl+Alt+Del on Windows). + * + * This is primarily intended for specialized applications such as VNC clients + * or VM frontends. Normal games should not use keyboard grab. + * + * When keyboard grab is enabled, SDL will continue to handle Alt+Tab when the + * window is full-screen to ensure the user is not trapped in your + * application. If you have a custom keyboard shortcut to exit fullscreen + * mode, you may suppress this behavior with + * `SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED`. + * + * If the caller enables a grab while another window is currently grabbed, the + * other window loses its grab in favor of the caller's window. + * + * \param window The window for which the keyboard grab mode should be set. + * \param grabbed This is SDL_TRUE to grab keyboard, and SDL_FALSE to release. + * + * \since This function is available since SDL 2.0.16. + * + * \sa SDL_GetWindowKeyboardGrab + * \sa SDL_SetWindowMouseGrab + * \sa SDL_SetWindowGrab + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowKeyboardGrab_proc = procedure(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; +Var + SDL_SetWindowKeyboardGrab : TSDL_SetWindowKeyboardGrab_proc = Nil; +{$else} + +procedure SDL_SetWindowKeyboardGrab(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowKeyboardGrab' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get a window's keyboard grab mode. + * + * Returns SDL_TRUE if keyboard is grabbed, and SDL_FALSE otherwise. + * + * SDL_SetWindowKeyboardGrab() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowKeyboardGrab_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; +Var + SDL_GetWindowKeyboardGrab : TSDL_GetWindowKeyboardGrab_fun = Nil; +{$else} + +function SDL_GetWindowKeyboardGrab(window: PSDL_Window): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowKeyboardGrab' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set a window's mouse grab mode. + * + * window The window for which the mouse grab mode should be set. + * grabbed This is SDL_TRUE to grab mouse, and SDL_FALSE to release. + * + * SDL_GetWindowMouseGrab() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowMouseGrab_proc = procedure(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; +Var + SDL_SetWindowMouseGrab : TSDL_SetWindowMouseGrab_proc = Nil; +{$else} + +procedure SDL_SetWindowMouseGrab(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowMouseGrab' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get a window's mouse grab mode. + * + * Returns SDL_TRUE if mouse is grabbed, and SDL_FALSE otherwise. + * + * SDL_SetWindowMouseGrab() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowMouseGrab_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; +Var + SDL_GetWindowMouseGrab : TSDL_GetWindowMouseGrab_fun = Nil; +{$else} + +function SDL_GetWindowMouseGrab(window: PSDL_Window): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowMouseGrab' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Confines the cursor to the specified area of a window. + * + * window The window that will be associated with the barrier. + * rect A rectangle area in window-relative coordinates. If NULL the barrier for the specified window will be destroyed. + * + * SDL_GetWindowMouseRect() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowMouseRect_proc = procedure(window: PSDL_Window; rect: PSDL_Rect); cdecl; +Var + SDL_SetWindowMouseRect : TSDL_SetWindowMouseRect_proc = Nil; +{$else} + +procedure SDL_SetWindowMouseRect(window: PSDL_Window; rect: PSDL_Rect); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowMouseRect' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the mouse confinement rectangle of a window. + * + * Returns A pointer to the mouse confinement rectangle of a window, or NULL if there isn't one. + * + * SDL_SetWindowMouseRect() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowMouseRect_fun = function(window: PSDL_Window): PSDL_Rect; cdecl; +Var + SDL_GetWindowMouseRect : TSDL_GetWindowMouseRect_fun = Nil; +{$else} + +function SDL_GetWindowMouseRect(window: PSDL_Window): PSDL_Rect; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowMouseRect' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * \brief Get the window that currently has an input grab enabled. + * + * \return This returns the window if input is grabbed, and NULL otherwise. + * + * \sa SDL_SetWindowGrab() + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetGrabbedWindow_fun = function(): PSDL_Window; cdecl; +Var + SDL_GetGrabbedWindow : TSDL_GetGrabbedWindow_fun = Nil; +{$else} + +function SDL_GetGrabbedWindow(): PSDL_Window; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetGrabbedWindow' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the brightness (gamma correction) for a window. + * + * 0 on success, or -1 if setting the brightness isn't supported. + * + * SDL_GetWindowBrightness() + * SDL_SetWindowGammaRamp() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowBrightness_fun = function(window: PSDL_Window; brightness: cfloat): cint; cdecl; +Var + SDL_SetWindowBrightness : TSDL_SetWindowBrightness_fun = Nil; +{$else} + +function SDL_SetWindowBrightness(window: PSDL_Window; brightness: cfloat): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowBrightness' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the brightness (gamma correction) for a window. + * + * The last brightness value passed to SDL_SetWindowBrightness() + * + * SDL_SetWindowBrightness() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowBrightness_fun = function(window: PSDL_Window): cfloat; cdecl; +Var + SDL_GetWindowBrightness : TSDL_GetWindowBrightness_fun = Nil; +{$else} + +function SDL_GetWindowBrightness(window: PSDL_Window): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowBrightness' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * \brief Set the opacity for a window + * + * \param window The window which will be made transparent or opaque + * \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be + * clamped internally between 0.0f and 1.0f. + * + * \return 0 on success, or -1 if setting the opacity isn't supported. + * + * \sa SDL_GetWindowOpacity() + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowOpacity_fun = function(window: PSDL_Window; opacity: cfloat): cint; cdecl; +Var + SDL_SetWindowOpacity : TSDL_SetWindowOpacity_fun = Nil; +{$else} + +function SDL_SetWindowOpacity(window: PSDL_Window; opacity: cfloat): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowOpacity' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * \brief Get the opacity of a window. + * + * If transparency isn't supported on this platform, opacity will be reported + * as 1.0f without error. + * + * \param window The window in question. + * \param out_opacity Opacity (0.0f - transparent, 1.0f - opaque) + * + * \return 0 on success, or -1 on error (invalid window, etc). + * + * \sa SDL_SetWindowOpacity() + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowOpacity_fun = function(window: PSDL_Window; out_opacity: pcfloat): cint; cdecl; +Var + SDL_GetWindowOpacity : TSDL_GetWindowOpacity_fun = Nil; +{$else} + +function SDL_GetWindowOpacity(window: PSDL_Window; out_opacity: pcfloat): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowOpacity' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * \brief Sets the window as a modal for another window + * + * \param modal_window The window that should be modal + * \param parent_window The parent window + * + * \return 0 on success, or -1 otherwise. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowModalFor_fun = function(modal_window, parent_window: PSDL_Window): cint; cdecl; +Var + SDL_SetWindowModalFor : TSDL_SetWindowModalFor_fun = Nil; +{$else} + +function SDL_SetWindowModalFor(modal_window, parent_window: PSDL_Window): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowModalFor' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * \brief Explicitly sets input focus to the window. + * + * You almost certainly want SDL_RaiseWindow() instead of this function. Use + * this with caution, as you might give focus to a window that's completely + * obscured by other windows. + * + * \param window The window that should get the input focus + * + * \return 0 on success, or -1 otherwise. + * \sa SDL_RaiseWindow() + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowInputFocus_fun = function(window: PSDL_Window): cint; cdecl; +Var + SDL_SetWindowInputFocus : TSDL_SetWindowInputFocus_fun = Nil; +{$else} + +function SDL_SetWindowInputFocus(window: PSDL_Window): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowInputFocus' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the gamma ramp for a window. + * + * red The translation table for the red channel, or nil. + * green The translation table for the green channel, or nil. + * blue The translation table for the blue channel, or nil. + * + * 0 on success, or -1 if gamma ramps are unsupported. + * + * Set the gamma translation table for the red, green, and blue channels + * of the video hardware. Each table is an array of 256 16-bit quantities, + * representing a mapping between the input and output for that channel. + * The input is the index into the array, and the output is the 16-bit + * gamma value at that index, scaled to the output color precision. + * + * SDL_GetWindowGammaRamp() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowGammaRamp_fun = function(window: PSDL_Window; const red: pcuint16; const green: pcuint16; const blue: pcuint16): cint; cdecl; +Var + SDL_SetWindowGammaRamp : TSDL_SetWindowGammaRamp_fun = Nil; +{$else} + +function SDL_SetWindowGammaRamp(window: PSDL_Window; const red: pcuint16; const green: pcuint16; const blue: pcuint16): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowGammaRamp' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the gamma ramp for a window. + * + * red A pointer to a 256 element array of 16-bit quantities to hold + * the translation table for the red channel, or nil. + * green A pointer to a 256 element array of 16-bit quantities to hold + * the translation table for the green channel, or nil. + * blue A pointer to a 256 element array of 16-bit quantities to hold + * the translation table for the blue channel, or nil. + * + * 0 on success, or -1 if gamma ramps are unsupported. + * + * SDL_SetWindowGammaRamp() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowGammaRamp_fun = function(window: PSDL_Window; red: pcuint16; green: pcuint16; blue: pcuint16): cint; cdecl; +Var + SDL_GetWindowGammaRamp : TSDL_GetWindowGammaRamp_fun = Nil; +{$else} + +function SDL_GetWindowGammaRamp(window: PSDL_Window; red: pcuint16; green: pcuint16; blue: pcuint16): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowGammaRamp' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Possible return values from the SDL_HitTest callback. + * + * \sa SDL_HitTest + *} +type + PPSDL_HitTestResult = ^PSDL_HitTestResult; + PSDL_HitTestResult = ^TSDL_HitTestResult; + TSDL_HitTestResult = type Integer; + +const + SDL_HITTEST_NORMAL = TSDL_HitTestResult(0); {**< Region is normal. No special properties. *} + SDL_HITTEST_DRAGGABLE = TSDL_HitTestResult(1); {**< Region can drag entire window. *} + SDL_HITTEST_RESIZE_TOPLEFT = TSDL_HitTestResult(2); + SDL_HITTEST_RESIZE_TOP = TSDL_HitTestResult(3); + SDL_HITTEST_RESIZE_TOPRIGHT = TSDL_HitTestResult(4); + SDL_HITTEST_RESIZE_RIGHT = TSDL_HitTestResult(5); + SDL_HITTEST_RESIZE_BOTTOMRIGHT = TSDL_HitTestResult(6); + SDL_HITTEST_RESIZE_BOTTOM = TSDL_HitTestResult(7); + SDL_HITTEST_RESIZE_BOTTOMLEFT = TSDL_HitTestResult(8); + SDL_HITTEST_RESIZE_LEFT = TSDL_HitTestResult(9); + + {** + * \brief Callback used for hit-testing. + * + * \sa SDL_SetWindowHitTest + *} +type + PPSDL_HitTest = ^PSDL_HitTest; + PSDL_HitTest = ^TSDL_HitTest; + TSDL_HitTest = function(win: PSDL_Window; const area: PSDL_Point; data: Pointer): TSDL_HitTestResult; cdecl; + + {** + * \brief Provide a callback that decides if a window region has special properties. + * + * Normally windows are dragged and resized by decorations provided by the + * system window manager (a title bar, borders, etc), but for some apps, it + * makes sense to drag them from somewhere else inside the window itself; for + * example, one might have a borderless window that wants to be draggable + * from any part, or simulate its own title bar, etc. + * + * This function lets the app provide a callback that designates pieces of + * a given window as special. This callback is run during event processing + * if we need to tell the OS to treat a region of the window specially; the + * use of this callback is known as "hit testing." + * + * Mouse input may not be delivered to your application if it is within + * a special area; the OS will often apply that input to moving the window or + * resizing the window and not deliver it to the application. + * + * Specifying NULL for a callback disables hit-testing. Hit-testing is + * disabled by default. + * + * Platforms that don't support this functionality will return -1 + * unconditionally, even if you're attempting to disable hit-testing. + * + * Your callback may fire at any time, and its firing does not indicate any + * specific behavior (for example, on Windows, this certainly might fire + * when the OS is deciding whether to drag your window, but it fires for lots + * of other reasons, too, some unrelated to anything you probably care about + * _and when the mouse isn't actually at the location it is testing_). + * Since this can fire at any time, you should try to keep your callback + * efficient, devoid of allocations, etc. + * + * \param window The window to set hit-testing on. + * \param callback The callback to call when doing a hit-test. + * \param callback_data An app-defined void pointer passed to the callback. + * \return 0 on success, -1 on error (including unsupported). + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowHitTest_fun = function(window: PSDL_Window; callback: TSDL_HitTest; callback_data: Pointer): cint; cdecl; +Var + SDL_SetWindowHitTest : TSDL_SetWindowHitTest_fun = Nil; +{$else} + +function SDL_SetWindowHitTest(window: PSDL_Window; callback: TSDL_HitTest; callback_data: Pointer): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowHitTest' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Request a window to demand attention from the user. + * + * \param window the window to be flashed + * \param operation the flash operation + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.16. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_FlashWindow_fun = function(window: PSDL_Window; operation: TSDL_FlashOperation): cint; cdecl; +Var + SDL_FlashWindow : TSDL_FlashWindow_fun = Nil; +{$else} + +function SDL_FlashWindow(window: PSDL_Window; operation: TSDL_FlashOperation): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FlashWindow' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Destroy a window. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_DestroyWindow_proc = procedure(window: PSDL_Window); cdecl; +Var + SDL_DestroyWindow : TSDL_DestroyWindow_proc = Nil; +{$else} + +procedure SDL_DestroyWindow(window: PSDL_Window); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyWindow' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Returns whether the screensaver is currently enabled (default on). + * + * SDL_EnableScreenSaver() + * SDL_DisableScreenSaver() + *} + +function SDL_IsScreenSaverEnabled: TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsScreenSaverEnabled' {$ENDIF} {$ENDIF}; + + {** + * Allow the screen to be blanked by a screensaver + * + * SDL_IsScreenSaverEnabled() + * SDL_DisableScreenSaver() + *} + +procedure SDL_EnableScreenSaver; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EnableScreenSaver' {$ENDIF} {$ENDIF}; + + {** + * Prevent the screen from being blanked by a screensaver + * + * SDL_IsScreenSaverEnabled() + * SDL_EnableScreenSaver() + *} + +procedure SDL_DisableScreenSaver; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DisableScreenSaver' {$ENDIF} {$ENDIF}; + + {** + * OpenGL support functions + *} + + {** + * Dynamically load an OpenGL library. + * + * path The platform dependent OpenGL library name, or nil to open the + * default OpenGL library. + * + * 0 on success, or -1 if the library couldn't be loaded. + * + * This should be done after initializing the video driver, but before + * creating any OpenGL windows. If no OpenGL library is loaded, the default + * library will be loaded upon creation of the first OpenGL window. + * + * If you do this, you need to retrieve all of the GL functions used in + * your program from the dynamic library using SDL_GL_GetProcAddress(). + * + * SDL_GL_GetProcAddress() + * SDL_GL_UnloadLibrary() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_LoadLibrary_fun = function(const path: PAnsiChar): cint; cdecl; +Var + SDL_GL_LoadLibrary : TSDL_GL_LoadLibrary_fun = Nil; +{$else} + +function SDL_GL_LoadLibrary(const path: PAnsiChar): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_LoadLibrary' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the address of an OpenGL function. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_GetProcAddress_fun = function(const proc: PAnsiChar): Pointer; cdecl; +Var + SDL_GL_GetProcAddress : TSDL_GL_GetProcAddress_fun = Nil; +{$else} + +function SDL_GL_GetProcAddress(const proc: PAnsiChar): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetProcAddress' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary(). + * + * SDL_GL_LoadLibrary() + *} + +procedure SDL_GL_UnloadLibrary; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_UnloadLibrary' {$ENDIF} {$ENDIF}; + + {** + * Return true if an OpenGL extension is supported for the current + * context. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_ExtensionSupported_fun = function(const extension: PAnsiChar): TSDL_Bool; cdecl; +Var + SDL_GL_ExtensionSupported : TSDL_GL_ExtensionSupported_fun = Nil; +{$else} + +function SDL_GL_ExtensionSupported(const extension: PAnsiChar): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_ExtensionSupported' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Reset all previously set OpenGL context attributes to their default values + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_ResetAttributes_proc = procedure(); cdecl; +Var + SDL_GL_ResetAttributes : TSDL_GL_ResetAttributes_proc = Nil; +{$else} + +procedure SDL_GL_ResetAttributes(); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_ResetAttributes' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set an OpenGL window attribute before window creation. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_SetAttribute_fun = function(attr: TSDL_GLattr; value: cint): cint; cdecl; +Var + SDL_GL_SetAttribute : TSDL_GL_SetAttribute_fun = Nil; +{$else} + +function SDL_GL_SetAttribute(attr: TSDL_GLattr; value: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_SetAttribute' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the actual value for an attribute from the current context. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_GetAttribute_fun = function(attr: TSDL_GLattr; value: pcint): cint; cdecl; +Var + SDL_GL_GetAttribute : TSDL_GL_GetAttribute_fun = Nil; +{$else} + +function SDL_GL_GetAttribute(attr: TSDL_GLattr; value: pcint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetAttribute' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Create an OpenGL context for use with an OpenGL window, and make it + * current. + * + * SDL_GL_DeleteContext() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_CreateContext_fun = function(window: PSDL_Window): TSDL_GLContext; cdecl; +Var + SDL_GL_CreateContext : TSDL_GL_CreateContext_fun = Nil; +{$else} + +function SDL_GL_CreateContext(window: PSDL_Window): TSDL_GLContext; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_CreateContext' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set up an OpenGL context for rendering into an OpenGL window. + * + * The context must have been created with a compatible window. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_MakeCurrent_fun = function(window: PSDL_Window; context: TSDL_GLContext): cint; cdecl; +Var + SDL_GL_MakeCurrent : TSDL_GL_MakeCurrent_fun = Nil; +{$else} + +function SDL_GL_MakeCurrent(window: PSDL_Window; context: TSDL_GLContext): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_MakeCurrent' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the currently active OpenGL window. + *} +function SDL_GL_GetCurrentWindow: PSDL_Window; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetCurrentWindow' {$ENDIF} {$ENDIF}; + + {** + * Get the currently active OpenGL context. + *} +function SDL_GL_GetCurrentContext: TSDL_GLContext; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetCurrentContext' {$ENDIF} {$ENDIF}; + + {** + * Get the size of a window's underlying drawable in pixels (for use + * with glViewport). + * + * window Window from which the drawable size should be queried + * w Pointer to variable for storing the width in pixels, may be NULL + * h Pointer to variable for storing the height in pixels, may be NULL + * + * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI + * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a + * platform with high-DPI support (Apple calls this "Retina"), and not disabled + * by the SDL_HINT_VIDEO_HIGHDPI_DISABLED hint. + * + * SDL_GetWindowSize() + * SDL_CreateWindow() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_GetDrawableSize_proc = procedure(window: PSDL_Window; w: pcint; h: pcint); cdecl; +Var + SDL_GL_GetDrawableSize : TSDL_GL_GetDrawableSize_proc = Nil; +{$else} + +procedure SDL_GL_GetDrawableSize(window: PSDL_Window; w: pcint; h: pcint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetDrawableSize' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the swap interval for the current OpenGL context. + * + * interval 0 for immediate updates, 1 for updates synchronized with the + * vertical retrace. If the system supports it, you may + * specify -1 to allow late swaps to happen immediately + * instead of waiting for the next retrace. + * + * 0 on success, or -1 if setting the swap interval is not supported. + * + * SDL_GL_GetSwapInterval() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_SetSwapInterval_fun = function(interval: cint): cint; cdecl; +Var + SDL_GL_SetSwapInterval : TSDL_GL_SetSwapInterval_fun = Nil; +{$else} + +function SDL_GL_SetSwapInterval(interval: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_SetSwapInterval' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the swap interval for the current OpenGL context. + * + * 0 if there is no vertical retrace synchronization, 1 if the buffer + * swap is synchronized with the vertical retrace, and -1 if late + * swaps happen immediately instead of waiting for the next retrace. + * If the system can't determine the swap interval, or there isn't a + * valid current context, this will return 0 as a safe default. + * + * SDL_GL_SetSwapInterval() + *} + +function SDL_GL_GetSwapInterval: cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetSwapInterval' {$ENDIF} {$ENDIF}; + + {** + * Swap the OpenGL buffers for a window, if double-buffering is + * supported. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_SwapWindow_proc = procedure(window: PSDL_Window); cdecl; +Var + SDL_GL_SwapWindow : TSDL_GL_SwapWindow_proc = Nil; +{$else} + +procedure SDL_GL_SwapWindow(window: PSDL_Window); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_SwapWindow' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Delete an OpenGL context. + * + * SDL_GL_CreateContext() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_DeleteContext_proc = procedure(context: TSDL_GLContext); cdecl; +Var + SDL_GL_DeleteContext : TSDL_GL_DeleteContext_proc = Nil; +{$else} + +procedure SDL_GL_DeleteContext(context: TSDL_GLContext); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_DeleteContext' {$ENDIF} {$ENDIF}; +{$endif} + + {*OpenGL support functions*} From a5e047806c7f10b73d7c2df9a15d91d02d6af273 Mon Sep 17 00:00:00 2001 From: PascalCorpsman Date: Thu, 21 Nov 2024 07:02:31 +0100 Subject: [PATCH 2/8] FIX: Change LineEndings to \n --- units/ctypes.inc | 406 +-- units/jedi.inc | 1032 +++---- units/sdl.inc | 228 +- units/sdl_dnymic_linking.inc | 2286 +++++++-------- units/sdlatomic.inc | 218 +- units/sdlaudio.inc | 3442 +++++++++++----------- units/sdlblendmode.inc | 180 +- units/sdlclipboard.inc | 306 +- units/sdlcpuinfo.inc | 446 +-- units/sdlerror.inc | 204 +- units/sdlevents.inc | 1714 +++++------ units/sdlfilesystem.inc | 242 +- units/sdlgamecontroller.inc | 1956 ++++++------- units/sdlgesture.inc | 208 +- units/sdlguid.inc | 152 +- units/sdlhaptic.inc | 3072 ++++++++++---------- units/sdlhidapi.inc | 852 +++--- units/sdlhints.inc | 5176 +++++++++++++++++----------------- units/sdljoystick.inc | 3082 ++++++++++---------- units/sdlkeyboard.inc | 840 +++--- units/sdlkeycode.inc | 640 ++--- units/sdlloadso.inc | 184 +- units/sdllocale.inc | 108 +- units/sdllog.inc | 554 ++-- units/sdlmessagebox.inc | 280 +- units/sdlmisc.inc | 58 +- units/sdlmouse.inc | 1110 ++++---- units/sdlmutex.inc | 978 +++---- units/sdlpixels.inc | 1838 ++++++------ units/sdlplatform.inc | 26 +- units/sdlpower.inc | 86 +- units/sdlrect.inc | 616 ++-- units/sdlrenderer.inc | 2444 ++++++++-------- units/sdlrwops.inc | 992 +++---- units/sdlscancode.inc | 788 +++--- units/sdlsensor.inc | 590 ++-- units/sdlshape.inc | 322 +-- units/sdlstdinc.inc | 2434 ++++++++-------- units/sdlsurface.inc | 1694 +++++------ units/sdlsystem.inc | 1506 +++++----- units/sdlsyswm.inc | 738 ++--- units/sdlthread.inc | 1028 +++---- units/sdltimer.inc | 226 +- units/sdltouch.inc | 256 +- units/sdltypes.inc | 20 +- units/sdlversion.inc | 268 +- units/sdlvideo.inc | 4446 ++++++++++++++--------------- 47 files changed, 25136 insertions(+), 25136 deletions(-) diff --git a/units/ctypes.inc b/units/ctypes.inc index 57b62cc3..cd0b26ff 100644 --- a/units/ctypes.inc +++ b/units/ctypes.inc @@ -1,203 +1,203 @@ -// C data types - -{ - Simple DirectMedia Layer - Copyright (C) 1997-2013 Sam Lantinga - - Pascal-Header-Conversion - Copyright (C) 2012-2020 Tim Blume aka End/EV1313 - - SDL2-for-Pascal - Copyright (C) 2020-2021 PGD Community - - This file is part of the project above. It has solely the purpose - to map common C data types correctly by Pascal compilers. - - FPC: Most C data types are found in the native ctypes unit. - Delphi + others: Relies on this file for C data type mapping. - - These native C types should be strictly separated from - types defined by SDL which can be found in sdlstdinc.inc. -} - -{$IFNDEF FPC} -type - DWord = LongWord; - - ppcbool = ^pcbool; - pcbool = ^cbool; - cbool = LongBool; - {$EXTERNALSYM cbool} - - ppcint8 = ^pcint8; - pcint8 = ^cint8; - cint8 = ShortInt; - {$EXTERNALSYM cint8} - - pcuint8 = ^cuint8; - cuint8 = Byte; - {$EXTERNALSYM cuint8} - - ppcint16 = ^pcint16; - pcint16 = ^cint16; - cint16 = SmallInt; - {$EXTERNALSYM cint16} - - ppcuint16 = ^pcuint16; - pcuint16 = ^cuint16; - cuint16 = Word; - {$EXTERNALSYM cuint16} - - ppcushort = ^pcushort; - pcushort = ^cushort; - cushort = Word; - {$EXTERNALSYM cushort} - - ppcint32 = ^pcint32; - pcint32 = ^cint32; - cint32 = LongInt; - {$EXTERNALSYM cint32} - - ppcuint32 = ^pcuint32; - pcuint32 = ^cuint32; - cuint32 = LongWord; - {$EXTERNALSYM cuint32} - - {$IFNDEF Has_Int64} - ppcint64 = ^pcint64; - pcint64 = ^cint64; - cint64 = record - hi: cuint32; - lo: cuint32; - end; - {$EXTERNALSYM cint64} - - ppcuint64 = ^pcuint64; - pcuint64 = ^cuint64; - cuint64 = record - hi: cuint32; - lo: cuint32; - end; - {$EXTERNALSYM cuint64} - {$ELSE} - ppcint64 = ^pcint64; - pcint64 = ^cint64; - cint64 = Int64; - {$EXTERNALSYM cint64} - - ppcuint64 = ^pcuint64; - pcuint64 = ^cuint64; - cuint64 = UInt64; - {$EXTERNALSYM cuint64} - {$ENDIF} - - ppcsize_t = ^pcsize_t; - pcsize_t = ^csize_t; - {$IFNDEF WIN64} - csize_t = cuint32; - {$ELSE} - csize_t = cuint64; - {$ENDIF} - {$EXTERNALSYM csize_t} - - ppcfloat = ^pcfloat; - pcfloat = ^cfloat; - cfloat = Single; - {$EXTERNALSYM cfloat} - - ppcdouble = ^pcdouble; - pcdouble = ^cdouble; - cdouble = Double; - {$EXTERNALSYM cfloat} - - ppcint = ^pcint; - pcint = ^cint; - - ppcuint = ^pcuint; - pcuint = ^cuint; - - ppclong = ^pclong; - pclong = ^clong; - - ppculong = ^pculong; - pculong = ^culong; - { - Integer type sizes based on: - https://en.cppreference.com/w/c/language/arithmetic_types#Data_models - } - cint = cint32; - cuint = cuint32; - {$IF DEFINED(CPU32) OR DEFINED(CPU32BITS)} - clong = cint32; - culong = cuint32; - {$ELSE} // 64-bit - {$IFDEF MSWINDOWS} - clong = cint32; - culong = cuint32; - {$ELSE} - clong = cint64; - culong = cuint64; - {$ENDIF} - {$ENDIF} - {$EXTERNALSYM cint} - {$EXTERNALSYM cuint} - {$EXTERNALSYM clong} - {$EXTERNALSYM culong} - -{$ENDIF} - -{ Data types for all compilers } -type - PPUInt8Array = ^PUInt8Array; - PUInt8Array = ^TUInt8Array; - TUInt8Array = array [0..MAXINT shr 1] of cuint8; - - ppcuint8 = ^pcuint8; - - { "The following type designates an unsigned integer type [or signed respectivly] - with the property that any valid pointer to void can be - converted to this type, then converted back to a pointer - to void, and the result will compare equal to the original - pointer: uintptr_t" - Source: https://pubs.opengroup.org/onlinepubs/000095399/basedefs/stdint.h.html - } - {$IFNDEF FPC} - cuintptr_t = UIntPtr; - {$EXTERNALSYM cuintptr_t} - cintptr_t = IntPtr; - {$EXTERNALSYM cintptr_t} - {$ELSE} - cuintptr_t = PtrUInt; - {$EXTERNALSYM cuintptr_t} - cintptr_t = PtrInt; - {$EXTERNALSYM cintptr_t} - {$ENDIF} - - {$IFDEF WANT_CWCHAR_T} - (* wchar_t is the "wide character" type of the C language. - * The size of this type is platform- and compiler-dependent. - * - * While FPC does have it's own "wide character" type, System.WideChar, - * that one is defined as always being 16-bits, so we can't re-use it here. - * - * When using FPC on Unices, the UnixType unit provides a wchar_t definition. - * - * On other systems/compiler combos, let's just go - * by what the CPP reference wiki claims, i.e: - * - wchar_t is 16-bits on Windows - * - wchar_t is 32-bits on Linux "and many other non-Windows systems" - * - * See: https://en.cppreference.com/w/cpp/language/types#Character_types - *) - {$IF DEFINED(FPC) AND DEFINED(UNIX)} - cwchar_t = UnixType.wchar_t; - {$ELSE} - {$IF DEFINED(WIN32) OR DEFINED(WIN64)} - cwchar_t = cuint16; - {$ELSE} - cwchar_t = cuint32; - {$ENDIF} - {$ENDIF} - {$EXTERNALSYM cwchar_t} - pcwchar_t = ^cwchar_t; - {$ENDIF} +// C data types + +{ + Simple DirectMedia Layer + Copyright (C) 1997-2013 Sam Lantinga + + Pascal-Header-Conversion + Copyright (C) 2012-2020 Tim Blume aka End/EV1313 + + SDL2-for-Pascal + Copyright (C) 2020-2021 PGD Community + + This file is part of the project above. It has solely the purpose + to map common C data types correctly by Pascal compilers. + + FPC: Most C data types are found in the native ctypes unit. + Delphi + others: Relies on this file for C data type mapping. + + These native C types should be strictly separated from + types defined by SDL which can be found in sdlstdinc.inc. +} + +{$IFNDEF FPC} +type + DWord = LongWord; + + ppcbool = ^pcbool; + pcbool = ^cbool; + cbool = LongBool; + {$EXTERNALSYM cbool} + + ppcint8 = ^pcint8; + pcint8 = ^cint8; + cint8 = ShortInt; + {$EXTERNALSYM cint8} + + pcuint8 = ^cuint8; + cuint8 = Byte; + {$EXTERNALSYM cuint8} + + ppcint16 = ^pcint16; + pcint16 = ^cint16; + cint16 = SmallInt; + {$EXTERNALSYM cint16} + + ppcuint16 = ^pcuint16; + pcuint16 = ^cuint16; + cuint16 = Word; + {$EXTERNALSYM cuint16} + + ppcushort = ^pcushort; + pcushort = ^cushort; + cushort = Word; + {$EXTERNALSYM cushort} + + ppcint32 = ^pcint32; + pcint32 = ^cint32; + cint32 = LongInt; + {$EXTERNALSYM cint32} + + ppcuint32 = ^pcuint32; + pcuint32 = ^cuint32; + cuint32 = LongWord; + {$EXTERNALSYM cuint32} + + {$IFNDEF Has_Int64} + ppcint64 = ^pcint64; + pcint64 = ^cint64; + cint64 = record + hi: cuint32; + lo: cuint32; + end; + {$EXTERNALSYM cint64} + + ppcuint64 = ^pcuint64; + pcuint64 = ^cuint64; + cuint64 = record + hi: cuint32; + lo: cuint32; + end; + {$EXTERNALSYM cuint64} + {$ELSE} + ppcint64 = ^pcint64; + pcint64 = ^cint64; + cint64 = Int64; + {$EXTERNALSYM cint64} + + ppcuint64 = ^pcuint64; + pcuint64 = ^cuint64; + cuint64 = UInt64; + {$EXTERNALSYM cuint64} + {$ENDIF} + + ppcsize_t = ^pcsize_t; + pcsize_t = ^csize_t; + {$IFNDEF WIN64} + csize_t = cuint32; + {$ELSE} + csize_t = cuint64; + {$ENDIF} + {$EXTERNALSYM csize_t} + + ppcfloat = ^pcfloat; + pcfloat = ^cfloat; + cfloat = Single; + {$EXTERNALSYM cfloat} + + ppcdouble = ^pcdouble; + pcdouble = ^cdouble; + cdouble = Double; + {$EXTERNALSYM cfloat} + + ppcint = ^pcint; + pcint = ^cint; + + ppcuint = ^pcuint; + pcuint = ^cuint; + + ppclong = ^pclong; + pclong = ^clong; + + ppculong = ^pculong; + pculong = ^culong; + { + Integer type sizes based on: + https://en.cppreference.com/w/c/language/arithmetic_types#Data_models + } + cint = cint32; + cuint = cuint32; + {$IF DEFINED(CPU32) OR DEFINED(CPU32BITS)} + clong = cint32; + culong = cuint32; + {$ELSE} // 64-bit + {$IFDEF MSWINDOWS} + clong = cint32; + culong = cuint32; + {$ELSE} + clong = cint64; + culong = cuint64; + {$ENDIF} + {$ENDIF} + {$EXTERNALSYM cint} + {$EXTERNALSYM cuint} + {$EXTERNALSYM clong} + {$EXTERNALSYM culong} + +{$ENDIF} + +{ Data types for all compilers } +type + PPUInt8Array = ^PUInt8Array; + PUInt8Array = ^TUInt8Array; + TUInt8Array = array [0..MAXINT shr 1] of cuint8; + + ppcuint8 = ^pcuint8; + + { "The following type designates an unsigned integer type [or signed respectivly] + with the property that any valid pointer to void can be + converted to this type, then converted back to a pointer + to void, and the result will compare equal to the original + pointer: uintptr_t" + Source: https://pubs.opengroup.org/onlinepubs/000095399/basedefs/stdint.h.html + } + {$IFNDEF FPC} + cuintptr_t = UIntPtr; + {$EXTERNALSYM cuintptr_t} + cintptr_t = IntPtr; + {$EXTERNALSYM cintptr_t} + {$ELSE} + cuintptr_t = PtrUInt; + {$EXTERNALSYM cuintptr_t} + cintptr_t = PtrInt; + {$EXTERNALSYM cintptr_t} + {$ENDIF} + + {$IFDEF WANT_CWCHAR_T} + (* wchar_t is the "wide character" type of the C language. + * The size of this type is platform- and compiler-dependent. + * + * While FPC does have it's own "wide character" type, System.WideChar, + * that one is defined as always being 16-bits, so we can't re-use it here. + * + * When using FPC on Unices, the UnixType unit provides a wchar_t definition. + * + * On other systems/compiler combos, let's just go + * by what the CPP reference wiki claims, i.e: + * - wchar_t is 16-bits on Windows + * - wchar_t is 32-bits on Linux "and many other non-Windows systems" + * + * See: https://en.cppreference.com/w/cpp/language/types#Character_types + *) + {$IF DEFINED(FPC) AND DEFINED(UNIX)} + cwchar_t = UnixType.wchar_t; + {$ELSE} + {$IF DEFINED(WIN32) OR DEFINED(WIN64)} + cwchar_t = cuint16; + {$ELSE} + cwchar_t = cuint32; + {$ENDIF} + {$ENDIF} + {$EXTERNALSYM cwchar_t} + pcwchar_t = ^cwchar_t; + {$ENDIF} diff --git a/units/jedi.inc b/units/jedi.inc index 23c4aa5e..0e305e70 100644 --- a/units/jedi.inc +++ b/units/jedi.inc @@ -1,516 +1,516 @@ -{ - This file (jedi.inc) is part of SDL2-for-Pascal. - It defines some variables for several Pascal-Compilers and OS-versions. - - It is based upon: - - Pascal-Header-Conversion - Copyright (c) 2012/13 Tim Blume aka End - - jedi-sdl.inc: Global Conditional Definitions for JEDI-SDL cross-compilation - Copyright (C) 2000 - 2013 Prof. Abimbola Olowofoyeku and Tim Blume - See: https://github.com/ev1313/ - - 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. -} - -{.$define Debug} { uncomment for debugging } - -{$IFNDEF FPC} - {$IFDEF Debug} - {$F+,D+,Q-,L+,R+,I-,S+,Y+,A+} - {$ELSE} - {$F+,Q-,R-,S-,I-,A+} - {$ENDIF} -{$ELSE} - {$MODE DELPHI} - {$IFDEF VER3_2} - {$WARN 6058 OFF} { Turn off compiler hint: Call to subroutine "..." marked as inline is not inlined - See: https://forum.lazarus.freepascal.org/index.php?topic=50585.0 } - {$ENDIF} -{$ENDIF} - -{$IFDEF LINUX} -{$DEFINE UNIX} -{$ENDIF} - -{$IFDEF ver70} - {$IFDEF Windows} - {$DEFINE Win16} - {$ENDIF Windows} - {$IFDEF MSDOS} - {$DEFINE NO_EXPORTS} - {$ENDIF MSDOS} - {$IFDEF DPMI} - {$DEFINE BP_DPMI} - {$ENDIF} - {$DEFINE OS_16_BIT} - {$DEFINE __OS_DOS__} -{$ENDIF ver70} - -{$IFDEF ver80} - {$DEFINE Delphi} {Delphi 1.x} - {$DEFINE Delphi16} - {$DEFINE Win16} - {$DEFINE OS_16_BIT} - {$DEFINE __OS_DOS__} -{$ENDIF ver80} - -{$IFDEF ver90} - {$DEFINE Delphi} {Delphi 2.x} - {$DEFINE WIN32} - {$DEFINE WINDOWS} -{$ENDIF ver90} - -{$IFDEF ver100} - {$DEFINE Delphi} {Delphi 3.x} - {$DEFINE WIN32} - {$DEFINE WINDOWS} -{$ENDIF ver100} - -{$IFDEF ver93} - {$DEFINE Delphi} {C++ Builder 1.x} - {$DEFINE WINDOWS} -{$ENDIF ver93} - -{$IFDEF ver110} - {$DEFINE Delphi} {C++ Builder 3.x} - {$DEFINE WINDOWS} -{$ENDIF ver110} - -{$IFDEF ver120} - {$DEFINE Delphi} {Delphi 4.x} - {$DEFINE Delphi4UP} - {$DEFINE Has_Int64} - {$DEFINE WINDOWS} -{$ENDIF ver120} - -{$IFDEF ver130} - {$DEFINE Delphi} {Delphi / C++ Builder 5.x} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Has_Int64} - {$DEFINE WINDOWS} -{$ENDIF ver130} - -{$IFDEF ver140} - {$DEFINE Delphi} {Delphi / C++ Builder 6.x} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Has_Int64} - {$DEFINE HAS_TYPES} -{$ENDIF ver140} - -{$IFDEF ver150} - {$DEFINE Delphi} {Delphi 7.x} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver150} - -{$IFDEF ver160} - {$DEFINE Delphi} {Delphi 8.x} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver160} - -{$IFDEF ver170} - {$DEFINE Delphi} {Delphi / C++ Builder 2005} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver170} - -{$IFDEF ver180} - {$DEFINE Delphi} {Delphi / C++ Builder 2006 / 2007} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver180} - -{$IFDEF ver185} - {$DEFINE Delphi} {Delphi / C++ Builder 2007} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$DEFINE Delphi11UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver185} - -{$IFDEF ver190} - {$DEFINE Delphi} {Delphi / C++ Builder 2007 } - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$DEFINE Delphi11UP} - {$DEFINE Delphi12UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver190} - -{$IFDEF ver200} - {$DEFINE Delphi} {Delphi / C++ Builder 2009 } - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$DEFINE Delphi11UP} - {$DEFINE Delphi12UP} - {$DEFINE Delphi13UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver200} - -{$IFDEF ver210} - {$DEFINE Delphi} {Delphi / C++ Builder 2010} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$DEFINE Delphi11UP} - {$DEFINE Delphi12UP} - {$DEFINE Delphi13UP} - {$DEFINE Delphi14UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver210} - -{$IFDEF ver220} - {$DEFINE Delphi} {Delphi / C++ Builder XE} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$DEFINE Delphi11UP} - {$DEFINE Delphi12UP} - {$DEFINE Delphi13UP} - {$DEFINE Delphi14UP} - {$DEFINE Delphi15UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver220} - -{$IFDEF ver230} - {$DEFINE Delphi} {Delphi / C++ Builder XE2} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$DEFINE Delphi11UP} - {$DEFINE Delphi12UP} - {$DEFINE Delphi13UP} - {$DEFINE Delphi14UP} - {$DEFINE Delphi15UP} - {$DEFINE Delphi16UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver230} - -{$IFDEF ver240} - {$DEFINE Delphi} {Delphi / C++ Builder XE4} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$DEFINE Delphi11UP} - {$DEFINE Delphi12UP} - {$DEFINE Delphi13UP} - {$DEFINE Delphi14UP} - {$DEFINE Delphi15UP} - {$DEFINE Delphi16UP} - {$DEFINE Delphi17UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver240} - -{$IFDEF ver250} - {$DEFINE Delphi} {Delphi / C++ Builder XE5} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$DEFINE Delphi11UP} - {$DEFINE Delphi12UP} - {$DEFINE Delphi13UP} - {$DEFINE Delphi14UP} - {$DEFINE Delphi15UP} - {$DEFINE Delphi16UP} - {$DEFINE Delphi17UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver250} - -{$IFDEF ver260} - {$DEFINE Delphi} {Delphi / C++ Builder XE6} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$DEFINE Delphi11UP} - {$DEFINE Delphi12UP} - {$DEFINE Delphi13UP} - {$DEFINE Delphi14UP} - {$DEFINE Delphi15UP} - {$DEFINE Delphi16UP} - {$DEFINE Delphi17UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver260} - -{$IFDEF ver270} - {$DEFINE Delphi} {Delphi / C++ Builder XE7} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$DEFINE Delphi11UP} - {$DEFINE Delphi12UP} - {$DEFINE Delphi13UP} - {$DEFINE Delphi14UP} - {$DEFINE Delphi15UP} - {$DEFINE Delphi16UP} - {$DEFINE Delphi17UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$ENDIF ver270} - -{$IFNDEF FPC} -{$IF CompilerVersion > 27} - {$DEFINE Delphi} {Delphi / C++ Builder} - {$DEFINE Delphi4UP} - {$DEFINE Delphi5UP} - {$DEFINE Delphi6UP} - {$DEFINE Delphi7UP} - {$DEFINE Delphi8UP} - {$DEFINE Delphi9UP} - {$DEFINE Delphi10UP} - {$DEFINE Delphi11UP} - {$DEFINE Delphi12UP} - {$DEFINE Delphi13UP} - {$DEFINE Delphi14UP} - {$DEFINE Delphi15UP} - {$DEFINE Delphi16UP} - {$DEFINE Delphi17UP} - {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} - {$DEFINE Has_Int64} - {$DEFINE Has_UInt64} - {$DEFINE Has_Native} - {$DEFINE HAS_TYPES} -{$IFEND} -{$ENDIF} - -{*************** define 16/32/64 Bit ********************} - -{$IFDEF WIN16} - {$DEFINE 16BIT} - {$DEFINE WINDOWS} -{$ELSE} - {$IFDEF WIN32} - {$DEFINE 32BIT} - {$DEFINE WINDOWS} - {$ELSE} - {$IFDEF WIN64} - {$DEFINE 64BIT} - {$DEFINE WINDOWS} - {$ELSE} - //TODO!! - {$DEFINE 32BIT} - {$ENDIF} - {$ENDIF} -{$ENDIF} - -{$IFDEF Delphi} - {$DEFINE USE_STDCALL} - {$IFDEF 32Bit} - {$DEFINE DELPHI32} - {$ELSE} - {$IFDEF 64Bit} - {$DEFINE DELPHI64} - {$ELSE} - {$DEFINE DELPHI16} - {$ENDIF} - {$ENDIF} - //{$ALIGN ON} -{$ENDIF Delphi} - -{$IFDEF FPC} - {$H+} - {$PACKRECORDS C} // Added for record - {$PACKENUM DEFAULT} // Added for c-like enumerators - {$MACRO ON} // Added For OpenGL - {$DEFINE Delphi} - {$DEFINE UseAT} - {$UNDEF USE_STDCALL} - {$DEFINE OS_BigMem} - {$DEFINE NO_EXPORTS} - {$DEFINE Has_UInt64} - {$DEFINE Has_Int64} - {$DEFINE Has_Native} - {$DEFINE NOCRT} - {$IFDEF UNIX} - {$DEFINE fpc_unix} - {$ELSE} - {$DEFINE __OS_DOS__} - {$ENDIF} - {$IFDEF WIN32} - {$DEFINE UseWin} - {$ENDIF} - {$DEFINE HAS_TYPES} -{$ENDIF FPC} - -{$IFDEF Win16} - {$K+} {smart callbacks} -{$ENDIF Win16} - -{$IFDEF Win32} - {$DEFINE OS_BigMem} -{$ENDIF Win32} - -{ ************************** dos/dos-like platforms **************} -{$IFDEF Windows} - {$DEFINE __OS_DOS__} - {$DEFINE UseWin} - {$DEFINE MSWINDOWS} -{$ENDIF Delphi} - -{$IFDEF OS2} - {$DEFINE __OS_DOS__} - {$DEFINE Can_Use_DLL} -{$ENDIF Delphi} - -{$IFDEF UseWin} - {$DEFINE Can_Use_DLL} -{$ENDIF} - -{$IFDEF Win16} - {$DEFINE Can_Use_DLL} -{$ENDIF} - -{$IFDEF BP_DPMI} - {$DEFINE Can_Use_DLL} -{$ENDIF} - -{$IFDEF USE_STDCALL} - {$DEFINE BY_NAME} -{$ENDIF} - -{*************** define LITTLE ENDIAN platforms ********************} - - -{$IFDEF Delphi} - {$DEFINE IA32} -{$ENDIF} - -{$IFDEF FPC} - {$IFDEF FPC_LITTLE_ENDIAN} - {$DEFINE IA32} - {$ENDIF} -{$ENDIF} +{ + This file (jedi.inc) is part of SDL2-for-Pascal. + It defines some variables for several Pascal-Compilers and OS-versions. + + It is based upon: + + Pascal-Header-Conversion + Copyright (c) 2012/13 Tim Blume aka End + + jedi-sdl.inc: Global Conditional Definitions for JEDI-SDL cross-compilation + Copyright (C) 2000 - 2013 Prof. Abimbola Olowofoyeku and Tim Blume + See: https://github.com/ev1313/ + + 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. +} + +{.$define Debug} { uncomment for debugging } + +{$IFNDEF FPC} + {$IFDEF Debug} + {$F+,D+,Q-,L+,R+,I-,S+,Y+,A+} + {$ELSE} + {$F+,Q-,R-,S-,I-,A+} + {$ENDIF} +{$ELSE} + {$MODE DELPHI} + {$IFDEF VER3_2} + {$WARN 6058 OFF} { Turn off compiler hint: Call to subroutine "..." marked as inline is not inlined + See: https://forum.lazarus.freepascal.org/index.php?topic=50585.0 } + {$ENDIF} +{$ENDIF} + +{$IFDEF LINUX} +{$DEFINE UNIX} +{$ENDIF} + +{$IFDEF ver70} + {$IFDEF Windows} + {$DEFINE Win16} + {$ENDIF Windows} + {$IFDEF MSDOS} + {$DEFINE NO_EXPORTS} + {$ENDIF MSDOS} + {$IFDEF DPMI} + {$DEFINE BP_DPMI} + {$ENDIF} + {$DEFINE OS_16_BIT} + {$DEFINE __OS_DOS__} +{$ENDIF ver70} + +{$IFDEF ver80} + {$DEFINE Delphi} {Delphi 1.x} + {$DEFINE Delphi16} + {$DEFINE Win16} + {$DEFINE OS_16_BIT} + {$DEFINE __OS_DOS__} +{$ENDIF ver80} + +{$IFDEF ver90} + {$DEFINE Delphi} {Delphi 2.x} + {$DEFINE WIN32} + {$DEFINE WINDOWS} +{$ENDIF ver90} + +{$IFDEF ver100} + {$DEFINE Delphi} {Delphi 3.x} + {$DEFINE WIN32} + {$DEFINE WINDOWS} +{$ENDIF ver100} + +{$IFDEF ver93} + {$DEFINE Delphi} {C++ Builder 1.x} + {$DEFINE WINDOWS} +{$ENDIF ver93} + +{$IFDEF ver110} + {$DEFINE Delphi} {C++ Builder 3.x} + {$DEFINE WINDOWS} +{$ENDIF ver110} + +{$IFDEF ver120} + {$DEFINE Delphi} {Delphi 4.x} + {$DEFINE Delphi4UP} + {$DEFINE Has_Int64} + {$DEFINE WINDOWS} +{$ENDIF ver120} + +{$IFDEF ver130} + {$DEFINE Delphi} {Delphi / C++ Builder 5.x} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Has_Int64} + {$DEFINE WINDOWS} +{$ENDIF ver130} + +{$IFDEF ver140} + {$DEFINE Delphi} {Delphi / C++ Builder 6.x} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Has_Int64} + {$DEFINE HAS_TYPES} +{$ENDIF ver140} + +{$IFDEF ver150} + {$DEFINE Delphi} {Delphi 7.x} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver150} + +{$IFDEF ver160} + {$DEFINE Delphi} {Delphi 8.x} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver160} + +{$IFDEF ver170} + {$DEFINE Delphi} {Delphi / C++ Builder 2005} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver170} + +{$IFDEF ver180} + {$DEFINE Delphi} {Delphi / C++ Builder 2006 / 2007} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver180} + +{$IFDEF ver185} + {$DEFINE Delphi} {Delphi / C++ Builder 2007} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$DEFINE Delphi11UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver185} + +{$IFDEF ver190} + {$DEFINE Delphi} {Delphi / C++ Builder 2007 } + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$DEFINE Delphi11UP} + {$DEFINE Delphi12UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver190} + +{$IFDEF ver200} + {$DEFINE Delphi} {Delphi / C++ Builder 2009 } + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$DEFINE Delphi11UP} + {$DEFINE Delphi12UP} + {$DEFINE Delphi13UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver200} + +{$IFDEF ver210} + {$DEFINE Delphi} {Delphi / C++ Builder 2010} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$DEFINE Delphi11UP} + {$DEFINE Delphi12UP} + {$DEFINE Delphi13UP} + {$DEFINE Delphi14UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver210} + +{$IFDEF ver220} + {$DEFINE Delphi} {Delphi / C++ Builder XE} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$DEFINE Delphi11UP} + {$DEFINE Delphi12UP} + {$DEFINE Delphi13UP} + {$DEFINE Delphi14UP} + {$DEFINE Delphi15UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver220} + +{$IFDEF ver230} + {$DEFINE Delphi} {Delphi / C++ Builder XE2} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$DEFINE Delphi11UP} + {$DEFINE Delphi12UP} + {$DEFINE Delphi13UP} + {$DEFINE Delphi14UP} + {$DEFINE Delphi15UP} + {$DEFINE Delphi16UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver230} + +{$IFDEF ver240} + {$DEFINE Delphi} {Delphi / C++ Builder XE4} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$DEFINE Delphi11UP} + {$DEFINE Delphi12UP} + {$DEFINE Delphi13UP} + {$DEFINE Delphi14UP} + {$DEFINE Delphi15UP} + {$DEFINE Delphi16UP} + {$DEFINE Delphi17UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver240} + +{$IFDEF ver250} + {$DEFINE Delphi} {Delphi / C++ Builder XE5} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$DEFINE Delphi11UP} + {$DEFINE Delphi12UP} + {$DEFINE Delphi13UP} + {$DEFINE Delphi14UP} + {$DEFINE Delphi15UP} + {$DEFINE Delphi16UP} + {$DEFINE Delphi17UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver250} + +{$IFDEF ver260} + {$DEFINE Delphi} {Delphi / C++ Builder XE6} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$DEFINE Delphi11UP} + {$DEFINE Delphi12UP} + {$DEFINE Delphi13UP} + {$DEFINE Delphi14UP} + {$DEFINE Delphi15UP} + {$DEFINE Delphi16UP} + {$DEFINE Delphi17UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver260} + +{$IFDEF ver270} + {$DEFINE Delphi} {Delphi / C++ Builder XE7} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$DEFINE Delphi11UP} + {$DEFINE Delphi12UP} + {$DEFINE Delphi13UP} + {$DEFINE Delphi14UP} + {$DEFINE Delphi15UP} + {$DEFINE Delphi16UP} + {$DEFINE Delphi17UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$ENDIF ver270} + +{$IFNDEF FPC} +{$IF CompilerVersion > 27} + {$DEFINE Delphi} {Delphi / C++ Builder} + {$DEFINE Delphi4UP} + {$DEFINE Delphi5UP} + {$DEFINE Delphi6UP} + {$DEFINE Delphi7UP} + {$DEFINE Delphi8UP} + {$DEFINE Delphi9UP} + {$DEFINE Delphi10UP} + {$DEFINE Delphi11UP} + {$DEFINE Delphi12UP} + {$DEFINE Delphi13UP} + {$DEFINE Delphi14UP} + {$DEFINE Delphi15UP} + {$DEFINE Delphi16UP} + {$DEFINE Delphi17UP} + {$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types} + {$DEFINE Has_Int64} + {$DEFINE Has_UInt64} + {$DEFINE Has_Native} + {$DEFINE HAS_TYPES} +{$IFEND} +{$ENDIF} + +{*************** define 16/32/64 Bit ********************} + +{$IFDEF WIN16} + {$DEFINE 16BIT} + {$DEFINE WINDOWS} +{$ELSE} + {$IFDEF WIN32} + {$DEFINE 32BIT} + {$DEFINE WINDOWS} + {$ELSE} + {$IFDEF WIN64} + {$DEFINE 64BIT} + {$DEFINE WINDOWS} + {$ELSE} + //TODO!! + {$DEFINE 32BIT} + {$ENDIF} + {$ENDIF} +{$ENDIF} + +{$IFDEF Delphi} + {$DEFINE USE_STDCALL} + {$IFDEF 32Bit} + {$DEFINE DELPHI32} + {$ELSE} + {$IFDEF 64Bit} + {$DEFINE DELPHI64} + {$ELSE} + {$DEFINE DELPHI16} + {$ENDIF} + {$ENDIF} + //{$ALIGN ON} +{$ENDIF Delphi} + +{$IFDEF FPC} + {$H+} + {$PACKRECORDS C} // Added for record + {$PACKENUM DEFAULT} // Added for c-like enumerators + {$MACRO ON} // Added For OpenGL + {$DEFINE Delphi} + {$DEFINE UseAT} + {$UNDEF USE_STDCALL} + {$DEFINE OS_BigMem} + {$DEFINE NO_EXPORTS} + {$DEFINE Has_UInt64} + {$DEFINE Has_Int64} + {$DEFINE Has_Native} + {$DEFINE NOCRT} + {$IFDEF UNIX} + {$DEFINE fpc_unix} + {$ELSE} + {$DEFINE __OS_DOS__} + {$ENDIF} + {$IFDEF WIN32} + {$DEFINE UseWin} + {$ENDIF} + {$DEFINE HAS_TYPES} +{$ENDIF FPC} + +{$IFDEF Win16} + {$K+} {smart callbacks} +{$ENDIF Win16} + +{$IFDEF Win32} + {$DEFINE OS_BigMem} +{$ENDIF Win32} + +{ ************************** dos/dos-like platforms **************} +{$IFDEF Windows} + {$DEFINE __OS_DOS__} + {$DEFINE UseWin} + {$DEFINE MSWINDOWS} +{$ENDIF Delphi} + +{$IFDEF OS2} + {$DEFINE __OS_DOS__} + {$DEFINE Can_Use_DLL} +{$ENDIF Delphi} + +{$IFDEF UseWin} + {$DEFINE Can_Use_DLL} +{$ENDIF} + +{$IFDEF Win16} + {$DEFINE Can_Use_DLL} +{$ENDIF} + +{$IFDEF BP_DPMI} + {$DEFINE Can_Use_DLL} +{$ENDIF} + +{$IFDEF USE_STDCALL} + {$DEFINE BY_NAME} +{$ENDIF} + +{*************** define LITTLE ENDIAN platforms ********************} + + +{$IFDEF Delphi} + {$DEFINE IA32} +{$ENDIF} + +{$IFDEF FPC} + {$IFDEF FPC_LITTLE_ENDIAN} + {$DEFINE IA32} + {$ENDIF} +{$ENDIF} diff --git a/units/sdl.inc b/units/sdl.inc index 2bfaf96b..b6e110ff 100644 --- a/units/sdl.inc +++ b/units/sdl.inc @@ -1,114 +1,114 @@ -// based on "sdl.h" - -type - PPSDL_Init = ^PSDL_Init; - PSDL_Init = ^TSDL_Init; - TSDL_Init = type cuint32; - -const - SDL_INIT_TIMER = TSDL_Init($00000001); - {$EXTERNALSYM SDL_INIT_TIMER} - SDL_INIT_AUDIO = TSDL_Init($00000010); - {$EXTERNALSYM SDL_INIT_AUDIO} - SDL_INIT_VIDEO = TSDL_Init($00000020); // SDL_INIT_VIDEO implies SDL_INIT_EVENTS - {$EXTERNALSYM SDL_INIT_VIDEO} - SDL_INIT_JOYSTICK = TSDL_Init($00000200); // SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS - {$EXTERNALSYM SDL_INIT_JOYSTICK} - SDL_INIT_HAPTIC = TSDL_Init($00001000); - {$EXTERNALSYM SDL_INIT_HAPTIC} - SDL_INIT_GAMECONTROLLER = TSDL_Init($00002000); //turn on game controller also implicitly does JOYSTICK - {$EXTERNALSYM SDL_INIT_GAMECONTROLLER} // SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK - SDL_INIT_EVENTS = TSDL_Init($00004000); - {$EXTERNALSYM SDL_INIT_EVENTS} - SDL_INIT_SENSOR = TSDL_Init($00008000); - {$EXTERNALSYM SDL_INIT_SENSOR} - SDL_INIT_NOPARACHUTE = TSDL_Init($00100000); //Don't catch fatal signals - {$EXTERNALSYM SDL_INIT_NOPARACHUTE} // compatibility; this flag is ignored. - SDL_INIT_EVERYTHING = TSDL_Init( - 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 or - SDL_INIT_SENSOR - ); - {$EXTERNALSYM SDL_INIT_EVERYTHING} - -{** - * This function initializes the subsystems specified by flags - * Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup - * signal handlers for some commonly ignored fatal signals (like SIGSEGV). - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_Init_fun = function(flags: TSDL_Init): cint; cdecl; -Var - SDL_Init : TSDL_Init_fun = Nil; -{$else} - -function SDL_Init(flags: TSDL_Init): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Init' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * This function initializes specific SDL subsystems - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_InitSubSystem_fun = function(flags: TSDL_Init): cint; cdecl; -Var - SDL_InitSubSystem : TSDL_InitSubSystem_fun = Nil; -{$else} - -function SDL_InitSubSystem(flags: TSDL_Init): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_InitSubSystem' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * This function cleans up specific SDL subsystems - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_QuitSubSystem_proc = procedure(flags: TSDL_Init); cdecl; -Var - SDL_QuitSubSystem : TSDL_QuitSubSystem_proc = Nil; -{$else} - -procedure SDL_QuitSubSystem(flags: TSDL_Init); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_QuitSubSystem' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * This function returns a mask of the specified subsystems which have - * previously been initialized. - * - * If flags is 0, it returns a mask of all initialized subsystems. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_WasInit_fun = function(flags: TSDL_Init): cuint32; cdecl; -Var - SDL_WasInit : TSDL_WasInit_fun = Nil; -{$else} - -function SDL_WasInit(flags: TSDL_Init): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WasInit' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * This function cleans up all initialized subsystems. You should - * call it upon all exit conditions. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_Quit_proc = procedure(); cdecl; -Var - SDL_Quit : TSDL_Quit_proc = Nil; -{$else} - -procedure SDL_Quit(); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Quit' {$ENDIF} {$ENDIF}; -{$endif} - +// based on "sdl.h" + +type + PPSDL_Init = ^PSDL_Init; + PSDL_Init = ^TSDL_Init; + TSDL_Init = type cuint32; + +const + SDL_INIT_TIMER = TSDL_Init($00000001); + {$EXTERNALSYM SDL_INIT_TIMER} + SDL_INIT_AUDIO = TSDL_Init($00000010); + {$EXTERNALSYM SDL_INIT_AUDIO} + SDL_INIT_VIDEO = TSDL_Init($00000020); // SDL_INIT_VIDEO implies SDL_INIT_EVENTS + {$EXTERNALSYM SDL_INIT_VIDEO} + SDL_INIT_JOYSTICK = TSDL_Init($00000200); // SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS + {$EXTERNALSYM SDL_INIT_JOYSTICK} + SDL_INIT_HAPTIC = TSDL_Init($00001000); + {$EXTERNALSYM SDL_INIT_HAPTIC} + SDL_INIT_GAMECONTROLLER = TSDL_Init($00002000); //turn on game controller also implicitly does JOYSTICK + {$EXTERNALSYM SDL_INIT_GAMECONTROLLER} // SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK + SDL_INIT_EVENTS = TSDL_Init($00004000); + {$EXTERNALSYM SDL_INIT_EVENTS} + SDL_INIT_SENSOR = TSDL_Init($00008000); + {$EXTERNALSYM SDL_INIT_SENSOR} + SDL_INIT_NOPARACHUTE = TSDL_Init($00100000); //Don't catch fatal signals + {$EXTERNALSYM SDL_INIT_NOPARACHUTE} // compatibility; this flag is ignored. + SDL_INIT_EVERYTHING = TSDL_Init( + 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 or + SDL_INIT_SENSOR + ); + {$EXTERNALSYM SDL_INIT_EVERYTHING} + +{** + * This function initializes the subsystems specified by flags + * Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup + * signal handlers for some commonly ignored fatal signals (like SIGSEGV). + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_Init_fun = function(flags: TSDL_Init): cint; cdecl; +Var + SDL_Init : TSDL_Init_fun = Nil; +{$else} + +function SDL_Init(flags: TSDL_Init): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Init' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * This function initializes specific SDL subsystems + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_InitSubSystem_fun = function(flags: TSDL_Init): cint; cdecl; +Var + SDL_InitSubSystem : TSDL_InitSubSystem_fun = Nil; +{$else} + +function SDL_InitSubSystem(flags: TSDL_Init): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_InitSubSystem' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * This function cleans up specific SDL subsystems + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_QuitSubSystem_proc = procedure(flags: TSDL_Init); cdecl; +Var + SDL_QuitSubSystem : TSDL_QuitSubSystem_proc = Nil; +{$else} + +procedure SDL_QuitSubSystem(flags: TSDL_Init); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_QuitSubSystem' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * This function returns a mask of the specified subsystems which have + * previously been initialized. + * + * If flags is 0, it returns a mask of all initialized subsystems. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WasInit_fun = function(flags: TSDL_Init): cuint32; cdecl; +Var + SDL_WasInit : TSDL_WasInit_fun = Nil; +{$else} + +function SDL_WasInit(flags: TSDL_Init): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WasInit' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * This function cleans up all initialized subsystems. You should + * call it upon all exit conditions. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_Quit_proc = procedure(); cdecl; +Var + SDL_Quit : TSDL_Quit_proc = Nil; +{$else} + +procedure SDL_Quit(); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Quit' {$ENDIF} {$ENDIF}; +{$endif} + diff --git a/units/sdl_dnymic_linking.inc b/units/sdl_dnymic_linking.inc index b7999669..207b26c2 100644 --- a/units/sdl_dnymic_linking.inc +++ b/units/sdl_dnymic_linking.inc @@ -1,1143 +1,1143 @@ - -{$IFDEF SDL_DYNAMIC_LINKING} - -Var - LibHandle: TLibHandle = 0; - -Function SDL_LoadLib(LibFilename: String): Boolean; -Begin - result := false; - SDL_UnLoadLib(); - If LibFilename = '' Then - LibFilename := SDL_LibName; - LibHandle := LoadLibrary(LibFilename); - If LibHandle <> 0 Then Begin - (* - * Das hier ist nicht mal Ansatzweise fertig, aber es reicht um SDL2 zu initialisieren und einen Joystick ab zu fragen ;) - *) - result := true; - - SDL_Init := TSDL_Init_fun(GetProcAddress(LibHandle, 'SDL_Init')); - If Not assigned(SDL_Init) Then result := false; - SDL_InitSubSystem := TSDL_InitSubSystem_fun(GetProcAddress(LibHandle, 'SDL_InitSubSystem')); - If Not assigned(SDL_InitSubSystem) Then result := false; - SDL_QuitSubSystem := TSDL_QuitSubSystem_proc(GetProcAddress(LibHandle, 'SDL_QuitSubSystem')); - If Not assigned(SDL_QuitSubSystem) Then result := false; - SDL_WasInit := TSDL_WasInit_fun(GetProcAddress(LibHandle, 'SDL_WasInit')); - If Not assigned(SDL_WasInit) Then result := false; - SDL_Quit := TSDL_Quit_proc(GetProcAddress(LibHandle, 'SDL_Quit')); - If Not assigned(SDL_Quit) Then result := false; - SDL_GetAudioDriver := TSDL_GetAudioDriver_fun(GetProcAddress(LibHandle, 'SDL_GetAudioDriver')); - If Not assigned(SDL_GetAudioDriver) Then result := false; - SDL_AudioInit := TSDL_AudioInit_fun(GetProcAddress(LibHandle, 'SDL_AudioInit')); - If Not assigned(SDL_AudioInit) Then result := false; - SDL_OpenAudio := TSDL_OpenAudio_fun(GetProcAddress(LibHandle, 'SDL_OpenAudio')); - If Not assigned(SDL_OpenAudio) Then result := false; - SDL_GetNumAudioDevices := TSDL_GetNumAudioDevices_fun(GetProcAddress(LibHandle, 'SDL_GetNumAudioDevices')); - If Not assigned(SDL_GetNumAudioDevices) Then result := false; - SDL_GetAudioDeviceName := TSDL_GetAudioDeviceName_fun(GetProcAddress(LibHandle, 'SDL_GetAudioDeviceName')); - If Not assigned(SDL_GetAudioDeviceName) Then result := false; - //SDL_GetAudioDeviceSpec := TSDL_GetAudioDeviceSpec_fun(GetProcAddress(LibHandle, 'SDL_GetAudioDeviceSpec')); // TODO: Das geht nicht, warum ? - //If Not assigned(SDL_GetAudioDeviceSpec) Then result := false; - //SDL_GetDefaultAudioInfo := TSDL_GetDefaultAudioInfo_fun(GetProcAddress(LibHandle, 'SDL_GetDefaultAudioInfo')); // TODO: Das geht nicht, warum ? - //If Not assigned(SDL_GetDefaultAudioInfo) Then result := false; - SDL_OpenAudioDevice := TSDL_OpenAudioDevice_fun(GetProcAddress(LibHandle, 'SDL_OpenAudioDevice')); - If Not assigned(SDL_OpenAudioDevice) Then result := false; - SDL_GetAudioDeviceStatus := TSDL_GetAudioDeviceStatus_fun(GetProcAddress(LibHandle, 'SDL_GetAudioDeviceStatus')); - If Not assigned(SDL_GetAudioDeviceStatus) Then result := false; - SDL_PauseAudio := TSDL_PauseAudio_proc(GetProcAddress(LibHandle, 'SDL_PauseAudio')); - If Not assigned(SDL_PauseAudio) Then result := false; - SDL_PauseAudioDevice := TSDL_PauseAudioDevice_proc(GetProcAddress(LibHandle, 'SDL_PauseAudioDevice')); - If Not assigned(SDL_PauseAudioDevice) Then result := false; - SDL_LoadWAV_RW := TSDL_LoadWAV_RW_fun(GetProcAddress(LibHandle, 'SDL_LoadWAV_RW')); - If Not assigned(SDL_LoadWAV_RW) Then result := false; - SDL_FreeWAV := TSDL_FreeWAV_proc(GetProcAddress(LibHandle, 'SDL_FreeWAV')); - If Not assigned(SDL_FreeWAV) Then result := false; - SDL_BuildAudioCVT := TSDL_BuildAudioCVT_fun(GetProcAddress(LibHandle, 'SDL_BuildAudioCVT')); - If Not assigned(SDL_BuildAudioCVT) Then result := false; - SDL_ConvertAudio := TSDL_ConvertAudio_fun(GetProcAddress(LibHandle, 'SDL_ConvertAudio')); - If Not assigned(SDL_ConvertAudio) Then result := false; - SDL_NewAudioStream := TSDL_NewAudioStream_fun(GetProcAddress(LibHandle, 'SDL_NewAudioStream')); - If Not assigned(SDL_NewAudioStream) Then result := false; - SDL_AudioStreamPut := TSDL_AudioStreamPut_fun(GetProcAddress(LibHandle, 'SDL_AudioStreamPut')); - If Not assigned(SDL_AudioStreamPut) Then result := false; - SDL_AudioStreamGet := TSDL_AudioStreamGet_fun(GetProcAddress(LibHandle, 'SDL_AudioStreamGet')); - If Not assigned(SDL_AudioStreamGet) Then result := false; - SDL_AudioStreamAvailable := TSDL_AudioStreamAvailable_fun(GetProcAddress(LibHandle, 'SDL_AudioStreamAvailable')); - If Not assigned(SDL_AudioStreamAvailable) Then result := false; - SDL_AudioStreamFlush := TSDL_AudioStreamFlush_fun(GetProcAddress(LibHandle, 'SDL_AudioStreamFlush')); - If Not assigned(SDL_AudioStreamFlush) Then result := false; - SDL_AudioStreamClear := TSDL_AudioStreamClear_proc(GetProcAddress(LibHandle, 'SDL_AudioStreamClear')); - If Not assigned(SDL_AudioStreamClear) Then result := false; - SDL_FreeAudioStream := TSDL_FreeAudioStream_proc(GetProcAddress(LibHandle, 'SDL_FreeAudioStream')); - If Not assigned(SDL_FreeAudioStream) Then result := false; - SDL_MixAudio := TSDL_MixAudio_proc(GetProcAddress(LibHandle, 'SDL_MixAudio')); - If Not assigned(SDL_MixAudio) Then result := false; - SDL_MixAudioFormat := TSDL_MixAudioFormat_proc(GetProcAddress(LibHandle, 'SDL_MixAudioFormat')); - If Not assigned(SDL_MixAudioFormat) Then result := false; - SDL_QueueAudio := TSDL_QueueAudio_fun(GetProcAddress(LibHandle, 'SDL_QueueAudio')); - If Not assigned(SDL_QueueAudio) Then result := false; - SDL_DequeueAudio := TSDL_DequeueAudio_fun(GetProcAddress(LibHandle, 'SDL_DequeueAudio')); - If Not assigned(SDL_DequeueAudio) Then result := false; - SDL_GetQueuedAudioSize := TSDL_GetQueuedAudioSize_fun(GetProcAddress(LibHandle, 'SDL_GetQueuedAudioSize')); - If Not assigned(SDL_GetQueuedAudioSize) Then result := false; - SDL_ClearQueuedAudio := TSDL_ClearQueuedAudio_proc(GetProcAddress(LibHandle, 'SDL_ClearQueuedAudio')); - If Not assigned(SDL_ClearQueuedAudio) Then result := false; - SDL_LockAudioDevice := TSDL_LockAudioDevice_proc(GetProcAddress(LibHandle, 'SDL_LockAudioDevice')); - If Not assigned(SDL_LockAudioDevice) Then result := false; - SDL_UnlockAudioDevice := TSDL_UnlockAudioDevice_proc(GetProcAddress(LibHandle, 'SDL_UnlockAudioDevice')); - If Not assigned(SDL_UnlockAudioDevice) Then result := false; - SDL_CloseAudioDevice := TSDL_CloseAudioDevice_proc(GetProcAddress(LibHandle, 'SDL_CloseAudioDevice')); - If Not assigned(SDL_CloseAudioDevice) Then result := false; - SDL_ComposeCustomBlendMode := TSDL_ComposeCustomBlendMode_fun(GetProcAddress(LibHandle, 'SDL_ComposeCustomBlendMode')); - If Not assigned(SDL_ComposeCustomBlendMode) Then result := false; - SDL_SetClipboardText := TSDL_SetClipboardText_fun(GetProcAddress(LibHandle, 'SDL_SetClipboardText')); - If Not assigned(SDL_SetClipboardText) Then result := false; - SDL_GetClipboardText := TSDL_GetClipboardText_fun(GetProcAddress(LibHandle, 'SDL_GetClipboardText')); - If Not assigned(SDL_GetClipboardText) Then result := false; - SDL_HasClipboardText := TSDL_HasClipboardText_fun(GetProcAddress(LibHandle, 'SDL_HasClipboardText')); - If Not assigned(SDL_HasClipboardText) Then result := false; - //SDL_SetPrimarySelectionText := TSDL_SetPrimarySelectionText_fun(GetProcAddress(LibHandle, 'SDL_SetPrimarySelectionText')); // TODO: Das geht nicht, warum ? - //If Not assigned(SDL_SetPrimarySelectionText) Then result := false; - //SDL_GetPrimarySelectionText := TSDL_GetPrimarySelectionText_fun(GetProcAddress(LibHandle, 'SDL_GetPrimarySelectionText')); - //If Not assigned(SDL_GetPrimarySelectionText) Then result := false; - //SDL_HasPrimarySelectionText := TSDL_HasPrimarySelectionText_fun(GetProcAddress(LibHandle, 'SDL_HasPrimarySelectionText')); - //If Not assigned(SDL_HasPrimarySelectionText) Then result := false; - SDL_GetCPUCount := TSDL_GetCPUCount_fun(GetProcAddress(LibHandle, 'SDL_GetCPUCount')); - If Not assigned(SDL_GetCPUCount) Then result := false; - SDL_SetError := TSDL_SetError_fun(GetProcAddress(LibHandle, 'SDL_SetError')); - If Not assigned(SDL_SetError) Then result := false; - //SDL_GetErrorMsg := TSDL_GetErrorMsg_fun(GetProcAddress(LibHandle, 'SDL_GetErrorMsg')); - //If Not assigned(SDL_GetErrorMsg) Then result := false; - SDL_Error := TSDL_Error_fun(GetProcAddress(LibHandle, 'SDL_Error')); - If Not assigned(SDL_Error) Then result := false; - SDL_GetBasePath := TSDL_GetBasePath_fun(GetProcAddress(LibHandle, 'SDL_GetBasePath')); - If Not assigned(SDL_GetBasePath) Then result := false; - SDL_GetPrefPath := TSDL_GetPrefPath_fun(GetProcAddress(LibHandle, 'SDL_GetPrefPath')); - If Not assigned(SDL_GetPrefPath) Then result := false; - SDL_GameControllerAddMappingsFromRW := TSDL_GameControllerAddMappingsFromRW_fun(GetProcAddress(LibHandle, 'SDL_GameControllerAddMappingsFromRW')); - If Not assigned(SDL_GameControllerAddMappingsFromRW) Then result := false; - SDL_GameControllerNumMappings := TSDL_GameControllerNumMappings_fun(GetProcAddress(LibHandle, 'SDL_GameControllerNumMappings')); - If Not assigned(SDL_GameControllerNumMappings) Then result := false; - SDL_GameControllerMappingForIndex := TSDL_GameControllerMappingForIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerMappingForIndex')); - If Not assigned(SDL_GameControllerMappingForIndex) Then result := false; - //SDL_GameControllerPathForIndex := TSDL_GameControllerPathForIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerPathForIndex')); - //If Not assigned(SDL_GameControllerPathForIndex) Then result := false; - SDL_GameControllerTypeForIndex := TSDL_GameControllerTypeForIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerTypeForIndex')); - If Not assigned(SDL_GameControllerTypeForIndex) Then result := false; - SDL_GameControllerMappingForDeviceIndex := TSDL_GameControllerMappingForDeviceIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerMappingForDeviceIndex')); - If Not assigned(SDL_GameControllerMappingForDeviceIndex) Then result := false; - SDL_GameControllerFromInstanceID := TSDL_GameControllerFromInstanceID_fun(GetProcAddress(LibHandle, 'SDL_GameControllerFromInstanceID')); - If Not assigned(SDL_GameControllerFromInstanceID) Then result := false; - SDL_GameControllerFromPlayerIndex := TSDL_GameControllerFromPlayerIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerFromPlayerIndex')); - If Not assigned(SDL_GameControllerFromPlayerIndex) Then result := false; - //SDL_GameControllerPath := TSDL_GameControllerPath_fun(GetProcAddress(LibHandle, 'SDL_GameControllerPath')); - //If Not assigned(SDL_GameControllerPath) Then result := false; - SDL_GameControllerGetType := TSDL_GameControllerGetType_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetType')); - If Not assigned(SDL_GameControllerGetType) Then result := false; - SDL_GameControllerGetPlayerIndex := TSDL_GameControllerGetPlayerIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetPlayerIndex')); - If Not assigned(SDL_GameControllerGetPlayerIndex) Then result := false; - SDL_GameControllerSetPlayerIndex := TSDL_GameControllerSetPlayerIndex_proc(GetProcAddress(LibHandle, 'SDL_GameControllerSetPlayerIndex')); - If Not assigned(SDL_GameControllerSetPlayerIndex) Then result := false; - SDL_GameControllerGetVendor := TSDL_GameControllerGetVendor_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetVendor')); - If Not assigned(SDL_GameControllerGetVendor) Then result := false; - SDL_GameControllerGetProduct := TSDL_GameControllerGetProduct_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetProduct')); - If Not assigned(SDL_GameControllerGetProduct) Then result := false; - SDL_GameControllerGetProductVersion := TSDL_GameControllerGetProductVersion_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetProductVersion')); - If Not assigned(SDL_GameControllerGetProductVersion) Then result := false; - //SDL_GameControllerGetFirmwareVersion := TSDL_GameControllerGetFirmwareVersion_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetFirmwareVersion')); - //If Not assigned(SDL_GameControllerGetFirmwareVersion) Then result := false; - //SDL_GameControllerGetSerial := TSDL_GameControllerGetSerial_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetSerial')); - //If Not assigned(SDL_GameControllerGetSerial) Then result := false; - //SDL_GameControllerGetSteamHandle := TSDL_GameControllerGetSteamHandle_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetSteamHandle')); - //If Not assigned(SDL_GameControllerGetSteamHandle) Then result := false; - //SDL_GameControllerHasAxis := TSDL_GameControllerHasAxis_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasAxis')); - //If Not assigned(SDL_GameControllerHasAxis) Then result := false; - //SDL_GameControllerHasButton := TSDL_GameControllerHasButton_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasButton')); - //If Not assigned(SDL_GameControllerHasButton) Then result := false; - //SDL_GameControllerGetNumTouchpads := TSDL_GameControllerGetNumTouchpads_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetNumTouchpads')); - //If Not assigned(SDL_GameControllerGetNumTouchpads) Then result := false; - //SDL_GameControllerGetNumTouchpadFingers := TSDL_GameControllerGetNumTouchpadFingers_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetNumTouchpadFingers')); - //If Not assigned(SDL_GameControllerGetNumTouchpadFingers) Then result := false; - //SDL_GameControllerGetTouchpadFinger := TSDL_GameControllerGetTouchpadFinger_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetTouchpadFinger')); - //If Not assigned(SDL_GameControllerGetTouchpadFinger) Then result := false; - //SDL_GameControllerHasSensor := TSDL_GameControllerHasSensor_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasSensor')); - //If Not assigned(SDL_GameControllerHasSensor) Then result := false; - //SDL_GameControllerSetSensorEnabled := TSDL_GameControllerSetSensorEnabled_fun(GetProcAddress(LibHandle, 'SDL_GameControllerSetSensorEnabled')); - //If Not assigned(SDL_GameControllerSetSensorEnabled) Then result := false; - //SDL_GameControllerIsSensorEnabled := TSDL_GameControllerIsSensorEnabled_fun(GetProcAddress(LibHandle, 'SDL_GameControllerIsSensorEnabled')); - //If Not assigned(SDL_GameControllerIsSensorEnabled) Then result := false; - (*SDL_GameControllerGetSensorDataRate := TSDL_GameControllerGetSensorDataRate_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetSensorDataRate')); - If Not assigned(SDL_GameControllerGetSensorDataRate) Then result := false; - SDL_GameControllerGetSensorData := TSDL_GameControllerGetSensorData_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetSensorData')); - If Not assigned(SDL_GameControllerGetSensorData) Then result := false; - SDL_GameControllerGetSensorDataWithTimestamp := TSDL_GameControllerGetSensorDataWithTimestamp_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetSensorDataWithTimestamp')); - If Not assigned(SDL_GameControllerGetSensorDataWithTimestamp) Then result := false; - SDL_GameControllerHasRumble := TSDL_GameControllerHasRumble_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasRumble')); - If Not assigned(SDL_GameControllerHasRumble) Then result := false; - SDL_GameControllerRumble := TSDL_GameControllerRumble_fun(GetProcAddress(LibHandle, 'SDL_GameControllerRumble')); - If Not assigned(SDL_GameControllerRumble) Then result := false; - SDL_GameControllerHasRumbleTriggers := TSDL_GameControllerHasRumbleTriggers_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasRumbleTriggers')); - If Not assigned(SDL_GameControllerHasRumbleTriggers) Then result := false; - SDL_GameControllerRumbleTriggers := TSDL_GameControllerRumbleTriggers_fun(GetProcAddress(LibHandle, 'SDL_GameControllerRumbleTriggers')); - If Not assigned(SDL_GameControllerRumbleTriggers) Then result := false; - SDL_GameControllerHasLED := TSDL_GameControllerHasLED_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasLED')); - If Not assigned(SDL_GameControllerHasLED) Then result := false; - SDL_GameControllerSetLED := TSDL_GameControllerSetLED_fun(GetProcAddress(LibHandle, 'SDL_GameControllerSetLED')); - If Not assigned(SDL_GameControllerSetLED) Then result := false; - SDL_GameControllerSendEffect := TSDL_GameControllerSendEffect_fun(GetProcAddress(LibHandle, 'SDL_GameControllerSendEffect')); - If Not assigned(SDL_GameControllerSendEffect) Then result := false; - SDL_GameControllerGetAppleSFSymbolsNameForAxis := TSDL_GameControllerGetAppleSFSymbolsNameForAxis_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetAppleSFSymbolsNameForAxis')); - If Not assigned(SDL_GameControllerGetAppleSFSymbolsNameForAxis) Then result := false; - SDL_GameControllerGetAppleSFSymbolsNameForButton := TSDL_GameControllerGetAppleSFSymbolsNameForButton_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetAppleSFSymbolsNameForButton')); - If Not assigned(SDL_GameControllerGetAppleSFSymbolsNameForButton) Then result := false; - SDL_RecordGesture := TSDL_RecordGesture_fun(GetProcAddress(LibHandle, 'SDL_RecordGesture')); - If Not assigned(SDL_RecordGesture) Then result := false; - SDL_SaveAllDollarTemplates := TSDL_SaveAllDollarTemplates_fun(GetProcAddress(LibHandle, 'SDL_SaveAllDollarTemplates')); - If Not assigned(SDL_SaveAllDollarTemplates) Then result := false; - SDL_SaveDollarTemplate := TSDL_SaveDollarTemplate_fun(GetProcAddress(LibHandle, 'SDL_SaveDollarTemplate')); - If Not assigned(SDL_SaveDollarTemplate) Then result := false; - SDL_LoadDollarTemplates := TSDL_LoadDollarTemplates_fun(GetProcAddress(LibHandle, 'SDL_LoadDollarTemplates')); - If Not assigned(SDL_LoadDollarTemplates) Then result := false; - SDL_GUIDToString := TSDL_GUIDToString_proc(GetProcAddress(LibHandle, 'SDL_GUIDToString')); - If Not assigned(SDL_GUIDToString) Then result := false; - SDL_GUIDFromString := TSDL_GUIDFromString_fun(GetProcAddress(LibHandle, 'SDL_GUIDFromString')); - If Not assigned(SDL_GUIDFromString) Then result := false; - SDL_HapticName := TSDL_HapticName_fun(GetProcAddress(LibHandle, 'SDL_HapticName')); - If Not assigned(SDL_HapticName) Then result := false; - SDL_HapticOpen := TSDL_HapticOpen_fun(GetProcAddress(LibHandle, 'SDL_HapticOpen')); - If Not assigned(SDL_HapticOpen) Then result := false; - SDL_HapticOpened := TSDL_HapticOpened_fun(GetProcAddress(LibHandle, 'SDL_HapticOpened')); - If Not assigned(SDL_HapticOpened) Then result := false; - SDL_HapticIndex := TSDL_HapticIndex_fun(GetProcAddress(LibHandle, 'SDL_HapticIndex')); - If Not assigned(SDL_HapticIndex) Then result := false; - SDL_JoystickIsHaptic := TSDL_JoystickIsHaptic_fun(GetProcAddress(LibHandle, 'SDL_JoystickIsHaptic')); - If Not assigned(SDL_JoystickIsHaptic) Then result := false; - SDL_HapticOpenFromJoystick := TSDL_HapticOpenFromJoystick_fun(GetProcAddress(LibHandle, 'SDL_HapticOpenFromJoystick')); - If Not assigned(SDL_HapticOpenFromJoystick) Then result := false; - SDL_HapticClose := TSDL_HapticClose_proc(GetProcAddress(LibHandle, 'SDL_HapticClose')); - If Not assigned(SDL_HapticClose) Then result := false; - SDL_HapticNumEffects := TSDL_HapticNumEffects_fun(GetProcAddress(LibHandle, 'SDL_HapticNumEffects')); - If Not assigned(SDL_HapticNumEffects) Then result := false; - SDL_HapticNumEffectsPlaying := TSDL_HapticNumEffectsPlaying_fun(GetProcAddress(LibHandle, 'SDL_HapticNumEffectsPlaying')); - If Not assigned(SDL_HapticNumEffectsPlaying) Then result := false; - SDL_HapticQuery := TSDL_HapticQuery_fun(GetProcAddress(LibHandle, 'SDL_HapticQuery')); - If Not assigned(SDL_HapticQuery) Then result := false; - SDL_HapticNumAxes := TSDL_HapticNumAxes_fun(GetProcAddress(LibHandle, 'SDL_HapticNumAxes')); - If Not assigned(SDL_HapticNumAxes) Then result := false; - SDL_HapticEffectSupported := TSDL_HapticEffectSupported_fun(GetProcAddress(LibHandle, 'SDL_HapticEffectSupported')); - If Not assigned(SDL_HapticEffectSupported) Then result := false; - SDL_HapticNewEffect := TSDL_HapticNewEffect_fun(GetProcAddress(LibHandle, 'SDL_HapticNewEffect')); - If Not assigned(SDL_HapticNewEffect) Then result := false; - SDL_HapticUpdateEffect := TSDL_HapticUpdateEffect_fun(GetProcAddress(LibHandle, 'SDL_HapticUpdateEffect')); - If Not assigned(SDL_HapticUpdateEffect) Then result := false; - SDL_HapticRunEffect := TSDL_HapticRunEffect_fun(GetProcAddress(LibHandle, 'SDL_HapticRunEffect')); - If Not assigned(SDL_HapticRunEffect) Then result := false; - SDL_HapticStopEffect := TSDL_HapticStopEffect_fun(GetProcAddress(LibHandle, 'SDL_HapticStopEffect')); - If Not assigned(SDL_HapticStopEffect) Then result := false; - SDL_HapticDestroyEffect := TSDL_HapticDestroyEffect_proc(GetProcAddress(LibHandle, 'SDL_HapticDestroyEffect')); - If Not assigned(SDL_HapticDestroyEffect) Then result := false; - SDL_HapticGetEffectStatus := TSDL_HapticGetEffectStatus_fun(GetProcAddress(LibHandle, 'SDL_HapticGetEffectStatus')); - If Not assigned(SDL_HapticGetEffectStatus) Then result := false; - SDL_HapticSetGain := TSDL_HapticSetGain_fun(GetProcAddress(LibHandle, 'SDL_HapticSetGain')); - If Not assigned(SDL_HapticSetGain) Then result := false; - SDL_HapticSetAutocenter := TSDL_HapticSetAutocenter_fun(GetProcAddress(LibHandle, 'SDL_HapticSetAutocenter')); - If Not assigned(SDL_HapticSetAutocenter) Then result := false; - SDL_HapticPause := TSDL_HapticPause_fun(GetProcAddress(LibHandle, 'SDL_HapticPause')); - If Not assigned(SDL_HapticPause) Then result := false; - SDL_HapticUnpause := TSDL_HapticUnpause_fun(GetProcAddress(LibHandle, 'SDL_HapticUnpause')); - If Not assigned(SDL_HapticUnpause) Then result := false; - SDL_HapticStopAll := TSDL_HapticStopAll_fun(GetProcAddress(LibHandle, 'SDL_HapticStopAll')); - If Not assigned(SDL_HapticStopAll) Then result := false; - SDL_HapticRumbleSupported := TSDL_HapticRumbleSupported_fun(GetProcAddress(LibHandle, 'SDL_HapticRumbleSupported')); - If Not assigned(SDL_HapticRumbleSupported) Then result := false; - SDL_HapticRumbleInit := TSDL_HapticRumbleInit_fun(GetProcAddress(LibHandle, 'SDL_HapticRumbleInit')); - If Not assigned(SDL_HapticRumbleInit) Then result := false; - SDL_HapticRumblePlay := TSDL_HapticRumblePlay_fun(GetProcAddress(LibHandle, 'SDL_HapticRumblePlay')); - If Not assigned(SDL_HapticRumblePlay) Then result := false; - SDL_HapticRumbleStop := TSDL_HapticRumbleStop_fun(GetProcAddress(LibHandle, 'SDL_HapticRumbleStop')); - If Not assigned(SDL_HapticRumbleStop) Then result := false; - SDL_SetHintWithPriority := TSDL_SetHintWithPriority_fun(GetProcAddress(LibHandle, 'SDL_SetHintWithPriority')); - If Not assigned(SDL_SetHintWithPriority) Then result := false; - SDL_SetHint := TSDL_SetHint_fun(GetProcAddress(LibHandle, 'SDL_SetHint')); - If Not assigned(SDL_SetHint) Then result := false; - SDL_ResetHint := TSDL_ResetHint_fun(GetProcAddress(LibHandle, 'SDL_ResetHint')); - If Not assigned(SDL_ResetHint) Then result := false; - SDL_ResetHints := TSDL_ResetHints_proc(GetProcAddress(LibHandle, 'SDL_ResetHints')); - If Not assigned(SDL_ResetHints) Then result := false; - SDL_GetHint := TSDL_GetHint_fun(GetProcAddress(LibHandle, 'SDL_GetHint')); - If Not assigned(SDL_GetHint) Then result := false; - SDL_GetHintBoolean := TSDL_GetHintBoolean_fun(GetProcAddress(LibHandle, 'SDL_GetHintBoolean')); - If Not assigned(SDL_GetHintBoolean) Then result := false; - SDL_AddHintCallback := TSDL_AddHintCallback_proc(GetProcAddress(LibHandle, 'SDL_AddHintCallback')); - If Not assigned(SDL_AddHintCallback) Then result := false; - SDL_DelHintCallback := TSDL_DelHintCallback_proc(GetProcAddress(LibHandle, 'SDL_DelHintCallback')); - If Not assigned(SDL_DelHintCallback) Then result := false; - SDL_ClearHints := TSDL_ClearHints_proc(GetProcAddress(LibHandle, 'SDL_ClearHints')); - If Not assigned(SDL_ClearHints) Then result := false; - SDL_LockJoysticks := TSDL_LockJoysticks_proc(GetProcAddress(LibHandle, 'SDL_LockJoysticks')); - If Not assigned(SDL_LockJoysticks) Then result := false; - SDL_UnlockJoysticks := TSDL_UnlockJoysticks_proc(GetProcAddress(LibHandle, 'SDL_UnlockJoysticks')); - If Not assigned(SDL_UnlockJoysticks) Then result := false;//*) - SDL_NumJoysticks := TSDL_NumJoysticks_fun(GetProcAddress(LibHandle, 'SDL_NumJoysticks')); - If Not assigned(SDL_NumJoysticks) Then result := false; - SDL_JoystickNameForIndex := TSDL_JoystickNameForIndex_fun(GetProcAddress(LibHandle, 'SDL_JoystickNameForIndex')); - If Not assigned(SDL_JoystickNameForIndex) Then result := false; - (* SDL_JoystickPathForIndex := TSDL_JoystickPathForIndex_fun(GetProcAddress(LibHandle, 'SDL_JoystickPathForIndex')); - If Not assigned(SDL_JoystickPathForIndex) Then result := false; - SDL_JoystickGetDevicePlayerIndex := TSDL_JoystickGetDevicePlayerIndex_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDevicePlayerIndex')); - If Not assigned(SDL_JoystickGetDevicePlayerIndex) Then result := false; - SDL_JoystickGetDeviceGUID := TSDL_JoystickGetDeviceGUID_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceGUID')); - If Not assigned(SDL_JoystickGetDeviceGUID) Then result := false; - SDL_JoystickGetDeviceVendor := TSDL_JoystickGetDeviceVendor_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceVendor')); - If Not assigned(SDL_JoystickGetDeviceVendor) Then result := false; - SDL_JoystickGetDeviceProduct := TSDL_JoystickGetDeviceProduct_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceProduct')); - If Not assigned(SDL_JoystickGetDeviceProduct) Then result := false; - SDL_JoystickGetDeviceProductVersion := TSDL_JoystickGetDeviceProductVersion_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceProductVersion')); - If Not assigned(SDL_JoystickGetDeviceProductVersion) Then result := false; - SDL_JoystickGetDeviceType := TSDL_JoystickGetDeviceType_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceType')); - If Not assigned(SDL_JoystickGetDeviceType) Then result := false; - SDL_JoystickGetDeviceInstanceID := TSDL_JoystickGetDeviceInstanceID_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceInstanceID')); - If Not assigned(SDL_JoystickGetDeviceInstanceID) Then result := false;// *) - SDL_JoystickOpen := TSDL_JoystickOpen_fun(GetProcAddress(LibHandle, 'SDL_JoystickOpen')); - If Not assigned(SDL_JoystickOpen) Then result := false; - (* SDL_JoystickFromInstanceID := TSDL_JoystickFromInstanceID_fun(GetProcAddress(LibHandle, 'SDL_JoystickFromInstanceID')); - If Not assigned(SDL_JoystickFromInstanceID) Then result := false; - SDL_JoystickFromPlayerIndex := TSDL_JoystickFromPlayerIndex_fun(GetProcAddress(LibHandle, 'SDL_JoystickFromPlayerIndex')); - If Not assigned(SDL_JoystickFromPlayerIndex) Then result := false; - SDL_JoystickAttachVirtual := TSDL_JoystickAttachVirtual_fun(GetProcAddress(LibHandle, 'SDL_JoystickAttachVirtual')); - If Not assigned(SDL_JoystickAttachVirtual) Then result := false; - SDL_JoystickAttachVirtualEx := TSDL_JoystickAttachVirtualEx_fun(GetProcAddress(LibHandle, 'SDL_JoystickAttachVirtualEx')); - If Not assigned(SDL_JoystickAttachVirtualEx) Then result := false; - SDL_JoystickDetachVirtual := TSDL_JoystickDetachVirtual_fun(GetProcAddress(LibHandle, 'SDL_JoystickDetachVirtual')); - If Not assigned(SDL_JoystickDetachVirtual) Then result := false; - SDL_JoystickIsVirtual := TSDL_JoystickIsVirtual_fun(GetProcAddress(LibHandle, 'SDL_JoystickIsVirtual')); - If Not assigned(SDL_JoystickIsVirtual) Then result := false; - SDL_JoystickSetVirtualAxis := TSDL_JoystickSetVirtualAxis_fun(GetProcAddress(LibHandle, 'SDL_JoystickSetVirtualAxis')); - If Not assigned(SDL_JoystickSetVirtualAxis) Then result := false; - SDL_JoystickSetVirtualButton := TSDL_JoystickSetVirtualButton_fun(GetProcAddress(LibHandle, 'SDL_JoystickSetVirtualButton')); - If Not assigned(SDL_JoystickSetVirtualButton) Then result := false; - SDL_JoystickSetVirtualHat := TSDL_JoystickSetVirtualHat_fun(GetProcAddress(LibHandle, 'SDL_JoystickSetVirtualHat')); - If Not assigned(SDL_JoystickSetVirtualHat) Then result := false; - SDL_JoystickName := TSDL_JoystickName_fun(GetProcAddress(LibHandle, 'SDL_JoystickName')); - If Not assigned(SDL_JoystickName) Then result := false; - SDL_JoystickPath := TSDL_JoystickPath_fun(GetProcAddress(LibHandle, 'SDL_JoystickPath')); - If Not assigned(SDL_JoystickPath) Then result := false; - SDL_JoystickGetPlayerIndex := TSDL_JoystickGetPlayerIndex_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetPlayerIndex')); - If Not assigned(SDL_JoystickGetPlayerIndex) Then result := false; - SDL_JoystickSetPlayerIndex := TSDL_JoystickSetPlayerIndex_proc(GetProcAddress(LibHandle, 'SDL_JoystickSetPlayerIndex')); - If Not assigned(SDL_JoystickSetPlayerIndex) Then result := false; - SDL_JoystickGetGUID := TSDL_JoystickGetGUID_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetGUID')); - If Not assigned(SDL_JoystickGetGUID) Then result := false; - SDL_JoystickGetVendor := TSDL_JoystickGetVendor_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetVendor')); - If Not assigned(SDL_JoystickGetVendor) Then result := false; - SDL_JoystickGetProduct := TSDL_JoystickGetProduct_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetProduct')); - If Not assigned(SDL_JoystickGetProduct) Then result := false; - SDL_JoystickGetProductVersion := TSDL_JoystickGetProductVersion_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetProductVersion')); - If Not assigned(SDL_JoystickGetProductVersion) Then result := false; - SDL_JoystickGetFirmwareVersion := TSDL_JoystickGetFirmwareVersion_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetFirmwareVersion')); - If Not assigned(SDL_JoystickGetFirmwareVersion) Then result := false; - SDL_JoystickGetSerial := TSDL_JoystickGetSerial_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetSerial')); - If Not assigned(SDL_JoystickGetSerial) Then result := false; - SDL_JoystickGetType := TSDL_JoystickGetType_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetType')); - If Not assigned(SDL_JoystickGetType) Then result := false; - SDL_JoystickGetGUIDString := TSDL_JoystickGetGUIDString_proc(GetProcAddress(LibHandle, 'SDL_JoystickGetGUIDString')); - If Not assigned(SDL_JoystickGetGUIDString) Then result := false; - SDL_JoystickGetGUIDFromString := TSDL_JoystickGetGUIDFromString_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetGUIDFromString')); - If Not assigned(SDL_JoystickGetGUIDFromString) Then result := false; - SDL_GetJoystickGUIDInfo := TSDL_GetJoystickGUIDInfo_proc(GetProcAddress(LibHandle, 'SDL_GetJoystickGUIDInfo')); - If Not assigned(SDL_GetJoystickGUIDInfo) Then result := false; - SDL_JoystickGetAttached := TSDL_JoystickGetAttached_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetAttached')); - If Not assigned(SDL_JoystickGetAttached) Then result := false; - SDL_JoystickInstanceID := TSDL_JoystickInstanceID_fun(GetProcAddress(LibHandle, 'SDL_JoystickInstanceID')); - If Not assigned(SDL_JoystickInstanceID) Then result := false;//*) - SDL_JoystickNumAxes := TSDL_JoystickNumAxes_fun(GetProcAddress(LibHandle, 'SDL_JoystickNumAxes')); - If Not assigned(SDL_JoystickNumAxes) Then result := false; - (* SDL_JoystickNumBalls := TSDL_JoystickNumBalls_fun(GetProcAddress(LibHandle, 'SDL_JoystickNumBalls')); - If Not assigned(SDL_JoystickNumBalls) Then result := false; - SDL_JoystickNumHats := TSDL_JoystickNumHats_fun(GetProcAddress(LibHandle, 'SDL_JoystickNumHats')); - If Not assigned(SDL_JoystickNumHats) Then result := false; //*) - SDL_JoystickNumButtons := TSDL_JoystickNumButtons_fun(GetProcAddress(LibHandle, 'SDL_JoystickNumButtons')); - If Not assigned(SDL_JoystickNumButtons) Then result := false; - (* SDL_JoystickUpdate := TSDL_JoystickUpdate_proc(GetProcAddress(LibHandle, 'SDL_JoystickUpdate')); - If Not assigned(SDL_JoystickUpdate) Then result := false;// *) - SDL_JoystickEventState := TSDL_JoystickEventState_fun(GetProcAddress(LibHandle, 'SDL_JoystickEventState')); - If Not assigned(SDL_JoystickEventState) Then result := false; - SDL_JoystickGetAxis := TSDL_JoystickGetAxis_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetAxis')); - If Not assigned(SDL_JoystickGetAxis) Then result := false; - (* SDL_JoystickGetAxisInitialState := TSDL_JoystickGetAxisInitialState_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetAxisInitialState')); - If Not assigned(SDL_JoystickGetAxisInitialState) Then result := false; - SDL_JoystickGetHat := TSDL_JoystickGetHat_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetHat')); - If Not assigned(SDL_JoystickGetHat) Then result := false; - SDL_JoystickGetBall := TSDL_JoystickGetBall_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetBall')); - If Not assigned(SDL_JoystickGetBall) Then result := false;// *) - SDL_JoystickGetButton := TSDL_JoystickGetButton_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetButton')); - If Not assigned(SDL_JoystickGetButton) Then result := false; - (* SDL_JoystickRumble := TSDL_JoystickRumble_fun(GetProcAddress(LibHandle, 'SDL_JoystickRumble')); - If Not assigned(SDL_JoystickRumble) Then result := false; - SDL_JoystickRumbleTriggers := TSDL_JoystickRumbleTriggers_fun(GetProcAddress(LibHandle, 'SDL_JoystickRumbleTriggers')); - If Not assigned(SDL_JoystickRumbleTriggers) Then result := false; - SDL_JoystickHasLED := TSDL_JoystickHasLED_fun(GetProcAddress(LibHandle, 'SDL_JoystickHasLED')); - If Not assigned(SDL_JoystickHasLED) Then result := false; - SDL_JoystickHasRumble := TSDL_JoystickHasRumble_fun(GetProcAddress(LibHandle, 'SDL_JoystickHasRumble')); - If Not assigned(SDL_JoystickHasRumble) Then result := false; - SDL_JoystickHasRumbleTriggers := TSDL_JoystickHasRumbleTriggers_fun(GetProcAddress(LibHandle, 'SDL_JoystickHasRumbleTriggers')); - If Not assigned(SDL_JoystickHasRumbleTriggers) Then result := false; - SDL_JoystickSetLED := TSDL_JoystickSetLED_fun(GetProcAddress(LibHandle, 'SDL_JoystickSetLED')); - If Not assigned(SDL_JoystickSetLED) Then result := false; - SDL_JoystickSendEffect := TSDL_JoystickSendEffect_fun(GetProcAddress(LibHandle, 'SDL_JoystickSendEffect')); - If Not assigned(SDL_JoystickSendEffect) Then result := false;*) - SDL_JoystickClose := TSDL_JoystickClose_proc(GetProcAddress(LibHandle, 'SDL_JoystickClose')); - If Not assigned(SDL_JoystickClose) Then result := false; - (* SDL_JoystickCurrentPowerLevel := TSDL_JoystickCurrentPowerLevel_fun(GetProcAddress(LibHandle, 'SDL_JoystickCurrentPowerLevel')); - If Not assigned(SDL_JoystickCurrentPowerLevel) Then result := false; - SDL_GetKeyboardState := TSDL_GetKeyboardState_fun(GetProcAddress(LibHandle, 'SDL_GetKeyboardState')); - If Not assigned(SDL_GetKeyboardState) Then result := false; - SDL_SetModState := TSDL_SetModState_proc(GetProcAddress(LibHandle, 'SDL_SetModState')); - If Not assigned(SDL_SetModState) Then result := false; - SDL_GetKeyFromScancode := TSDL_GetKeyFromScancode_fun(GetProcAddress(LibHandle, 'SDL_GetKeyFromScancode')); - If Not assigned(SDL_GetKeyFromScancode) Then result := false; - SDL_GetScancodeFromKey := TSDL_GetScancodeFromKey_fun(GetProcAddress(LibHandle, 'SDL_GetScancodeFromKey')); - If Not assigned(SDL_GetScancodeFromKey) Then result := false; - SDL_GetScancodeName := TSDL_GetScancodeName_fun(GetProcAddress(LibHandle, 'SDL_GetScancodeName')); - If Not assigned(SDL_GetScancodeName) Then result := false; - SDL_GetScancodeFromName := TSDL_GetScancodeFromName_fun(GetProcAddress(LibHandle, 'SDL_GetScancodeFromName')); - If Not assigned(SDL_GetScancodeFromName) Then result := false; - SDL_GetKeyName := TSDL_GetKeyName_fun(GetProcAddress(LibHandle, 'SDL_GetKeyName')); - If Not assigned(SDL_GetKeyName) Then result := false; - SDL_GetKeyFromName := TSDL_GetKeyFromName_fun(GetProcAddress(LibHandle, 'SDL_GetKeyFromName')); - If Not assigned(SDL_GetKeyFromName) Then result := false; - SDL_SetTextInputRect := TSDL_SetTextInputRect_proc(GetProcAddress(LibHandle, 'SDL_SetTextInputRect')); - If Not assigned(SDL_SetTextInputRect) Then result := false; - SDL_IsScreenKeyboardShown := TSDL_IsScreenKeyboardShown_fun(GetProcAddress(LibHandle, 'SDL_IsScreenKeyboardShown')); - If Not assigned(SDL_IsScreenKeyboardShown) Then result := false; - SDL_LoadObject := TSDL_LoadObject_fun(GetProcAddress(LibHandle, 'SDL_LoadObject')); - If Not assigned(SDL_LoadObject) Then result := false; - SDL_UnloadObject := TSDL_UnloadObject_proc(GetProcAddress(LibHandle, 'SDL_UnloadObject')); - If Not assigned(SDL_UnloadObject) Then result := false; - SDL_LogSetAllPriority := TSDL_LogSetAllPriority_proc(GetProcAddress(LibHandle, 'SDL_LogSetAllPriority')); - If Not assigned(SDL_LogSetAllPriority) Then result := false; - SDL_LogSetPriority := TSDL_LogSetPriority_proc(GetProcAddress(LibHandle, 'SDL_LogSetPriority')); - If Not assigned(SDL_LogSetPriority) Then result := false; - SDL_LogGetPriority := TSDL_LogGetPriority_fun(GetProcAddress(LibHandle, 'SDL_LogGetPriority')); - If Not assigned(SDL_LogGetPriority) Then result := false; - SDL_LogResetPriorities := TSDL_LogResetPriorities_proc(GetProcAddress(LibHandle, 'SDL_LogResetPriorities')); - If Not assigned(SDL_LogResetPriorities) Then result := false; - SDL_Log := TSDL_Log_proc(GetProcAddress(LibHandle, 'SDL_Log')); - If Not assigned(SDL_Log) Then result := false; - SDL_LogVerbose := TSDL_LogVerbose_proc(GetProcAddress(LibHandle, 'SDL_LogVerbose')); - If Not assigned(SDL_LogVerbose) Then result := false; - SDL_LogDebug := TSDL_LogDebug_proc(GetProcAddress(LibHandle, 'SDL_LogDebug')); - If Not assigned(SDL_LogDebug) Then result := false; - SDL_LogInfo := TSDL_LogInfo_proc(GetProcAddress(LibHandle, 'SDL_LogInfo')); - If Not assigned(SDL_LogInfo) Then result := false; - SDL_LogWarn := TSDL_LogWarn_proc(GetProcAddress(LibHandle, 'SDL_LogWarn')); - If Not assigned(SDL_LogWarn) Then result := false; - SDL_LogError := TSDL_LogError_proc(GetProcAddress(LibHandle, 'SDL_LogError')); - If Not assigned(SDL_LogError) Then result := false; - SDL_LogCritical := TSDL_LogCritical_proc(GetProcAddress(LibHandle, 'SDL_LogCritical')); - If Not assigned(SDL_LogCritical) Then result := false; - SDL_LogMessage := TSDL_LogMessage_proc(GetProcAddress(LibHandle, 'SDL_LogMessage')); - If Not assigned(SDL_LogMessage) Then result := false; - SDL_LogMessageV := TSDL_LogMessageV_proc(GetProcAddress(LibHandle, 'SDL_LogMessageV')); - If Not assigned(SDL_LogMessageV) Then result := false; - SDL_ShowMessageBox := TSDL_ShowMessageBox_fun(GetProcAddress(LibHandle, 'SDL_ShowMessageBox')); - If Not assigned(SDL_ShowMessageBox) Then result := false; - SDL_ShowSimpleMessageBox := TSDL_ShowSimpleMessageBox_fun(GetProcAddress(LibHandle, 'SDL_ShowSimpleMessageBox')); - If Not assigned(SDL_ShowSimpleMessageBox) Then result := false; - SDL_GetMouseState := TSDL_GetMouseState_fun(GetProcAddress(LibHandle, 'SDL_GetMouseState')); - If Not assigned(SDL_GetMouseState) Then result := false; - SDL_GetGlobalMouseState := TSDL_GetGlobalMouseState_fun(GetProcAddress(LibHandle, 'SDL_GetGlobalMouseState')); - If Not assigned(SDL_GetGlobalMouseState) Then result := false; - SDL_GetRelativeMouseState := TSDL_GetRelativeMouseState_fun(GetProcAddress(LibHandle, 'SDL_GetRelativeMouseState')); - If Not assigned(SDL_GetRelativeMouseState) Then result := false; - SDL_WarpMouseInWindow := TSDL_WarpMouseInWindow_proc(GetProcAddress(LibHandle, 'SDL_WarpMouseInWindow')); - If Not assigned(SDL_WarpMouseInWindow) Then result := false; - SDL_WarpMouseGlobal := TSDL_WarpMouseGlobal_fun(GetProcAddress(LibHandle, 'SDL_WarpMouseGlobal')); - If Not assigned(SDL_WarpMouseGlobal) Then result := false; - SDL_SetRelativeMouseMode := TSDL_SetRelativeMouseMode_fun(GetProcAddress(LibHandle, 'SDL_SetRelativeMouseMode')); - If Not assigned(SDL_SetRelativeMouseMode) Then result := false; - SDL_CaptureMouse := TSDL_CaptureMouse_fun(GetProcAddress(LibHandle, 'SDL_CaptureMouse')); - If Not assigned(SDL_CaptureMouse) Then result := false; - SDL_CreateCursor := TSDL_CreateCursor_fun(GetProcAddress(LibHandle, 'SDL_CreateCursor')); - If Not assigned(SDL_CreateCursor) Then result := false; - SDL_CreateColorCursor := TSDL_CreateColorCursor_fun(GetProcAddress(LibHandle, 'SDL_CreateColorCursor')); - If Not assigned(SDL_CreateColorCursor) Then result := false; - SDL_CreateSystemCursor := TSDL_CreateSystemCursor_fun(GetProcAddress(LibHandle, 'SDL_CreateSystemCursor')); - If Not assigned(SDL_CreateSystemCursor) Then result := false; - SDL_SetCursor := TSDL_SetCursor_proc(GetProcAddress(LibHandle, 'SDL_SetCursor')); - If Not assigned(SDL_SetCursor) Then result := false; - SDL_FreeCursor := TSDL_FreeCursor_proc(GetProcAddress(LibHandle, 'SDL_FreeCursor')); - If Not assigned(SDL_FreeCursor) Then result := false; - SDL_ShowCursor := TSDL_ShowCursor_fun(GetProcAddress(LibHandle, 'SDL_ShowCursor')); - If Not assigned(SDL_ShowCursor) Then result := false; - SDL_LockMutex := TSDL_LockMutex_fun(GetProcAddress(LibHandle, 'SDL_LockMutex')); - If Not assigned(SDL_LockMutex) Then result := false; - SDL_TryLockMutex := TSDL_TryLockMutex_fun(GetProcAddress(LibHandle, 'SDL_TryLockMutex')); - If Not assigned(SDL_TryLockMutex) Then result := false; - SDL_UnlockMutex := TSDL_UnlockMutex_fun(GetProcAddress(LibHandle, 'SDL_UnlockMutex')); - If Not assigned(SDL_UnlockMutex) Then result := false; - SDL_DestroyMutex := TSDL_DestroyMutex_proc(GetProcAddress(LibHandle, 'SDL_DestroyMutex')); - If Not assigned(SDL_DestroyMutex) Then result := false; - SDL_CreateSemaphore := TSDL_CreateSemaphore_fun(GetProcAddress(LibHandle, 'SDL_CreateSemaphore')); - If Not assigned(SDL_CreateSemaphore) Then result := false; - SDL_DestroySemaphore := TSDL_DestroySemaphore_proc(GetProcAddress(LibHandle, 'SDL_DestroySemaphore')); - If Not assigned(SDL_DestroySemaphore) Then result := false; - SDL_SemWait := TSDL_SemWait_fun(GetProcAddress(LibHandle, 'SDL_SemWait')); - If Not assigned(SDL_SemWait) Then result := false; - SDL_SemTryWait := TSDL_SemTryWait_fun(GetProcAddress(LibHandle, 'SDL_SemTryWait')); - If Not assigned(SDL_SemTryWait) Then result := false; - SDL_SemWaitTimeout := TSDL_SemWaitTimeout_fun(GetProcAddress(LibHandle, 'SDL_SemWaitTimeout')); - If Not assigned(SDL_SemWaitTimeout) Then result := false; - SDL_SemPost := TSDL_SemPost_fun(GetProcAddress(LibHandle, 'SDL_SemPost')); - If Not assigned(SDL_SemPost) Then result := false; - SDL_SemValue := TSDL_SemValue_fun(GetProcAddress(LibHandle, 'SDL_SemValue')); - If Not assigned(SDL_SemValue) Then result := false; - SDL_DestroyCond := TSDL_DestroyCond_proc(GetProcAddress(LibHandle, 'SDL_DestroyCond')); - If Not assigned(SDL_DestroyCond) Then result := false; - SDL_CondSignal := TSDL_CondSignal_fun(GetProcAddress(LibHandle, 'SDL_CondSignal')); - If Not assigned(SDL_CondSignal) Then result := false; - SDL_CondBroadcast := TSDL_CondBroadcast_fun(GetProcAddress(LibHandle, 'SDL_CondBroadcast')); - If Not assigned(SDL_CondBroadcast) Then result := false; - SDL_CondWait := TSDL_CondWait_fun(GetProcAddress(LibHandle, 'SDL_CondWait')); - If Not assigned(SDL_CondWait) Then result := false; - SDL_CondWaitTimeout := TSDL_CondWaitTimeout_fun(GetProcAddress(LibHandle, 'SDL_CondWaitTimeout')); - If Not assigned(SDL_CondWaitTimeout) Then result := false; - SDL_GetPixelFormatName := TSDL_GetPixelFormatName_fun(GetProcAddress(LibHandle, 'SDL_GetPixelFormatName')); - If Not assigned(SDL_GetPixelFormatName) Then result := false; - SDL_PixelFormatEnumToMasks := TSDL_PixelFormatEnumToMasks_fun(GetProcAddress(LibHandle, 'SDL_PixelFormatEnumToMasks')); - If Not assigned(SDL_PixelFormatEnumToMasks) Then result := false; - SDL_MasksToPixelFormatEnum := TSDL_MasksToPixelFormatEnum_fun(GetProcAddress(LibHandle, 'SDL_MasksToPixelFormatEnum')); - If Not assigned(SDL_MasksToPixelFormatEnum) Then result := false; - SDL_AllocFormat := TSDL_AllocFormat_fun(GetProcAddress(LibHandle, 'SDL_AllocFormat')); - If Not assigned(SDL_AllocFormat) Then result := false; - SDL_FreeFormat := TSDL_FreeFormat_proc(GetProcAddress(LibHandle, 'SDL_FreeFormat')); - If Not assigned(SDL_FreeFormat) Then result := false; - SDL_AllocPalette := TSDL_AllocPalette_fun(GetProcAddress(LibHandle, 'SDL_AllocPalette')); - If Not assigned(SDL_AllocPalette) Then result := false; - SDL_SetPixelFormatPalette := TSDL_SetPixelFormatPalette_fun(GetProcAddress(LibHandle, 'SDL_SetPixelFormatPalette')); - If Not assigned(SDL_SetPixelFormatPalette) Then result := false; - SDL_SetPaletteColors := TSDL_SetPaletteColors_fun(GetProcAddress(LibHandle, 'SDL_SetPaletteColors')); - If Not assigned(SDL_SetPaletteColors) Then result := false; - SDL_FreePalette := TSDL_FreePalette_proc(GetProcAddress(LibHandle, 'SDL_FreePalette')); - If Not assigned(SDL_FreePalette) Then result := false; - SDL_MapRGB := TSDL_MapRGB_fun(GetProcAddress(LibHandle, 'SDL_MapRGB')); - If Not assigned(SDL_MapRGB) Then result := false; - SDL_MapRGBA := TSDL_MapRGBA_fun(GetProcAddress(LibHandle, 'SDL_MapRGBA')); - If Not assigned(SDL_MapRGBA) Then result := false; - SDL_GetRGB := TSDL_GetRGB_proc(GetProcAddress(LibHandle, 'SDL_GetRGB')); - If Not assigned(SDL_GetRGB) Then result := false; - SDL_GetRGBA := TSDL_GetRGBA_proc(GetProcAddress(LibHandle, 'SDL_GetRGBA')); - If Not assigned(SDL_GetRGBA) Then result := false; - SDL_CalculateGammaRamp := TSDL_CalculateGammaRamp_proc(GetProcAddress(LibHandle, 'SDL_CalculateGammaRamp')); - If Not assigned(SDL_CalculateGammaRamp) Then result := false; - SDL_GetPowerInfo := TSDL_GetPowerInfo_fun(GetProcAddress(LibHandle, 'SDL_GetPowerInfo')); - If Not assigned(SDL_GetPowerInfo) Then result := false; - SDL_HasIntersection := TSDL_HasIntersection_fun(GetProcAddress(LibHandle, 'SDL_HasIntersection')); - If Not assigned(SDL_HasIntersection) Then result := false; - SDL_IntersectRect := TSDL_IntersectRect_fun(GetProcAddress(LibHandle, 'SDL_IntersectRect')); - If Not assigned(SDL_IntersectRect) Then result := false; - SDL_UnionRect := TSDL_UnionRect_proc(GetProcAddress(LibHandle, 'SDL_UnionRect')); - If Not assigned(SDL_UnionRect) Then result := false; - SDL_EnclosePoints := TSDL_EnclosePoints_fun(GetProcAddress(LibHandle, 'SDL_EnclosePoints')); - If Not assigned(SDL_EnclosePoints) Then result := false; - SDL_IntersectRectAndLine := TSDL_IntersectRectAndLine_fun(GetProcAddress(LibHandle, 'SDL_IntersectRectAndLine')); - If Not assigned(SDL_IntersectRectAndLine) Then result := false; - SDL_HasIntersectionF := TSDL_HasIntersectionF_fun(GetProcAddress(LibHandle, 'SDL_HasIntersectionF')); - If Not assigned(SDL_HasIntersectionF) Then result := false; - SDL_IntersectFRect := TSDL_IntersectFRect_fun(GetProcAddress(LibHandle, 'SDL_IntersectFRect')); - If Not assigned(SDL_IntersectFRect) Then result := false; - SDL_UnionFRect := TSDL_UnionFRect_fun(GetProcAddress(LibHandle, 'SDL_UnionFRect')); - If Not assigned(SDL_UnionFRect) Then result := false; - SDL_EncloseFPoints := TSDL_EncloseFPoints_fun(GetProcAddress(LibHandle, 'SDL_EncloseFPoints')); - If Not assigned(SDL_EncloseFPoints) Then result := false; - SDL_IntersectFRectAndLine := TSDL_IntersectFRectAndLine_fun(GetProcAddress(LibHandle, 'SDL_IntersectFRectAndLine')); - If Not assigned(SDL_IntersectFRectAndLine) Then result := false; - SDL_LockTexture := TSDL_LockTexture_fun(GetProcAddress(LibHandle, 'SDL_LockTexture')); - If Not assigned(SDL_LockTexture) Then result := false; - SDL_LockTextureToSurface := TSDL_LockTextureToSurface_fun(GetProcAddress(LibHandle, 'SDL_LockTextureToSurface')); - If Not assigned(SDL_LockTextureToSurface) Then result := false; - SDL_RenderIsClipEnabled := TSDL_RenderIsClipEnabled_fun(GetProcAddress(LibHandle, 'SDL_RenderIsClipEnabled')); - If Not assigned(SDL_RenderIsClipEnabled) Then result := false; - SDL_RenderDrawPointF := TSDL_RenderDrawPointF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawPointF')); - If Not assigned(SDL_RenderDrawPointF) Then result := false; - SDL_RenderDrawPointsF := TSDL_RenderDrawPointsF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawPointsF')); - If Not assigned(SDL_RenderDrawPointsF) Then result := false; - SDL_RenderDrawLineF := TSDL_RenderDrawLineF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawLineF')); - If Not assigned(SDL_RenderDrawLineF) Then result := false; - SDL_RenderDrawLinesF := TSDL_RenderDrawLinesF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawLinesF')); - If Not assigned(SDL_RenderDrawLinesF) Then result := false; - SDL_RenderDrawRectF := TSDL_RenderDrawRectF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawRectF')); - If Not assigned(SDL_RenderDrawRectF) Then result := false; - SDL_RenderDrawRectsF := TSDL_RenderDrawRectsF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawRectsF')); - If Not assigned(SDL_RenderDrawRectsF) Then result := false; - SDL_RenderFillRectF := TSDL_RenderFillRectF_fun(GetProcAddress(LibHandle, 'SDL_RenderFillRectF')); - If Not assigned(SDL_RenderFillRectF) Then result := false; - SDL_RenderFillRectsF := TSDL_RenderFillRectsF_fun(GetProcAddress(LibHandle, 'SDL_RenderFillRectsF')); - If Not assigned(SDL_RenderFillRectsF) Then result := false; - SDL_RenderCopyF := TSDL_RenderCopyF_fun(GetProcAddress(LibHandle, 'SDL_RenderCopyF')); - If Not assigned(SDL_RenderCopyF) Then result := false; - SDL_RenderCopyExF := TSDL_RenderCopyExF_fun(GetProcAddress(LibHandle, 'SDL_RenderCopyExF')); - If Not assigned(SDL_RenderCopyExF) Then result := false; - SDL_RenderGetMetalLayer := TSDL_RenderGetMetalLayer_fun(GetProcAddress(LibHandle, 'SDL_RenderGetMetalLayer')); - If Not assigned(SDL_RenderGetMetalLayer) Then result := false; - SDL_RenderGetMetalCommandEncoder := TSDL_RenderGetMetalCommandEncoder_fun(GetProcAddress(LibHandle, 'SDL_RenderGetMetalCommandEncoder')); - If Not assigned(SDL_RenderGetMetalCommandEncoder) Then result := false; - SDL_UpdateYUVTexture := TSDL_UpdateYUVTexture_fun(GetProcAddress(LibHandle, 'SDL_UpdateYUVTexture')); - If Not assigned(SDL_UpdateYUVTexture) Then result := false; - SDL_RWFromFile := TSDL_RWFromFile_fun(GetProcAddress(LibHandle, 'SDL_RWFromFile')); - If Not assigned(SDL_RWFromFile) Then result := false; - SDL_RWFromFP := TSDL_RWFromFP_fun(GetProcAddress(LibHandle, 'SDL_RWFromFP')); - If Not assigned(SDL_RWFromFP) Then result := false; - SDL_RWFromMem := TSDL_RWFromMem_fun(GetProcAddress(LibHandle, 'SDL_RWFromMem')); - If Not assigned(SDL_RWFromMem) Then result := false; - SDL_RWFromConstMem := TSDL_RWFromConstMem_fun(GetProcAddress(LibHandle, 'SDL_RWFromConstMem')); - If Not assigned(SDL_RWFromConstMem) Then result := false; - SDL_FreeRW := TSDL_FreeRW_proc(GetProcAddress(LibHandle, 'SDL_FreeRW')); - If Not assigned(SDL_FreeRW) Then result := false; - SDL_RWsize := TSDL_RWsize_fun(GetProcAddress(LibHandle, 'SDL_RWsize')); - If Not assigned(SDL_RWsize) Then result := false; - SDL_RWseek := TSDL_RWseek_fun(GetProcAddress(LibHandle, 'SDL_RWseek')); - If Not assigned(SDL_RWseek) Then result := false; - SDL_RWtell := TSDL_RWtell_fun(GetProcAddress(LibHandle, 'SDL_RWtell')); - If Not assigned(SDL_RWtell) Then result := false; - SDL_RWread := TSDL_RWread_fun(GetProcAddress(LibHandle, 'SDL_RWread')); - If Not assigned(SDL_RWread) Then result := false; - SDL_RWwrite := TSDL_RWwrite_fun(GetProcAddress(LibHandle, 'SDL_RWwrite')); - If Not assigned(SDL_RWwrite) Then result := false; - SDL_RWclose := TSDL_RWclose_fun(GetProcAddress(LibHandle, 'SDL_RWclose')); - If Not assigned(SDL_RWclose) Then result := false; - SDL_LoadFile_RW := TSDL_LoadFile_RW_fun(GetProcAddress(LibHandle, 'SDL_LoadFile_RW')); - If Not assigned(SDL_LoadFile_RW) Then result := false; - SDL_LoadFile := TSDL_LoadFile_fun(GetProcAddress(LibHandle, 'SDL_LoadFile')); - If Not assigned(SDL_LoadFile) Then result := false; - SDL_ReadU8 := TSDL_ReadU8_fun(GetProcAddress(LibHandle, 'SDL_ReadU8')); - If Not assigned(SDL_ReadU8) Then result := false; - SDL_ReadLE16 := TSDL_ReadLE16_fun(GetProcAddress(LibHandle, 'SDL_ReadLE16')); - If Not assigned(SDL_ReadLE16) Then result := false; - SDL_ReadBE16 := TSDL_ReadBE16_fun(GetProcAddress(LibHandle, 'SDL_ReadBE16')); - If Not assigned(SDL_ReadBE16) Then result := false; - SDL_ReadLE32 := TSDL_ReadLE32_fun(GetProcAddress(LibHandle, 'SDL_ReadLE32')); - If Not assigned(SDL_ReadLE32) Then result := false; - SDL_ReadBE32 := TSDL_ReadBE32_fun(GetProcAddress(LibHandle, 'SDL_ReadBE32')); - If Not assigned(SDL_ReadBE32) Then result := false; - SDL_ReadLE64 := TSDL_ReadLE64_fun(GetProcAddress(LibHandle, 'SDL_ReadLE64')); - If Not assigned(SDL_ReadLE64) Then result := false; - SDL_ReadBE64 := TSDL_ReadBE64_fun(GetProcAddress(LibHandle, 'SDL_ReadBE64')); - If Not assigned(SDL_ReadBE64) Then result := false; - SDL_WriteU8 := TSDL_WriteU8_fun(GetProcAddress(LibHandle, 'SDL_WriteU8')); - If Not assigned(SDL_WriteU8) Then result := false; - SDL_WriteLE16 := TSDL_WriteLE16_fun(GetProcAddress(LibHandle, 'SDL_WriteLE16')); - If Not assigned(SDL_WriteLE16) Then result := false; - SDL_WriteBE16 := TSDL_WriteBE16_fun(GetProcAddress(LibHandle, 'SDL_WriteBE16')); - If Not assigned(SDL_WriteBE16) Then result := false; - SDL_WriteLE32 := TSDL_WriteLE32_fun(GetProcAddress(LibHandle, 'SDL_WriteLE32')); - If Not assigned(SDL_WriteLE32) Then result := false; - SDL_WriteBE32 := TSDL_WriteBE32_fun(GetProcAddress(LibHandle, 'SDL_WriteBE32')); - If Not assigned(SDL_WriteBE32) Then result := false; - SDL_WriteLE64 := TSDL_WriteLE64_fun(GetProcAddress(LibHandle, 'SDL_WriteLE64')); - If Not assigned(SDL_WriteLE64) Then result := false; - SDL_WriteBE64 := TSDL_WriteBE64_fun(GetProcAddress(LibHandle, 'SDL_WriteBE64')); - If Not assigned(SDL_WriteBE64) Then result := false; - SDL_CreateShapedWindow := TSDL_CreateShapedWindow_fun(GetProcAddress(LibHandle, 'SDL_CreateShapedWindow')); - If Not assigned(SDL_CreateShapedWindow) Then result := false; - SDL_IsShapedWindow := TSDL_IsShapedWindow_fun(GetProcAddress(LibHandle, 'SDL_IsShapedWindow')); - If Not assigned(SDL_IsShapedWindow) Then result := false; - SDL_SetWindowShape := TSDL_SetWindowShape_fun(GetProcAddress(LibHandle, 'SDL_SetWindowShape')); - If Not assigned(SDL_SetWindowShape) Then result := false; - SDL_GetShapedWindowMode := TSDL_GetShapedWindowMode_fun(GetProcAddress(LibHandle, 'SDL_GetShapedWindowMode')); - If Not assigned(SDL_GetShapedWindowMode) Then result := false; - SDL_GetNumAllocations := TSDL_GetNumAllocations_fun(GetProcAddress(LibHandle, 'SDL_GetNumAllocations')); - If Not assigned(SDL_GetNumAllocations) Then result := false; - SDL_malloc := TSDL_malloc_fun(GetProcAddress(LibHandle, 'SDL_malloc')); - If Not assigned(SDL_malloc) Then result := false; - SDL_calloc := TSDL_calloc_fun(GetProcAddress(LibHandle, 'SDL_calloc')); - If Not assigned(SDL_calloc) Then result := false; - SDL_realloc := TSDL_realloc_fun(GetProcAddress(LibHandle, 'SDL_realloc')); - If Not assigned(SDL_realloc) Then result := false; - SDL_free := TSDL_free_proc(GetProcAddress(LibHandle, 'SDL_free')); - If Not assigned(SDL_free) Then result := false; - SDL_isalpha := TSDL_isalpha_fun(GetProcAddress(LibHandle, 'SDL_isalpha')); - If Not assigned(SDL_isalpha) Then result := false; - SDL_isalnum := TSDL_isalnum_fun(GetProcAddress(LibHandle, 'SDL_isalnum')); - If Not assigned(SDL_isalnum) Then result := false; - SDL_isblank := TSDL_isblank_fun(GetProcAddress(LibHandle, 'SDL_isblank')); - If Not assigned(SDL_isblank) Then result := false; - SDL_iscntrl := TSDL_iscntrl_fun(GetProcAddress(LibHandle, 'SDL_iscntrl')); - If Not assigned(SDL_iscntrl) Then result := false; - SDL_isdigit := TSDL_isdigit_fun(GetProcAddress(LibHandle, 'SDL_isdigit')); - If Not assigned(SDL_isdigit) Then result := false; - SDL_isxdigit := TSDL_isxdigit_fun(GetProcAddress(LibHandle, 'SDL_isxdigit')); - If Not assigned(SDL_isxdigit) Then result := false; - SDL_ispunct := TSDL_ispunct_fun(GetProcAddress(LibHandle, 'SDL_ispunct')); - If Not assigned(SDL_ispunct) Then result := false; - SDL_isspace := TSDL_isspace_fun(GetProcAddress(LibHandle, 'SDL_isspace')); - If Not assigned(SDL_isspace) Then result := false; - SDL_isupper := TSDL_isupper_fun(GetProcAddress(LibHandle, 'SDL_isupper')); - If Not assigned(SDL_isupper) Then result := false; - SDL_islower := TSDL_islower_fun(GetProcAddress(LibHandle, 'SDL_islower')); - If Not assigned(SDL_islower) Then result := false; - SDL_isprint := TSDL_isprint_fun(GetProcAddress(LibHandle, 'SDL_isprint')); - If Not assigned(SDL_isprint) Then result := false; - SDL_isgraph := TSDL_isgraph_fun(GetProcAddress(LibHandle, 'SDL_isgraph')); - If Not assigned(SDL_isgraph) Then result := false; - SDL_toupper := TSDL_toupper_fun(GetProcAddress(LibHandle, 'SDL_toupper')); - If Not assigned(SDL_toupper) Then result := false; - SDL_tolower := TSDL_tolower_fun(GetProcAddress(LibHandle, 'SDL_tolower')); - If Not assigned(SDL_tolower) Then result := false; - SDL_acos := TSDL_acos_fun(GetProcAddress(LibHandle, 'SDL_acos')); - If Not assigned(SDL_acos) Then result := false; - SDL_acosf := TSDL_acosf_fun(GetProcAddress(LibHandle, 'SDL_acosf')); - If Not assigned(SDL_acosf) Then result := false; - SDL_asin := TSDL_asin_fun(GetProcAddress(LibHandle, 'SDL_asin')); - If Not assigned(SDL_asin) Then result := false; - SDL_asinf := TSDL_asinf_fun(GetProcAddress(LibHandle, 'SDL_asinf')); - If Not assigned(SDL_asinf) Then result := false; - SDL_atan := TSDL_atan_fun(GetProcAddress(LibHandle, 'SDL_atan')); - If Not assigned(SDL_atan) Then result := false; - SDL_atanf := TSDL_atanf_fun(GetProcAddress(LibHandle, 'SDL_atanf')); - If Not assigned(SDL_atanf) Then result := false; - SDL_atan2 := TSDL_atan2_fun(GetProcAddress(LibHandle, 'SDL_atan2')); - If Not assigned(SDL_atan2) Then result := false; - SDL_atan2f := TSDL_atan2f_fun(GetProcAddress(LibHandle, 'SDL_atan2f')); - If Not assigned(SDL_atan2f) Then result := false; - SDL_ceil := TSDL_ceil_fun(GetProcAddress(LibHandle, 'SDL_ceil')); - If Not assigned(SDL_ceil) Then result := false; - SDL_ceilf := TSDL_ceilf_fun(GetProcAddress(LibHandle, 'SDL_ceilf')); - If Not assigned(SDL_ceilf) Then result := false; - SDL_copysign := TSDL_copysign_fun(GetProcAddress(LibHandle, 'SDL_copysign')); - If Not assigned(SDL_copysign) Then result := false; - SDL_copysignf := TSDL_copysignf_fun(GetProcAddress(LibHandle, 'SDL_copysignf')); - If Not assigned(SDL_copysignf) Then result := false; - SDL_cos := TSDL_cos_fun(GetProcAddress(LibHandle, 'SDL_cos')); - If Not assigned(SDL_cos) Then result := false; - SDL_cosf := TSDL_cosf_fun(GetProcAddress(LibHandle, 'SDL_cosf')); - If Not assigned(SDL_cosf) Then result := false; - SDL_exp := TSDL_exp_fun(GetProcAddress(LibHandle, 'SDL_exp')); - If Not assigned(SDL_exp) Then result := false; - SDL_expf := TSDL_expf_fun(GetProcAddress(LibHandle, 'SDL_expf')); - If Not assigned(SDL_expf) Then result := false; - SDL_fabs := TSDL_fabs_fun(GetProcAddress(LibHandle, 'SDL_fabs')); - If Not assigned(SDL_fabs) Then result := false; - SDL_fabsf := TSDL_fabsf_fun(GetProcAddress(LibHandle, 'SDL_fabsf')); - If Not assigned(SDL_fabsf) Then result := false; - SDL_floor := TSDL_floor_fun(GetProcAddress(LibHandle, 'SDL_floor')); - If Not assigned(SDL_floor) Then result := false; - SDL_floorf := TSDL_floorf_fun(GetProcAddress(LibHandle, 'SDL_floorf')); - If Not assigned(SDL_floorf) Then result := false; - SDL_fmod := TSDL_fmod_fun(GetProcAddress(LibHandle, 'SDL_fmod')); - If Not assigned(SDL_fmod) Then result := false; - SDL_fmodf := TSDL_fmodf_fun(GetProcAddress(LibHandle, 'SDL_fmodf')); - If Not assigned(SDL_fmodf) Then result := false; - SDL_nlog := TSDL_nlog_fun(GetProcAddress(LibHandle, 'SDL_nlog')); - If Not assigned(SDL_nlog) Then result := false; - SDL_nlogf := TSDL_nlogf_fun(GetProcAddress(LibHandle, 'SDL_nlogf')); - If Not assigned(SDL_nlogf) Then result := false; - SDL_log10 := TSDL_log10_fun(GetProcAddress(LibHandle, 'SDL_log10')); - If Not assigned(SDL_log10) Then result := false; - SDL_log10f := TSDL_log10f_fun(GetProcAddress(LibHandle, 'SDL_log10f')); - If Not assigned(SDL_log10f) Then result := false; - SDL_lround := TSDL_lround_fun(GetProcAddress(LibHandle, 'SDL_lround')); - If Not assigned(SDL_lround) Then result := false; - SDL_lroundf := TSDL_lroundf_fun(GetProcAddress(LibHandle, 'SDL_lroundf')); - If Not assigned(SDL_lroundf) Then result := false; - SDL_pow := TSDL_pow_fun(GetProcAddress(LibHandle, 'SDL_pow')); - If Not assigned(SDL_pow) Then result := false; - SDL_powf := TSDL_powf_fun(GetProcAddress(LibHandle, 'SDL_powf')); - If Not assigned(SDL_powf) Then result := false; - SDL_round := TSDL_round_fun(GetProcAddress(LibHandle, 'SDL_round')); - If Not assigned(SDL_round) Then result := false; - SDL_roundf := TSDL_roundf_fun(GetProcAddress(LibHandle, 'SDL_roundf')); - If Not assigned(SDL_roundf) Then result := false; - SDL_scalbn := TSDL_scalbn_fun(GetProcAddress(LibHandle, 'SDL_scalbn')); - If Not assigned(SDL_scalbn) Then result := false; - SDL_scalbnf := TSDL_scalbnf_fun(GetProcAddress(LibHandle, 'SDL_scalbnf')); - If Not assigned(SDL_scalbnf) Then result := false; - SDL_sin := TSDL_sin_fun(GetProcAddress(LibHandle, 'SDL_sin')); - If Not assigned(SDL_sin) Then result := false; - SDL_sinf := TSDL_sinf_fun(GetProcAddress(LibHandle, 'SDL_sinf')); - If Not assigned(SDL_sinf) Then result := false; - SDL_sqrt := TSDL_sqrt_fun(GetProcAddress(LibHandle, 'SDL_sqrt')); - If Not assigned(SDL_sqrt) Then result := false; - SDL_sqrtf := TSDL_sqrtf_fun(GetProcAddress(LibHandle, 'SDL_sqrtf')); - If Not assigned(SDL_sqrtf) Then result := false; - SDL_tan := TSDL_tan_fun(GetProcAddress(LibHandle, 'SDL_tan')); - If Not assigned(SDL_tan) Then result := false; - SDL_tanf := TSDL_tanf_fun(GetProcAddress(LibHandle, 'SDL_tanf')); - If Not assigned(SDL_tanf) Then result := false; - SDL_trunc := TSDL_trunc_fun(GetProcAddress(LibHandle, 'SDL_trunc')); - If Not assigned(SDL_trunc) Then result := false; - SDL_truncf := TSDL_truncf_fun(GetProcAddress(LibHandle, 'SDL_truncf')); - If Not assigned(SDL_truncf) Then result := false; - SDL_iconv_string := TSDL_iconv_string_fun(GetProcAddress(LibHandle, 'SDL_iconv_string')); - If Not assigned(SDL_iconv_string) Then result := false; - SDL_iconv_open := TSDL_iconv_open_fun(GetProcAddress(LibHandle, 'SDL_iconv_open')); - If Not assigned(SDL_iconv_open) Then result := false; - SDL_iconv_close := TSDL_iconv_close_fun(GetProcAddress(LibHandle, 'SDL_iconv_close')); - If Not assigned(SDL_iconv_close) Then result := false; - SDL_iconv := TSDL_iconv_fun(GetProcAddress(LibHandle, 'SDL_iconv')); - If Not assigned(SDL_iconv) Then result := false; - SDL_CreateRGBSurface := TSDL_CreateRGBSurface_fun(GetProcAddress(LibHandle, 'SDL_CreateRGBSurface')); - If Not assigned(SDL_CreateRGBSurface) Then result := false; - SDL_CreateRGBSurfaceWithFormat := TSDL_CreateRGBSurfaceWithFormat_fun(GetProcAddress(LibHandle, 'SDL_CreateRGBSurfaceWithFormat')); - If Not assigned(SDL_CreateRGBSurfaceWithFormat) Then result := false; - SDL_CreateRGBSurfaceFrom := TSDL_CreateRGBSurfaceFrom_fun(GetProcAddress(LibHandle, 'SDL_CreateRGBSurfaceFrom')); - If Not assigned(SDL_CreateRGBSurfaceFrom) Then result := false; - SDL_CreateRGBSurfaceWithFormatFrom := TSDL_CreateRGBSurfaceWithFormatFrom_fun(GetProcAddress(LibHandle, 'SDL_CreateRGBSurfaceWithFormatFrom')); - If Not assigned(SDL_CreateRGBSurfaceWithFormatFrom) Then result := false; - SDL_FreeSurface := TSDL_FreeSurface_proc(GetProcAddress(LibHandle, 'SDL_FreeSurface')); - If Not assigned(SDL_FreeSurface) Then result := false; - SDL_SetSurfacePalette := TSDL_SetSurfacePalette_fun(GetProcAddress(LibHandle, 'SDL_SetSurfacePalette')); - If Not assigned(SDL_SetSurfacePalette) Then result := false; - SDL_LockSurface := TSDL_LockSurface_fun(GetProcAddress(LibHandle, 'SDL_LockSurface')); - If Not assigned(SDL_LockSurface) Then result := false; - SDL_UnlockSurface := TSDL_UnlockSurface_proc(GetProcAddress(LibHandle, 'SDL_UnlockSurface')); - If Not assigned(SDL_UnlockSurface) Then result := false; - SDL_LoadBMP_RW := TSDL_LoadBMP_RW_fun(GetProcAddress(LibHandle, 'SDL_LoadBMP_RW')); - If Not assigned(SDL_LoadBMP_RW) Then result := false; - SDL_SaveBMP_RW := TSDL_SaveBMP_RW_fun(GetProcAddress(LibHandle, 'SDL_SaveBMP_RW')); - If Not assigned(SDL_SaveBMP_RW) Then result := false; - SDL_SetSurfaceRLE := TSDL_SetSurfaceRLE_fun(GetProcAddress(LibHandle, 'SDL_SetSurfaceRLE')); - If Not assigned(SDL_SetSurfaceRLE) Then result := false; - SDL_HasSurfaceRLE := TSDL_HasSurfaceRLE_fun(GetProcAddress(LibHandle, 'SDL_HasSurfaceRLE')); - If Not assigned(SDL_HasSurfaceRLE) Then result := false; - SDL_SetColorKey := TSDL_SetColorKey_fun(GetProcAddress(LibHandle, 'SDL_SetColorKey')); - If Not assigned(SDL_SetColorKey) Then result := false; - SDL_HasColorKey := TSDL_HasColorKey_fun(GetProcAddress(LibHandle, 'SDL_HasColorKey')); - If Not assigned(SDL_HasColorKey) Then result := false; - SDL_GetColorKey := TSDL_GetColorKey_fun(GetProcAddress(LibHandle, 'SDL_GetColorKey')); - If Not assigned(SDL_GetColorKey) Then result := false; - SDL_SetSurfaceColorMod := TSDL_SetSurfaceColorMod_fun(GetProcAddress(LibHandle, 'SDL_SetSurfaceColorMod')); - If Not assigned(SDL_SetSurfaceColorMod) Then result := false; - SDL_GetSurfaceColorMod := TSDL_GetSurfaceColorMod_fun(GetProcAddress(LibHandle, 'SDL_GetSurfaceColorMod')); - If Not assigned(SDL_GetSurfaceColorMod) Then result := false; - SDL_SetSurfaceAlphaMod := TSDL_SetSurfaceAlphaMod_fun(GetProcAddress(LibHandle, 'SDL_SetSurfaceAlphaMod')); - If Not assigned(SDL_SetSurfaceAlphaMod) Then result := false; - SDL_GetSurfaceAlphaMod := TSDL_GetSurfaceAlphaMod_fun(GetProcAddress(LibHandle, 'SDL_GetSurfaceAlphaMod')); - If Not assigned(SDL_GetSurfaceAlphaMod) Then result := false; - SDL_SetSurfaceBlendMode := TSDL_SetSurfaceBlendMode_fun(GetProcAddress(LibHandle, 'SDL_SetSurfaceBlendMode')); - If Not assigned(SDL_SetSurfaceBlendMode) Then result := false; - SDL_GetSurfaceBlendMode := TSDL_GetSurfaceBlendMode_fun(GetProcAddress(LibHandle, 'SDL_GetSurfaceBlendMode')); - If Not assigned(SDL_GetSurfaceBlendMode) Then result := false; - SDL_SetClipRect := TSDL_SetClipRect_fun(GetProcAddress(LibHandle, 'SDL_SetClipRect')); - If Not assigned(SDL_SetClipRect) Then result := false; - SDL_GetClipRect := TSDL_GetClipRect_proc(GetProcAddress(LibHandle, 'SDL_GetClipRect')); - If Not assigned(SDL_GetClipRect) Then result := false; - SDL_DuplicateSurface := TSDL_DuplicateSurface_fun(GetProcAddress(LibHandle, 'SDL_DuplicateSurface')); - If Not assigned(SDL_DuplicateSurface) Then result := false; - SDL_ConvertSurface := TSDL_ConvertSurface_fun(GetProcAddress(LibHandle, 'SDL_ConvertSurface')); - If Not assigned(SDL_ConvertSurface) Then result := false; - SDL_ConvertSurfaceFormat := TSDL_ConvertSurfaceFormat_fun(GetProcAddress(LibHandle, 'SDL_ConvertSurfaceFormat')); - If Not assigned(SDL_ConvertSurfaceFormat) Then result := false; - SDL_ConvertPixels := TSDL_ConvertPixels_fun(GetProcAddress(LibHandle, 'SDL_ConvertPixels')); - If Not assigned(SDL_ConvertPixels) Then result := false; - SDL_FillRect := TSDL_FillRect_fun(GetProcAddress(LibHandle, 'SDL_FillRect')); - If Not assigned(SDL_FillRect) Then result := false; - SDL_FillRects := TSDL_FillRects_fun(GetProcAddress(LibHandle, 'SDL_FillRects')); - If Not assigned(SDL_FillRects) Then result := false; - SDL_BlitSurface := TSDL_BlitSurface_fun(GetProcAddress(LibHandle, 'SDL_BlitSurface')); - If Not assigned(SDL_BlitSurface) Then result := false; - SDL_UpperBlit := TSDL_UpperBlit_fun(GetProcAddress(LibHandle, 'SDL_UpperBlit')); - If Not assigned(SDL_UpperBlit) Then result := false; - SDL_LowerBlit := TSDL_LowerBlit_fun(GetProcAddress(LibHandle, 'SDL_LowerBlit')); - If Not assigned(SDL_LowerBlit) Then result := false; - SDL_SoftStretch := TSDL_SoftStretch_fun(GetProcAddress(LibHandle, 'SDL_SoftStretch')); - If Not assigned(SDL_SoftStretch) Then result := false; - SDL_BlitSurfaceScaled := TSDL_BlitSurfaceScaled_fun(GetProcAddress(LibHandle, 'SDL_BlitSurfaceScaled')); - If Not assigned(SDL_BlitSurfaceScaled) Then result := false; - SDL_UpperBlitScaled := TSDL_UpperBlitScaled_fun(GetProcAddress(LibHandle, 'SDL_UpperBlitScaled')); - If Not assigned(SDL_UpperBlitScaled) Then result := false; - SDL_LowerBlitScaled := TSDL_LowerBlitScaled_fun(GetProcAddress(LibHandle, 'SDL_LowerBlitScaled')); - If Not assigned(SDL_LowerBlitScaled) Then result := false; - SDL_SetYUVConversionMode := TSDL_SetYUVConversionMode_proc(GetProcAddress(LibHandle, 'SDL_SetYUVConversionMode')); - If Not assigned(SDL_SetYUVConversionMode) Then result := false; - SDL_GetYUVConversionModeForResolution := TSDL_GetYUVConversionModeForResolution_fun(GetProcAddress(LibHandle, 'SDL_GetYUVConversionModeForResolution')); - If Not assigned(SDL_GetYUVConversionModeForResolution) Then result := false; - SDL_SetWindowsMessageHook := TSDL_SetWindowsMessageHook_proc(GetProcAddress(LibHandle, 'SDL_SetWindowsMessageHook')); - If Not assigned(SDL_SetWindowsMessageHook) Then result := false; - SDL_Direct3D9GetAdapterIndex := TSDL_Direct3D9GetAdapterIndex_fun(GetProcAddress(LibHandle, 'SDL_Direct3D9GetAdapterIndex')); - If Not assigned(SDL_Direct3D9GetAdapterIndex) Then result := false; - SDL_RenderGetD3D9Device := TSDL_RenderGetD3D9Device_fun(GetProcAddress(LibHandle, 'SDL_RenderGetD3D9Device')); - If Not assigned(SDL_RenderGetD3D9Device) Then result := false; - SDL_RenderGetD3D11Device := TSDL_RenderGetD3D11Device_fun(GetProcAddress(LibHandle, 'SDL_RenderGetD3D11Device')); - If Not assigned(SDL_RenderGetD3D11Device) Then result := false; - SDL_RenderGetD3D12Device := TSDL_RenderGetD3D12Device_fun(GetProcAddress(LibHandle, 'SDL_RenderGetD3D12Device')); - If Not assigned(SDL_RenderGetD3D12Device) Then result := false; - SDL_DXGIGetOutputInfo := TSDL_DXGIGetOutputInfo_fun(GetProcAddress(LibHandle, 'SDL_DXGIGetOutputInfo')); - If Not assigned(SDL_DXGIGetOutputInfo) Then result := false; //*) -{$IFDEF LINUX} - SDL_LinuxSetThreadPriority := TSDL_LinuxSetThreadPriority_fun(GetProcAddress(LibHandle, 'SDL_LinuxSetThreadPriority')); - If Not assigned(SDL_LinuxSetThreadPriority) Then result := false; - SDL_LinuxSetThreadPriorityAndPolicy := TSDL_LinuxSetThreadPriorityAndPolicy_fun(GetProcAddress(LibHandle, 'SDL_LinuxSetThreadPriorityAndPolicy')); - If Not assigned(SDL_LinuxSetThreadPriorityAndPolicy) Then result := false; -{$IFDEF Windows} - SDL_iPhoneSetAnimationCallback := TSDL_iPhoneSetAnimationCallback_fun(GetProcAddress(LibHandle, 'SDL_iPhoneSetAnimationCallback')); - If Not assigned(SDL_iPhoneSetAnimationCallback) Then result := false; - SDL_iPhoneSetEventPump := TSDL_iPhoneSetEventPump_proc(GetProcAddress(LibHandle, 'SDL_iPhoneSetEventPump')); - If Not assigned(SDL_iPhoneSetEventPump) Then result := false; - SDL_AndroidGetJNIEnv := TSDL_AndroidGetJNIEnv_fun(GetProcAddress(LibHandle, 'SDL_AndroidGetJNIEnv')); - If Not assigned(SDL_AndroidGetJNIEnv) Then result := false; - SDL_AndroidGetActivity := TSDL_AndroidGetActivity_fun(GetProcAddress(LibHandle, 'SDL_AndroidGetActivity')); - If Not assigned(SDL_AndroidGetActivity) Then result := false; - SDL_GetAndroidSDKVersion := TSDL_GetAndroidSDKVersion_fun(GetProcAddress(LibHandle, 'SDL_GetAndroidSDKVersion')); - If Not assigned(SDL_GetAndroidSDKVersion) Then result := false; - SDL_IsAndroidTV := TSDL_IsAndroidTV_fun(GetProcAddress(LibHandle, 'SDL_IsAndroidTV')); - If Not assigned(SDL_IsAndroidTV) Then result := false; - SDL_IsChromebook := TSDL_IsChromebook_fun(GetProcAddress(LibHandle, 'SDL_IsChromebook')); - If Not assigned(SDL_IsChromebook) Then result := false; - SDL_IsDeXMode := TSDL_IsDeXMode_fun(GetProcAddress(LibHandle, 'SDL_IsDeXMode')); - If Not assigned(SDL_IsDeXMode) Then result := false; - SDL_AndroidBackButton := TSDL_AndroidBackButton_proc(GetProcAddress(LibHandle, 'SDL_AndroidBackButton')); - If Not assigned(SDL_AndroidBackButton) Then result := false; - SDL_AndroidGetInternalStoragePath := TSDL_AndroidGetInternalStoragePath_fun(GetProcAddress(LibHandle, 'SDL_AndroidGetInternalStoragePath')); - If Not assigned(SDL_AndroidGetInternalStoragePath) Then result := false; - SDL_AndroidGetExternalStorageState := TSDL_AndroidGetExternalStorageState_fun(GetProcAddress(LibHandle, 'SDL_AndroidGetExternalStorageState')); - If Not assigned(SDL_AndroidGetExternalStorageState) Then result := false; - SDL_AndroidGetExternalStoragePath := TSDL_AndroidGetExternalStoragePath_fun(GetProcAddress(LibHandle, 'SDL_AndroidGetExternalStoragePath')); - If Not assigned(SDL_AndroidGetExternalStoragePath) Then result := false; - SDL_AndroidRequestPermission := TSDL_AndroidRequestPermission_fun(GetProcAddress(LibHandle, 'SDL_AndroidRequestPermission')); - If Not assigned(SDL_AndroidRequestPermission) Then result := false; - SDL_AndroidShowToast := TSDL_AndroidShowToast_fun(GetProcAddress(LibHandle, 'SDL_AndroidShowToast')); - If Not assigned(SDL_AndroidShowToast) Then result := false; - SDL_AndroidSendMessage := TSDL_AndroidSendMessage_fun(GetProcAddress(LibHandle, 'SDL_AndroidSendMessage')); - If Not assigned(SDL_AndroidSendMessage) Then result := false; - SDL_WinRTGetFSPathUNICODE := TSDL_WinRTGetFSPathUNICODE_fun(GetProcAddress(LibHandle, 'SDL_WinRTGetFSPathUNICODE')); - If Not assigned(SDL_WinRTGetFSPathUNICODE) Then result := false; - SDL_WinRTGetFSPathUTF8 := TSDL_WinRTGetFSPathUTF8_fun(GetProcAddress(LibHandle, 'SDL_WinRTGetFSPathUTF8')); - If Not assigned(SDL_WinRTGetFSPathUTF8) Then result := false; - SDL_WinRTGetDeviceFamily := TSDL_WinRTGetDeviceFamily_fun(GetProcAddress(LibHandle, 'SDL_WinRTGetDeviceFamily')); - If Not assigned(SDL_WinRTGetDeviceFamily) Then result := false; -{$ENDIF} -{$ENDIF} - SDL_IsTablet := TSDL_IsTablet_fun(GetProcAddress(LibHandle, 'SDL_IsTablet')); - If Not assigned(SDL_IsTablet) Then result := false; - SDL_GetWindowWMInfo := TSDL_GetWindowWMInfo_fun(GetProcAddress(LibHandle, 'SDL_GetWindowWMInfo')); - If Not assigned(SDL_GetWindowWMInfo) Then result := false; - SDL_CreateThread := TSDL_CreateThread_fun(GetProcAddress(LibHandle, 'SDL_CreateThread')); - If Not assigned(SDL_CreateThread) Then result := false; - SDL_CreateThreadWithStackSize := TSDL_CreateThreadWithStackSize_fun(GetProcAddress(LibHandle, 'SDL_CreateThreadWithStackSize')); - If Not assigned(SDL_CreateThreadWithStackSize) Then result := false; - SDL_CreateThread := TSDL_CreateThread_fun(GetProcAddress(LibHandle, 'SDL_CreateThread')); - If Not assigned(SDL_CreateThread) Then result := false; - SDL_CreateThreadWithStackSize := TSDL_CreateThreadWithStackSize_fun(GetProcAddress(LibHandle, 'SDL_CreateThreadWithStackSize')); - If Not assigned(SDL_CreateThreadWithStackSize) Then result := false; - SDL_GetThreadName := TSDL_GetThreadName_fun(GetProcAddress(LibHandle, 'SDL_GetThreadName')); - If Not assigned(SDL_GetThreadName) Then result := false; - SDL_GetThreadID := TSDL_GetThreadID_fun(GetProcAddress(LibHandle, 'SDL_GetThreadID')); - If Not assigned(SDL_GetThreadID) Then result := false; - SDL_SetThreadPriority := TSDL_SetThreadPriority_fun(GetProcAddress(LibHandle, 'SDL_SetThreadPriority')); - If Not assigned(SDL_SetThreadPriority) Then result := false; - SDL_WaitThread := TSDL_WaitThread_proc(GetProcAddress(LibHandle, 'SDL_WaitThread')); - If Not assigned(SDL_WaitThread) Then result := false; - SDL_DetachThread := TSDL_DetachThread_proc(GetProcAddress(LibHandle, 'SDL_DetachThread')); - If Not assigned(SDL_DetachThread) Then result := false; - SDL_TLSGet := TSDL_TLSGet_fun(GetProcAddress(LibHandle, 'SDL_TLSGet')); - If Not assigned(SDL_TLSGet) Then result := false; - SDL_TLSSet := TSDL_TLSSet_fun(GetProcAddress(LibHandle, 'SDL_TLSSet')); - If Not assigned(SDL_TLSSet) Then result := false; - SDL_Delay := TSDL_Delay_proc(GetProcAddress(LibHandle, 'SDL_Delay')); - If Not assigned(SDL_Delay) Then result := false; - SDL_AddTimer := TSDL_AddTimer_fun(GetProcAddress(LibHandle, 'SDL_AddTimer')); - If Not assigned(SDL_AddTimer) Then result := false; - SDL_RemoveTimer := TSDL_RemoveTimer_fun(GetProcAddress(LibHandle, 'SDL_RemoveTimer')); - If Not assigned(SDL_RemoveTimer) Then result := false; - SDL_GetNumTouchDevices := TSDL_GetNumTouchDevices_fun(GetProcAddress(LibHandle, 'SDL_GetNumTouchDevices')); - If Not assigned(SDL_GetNumTouchDevices) Then result := false; - SDL_GetTouchDevice := TSDL_GetTouchDevice_fun(GetProcAddress(LibHandle, 'SDL_GetTouchDevice')); - If Not assigned(SDL_GetTouchDevice) Then result := false; - (* SDL_GetTouchName := TSDL_GetTouchName_fun(GetProcAddress(LibHandle, 'SDL_GetTouchName')); - If Not assigned(SDL_GetTouchName) Then result := false; - SDL_GetTouchDeviceType := TSDL_GetTouchDeviceType_fun(GetProcAddress(LibHandle, 'SDL_GetTouchDeviceType')); - If Not assigned(SDL_GetTouchDeviceType) Then result := false; - SDL_GetNumTouchFingers := TSDL_GetNumTouchFingers_fun(GetProcAddress(LibHandle, 'SDL_GetNumTouchFingers')); - If Not assigned(SDL_GetNumTouchFingers) Then result := false; - SDL_GetTouchFinger := TSDL_GetTouchFinger_fun(GetProcAddress(LibHandle, 'SDL_GetTouchFinger')); - If Not assigned(SDL_GetTouchFinger) Then result := false; //*) - SDL_GetVersion := TSDL_GetVersion_proc(GetProcAddress(LibHandle, 'SDL_GetVersion')); - If Not assigned(SDL_GetVersion) Then result := false; - (* SDL_GetVideoDriver := TSDL_GetVideoDriver_fun(GetProcAddress(LibHandle, 'SDL_GetVideoDriver')); - If Not assigned(SDL_GetVideoDriver) Then result := false; - SDL_VideoInit := TSDL_VideoInit_fun(GetProcAddress(LibHandle, 'SDL_VideoInit')); - If Not assigned(SDL_VideoInit) Then result := false; - SDL_GetDisplayName := TSDL_GetDisplayName_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayName')); - If Not assigned(SDL_GetDisplayName) Then result := false; - SDL_GetDisplayBounds := TSDL_GetDisplayBounds_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayBounds')); - If Not assigned(SDL_GetDisplayBounds) Then result := false; - SDL_GetDisplayUsableBounds := TSDL_GetDisplayUsableBounds_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayUsableBounds')); - If Not assigned(SDL_GetDisplayUsableBounds) Then result := false; - SDL_GetDisplayDPI := TSDL_GetDisplayDPI_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayDPI')); - If Not assigned(SDL_GetDisplayDPI) Then result := false; - SDL_GetDisplayOrientation := TSDL_GetDisplayOrientation_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayOrientation')); - If Not assigned(SDL_GetDisplayOrientation) Then result := false; - SDL_GetNumDisplayModes := TSDL_GetNumDisplayModes_fun(GetProcAddress(LibHandle, 'SDL_GetNumDisplayModes')); - If Not assigned(SDL_GetNumDisplayModes) Then result := false; - SDL_GetDisplayMode := TSDL_GetDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayMode')); - If Not assigned(SDL_GetDisplayMode) Then result := false; - SDL_GetDesktopDisplayMode := TSDL_GetDesktopDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_GetDesktopDisplayMode')); - If Not assigned(SDL_GetDesktopDisplayMode) Then result := false; - SDL_GetCurrentDisplayMode := TSDL_GetCurrentDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_GetCurrentDisplayMode')); - If Not assigned(SDL_GetCurrentDisplayMode) Then result := false; - SDL_GetClosestDisplayMode := TSDL_GetClosestDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_GetClosestDisplayMode')); - If Not assigned(SDL_GetClosestDisplayMode) Then result := false; - SDL_GetPointDisplayIndex := TSDL_GetPointDisplayIndex_fun(GetProcAddress(LibHandle, 'SDL_GetPointDisplayIndex')); - If Not assigned(SDL_GetPointDisplayIndex) Then result := false; - SDL_GetRectDisplayIndex := TSDL_GetRectDisplayIndex_fun(GetProcAddress(LibHandle, 'SDL_GetRectDisplayIndex')); - If Not assigned(SDL_GetRectDisplayIndex) Then result := false; - SDL_GetWindowDisplayIndex := TSDL_GetWindowDisplayIndex_fun(GetProcAddress(LibHandle, 'SDL_GetWindowDisplayIndex')); - If Not assigned(SDL_GetWindowDisplayIndex) Then result := false; - SDL_SetWindowDisplayMode := TSDL_SetWindowDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_SetWindowDisplayMode')); - If Not assigned(SDL_SetWindowDisplayMode) Then result := false; - SDL_GetWindowDisplayMode := TSDL_GetWindowDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_GetWindowDisplayMode')); - If Not assigned(SDL_GetWindowDisplayMode) Then result := false; - SDL_GetWindowICCProfile := TSDL_GetWindowICCProfile_fun(GetProcAddress(LibHandle, 'SDL_GetWindowICCProfile')); - If Not assigned(SDL_GetWindowICCProfile) Then result := false; - SDL_GetWindowPixelFormat := TSDL_GetWindowPixelFormat_fun(GetProcAddress(LibHandle, 'SDL_GetWindowPixelFormat')); - If Not assigned(SDL_GetWindowPixelFormat) Then result := false; - SDL_CreateWindow := TSDL_CreateWindow_fun(GetProcAddress(LibHandle, 'SDL_CreateWindow')); - If Not assigned(SDL_CreateWindow) Then result := false; - SDL_CreateWindowFrom := TSDL_CreateWindowFrom_fun(GetProcAddress(LibHandle, 'SDL_CreateWindowFrom')); - If Not assigned(SDL_CreateWindowFrom) Then result := false; - SDL_GetWindowID := TSDL_GetWindowID_fun(GetProcAddress(LibHandle, 'SDL_GetWindowID')); - If Not assigned(SDL_GetWindowID) Then result := false; - SDL_GetWindowFromID := TSDL_GetWindowFromID_fun(GetProcAddress(LibHandle, 'SDL_GetWindowFromID')); - If Not assigned(SDL_GetWindowFromID) Then result := false; - SDL_GetWindowFlags := TSDL_GetWindowFlags_fun(GetProcAddress(LibHandle, 'SDL_GetWindowFlags')); - If Not assigned(SDL_GetWindowFlags) Then result := false; - SDL_SetWindowTitle := TSDL_SetWindowTitle_proc(GetProcAddress(LibHandle, 'SDL_SetWindowTitle')); - If Not assigned(SDL_SetWindowTitle) Then result := false; - SDL_GetWindowTitle := TSDL_GetWindowTitle_fun(GetProcAddress(LibHandle, 'SDL_GetWindowTitle')); - If Not assigned(SDL_GetWindowTitle) Then result := false; - SDL_SetWindowIcon := TSDL_SetWindowIcon_proc(GetProcAddress(LibHandle, 'SDL_SetWindowIcon')); - If Not assigned(SDL_SetWindowIcon) Then result := false; - SDL_SetWindowData := TSDL_SetWindowData_fun(GetProcAddress(LibHandle, 'SDL_SetWindowData')); - If Not assigned(SDL_SetWindowData) Then result := false; - SDL_GetWindowData := TSDL_GetWindowData_fun(GetProcAddress(LibHandle, 'SDL_GetWindowData')); - If Not assigned(SDL_GetWindowData) Then result := false; - SDL_SetWindowPosition := TSDL_SetWindowPosition_proc(GetProcAddress(LibHandle, 'SDL_SetWindowPosition')); - If Not assigned(SDL_SetWindowPosition) Then result := false; - SDL_GetWindowPosition := TSDL_GetWindowPosition_proc(GetProcAddress(LibHandle, 'SDL_GetWindowPosition')); - If Not assigned(SDL_GetWindowPosition) Then result := false; - SDL_SetWindowSize := TSDL_SetWindowSize_proc(GetProcAddress(LibHandle, 'SDL_SetWindowSize')); - If Not assigned(SDL_SetWindowSize) Then result := false; - SDL_GetWindowSize := TSDL_GetWindowSize_proc(GetProcAddress(LibHandle, 'SDL_GetWindowSize')); - If Not assigned(SDL_GetWindowSize) Then result := false; - SDL_GetWindowBordersSize := TSDL_GetWindowBordersSize_fun(GetProcAddress(LibHandle, 'SDL_GetWindowBordersSize')); - If Not assigned(SDL_GetWindowBordersSize) Then result := false; - SDL_GetWindowSizeInPixels := TSDL_GetWindowSizeInPixels_proc(GetProcAddress(LibHandle, 'SDL_GetWindowSizeInPixels')); - If Not assigned(SDL_GetWindowSizeInPixels) Then result := false; - SDL_SetWindowMinimumSize := TSDL_SetWindowMinimumSize_proc(GetProcAddress(LibHandle, 'SDL_SetWindowMinimumSize')); - If Not assigned(SDL_SetWindowMinimumSize) Then result := false; - SDL_GetWindowMinimumSize := TSDL_GetWindowMinimumSize_proc(GetProcAddress(LibHandle, 'SDL_GetWindowMinimumSize')); - If Not assigned(SDL_GetWindowMinimumSize) Then result := false; - SDL_SetWindowMaximumSize := TSDL_SetWindowMaximumSize_proc(GetProcAddress(LibHandle, 'SDL_SetWindowMaximumSize')); - If Not assigned(SDL_SetWindowMaximumSize) Then result := false; - SDL_GetWindowMaximumSize := TSDL_GetWindowMaximumSize_proc(GetProcAddress(LibHandle, 'SDL_GetWindowMaximumSize')); - If Not assigned(SDL_GetWindowMaximumSize) Then result := false; - SDL_SetWindowBordered := TSDL_SetWindowBordered_proc(GetProcAddress(LibHandle, 'SDL_SetWindowBordered')); - If Not assigned(SDL_SetWindowBordered) Then result := false; - SDL_SetWindowResizable := TSDL_SetWindowResizable_proc(GetProcAddress(LibHandle, 'SDL_SetWindowResizable')); - If Not assigned(SDL_SetWindowResizable) Then result := false; - SDL_SetWindowAlwaysOnTop := TSDL_SetWindowAlwaysOnTop_proc(GetProcAddress(LibHandle, 'SDL_SetWindowAlwaysOnTop')); - If Not assigned(SDL_SetWindowAlwaysOnTop) Then result := false; - SDL_ShowWindow := TSDL_ShowWindow_proc(GetProcAddress(LibHandle, 'SDL_ShowWindow')); - If Not assigned(SDL_ShowWindow) Then result := false; - SDL_HideWindow := TSDL_HideWindow_proc(GetProcAddress(LibHandle, 'SDL_HideWindow')); - If Not assigned(SDL_HideWindow) Then result := false; - SDL_RaiseWindow := TSDL_RaiseWindow_proc(GetProcAddress(LibHandle, 'SDL_RaiseWindow')); - If Not assigned(SDL_RaiseWindow) Then result := false; - SDL_MaximizeWindow := TSDL_MaximizeWindow_proc(GetProcAddress(LibHandle, 'SDL_MaximizeWindow')); - If Not assigned(SDL_MaximizeWindow) Then result := false; - SDL_MinimizeWindow := TSDL_MinimizeWindow_proc(GetProcAddress(LibHandle, 'SDL_MinimizeWindow')); - If Not assigned(SDL_MinimizeWindow) Then result := false; - SDL_RestoreWindow := TSDL_RestoreWindow_proc(GetProcAddress(LibHandle, 'SDL_RestoreWindow')); - If Not assigned(SDL_RestoreWindow) Then result := false; - SDL_SetWindowFullscreen := TSDL_SetWindowFullscreen_fun(GetProcAddress(LibHandle, 'SDL_SetWindowFullscreen')); - If Not assigned(SDL_SetWindowFullscreen) Then result := false; - SDL_HasWindowSurface := TSDL_HasWindowSurface_fun(GetProcAddress(LibHandle, 'SDL_HasWindowSurface')); - If Not assigned(SDL_HasWindowSurface) Then result := false; - SDL_GetWindowSurface := TSDL_GetWindowSurface_fun(GetProcAddress(LibHandle, 'SDL_GetWindowSurface')); - If Not assigned(SDL_GetWindowSurface) Then result := false; - SDL_UpdateWindowSurface := TSDL_UpdateWindowSurface_fun(GetProcAddress(LibHandle, 'SDL_UpdateWindowSurface')); - If Not assigned(SDL_UpdateWindowSurface) Then result := false; - SDL_UpdateWindowSurfaceRects := TSDL_UpdateWindowSurfaceRects_fun(GetProcAddress(LibHandle, 'SDL_UpdateWindowSurfaceRects')); - If Not assigned(SDL_UpdateWindowSurfaceRects) Then result := false; - SDL_DestroyWindowSurface := TSDL_DestroyWindowSurface_fun(GetProcAddress(LibHandle, 'SDL_DestroyWindowSurface')); - If Not assigned(SDL_DestroyWindowSurface) Then result := false; - SDL_SetWindowGrab := TSDL_SetWindowGrab_proc(GetProcAddress(LibHandle, 'SDL_SetWindowGrab')); - If Not assigned(SDL_SetWindowGrab) Then result := false; - SDL_GetWindowGrab := TSDL_GetWindowGrab_fun(GetProcAddress(LibHandle, 'SDL_GetWindowGrab')); - If Not assigned(SDL_GetWindowGrab) Then result := false; - SDL_SetWindowKeyboardGrab := TSDL_SetWindowKeyboardGrab_proc(GetProcAddress(LibHandle, 'SDL_SetWindowKeyboardGrab')); - If Not assigned(SDL_SetWindowKeyboardGrab) Then result := false; - SDL_GetWindowKeyboardGrab := TSDL_GetWindowKeyboardGrab_fun(GetProcAddress(LibHandle, 'SDL_GetWindowKeyboardGrab')); - If Not assigned(SDL_GetWindowKeyboardGrab) Then result := false; - SDL_SetWindowMouseGrab := TSDL_SetWindowMouseGrab_proc(GetProcAddress(LibHandle, 'SDL_SetWindowMouseGrab')); - If Not assigned(SDL_SetWindowMouseGrab) Then result := false; - SDL_GetWindowMouseGrab := TSDL_GetWindowMouseGrab_fun(GetProcAddress(LibHandle, 'SDL_GetWindowMouseGrab')); - If Not assigned(SDL_GetWindowMouseGrab) Then result := false; - SDL_SetWindowMouseRect := TSDL_SetWindowMouseRect_proc(GetProcAddress(LibHandle, 'SDL_SetWindowMouseRect')); - If Not assigned(SDL_SetWindowMouseRect) Then result := false; - SDL_GetWindowMouseRect := TSDL_GetWindowMouseRect_fun(GetProcAddress(LibHandle, 'SDL_GetWindowMouseRect')); - If Not assigned(SDL_GetWindowMouseRect) Then result := false; - SDL_GetGrabbedWindow := TSDL_GetGrabbedWindow_fun(GetProcAddress(LibHandle, 'SDL_GetGrabbedWindow')); - If Not assigned(SDL_GetGrabbedWindow) Then result := false; - SDL_SetWindowBrightness := TSDL_SetWindowBrightness_fun(GetProcAddress(LibHandle, 'SDL_SetWindowBrightness')); - If Not assigned(SDL_SetWindowBrightness) Then result := false; - SDL_GetWindowBrightness := TSDL_GetWindowBrightness_fun(GetProcAddress(LibHandle, 'SDL_GetWindowBrightness')); - If Not assigned(SDL_GetWindowBrightness) Then result := false; - SDL_SetWindowOpacity := TSDL_SetWindowOpacity_fun(GetProcAddress(LibHandle, 'SDL_SetWindowOpacity')); - If Not assigned(SDL_SetWindowOpacity) Then result := false; - SDL_GetWindowOpacity := TSDL_GetWindowOpacity_fun(GetProcAddress(LibHandle, 'SDL_GetWindowOpacity')); - If Not assigned(SDL_GetWindowOpacity) Then result := false; - SDL_SetWindowModalFor := TSDL_SetWindowModalFor_fun(GetProcAddress(LibHandle, 'SDL_SetWindowModalFor')); - If Not assigned(SDL_SetWindowModalFor) Then result := false; - SDL_SetWindowInputFocus := TSDL_SetWindowInputFocus_fun(GetProcAddress(LibHandle, 'SDL_SetWindowInputFocus')); - If Not assigned(SDL_SetWindowInputFocus) Then result := false; - SDL_SetWindowGammaRamp := TSDL_SetWindowGammaRamp_fun(GetProcAddress(LibHandle, 'SDL_SetWindowGammaRamp')); - If Not assigned(SDL_SetWindowGammaRamp) Then result := false; - SDL_GetWindowGammaRamp := TSDL_GetWindowGammaRamp_fun(GetProcAddress(LibHandle, 'SDL_GetWindowGammaRamp')); - If Not assigned(SDL_GetWindowGammaRamp) Then result := false; - SDL_SetWindowHitTest := TSDL_SetWindowHitTest_fun(GetProcAddress(LibHandle, 'SDL_SetWindowHitTest')); - If Not assigned(SDL_SetWindowHitTest) Then result := false; - SDL_FlashWindow := TSDL_FlashWindow_fun(GetProcAddress(LibHandle, 'SDL_FlashWindow')); - If Not assigned(SDL_FlashWindow) Then result := false; - SDL_DestroyWindow := TSDL_DestroyWindow_proc(GetProcAddress(LibHandle, 'SDL_DestroyWindow')); - If Not assigned(SDL_DestroyWindow) Then result := false; - SDL_GL_LoadLibrary := TSDL_GL_LoadLibrary_fun(GetProcAddress(LibHandle, 'SDL_GL_LoadLibrary')); - If Not assigned(SDL_GL_LoadLibrary) Then result := false; - SDL_GL_GetProcAddress := TSDL_GL_GetProcAddress_fun(GetProcAddress(LibHandle, 'SDL_GL_GetProcAddress')); - If Not assigned(SDL_GL_GetProcAddress) Then result := false; - SDL_GL_ExtensionSupported := TSDL_GL_ExtensionSupported_fun(GetProcAddress(LibHandle, 'SDL_GL_ExtensionSupported')); - If Not assigned(SDL_GL_ExtensionSupported) Then result := false; - SDL_GL_ResetAttributes := TSDL_GL_ResetAttributes_proc(GetProcAddress(LibHandle, 'SDL_GL_ResetAttributes')); - If Not assigned(SDL_GL_ResetAttributes) Then result := false; - SDL_GL_SetAttribute := TSDL_GL_SetAttribute_fun(GetProcAddress(LibHandle, 'SDL_GL_SetAttribute')); - If Not assigned(SDL_GL_SetAttribute) Then result := false; - SDL_GL_GetAttribute := TSDL_GL_GetAttribute_fun(GetProcAddress(LibHandle, 'SDL_GL_GetAttribute')); - If Not assigned(SDL_GL_GetAttribute) Then result := false; - SDL_GL_CreateContext := TSDL_GL_CreateContext_fun(GetProcAddress(LibHandle, 'SDL_GL_CreateContext')); - If Not assigned(SDL_GL_CreateContext) Then result := false; - SDL_GL_MakeCurrent := TSDL_GL_MakeCurrent_fun(GetProcAddress(LibHandle, 'SDL_GL_MakeCurrent')); - If Not assigned(SDL_GL_MakeCurrent) Then result := false; - SDL_GL_GetDrawableSize := TSDL_GL_GetDrawableSize_proc(GetProcAddress(LibHandle, 'SDL_GL_GetDrawableSize')); - If Not assigned(SDL_GL_GetDrawableSize) Then result := false; - SDL_GL_SetSwapInterval := TSDL_GL_SetSwapInterval_fun(GetProcAddress(LibHandle, 'SDL_GL_SetSwapInterval')); - If Not assigned(SDL_GL_SetSwapInterval) Then result := false; - SDL_GL_SwapWindow := TSDL_GL_SwapWindow_proc(GetProcAddress(LibHandle, 'SDL_GL_SwapWindow')); - If Not assigned(SDL_GL_SwapWindow) Then result := false; - SDL_GL_DeleteContext := TSDL_GL_DeleteContext_proc(GetProcAddress(LibHandle, 'SDL_GL_DeleteContext')); - If Not assigned(SDL_GL_DeleteContext) Then result := false; - *) - End; - If Not result Then SDL_UnLoadLib(); -End; - -Procedure SDL_UnLoadLib(); -Begin - If LibHandle <> 0 Then Begin - UnloadLibrary(LibHandle); - LibHandle := 0; - End; -End; -{$ENDIF} - + +{$IFDEF SDL_DYNAMIC_LINKING} + +Var + LibHandle: TLibHandle = 0; + +Function SDL_LoadLib(LibFilename: String): Boolean; +Begin + result := false; + SDL_UnLoadLib(); + If LibFilename = '' Then + LibFilename := SDL_LibName; + LibHandle := LoadLibrary(LibFilename); + If LibHandle <> 0 Then Begin + (* + * Das hier ist nicht mal Ansatzweise fertig, aber es reicht um SDL2 zu initialisieren und einen Joystick ab zu fragen ;) + *) + result := true; + + SDL_Init := TSDL_Init_fun(GetProcAddress(LibHandle, 'SDL_Init')); + If Not assigned(SDL_Init) Then result := false; + SDL_InitSubSystem := TSDL_InitSubSystem_fun(GetProcAddress(LibHandle, 'SDL_InitSubSystem')); + If Not assigned(SDL_InitSubSystem) Then result := false; + SDL_QuitSubSystem := TSDL_QuitSubSystem_proc(GetProcAddress(LibHandle, 'SDL_QuitSubSystem')); + If Not assigned(SDL_QuitSubSystem) Then result := false; + SDL_WasInit := TSDL_WasInit_fun(GetProcAddress(LibHandle, 'SDL_WasInit')); + If Not assigned(SDL_WasInit) Then result := false; + SDL_Quit := TSDL_Quit_proc(GetProcAddress(LibHandle, 'SDL_Quit')); + If Not assigned(SDL_Quit) Then result := false; + SDL_GetAudioDriver := TSDL_GetAudioDriver_fun(GetProcAddress(LibHandle, 'SDL_GetAudioDriver')); + If Not assigned(SDL_GetAudioDriver) Then result := false; + SDL_AudioInit := TSDL_AudioInit_fun(GetProcAddress(LibHandle, 'SDL_AudioInit')); + If Not assigned(SDL_AudioInit) Then result := false; + SDL_OpenAudio := TSDL_OpenAudio_fun(GetProcAddress(LibHandle, 'SDL_OpenAudio')); + If Not assigned(SDL_OpenAudio) Then result := false; + SDL_GetNumAudioDevices := TSDL_GetNumAudioDevices_fun(GetProcAddress(LibHandle, 'SDL_GetNumAudioDevices')); + If Not assigned(SDL_GetNumAudioDevices) Then result := false; + SDL_GetAudioDeviceName := TSDL_GetAudioDeviceName_fun(GetProcAddress(LibHandle, 'SDL_GetAudioDeviceName')); + If Not assigned(SDL_GetAudioDeviceName) Then result := false; + //SDL_GetAudioDeviceSpec := TSDL_GetAudioDeviceSpec_fun(GetProcAddress(LibHandle, 'SDL_GetAudioDeviceSpec')); // TODO: Das geht nicht, warum ? + //If Not assigned(SDL_GetAudioDeviceSpec) Then result := false; + //SDL_GetDefaultAudioInfo := TSDL_GetDefaultAudioInfo_fun(GetProcAddress(LibHandle, 'SDL_GetDefaultAudioInfo')); // TODO: Das geht nicht, warum ? + //If Not assigned(SDL_GetDefaultAudioInfo) Then result := false; + SDL_OpenAudioDevice := TSDL_OpenAudioDevice_fun(GetProcAddress(LibHandle, 'SDL_OpenAudioDevice')); + If Not assigned(SDL_OpenAudioDevice) Then result := false; + SDL_GetAudioDeviceStatus := TSDL_GetAudioDeviceStatus_fun(GetProcAddress(LibHandle, 'SDL_GetAudioDeviceStatus')); + If Not assigned(SDL_GetAudioDeviceStatus) Then result := false; + SDL_PauseAudio := TSDL_PauseAudio_proc(GetProcAddress(LibHandle, 'SDL_PauseAudio')); + If Not assigned(SDL_PauseAudio) Then result := false; + SDL_PauseAudioDevice := TSDL_PauseAudioDevice_proc(GetProcAddress(LibHandle, 'SDL_PauseAudioDevice')); + If Not assigned(SDL_PauseAudioDevice) Then result := false; + SDL_LoadWAV_RW := TSDL_LoadWAV_RW_fun(GetProcAddress(LibHandle, 'SDL_LoadWAV_RW')); + If Not assigned(SDL_LoadWAV_RW) Then result := false; + SDL_FreeWAV := TSDL_FreeWAV_proc(GetProcAddress(LibHandle, 'SDL_FreeWAV')); + If Not assigned(SDL_FreeWAV) Then result := false; + SDL_BuildAudioCVT := TSDL_BuildAudioCVT_fun(GetProcAddress(LibHandle, 'SDL_BuildAudioCVT')); + If Not assigned(SDL_BuildAudioCVT) Then result := false; + SDL_ConvertAudio := TSDL_ConvertAudio_fun(GetProcAddress(LibHandle, 'SDL_ConvertAudio')); + If Not assigned(SDL_ConvertAudio) Then result := false; + SDL_NewAudioStream := TSDL_NewAudioStream_fun(GetProcAddress(LibHandle, 'SDL_NewAudioStream')); + If Not assigned(SDL_NewAudioStream) Then result := false; + SDL_AudioStreamPut := TSDL_AudioStreamPut_fun(GetProcAddress(LibHandle, 'SDL_AudioStreamPut')); + If Not assigned(SDL_AudioStreamPut) Then result := false; + SDL_AudioStreamGet := TSDL_AudioStreamGet_fun(GetProcAddress(LibHandle, 'SDL_AudioStreamGet')); + If Not assigned(SDL_AudioStreamGet) Then result := false; + SDL_AudioStreamAvailable := TSDL_AudioStreamAvailable_fun(GetProcAddress(LibHandle, 'SDL_AudioStreamAvailable')); + If Not assigned(SDL_AudioStreamAvailable) Then result := false; + SDL_AudioStreamFlush := TSDL_AudioStreamFlush_fun(GetProcAddress(LibHandle, 'SDL_AudioStreamFlush')); + If Not assigned(SDL_AudioStreamFlush) Then result := false; + SDL_AudioStreamClear := TSDL_AudioStreamClear_proc(GetProcAddress(LibHandle, 'SDL_AudioStreamClear')); + If Not assigned(SDL_AudioStreamClear) Then result := false; + SDL_FreeAudioStream := TSDL_FreeAudioStream_proc(GetProcAddress(LibHandle, 'SDL_FreeAudioStream')); + If Not assigned(SDL_FreeAudioStream) Then result := false; + SDL_MixAudio := TSDL_MixAudio_proc(GetProcAddress(LibHandle, 'SDL_MixAudio')); + If Not assigned(SDL_MixAudio) Then result := false; + SDL_MixAudioFormat := TSDL_MixAudioFormat_proc(GetProcAddress(LibHandle, 'SDL_MixAudioFormat')); + If Not assigned(SDL_MixAudioFormat) Then result := false; + SDL_QueueAudio := TSDL_QueueAudio_fun(GetProcAddress(LibHandle, 'SDL_QueueAudio')); + If Not assigned(SDL_QueueAudio) Then result := false; + SDL_DequeueAudio := TSDL_DequeueAudio_fun(GetProcAddress(LibHandle, 'SDL_DequeueAudio')); + If Not assigned(SDL_DequeueAudio) Then result := false; + SDL_GetQueuedAudioSize := TSDL_GetQueuedAudioSize_fun(GetProcAddress(LibHandle, 'SDL_GetQueuedAudioSize')); + If Not assigned(SDL_GetQueuedAudioSize) Then result := false; + SDL_ClearQueuedAudio := TSDL_ClearQueuedAudio_proc(GetProcAddress(LibHandle, 'SDL_ClearQueuedAudio')); + If Not assigned(SDL_ClearQueuedAudio) Then result := false; + SDL_LockAudioDevice := TSDL_LockAudioDevice_proc(GetProcAddress(LibHandle, 'SDL_LockAudioDevice')); + If Not assigned(SDL_LockAudioDevice) Then result := false; + SDL_UnlockAudioDevice := TSDL_UnlockAudioDevice_proc(GetProcAddress(LibHandle, 'SDL_UnlockAudioDevice')); + If Not assigned(SDL_UnlockAudioDevice) Then result := false; + SDL_CloseAudioDevice := TSDL_CloseAudioDevice_proc(GetProcAddress(LibHandle, 'SDL_CloseAudioDevice')); + If Not assigned(SDL_CloseAudioDevice) Then result := false; + SDL_ComposeCustomBlendMode := TSDL_ComposeCustomBlendMode_fun(GetProcAddress(LibHandle, 'SDL_ComposeCustomBlendMode')); + If Not assigned(SDL_ComposeCustomBlendMode) Then result := false; + SDL_SetClipboardText := TSDL_SetClipboardText_fun(GetProcAddress(LibHandle, 'SDL_SetClipboardText')); + If Not assigned(SDL_SetClipboardText) Then result := false; + SDL_GetClipboardText := TSDL_GetClipboardText_fun(GetProcAddress(LibHandle, 'SDL_GetClipboardText')); + If Not assigned(SDL_GetClipboardText) Then result := false; + SDL_HasClipboardText := TSDL_HasClipboardText_fun(GetProcAddress(LibHandle, 'SDL_HasClipboardText')); + If Not assigned(SDL_HasClipboardText) Then result := false; + //SDL_SetPrimarySelectionText := TSDL_SetPrimarySelectionText_fun(GetProcAddress(LibHandle, 'SDL_SetPrimarySelectionText')); // TODO: Das geht nicht, warum ? + //If Not assigned(SDL_SetPrimarySelectionText) Then result := false; + //SDL_GetPrimarySelectionText := TSDL_GetPrimarySelectionText_fun(GetProcAddress(LibHandle, 'SDL_GetPrimarySelectionText')); + //If Not assigned(SDL_GetPrimarySelectionText) Then result := false; + //SDL_HasPrimarySelectionText := TSDL_HasPrimarySelectionText_fun(GetProcAddress(LibHandle, 'SDL_HasPrimarySelectionText')); + //If Not assigned(SDL_HasPrimarySelectionText) Then result := false; + SDL_GetCPUCount := TSDL_GetCPUCount_fun(GetProcAddress(LibHandle, 'SDL_GetCPUCount')); + If Not assigned(SDL_GetCPUCount) Then result := false; + SDL_SetError := TSDL_SetError_fun(GetProcAddress(LibHandle, 'SDL_SetError')); + If Not assigned(SDL_SetError) Then result := false; + //SDL_GetErrorMsg := TSDL_GetErrorMsg_fun(GetProcAddress(LibHandle, 'SDL_GetErrorMsg')); + //If Not assigned(SDL_GetErrorMsg) Then result := false; + SDL_Error := TSDL_Error_fun(GetProcAddress(LibHandle, 'SDL_Error')); + If Not assigned(SDL_Error) Then result := false; + SDL_GetBasePath := TSDL_GetBasePath_fun(GetProcAddress(LibHandle, 'SDL_GetBasePath')); + If Not assigned(SDL_GetBasePath) Then result := false; + SDL_GetPrefPath := TSDL_GetPrefPath_fun(GetProcAddress(LibHandle, 'SDL_GetPrefPath')); + If Not assigned(SDL_GetPrefPath) Then result := false; + SDL_GameControllerAddMappingsFromRW := TSDL_GameControllerAddMappingsFromRW_fun(GetProcAddress(LibHandle, 'SDL_GameControllerAddMappingsFromRW')); + If Not assigned(SDL_GameControllerAddMappingsFromRW) Then result := false; + SDL_GameControllerNumMappings := TSDL_GameControllerNumMappings_fun(GetProcAddress(LibHandle, 'SDL_GameControllerNumMappings')); + If Not assigned(SDL_GameControllerNumMappings) Then result := false; + SDL_GameControllerMappingForIndex := TSDL_GameControllerMappingForIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerMappingForIndex')); + If Not assigned(SDL_GameControllerMappingForIndex) Then result := false; + //SDL_GameControllerPathForIndex := TSDL_GameControllerPathForIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerPathForIndex')); + //If Not assigned(SDL_GameControllerPathForIndex) Then result := false; + SDL_GameControllerTypeForIndex := TSDL_GameControllerTypeForIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerTypeForIndex')); + If Not assigned(SDL_GameControllerTypeForIndex) Then result := false; + SDL_GameControllerMappingForDeviceIndex := TSDL_GameControllerMappingForDeviceIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerMappingForDeviceIndex')); + If Not assigned(SDL_GameControllerMappingForDeviceIndex) Then result := false; + SDL_GameControllerFromInstanceID := TSDL_GameControllerFromInstanceID_fun(GetProcAddress(LibHandle, 'SDL_GameControllerFromInstanceID')); + If Not assigned(SDL_GameControllerFromInstanceID) Then result := false; + SDL_GameControllerFromPlayerIndex := TSDL_GameControllerFromPlayerIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerFromPlayerIndex')); + If Not assigned(SDL_GameControllerFromPlayerIndex) Then result := false; + //SDL_GameControllerPath := TSDL_GameControllerPath_fun(GetProcAddress(LibHandle, 'SDL_GameControllerPath')); + //If Not assigned(SDL_GameControllerPath) Then result := false; + SDL_GameControllerGetType := TSDL_GameControllerGetType_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetType')); + If Not assigned(SDL_GameControllerGetType) Then result := false; + SDL_GameControllerGetPlayerIndex := TSDL_GameControllerGetPlayerIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetPlayerIndex')); + If Not assigned(SDL_GameControllerGetPlayerIndex) Then result := false; + SDL_GameControllerSetPlayerIndex := TSDL_GameControllerSetPlayerIndex_proc(GetProcAddress(LibHandle, 'SDL_GameControllerSetPlayerIndex')); + If Not assigned(SDL_GameControllerSetPlayerIndex) Then result := false; + SDL_GameControllerGetVendor := TSDL_GameControllerGetVendor_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetVendor')); + If Not assigned(SDL_GameControllerGetVendor) Then result := false; + SDL_GameControllerGetProduct := TSDL_GameControllerGetProduct_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetProduct')); + If Not assigned(SDL_GameControllerGetProduct) Then result := false; + SDL_GameControllerGetProductVersion := TSDL_GameControllerGetProductVersion_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetProductVersion')); + If Not assigned(SDL_GameControllerGetProductVersion) Then result := false; + //SDL_GameControllerGetFirmwareVersion := TSDL_GameControllerGetFirmwareVersion_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetFirmwareVersion')); + //If Not assigned(SDL_GameControllerGetFirmwareVersion) Then result := false; + //SDL_GameControllerGetSerial := TSDL_GameControllerGetSerial_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetSerial')); + //If Not assigned(SDL_GameControllerGetSerial) Then result := false; + //SDL_GameControllerGetSteamHandle := TSDL_GameControllerGetSteamHandle_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetSteamHandle')); + //If Not assigned(SDL_GameControllerGetSteamHandle) Then result := false; + //SDL_GameControllerHasAxis := TSDL_GameControllerHasAxis_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasAxis')); + //If Not assigned(SDL_GameControllerHasAxis) Then result := false; + //SDL_GameControllerHasButton := TSDL_GameControllerHasButton_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasButton')); + //If Not assigned(SDL_GameControllerHasButton) Then result := false; + //SDL_GameControllerGetNumTouchpads := TSDL_GameControllerGetNumTouchpads_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetNumTouchpads')); + //If Not assigned(SDL_GameControllerGetNumTouchpads) Then result := false; + //SDL_GameControllerGetNumTouchpadFingers := TSDL_GameControllerGetNumTouchpadFingers_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetNumTouchpadFingers')); + //If Not assigned(SDL_GameControllerGetNumTouchpadFingers) Then result := false; + //SDL_GameControllerGetTouchpadFinger := TSDL_GameControllerGetTouchpadFinger_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetTouchpadFinger')); + //If Not assigned(SDL_GameControllerGetTouchpadFinger) Then result := false; + //SDL_GameControllerHasSensor := TSDL_GameControllerHasSensor_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasSensor')); + //If Not assigned(SDL_GameControllerHasSensor) Then result := false; + //SDL_GameControllerSetSensorEnabled := TSDL_GameControllerSetSensorEnabled_fun(GetProcAddress(LibHandle, 'SDL_GameControllerSetSensorEnabled')); + //If Not assigned(SDL_GameControllerSetSensorEnabled) Then result := false; + //SDL_GameControllerIsSensorEnabled := TSDL_GameControllerIsSensorEnabled_fun(GetProcAddress(LibHandle, 'SDL_GameControllerIsSensorEnabled')); + //If Not assigned(SDL_GameControllerIsSensorEnabled) Then result := false; + (*SDL_GameControllerGetSensorDataRate := TSDL_GameControllerGetSensorDataRate_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetSensorDataRate')); + If Not assigned(SDL_GameControllerGetSensorDataRate) Then result := false; + SDL_GameControllerGetSensorData := TSDL_GameControllerGetSensorData_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetSensorData')); + If Not assigned(SDL_GameControllerGetSensorData) Then result := false; + SDL_GameControllerGetSensorDataWithTimestamp := TSDL_GameControllerGetSensorDataWithTimestamp_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetSensorDataWithTimestamp')); + If Not assigned(SDL_GameControllerGetSensorDataWithTimestamp) Then result := false; + SDL_GameControllerHasRumble := TSDL_GameControllerHasRumble_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasRumble')); + If Not assigned(SDL_GameControllerHasRumble) Then result := false; + SDL_GameControllerRumble := TSDL_GameControllerRumble_fun(GetProcAddress(LibHandle, 'SDL_GameControllerRumble')); + If Not assigned(SDL_GameControllerRumble) Then result := false; + SDL_GameControllerHasRumbleTriggers := TSDL_GameControllerHasRumbleTriggers_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasRumbleTriggers')); + If Not assigned(SDL_GameControllerHasRumbleTriggers) Then result := false; + SDL_GameControllerRumbleTriggers := TSDL_GameControllerRumbleTriggers_fun(GetProcAddress(LibHandle, 'SDL_GameControllerRumbleTriggers')); + If Not assigned(SDL_GameControllerRumbleTriggers) Then result := false; + SDL_GameControllerHasLED := TSDL_GameControllerHasLED_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasLED')); + If Not assigned(SDL_GameControllerHasLED) Then result := false; + SDL_GameControllerSetLED := TSDL_GameControllerSetLED_fun(GetProcAddress(LibHandle, 'SDL_GameControllerSetLED')); + If Not assigned(SDL_GameControllerSetLED) Then result := false; + SDL_GameControllerSendEffect := TSDL_GameControllerSendEffect_fun(GetProcAddress(LibHandle, 'SDL_GameControllerSendEffect')); + If Not assigned(SDL_GameControllerSendEffect) Then result := false; + SDL_GameControllerGetAppleSFSymbolsNameForAxis := TSDL_GameControllerGetAppleSFSymbolsNameForAxis_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetAppleSFSymbolsNameForAxis')); + If Not assigned(SDL_GameControllerGetAppleSFSymbolsNameForAxis) Then result := false; + SDL_GameControllerGetAppleSFSymbolsNameForButton := TSDL_GameControllerGetAppleSFSymbolsNameForButton_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetAppleSFSymbolsNameForButton')); + If Not assigned(SDL_GameControllerGetAppleSFSymbolsNameForButton) Then result := false; + SDL_RecordGesture := TSDL_RecordGesture_fun(GetProcAddress(LibHandle, 'SDL_RecordGesture')); + If Not assigned(SDL_RecordGesture) Then result := false; + SDL_SaveAllDollarTemplates := TSDL_SaveAllDollarTemplates_fun(GetProcAddress(LibHandle, 'SDL_SaveAllDollarTemplates')); + If Not assigned(SDL_SaveAllDollarTemplates) Then result := false; + SDL_SaveDollarTemplate := TSDL_SaveDollarTemplate_fun(GetProcAddress(LibHandle, 'SDL_SaveDollarTemplate')); + If Not assigned(SDL_SaveDollarTemplate) Then result := false; + SDL_LoadDollarTemplates := TSDL_LoadDollarTemplates_fun(GetProcAddress(LibHandle, 'SDL_LoadDollarTemplates')); + If Not assigned(SDL_LoadDollarTemplates) Then result := false; + SDL_GUIDToString := TSDL_GUIDToString_proc(GetProcAddress(LibHandle, 'SDL_GUIDToString')); + If Not assigned(SDL_GUIDToString) Then result := false; + SDL_GUIDFromString := TSDL_GUIDFromString_fun(GetProcAddress(LibHandle, 'SDL_GUIDFromString')); + If Not assigned(SDL_GUIDFromString) Then result := false; + SDL_HapticName := TSDL_HapticName_fun(GetProcAddress(LibHandle, 'SDL_HapticName')); + If Not assigned(SDL_HapticName) Then result := false; + SDL_HapticOpen := TSDL_HapticOpen_fun(GetProcAddress(LibHandle, 'SDL_HapticOpen')); + If Not assigned(SDL_HapticOpen) Then result := false; + SDL_HapticOpened := TSDL_HapticOpened_fun(GetProcAddress(LibHandle, 'SDL_HapticOpened')); + If Not assigned(SDL_HapticOpened) Then result := false; + SDL_HapticIndex := TSDL_HapticIndex_fun(GetProcAddress(LibHandle, 'SDL_HapticIndex')); + If Not assigned(SDL_HapticIndex) Then result := false; + SDL_JoystickIsHaptic := TSDL_JoystickIsHaptic_fun(GetProcAddress(LibHandle, 'SDL_JoystickIsHaptic')); + If Not assigned(SDL_JoystickIsHaptic) Then result := false; + SDL_HapticOpenFromJoystick := TSDL_HapticOpenFromJoystick_fun(GetProcAddress(LibHandle, 'SDL_HapticOpenFromJoystick')); + If Not assigned(SDL_HapticOpenFromJoystick) Then result := false; + SDL_HapticClose := TSDL_HapticClose_proc(GetProcAddress(LibHandle, 'SDL_HapticClose')); + If Not assigned(SDL_HapticClose) Then result := false; + SDL_HapticNumEffects := TSDL_HapticNumEffects_fun(GetProcAddress(LibHandle, 'SDL_HapticNumEffects')); + If Not assigned(SDL_HapticNumEffects) Then result := false; + SDL_HapticNumEffectsPlaying := TSDL_HapticNumEffectsPlaying_fun(GetProcAddress(LibHandle, 'SDL_HapticNumEffectsPlaying')); + If Not assigned(SDL_HapticNumEffectsPlaying) Then result := false; + SDL_HapticQuery := TSDL_HapticQuery_fun(GetProcAddress(LibHandle, 'SDL_HapticQuery')); + If Not assigned(SDL_HapticQuery) Then result := false; + SDL_HapticNumAxes := TSDL_HapticNumAxes_fun(GetProcAddress(LibHandle, 'SDL_HapticNumAxes')); + If Not assigned(SDL_HapticNumAxes) Then result := false; + SDL_HapticEffectSupported := TSDL_HapticEffectSupported_fun(GetProcAddress(LibHandle, 'SDL_HapticEffectSupported')); + If Not assigned(SDL_HapticEffectSupported) Then result := false; + SDL_HapticNewEffect := TSDL_HapticNewEffect_fun(GetProcAddress(LibHandle, 'SDL_HapticNewEffect')); + If Not assigned(SDL_HapticNewEffect) Then result := false; + SDL_HapticUpdateEffect := TSDL_HapticUpdateEffect_fun(GetProcAddress(LibHandle, 'SDL_HapticUpdateEffect')); + If Not assigned(SDL_HapticUpdateEffect) Then result := false; + SDL_HapticRunEffect := TSDL_HapticRunEffect_fun(GetProcAddress(LibHandle, 'SDL_HapticRunEffect')); + If Not assigned(SDL_HapticRunEffect) Then result := false; + SDL_HapticStopEffect := TSDL_HapticStopEffect_fun(GetProcAddress(LibHandle, 'SDL_HapticStopEffect')); + If Not assigned(SDL_HapticStopEffect) Then result := false; + SDL_HapticDestroyEffect := TSDL_HapticDestroyEffect_proc(GetProcAddress(LibHandle, 'SDL_HapticDestroyEffect')); + If Not assigned(SDL_HapticDestroyEffect) Then result := false; + SDL_HapticGetEffectStatus := TSDL_HapticGetEffectStatus_fun(GetProcAddress(LibHandle, 'SDL_HapticGetEffectStatus')); + If Not assigned(SDL_HapticGetEffectStatus) Then result := false; + SDL_HapticSetGain := TSDL_HapticSetGain_fun(GetProcAddress(LibHandle, 'SDL_HapticSetGain')); + If Not assigned(SDL_HapticSetGain) Then result := false; + SDL_HapticSetAutocenter := TSDL_HapticSetAutocenter_fun(GetProcAddress(LibHandle, 'SDL_HapticSetAutocenter')); + If Not assigned(SDL_HapticSetAutocenter) Then result := false; + SDL_HapticPause := TSDL_HapticPause_fun(GetProcAddress(LibHandle, 'SDL_HapticPause')); + If Not assigned(SDL_HapticPause) Then result := false; + SDL_HapticUnpause := TSDL_HapticUnpause_fun(GetProcAddress(LibHandle, 'SDL_HapticUnpause')); + If Not assigned(SDL_HapticUnpause) Then result := false; + SDL_HapticStopAll := TSDL_HapticStopAll_fun(GetProcAddress(LibHandle, 'SDL_HapticStopAll')); + If Not assigned(SDL_HapticStopAll) Then result := false; + SDL_HapticRumbleSupported := TSDL_HapticRumbleSupported_fun(GetProcAddress(LibHandle, 'SDL_HapticRumbleSupported')); + If Not assigned(SDL_HapticRumbleSupported) Then result := false; + SDL_HapticRumbleInit := TSDL_HapticRumbleInit_fun(GetProcAddress(LibHandle, 'SDL_HapticRumbleInit')); + If Not assigned(SDL_HapticRumbleInit) Then result := false; + SDL_HapticRumblePlay := TSDL_HapticRumblePlay_fun(GetProcAddress(LibHandle, 'SDL_HapticRumblePlay')); + If Not assigned(SDL_HapticRumblePlay) Then result := false; + SDL_HapticRumbleStop := TSDL_HapticRumbleStop_fun(GetProcAddress(LibHandle, 'SDL_HapticRumbleStop')); + If Not assigned(SDL_HapticRumbleStop) Then result := false; + SDL_SetHintWithPriority := TSDL_SetHintWithPriority_fun(GetProcAddress(LibHandle, 'SDL_SetHintWithPriority')); + If Not assigned(SDL_SetHintWithPriority) Then result := false; + SDL_SetHint := TSDL_SetHint_fun(GetProcAddress(LibHandle, 'SDL_SetHint')); + If Not assigned(SDL_SetHint) Then result := false; + SDL_ResetHint := TSDL_ResetHint_fun(GetProcAddress(LibHandle, 'SDL_ResetHint')); + If Not assigned(SDL_ResetHint) Then result := false; + SDL_ResetHints := TSDL_ResetHints_proc(GetProcAddress(LibHandle, 'SDL_ResetHints')); + If Not assigned(SDL_ResetHints) Then result := false; + SDL_GetHint := TSDL_GetHint_fun(GetProcAddress(LibHandle, 'SDL_GetHint')); + If Not assigned(SDL_GetHint) Then result := false; + SDL_GetHintBoolean := TSDL_GetHintBoolean_fun(GetProcAddress(LibHandle, 'SDL_GetHintBoolean')); + If Not assigned(SDL_GetHintBoolean) Then result := false; + SDL_AddHintCallback := TSDL_AddHintCallback_proc(GetProcAddress(LibHandle, 'SDL_AddHintCallback')); + If Not assigned(SDL_AddHintCallback) Then result := false; + SDL_DelHintCallback := TSDL_DelHintCallback_proc(GetProcAddress(LibHandle, 'SDL_DelHintCallback')); + If Not assigned(SDL_DelHintCallback) Then result := false; + SDL_ClearHints := TSDL_ClearHints_proc(GetProcAddress(LibHandle, 'SDL_ClearHints')); + If Not assigned(SDL_ClearHints) Then result := false; + SDL_LockJoysticks := TSDL_LockJoysticks_proc(GetProcAddress(LibHandle, 'SDL_LockJoysticks')); + If Not assigned(SDL_LockJoysticks) Then result := false; + SDL_UnlockJoysticks := TSDL_UnlockJoysticks_proc(GetProcAddress(LibHandle, 'SDL_UnlockJoysticks')); + If Not assigned(SDL_UnlockJoysticks) Then result := false;//*) + SDL_NumJoysticks := TSDL_NumJoysticks_fun(GetProcAddress(LibHandle, 'SDL_NumJoysticks')); + If Not assigned(SDL_NumJoysticks) Then result := false; + SDL_JoystickNameForIndex := TSDL_JoystickNameForIndex_fun(GetProcAddress(LibHandle, 'SDL_JoystickNameForIndex')); + If Not assigned(SDL_JoystickNameForIndex) Then result := false; + (* SDL_JoystickPathForIndex := TSDL_JoystickPathForIndex_fun(GetProcAddress(LibHandle, 'SDL_JoystickPathForIndex')); + If Not assigned(SDL_JoystickPathForIndex) Then result := false; + SDL_JoystickGetDevicePlayerIndex := TSDL_JoystickGetDevicePlayerIndex_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDevicePlayerIndex')); + If Not assigned(SDL_JoystickGetDevicePlayerIndex) Then result := false; + SDL_JoystickGetDeviceGUID := TSDL_JoystickGetDeviceGUID_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceGUID')); + If Not assigned(SDL_JoystickGetDeviceGUID) Then result := false; + SDL_JoystickGetDeviceVendor := TSDL_JoystickGetDeviceVendor_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceVendor')); + If Not assigned(SDL_JoystickGetDeviceVendor) Then result := false; + SDL_JoystickGetDeviceProduct := TSDL_JoystickGetDeviceProduct_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceProduct')); + If Not assigned(SDL_JoystickGetDeviceProduct) Then result := false; + SDL_JoystickGetDeviceProductVersion := TSDL_JoystickGetDeviceProductVersion_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceProductVersion')); + If Not assigned(SDL_JoystickGetDeviceProductVersion) Then result := false; + SDL_JoystickGetDeviceType := TSDL_JoystickGetDeviceType_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceType')); + If Not assigned(SDL_JoystickGetDeviceType) Then result := false; + SDL_JoystickGetDeviceInstanceID := TSDL_JoystickGetDeviceInstanceID_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceInstanceID')); + If Not assigned(SDL_JoystickGetDeviceInstanceID) Then result := false;// *) + SDL_JoystickOpen := TSDL_JoystickOpen_fun(GetProcAddress(LibHandle, 'SDL_JoystickOpen')); + If Not assigned(SDL_JoystickOpen) Then result := false; + (* SDL_JoystickFromInstanceID := TSDL_JoystickFromInstanceID_fun(GetProcAddress(LibHandle, 'SDL_JoystickFromInstanceID')); + If Not assigned(SDL_JoystickFromInstanceID) Then result := false; + SDL_JoystickFromPlayerIndex := TSDL_JoystickFromPlayerIndex_fun(GetProcAddress(LibHandle, 'SDL_JoystickFromPlayerIndex')); + If Not assigned(SDL_JoystickFromPlayerIndex) Then result := false; + SDL_JoystickAttachVirtual := TSDL_JoystickAttachVirtual_fun(GetProcAddress(LibHandle, 'SDL_JoystickAttachVirtual')); + If Not assigned(SDL_JoystickAttachVirtual) Then result := false; + SDL_JoystickAttachVirtualEx := TSDL_JoystickAttachVirtualEx_fun(GetProcAddress(LibHandle, 'SDL_JoystickAttachVirtualEx')); + If Not assigned(SDL_JoystickAttachVirtualEx) Then result := false; + SDL_JoystickDetachVirtual := TSDL_JoystickDetachVirtual_fun(GetProcAddress(LibHandle, 'SDL_JoystickDetachVirtual')); + If Not assigned(SDL_JoystickDetachVirtual) Then result := false; + SDL_JoystickIsVirtual := TSDL_JoystickIsVirtual_fun(GetProcAddress(LibHandle, 'SDL_JoystickIsVirtual')); + If Not assigned(SDL_JoystickIsVirtual) Then result := false; + SDL_JoystickSetVirtualAxis := TSDL_JoystickSetVirtualAxis_fun(GetProcAddress(LibHandle, 'SDL_JoystickSetVirtualAxis')); + If Not assigned(SDL_JoystickSetVirtualAxis) Then result := false; + SDL_JoystickSetVirtualButton := TSDL_JoystickSetVirtualButton_fun(GetProcAddress(LibHandle, 'SDL_JoystickSetVirtualButton')); + If Not assigned(SDL_JoystickSetVirtualButton) Then result := false; + SDL_JoystickSetVirtualHat := TSDL_JoystickSetVirtualHat_fun(GetProcAddress(LibHandle, 'SDL_JoystickSetVirtualHat')); + If Not assigned(SDL_JoystickSetVirtualHat) Then result := false; + SDL_JoystickName := TSDL_JoystickName_fun(GetProcAddress(LibHandle, 'SDL_JoystickName')); + If Not assigned(SDL_JoystickName) Then result := false; + SDL_JoystickPath := TSDL_JoystickPath_fun(GetProcAddress(LibHandle, 'SDL_JoystickPath')); + If Not assigned(SDL_JoystickPath) Then result := false; + SDL_JoystickGetPlayerIndex := TSDL_JoystickGetPlayerIndex_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetPlayerIndex')); + If Not assigned(SDL_JoystickGetPlayerIndex) Then result := false; + SDL_JoystickSetPlayerIndex := TSDL_JoystickSetPlayerIndex_proc(GetProcAddress(LibHandle, 'SDL_JoystickSetPlayerIndex')); + If Not assigned(SDL_JoystickSetPlayerIndex) Then result := false; + SDL_JoystickGetGUID := TSDL_JoystickGetGUID_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetGUID')); + If Not assigned(SDL_JoystickGetGUID) Then result := false; + SDL_JoystickGetVendor := TSDL_JoystickGetVendor_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetVendor')); + If Not assigned(SDL_JoystickGetVendor) Then result := false; + SDL_JoystickGetProduct := TSDL_JoystickGetProduct_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetProduct')); + If Not assigned(SDL_JoystickGetProduct) Then result := false; + SDL_JoystickGetProductVersion := TSDL_JoystickGetProductVersion_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetProductVersion')); + If Not assigned(SDL_JoystickGetProductVersion) Then result := false; + SDL_JoystickGetFirmwareVersion := TSDL_JoystickGetFirmwareVersion_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetFirmwareVersion')); + If Not assigned(SDL_JoystickGetFirmwareVersion) Then result := false; + SDL_JoystickGetSerial := TSDL_JoystickGetSerial_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetSerial')); + If Not assigned(SDL_JoystickGetSerial) Then result := false; + SDL_JoystickGetType := TSDL_JoystickGetType_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetType')); + If Not assigned(SDL_JoystickGetType) Then result := false; + SDL_JoystickGetGUIDString := TSDL_JoystickGetGUIDString_proc(GetProcAddress(LibHandle, 'SDL_JoystickGetGUIDString')); + If Not assigned(SDL_JoystickGetGUIDString) Then result := false; + SDL_JoystickGetGUIDFromString := TSDL_JoystickGetGUIDFromString_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetGUIDFromString')); + If Not assigned(SDL_JoystickGetGUIDFromString) Then result := false; + SDL_GetJoystickGUIDInfo := TSDL_GetJoystickGUIDInfo_proc(GetProcAddress(LibHandle, 'SDL_GetJoystickGUIDInfo')); + If Not assigned(SDL_GetJoystickGUIDInfo) Then result := false; + SDL_JoystickGetAttached := TSDL_JoystickGetAttached_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetAttached')); + If Not assigned(SDL_JoystickGetAttached) Then result := false; + SDL_JoystickInstanceID := TSDL_JoystickInstanceID_fun(GetProcAddress(LibHandle, 'SDL_JoystickInstanceID')); + If Not assigned(SDL_JoystickInstanceID) Then result := false;//*) + SDL_JoystickNumAxes := TSDL_JoystickNumAxes_fun(GetProcAddress(LibHandle, 'SDL_JoystickNumAxes')); + If Not assigned(SDL_JoystickNumAxes) Then result := false; + (* SDL_JoystickNumBalls := TSDL_JoystickNumBalls_fun(GetProcAddress(LibHandle, 'SDL_JoystickNumBalls')); + If Not assigned(SDL_JoystickNumBalls) Then result := false; + SDL_JoystickNumHats := TSDL_JoystickNumHats_fun(GetProcAddress(LibHandle, 'SDL_JoystickNumHats')); + If Not assigned(SDL_JoystickNumHats) Then result := false; //*) + SDL_JoystickNumButtons := TSDL_JoystickNumButtons_fun(GetProcAddress(LibHandle, 'SDL_JoystickNumButtons')); + If Not assigned(SDL_JoystickNumButtons) Then result := false; + (* SDL_JoystickUpdate := TSDL_JoystickUpdate_proc(GetProcAddress(LibHandle, 'SDL_JoystickUpdate')); + If Not assigned(SDL_JoystickUpdate) Then result := false;// *) + SDL_JoystickEventState := TSDL_JoystickEventState_fun(GetProcAddress(LibHandle, 'SDL_JoystickEventState')); + If Not assigned(SDL_JoystickEventState) Then result := false; + SDL_JoystickGetAxis := TSDL_JoystickGetAxis_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetAxis')); + If Not assigned(SDL_JoystickGetAxis) Then result := false; + (* SDL_JoystickGetAxisInitialState := TSDL_JoystickGetAxisInitialState_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetAxisInitialState')); + If Not assigned(SDL_JoystickGetAxisInitialState) Then result := false; + SDL_JoystickGetHat := TSDL_JoystickGetHat_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetHat')); + If Not assigned(SDL_JoystickGetHat) Then result := false; + SDL_JoystickGetBall := TSDL_JoystickGetBall_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetBall')); + If Not assigned(SDL_JoystickGetBall) Then result := false;// *) + SDL_JoystickGetButton := TSDL_JoystickGetButton_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetButton')); + If Not assigned(SDL_JoystickGetButton) Then result := false; + (* SDL_JoystickRumble := TSDL_JoystickRumble_fun(GetProcAddress(LibHandle, 'SDL_JoystickRumble')); + If Not assigned(SDL_JoystickRumble) Then result := false; + SDL_JoystickRumbleTriggers := TSDL_JoystickRumbleTriggers_fun(GetProcAddress(LibHandle, 'SDL_JoystickRumbleTriggers')); + If Not assigned(SDL_JoystickRumbleTriggers) Then result := false; + SDL_JoystickHasLED := TSDL_JoystickHasLED_fun(GetProcAddress(LibHandle, 'SDL_JoystickHasLED')); + If Not assigned(SDL_JoystickHasLED) Then result := false; + SDL_JoystickHasRumble := TSDL_JoystickHasRumble_fun(GetProcAddress(LibHandle, 'SDL_JoystickHasRumble')); + If Not assigned(SDL_JoystickHasRumble) Then result := false; + SDL_JoystickHasRumbleTriggers := TSDL_JoystickHasRumbleTriggers_fun(GetProcAddress(LibHandle, 'SDL_JoystickHasRumbleTriggers')); + If Not assigned(SDL_JoystickHasRumbleTriggers) Then result := false; + SDL_JoystickSetLED := TSDL_JoystickSetLED_fun(GetProcAddress(LibHandle, 'SDL_JoystickSetLED')); + If Not assigned(SDL_JoystickSetLED) Then result := false; + SDL_JoystickSendEffect := TSDL_JoystickSendEffect_fun(GetProcAddress(LibHandle, 'SDL_JoystickSendEffect')); + If Not assigned(SDL_JoystickSendEffect) Then result := false;*) + SDL_JoystickClose := TSDL_JoystickClose_proc(GetProcAddress(LibHandle, 'SDL_JoystickClose')); + If Not assigned(SDL_JoystickClose) Then result := false; + (* SDL_JoystickCurrentPowerLevel := TSDL_JoystickCurrentPowerLevel_fun(GetProcAddress(LibHandle, 'SDL_JoystickCurrentPowerLevel')); + If Not assigned(SDL_JoystickCurrentPowerLevel) Then result := false; + SDL_GetKeyboardState := TSDL_GetKeyboardState_fun(GetProcAddress(LibHandle, 'SDL_GetKeyboardState')); + If Not assigned(SDL_GetKeyboardState) Then result := false; + SDL_SetModState := TSDL_SetModState_proc(GetProcAddress(LibHandle, 'SDL_SetModState')); + If Not assigned(SDL_SetModState) Then result := false; + SDL_GetKeyFromScancode := TSDL_GetKeyFromScancode_fun(GetProcAddress(LibHandle, 'SDL_GetKeyFromScancode')); + If Not assigned(SDL_GetKeyFromScancode) Then result := false; + SDL_GetScancodeFromKey := TSDL_GetScancodeFromKey_fun(GetProcAddress(LibHandle, 'SDL_GetScancodeFromKey')); + If Not assigned(SDL_GetScancodeFromKey) Then result := false; + SDL_GetScancodeName := TSDL_GetScancodeName_fun(GetProcAddress(LibHandle, 'SDL_GetScancodeName')); + If Not assigned(SDL_GetScancodeName) Then result := false; + SDL_GetScancodeFromName := TSDL_GetScancodeFromName_fun(GetProcAddress(LibHandle, 'SDL_GetScancodeFromName')); + If Not assigned(SDL_GetScancodeFromName) Then result := false; + SDL_GetKeyName := TSDL_GetKeyName_fun(GetProcAddress(LibHandle, 'SDL_GetKeyName')); + If Not assigned(SDL_GetKeyName) Then result := false; + SDL_GetKeyFromName := TSDL_GetKeyFromName_fun(GetProcAddress(LibHandle, 'SDL_GetKeyFromName')); + If Not assigned(SDL_GetKeyFromName) Then result := false; + SDL_SetTextInputRect := TSDL_SetTextInputRect_proc(GetProcAddress(LibHandle, 'SDL_SetTextInputRect')); + If Not assigned(SDL_SetTextInputRect) Then result := false; + SDL_IsScreenKeyboardShown := TSDL_IsScreenKeyboardShown_fun(GetProcAddress(LibHandle, 'SDL_IsScreenKeyboardShown')); + If Not assigned(SDL_IsScreenKeyboardShown) Then result := false; + SDL_LoadObject := TSDL_LoadObject_fun(GetProcAddress(LibHandle, 'SDL_LoadObject')); + If Not assigned(SDL_LoadObject) Then result := false; + SDL_UnloadObject := TSDL_UnloadObject_proc(GetProcAddress(LibHandle, 'SDL_UnloadObject')); + If Not assigned(SDL_UnloadObject) Then result := false; + SDL_LogSetAllPriority := TSDL_LogSetAllPriority_proc(GetProcAddress(LibHandle, 'SDL_LogSetAllPriority')); + If Not assigned(SDL_LogSetAllPriority) Then result := false; + SDL_LogSetPriority := TSDL_LogSetPriority_proc(GetProcAddress(LibHandle, 'SDL_LogSetPriority')); + If Not assigned(SDL_LogSetPriority) Then result := false; + SDL_LogGetPriority := TSDL_LogGetPriority_fun(GetProcAddress(LibHandle, 'SDL_LogGetPriority')); + If Not assigned(SDL_LogGetPriority) Then result := false; + SDL_LogResetPriorities := TSDL_LogResetPriorities_proc(GetProcAddress(LibHandle, 'SDL_LogResetPriorities')); + If Not assigned(SDL_LogResetPriorities) Then result := false; + SDL_Log := TSDL_Log_proc(GetProcAddress(LibHandle, 'SDL_Log')); + If Not assigned(SDL_Log) Then result := false; + SDL_LogVerbose := TSDL_LogVerbose_proc(GetProcAddress(LibHandle, 'SDL_LogVerbose')); + If Not assigned(SDL_LogVerbose) Then result := false; + SDL_LogDebug := TSDL_LogDebug_proc(GetProcAddress(LibHandle, 'SDL_LogDebug')); + If Not assigned(SDL_LogDebug) Then result := false; + SDL_LogInfo := TSDL_LogInfo_proc(GetProcAddress(LibHandle, 'SDL_LogInfo')); + If Not assigned(SDL_LogInfo) Then result := false; + SDL_LogWarn := TSDL_LogWarn_proc(GetProcAddress(LibHandle, 'SDL_LogWarn')); + If Not assigned(SDL_LogWarn) Then result := false; + SDL_LogError := TSDL_LogError_proc(GetProcAddress(LibHandle, 'SDL_LogError')); + If Not assigned(SDL_LogError) Then result := false; + SDL_LogCritical := TSDL_LogCritical_proc(GetProcAddress(LibHandle, 'SDL_LogCritical')); + If Not assigned(SDL_LogCritical) Then result := false; + SDL_LogMessage := TSDL_LogMessage_proc(GetProcAddress(LibHandle, 'SDL_LogMessage')); + If Not assigned(SDL_LogMessage) Then result := false; + SDL_LogMessageV := TSDL_LogMessageV_proc(GetProcAddress(LibHandle, 'SDL_LogMessageV')); + If Not assigned(SDL_LogMessageV) Then result := false; + SDL_ShowMessageBox := TSDL_ShowMessageBox_fun(GetProcAddress(LibHandle, 'SDL_ShowMessageBox')); + If Not assigned(SDL_ShowMessageBox) Then result := false; + SDL_ShowSimpleMessageBox := TSDL_ShowSimpleMessageBox_fun(GetProcAddress(LibHandle, 'SDL_ShowSimpleMessageBox')); + If Not assigned(SDL_ShowSimpleMessageBox) Then result := false; + SDL_GetMouseState := TSDL_GetMouseState_fun(GetProcAddress(LibHandle, 'SDL_GetMouseState')); + If Not assigned(SDL_GetMouseState) Then result := false; + SDL_GetGlobalMouseState := TSDL_GetGlobalMouseState_fun(GetProcAddress(LibHandle, 'SDL_GetGlobalMouseState')); + If Not assigned(SDL_GetGlobalMouseState) Then result := false; + SDL_GetRelativeMouseState := TSDL_GetRelativeMouseState_fun(GetProcAddress(LibHandle, 'SDL_GetRelativeMouseState')); + If Not assigned(SDL_GetRelativeMouseState) Then result := false; + SDL_WarpMouseInWindow := TSDL_WarpMouseInWindow_proc(GetProcAddress(LibHandle, 'SDL_WarpMouseInWindow')); + If Not assigned(SDL_WarpMouseInWindow) Then result := false; + SDL_WarpMouseGlobal := TSDL_WarpMouseGlobal_fun(GetProcAddress(LibHandle, 'SDL_WarpMouseGlobal')); + If Not assigned(SDL_WarpMouseGlobal) Then result := false; + SDL_SetRelativeMouseMode := TSDL_SetRelativeMouseMode_fun(GetProcAddress(LibHandle, 'SDL_SetRelativeMouseMode')); + If Not assigned(SDL_SetRelativeMouseMode) Then result := false; + SDL_CaptureMouse := TSDL_CaptureMouse_fun(GetProcAddress(LibHandle, 'SDL_CaptureMouse')); + If Not assigned(SDL_CaptureMouse) Then result := false; + SDL_CreateCursor := TSDL_CreateCursor_fun(GetProcAddress(LibHandle, 'SDL_CreateCursor')); + If Not assigned(SDL_CreateCursor) Then result := false; + SDL_CreateColorCursor := TSDL_CreateColorCursor_fun(GetProcAddress(LibHandle, 'SDL_CreateColorCursor')); + If Not assigned(SDL_CreateColorCursor) Then result := false; + SDL_CreateSystemCursor := TSDL_CreateSystemCursor_fun(GetProcAddress(LibHandle, 'SDL_CreateSystemCursor')); + If Not assigned(SDL_CreateSystemCursor) Then result := false; + SDL_SetCursor := TSDL_SetCursor_proc(GetProcAddress(LibHandle, 'SDL_SetCursor')); + If Not assigned(SDL_SetCursor) Then result := false; + SDL_FreeCursor := TSDL_FreeCursor_proc(GetProcAddress(LibHandle, 'SDL_FreeCursor')); + If Not assigned(SDL_FreeCursor) Then result := false; + SDL_ShowCursor := TSDL_ShowCursor_fun(GetProcAddress(LibHandle, 'SDL_ShowCursor')); + If Not assigned(SDL_ShowCursor) Then result := false; + SDL_LockMutex := TSDL_LockMutex_fun(GetProcAddress(LibHandle, 'SDL_LockMutex')); + If Not assigned(SDL_LockMutex) Then result := false; + SDL_TryLockMutex := TSDL_TryLockMutex_fun(GetProcAddress(LibHandle, 'SDL_TryLockMutex')); + If Not assigned(SDL_TryLockMutex) Then result := false; + SDL_UnlockMutex := TSDL_UnlockMutex_fun(GetProcAddress(LibHandle, 'SDL_UnlockMutex')); + If Not assigned(SDL_UnlockMutex) Then result := false; + SDL_DestroyMutex := TSDL_DestroyMutex_proc(GetProcAddress(LibHandle, 'SDL_DestroyMutex')); + If Not assigned(SDL_DestroyMutex) Then result := false; + SDL_CreateSemaphore := TSDL_CreateSemaphore_fun(GetProcAddress(LibHandle, 'SDL_CreateSemaphore')); + If Not assigned(SDL_CreateSemaphore) Then result := false; + SDL_DestroySemaphore := TSDL_DestroySemaphore_proc(GetProcAddress(LibHandle, 'SDL_DestroySemaphore')); + If Not assigned(SDL_DestroySemaphore) Then result := false; + SDL_SemWait := TSDL_SemWait_fun(GetProcAddress(LibHandle, 'SDL_SemWait')); + If Not assigned(SDL_SemWait) Then result := false; + SDL_SemTryWait := TSDL_SemTryWait_fun(GetProcAddress(LibHandle, 'SDL_SemTryWait')); + If Not assigned(SDL_SemTryWait) Then result := false; + SDL_SemWaitTimeout := TSDL_SemWaitTimeout_fun(GetProcAddress(LibHandle, 'SDL_SemWaitTimeout')); + If Not assigned(SDL_SemWaitTimeout) Then result := false; + SDL_SemPost := TSDL_SemPost_fun(GetProcAddress(LibHandle, 'SDL_SemPost')); + If Not assigned(SDL_SemPost) Then result := false; + SDL_SemValue := TSDL_SemValue_fun(GetProcAddress(LibHandle, 'SDL_SemValue')); + If Not assigned(SDL_SemValue) Then result := false; + SDL_DestroyCond := TSDL_DestroyCond_proc(GetProcAddress(LibHandle, 'SDL_DestroyCond')); + If Not assigned(SDL_DestroyCond) Then result := false; + SDL_CondSignal := TSDL_CondSignal_fun(GetProcAddress(LibHandle, 'SDL_CondSignal')); + If Not assigned(SDL_CondSignal) Then result := false; + SDL_CondBroadcast := TSDL_CondBroadcast_fun(GetProcAddress(LibHandle, 'SDL_CondBroadcast')); + If Not assigned(SDL_CondBroadcast) Then result := false; + SDL_CondWait := TSDL_CondWait_fun(GetProcAddress(LibHandle, 'SDL_CondWait')); + If Not assigned(SDL_CondWait) Then result := false; + SDL_CondWaitTimeout := TSDL_CondWaitTimeout_fun(GetProcAddress(LibHandle, 'SDL_CondWaitTimeout')); + If Not assigned(SDL_CondWaitTimeout) Then result := false; + SDL_GetPixelFormatName := TSDL_GetPixelFormatName_fun(GetProcAddress(LibHandle, 'SDL_GetPixelFormatName')); + If Not assigned(SDL_GetPixelFormatName) Then result := false; + SDL_PixelFormatEnumToMasks := TSDL_PixelFormatEnumToMasks_fun(GetProcAddress(LibHandle, 'SDL_PixelFormatEnumToMasks')); + If Not assigned(SDL_PixelFormatEnumToMasks) Then result := false; + SDL_MasksToPixelFormatEnum := TSDL_MasksToPixelFormatEnum_fun(GetProcAddress(LibHandle, 'SDL_MasksToPixelFormatEnum')); + If Not assigned(SDL_MasksToPixelFormatEnum) Then result := false; + SDL_AllocFormat := TSDL_AllocFormat_fun(GetProcAddress(LibHandle, 'SDL_AllocFormat')); + If Not assigned(SDL_AllocFormat) Then result := false; + SDL_FreeFormat := TSDL_FreeFormat_proc(GetProcAddress(LibHandle, 'SDL_FreeFormat')); + If Not assigned(SDL_FreeFormat) Then result := false; + SDL_AllocPalette := TSDL_AllocPalette_fun(GetProcAddress(LibHandle, 'SDL_AllocPalette')); + If Not assigned(SDL_AllocPalette) Then result := false; + SDL_SetPixelFormatPalette := TSDL_SetPixelFormatPalette_fun(GetProcAddress(LibHandle, 'SDL_SetPixelFormatPalette')); + If Not assigned(SDL_SetPixelFormatPalette) Then result := false; + SDL_SetPaletteColors := TSDL_SetPaletteColors_fun(GetProcAddress(LibHandle, 'SDL_SetPaletteColors')); + If Not assigned(SDL_SetPaletteColors) Then result := false; + SDL_FreePalette := TSDL_FreePalette_proc(GetProcAddress(LibHandle, 'SDL_FreePalette')); + If Not assigned(SDL_FreePalette) Then result := false; + SDL_MapRGB := TSDL_MapRGB_fun(GetProcAddress(LibHandle, 'SDL_MapRGB')); + If Not assigned(SDL_MapRGB) Then result := false; + SDL_MapRGBA := TSDL_MapRGBA_fun(GetProcAddress(LibHandle, 'SDL_MapRGBA')); + If Not assigned(SDL_MapRGBA) Then result := false; + SDL_GetRGB := TSDL_GetRGB_proc(GetProcAddress(LibHandle, 'SDL_GetRGB')); + If Not assigned(SDL_GetRGB) Then result := false; + SDL_GetRGBA := TSDL_GetRGBA_proc(GetProcAddress(LibHandle, 'SDL_GetRGBA')); + If Not assigned(SDL_GetRGBA) Then result := false; + SDL_CalculateGammaRamp := TSDL_CalculateGammaRamp_proc(GetProcAddress(LibHandle, 'SDL_CalculateGammaRamp')); + If Not assigned(SDL_CalculateGammaRamp) Then result := false; + SDL_GetPowerInfo := TSDL_GetPowerInfo_fun(GetProcAddress(LibHandle, 'SDL_GetPowerInfo')); + If Not assigned(SDL_GetPowerInfo) Then result := false; + SDL_HasIntersection := TSDL_HasIntersection_fun(GetProcAddress(LibHandle, 'SDL_HasIntersection')); + If Not assigned(SDL_HasIntersection) Then result := false; + SDL_IntersectRect := TSDL_IntersectRect_fun(GetProcAddress(LibHandle, 'SDL_IntersectRect')); + If Not assigned(SDL_IntersectRect) Then result := false; + SDL_UnionRect := TSDL_UnionRect_proc(GetProcAddress(LibHandle, 'SDL_UnionRect')); + If Not assigned(SDL_UnionRect) Then result := false; + SDL_EnclosePoints := TSDL_EnclosePoints_fun(GetProcAddress(LibHandle, 'SDL_EnclosePoints')); + If Not assigned(SDL_EnclosePoints) Then result := false; + SDL_IntersectRectAndLine := TSDL_IntersectRectAndLine_fun(GetProcAddress(LibHandle, 'SDL_IntersectRectAndLine')); + If Not assigned(SDL_IntersectRectAndLine) Then result := false; + SDL_HasIntersectionF := TSDL_HasIntersectionF_fun(GetProcAddress(LibHandle, 'SDL_HasIntersectionF')); + If Not assigned(SDL_HasIntersectionF) Then result := false; + SDL_IntersectFRect := TSDL_IntersectFRect_fun(GetProcAddress(LibHandle, 'SDL_IntersectFRect')); + If Not assigned(SDL_IntersectFRect) Then result := false; + SDL_UnionFRect := TSDL_UnionFRect_fun(GetProcAddress(LibHandle, 'SDL_UnionFRect')); + If Not assigned(SDL_UnionFRect) Then result := false; + SDL_EncloseFPoints := TSDL_EncloseFPoints_fun(GetProcAddress(LibHandle, 'SDL_EncloseFPoints')); + If Not assigned(SDL_EncloseFPoints) Then result := false; + SDL_IntersectFRectAndLine := TSDL_IntersectFRectAndLine_fun(GetProcAddress(LibHandle, 'SDL_IntersectFRectAndLine')); + If Not assigned(SDL_IntersectFRectAndLine) Then result := false; + SDL_LockTexture := TSDL_LockTexture_fun(GetProcAddress(LibHandle, 'SDL_LockTexture')); + If Not assigned(SDL_LockTexture) Then result := false; + SDL_LockTextureToSurface := TSDL_LockTextureToSurface_fun(GetProcAddress(LibHandle, 'SDL_LockTextureToSurface')); + If Not assigned(SDL_LockTextureToSurface) Then result := false; + SDL_RenderIsClipEnabled := TSDL_RenderIsClipEnabled_fun(GetProcAddress(LibHandle, 'SDL_RenderIsClipEnabled')); + If Not assigned(SDL_RenderIsClipEnabled) Then result := false; + SDL_RenderDrawPointF := TSDL_RenderDrawPointF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawPointF')); + If Not assigned(SDL_RenderDrawPointF) Then result := false; + SDL_RenderDrawPointsF := TSDL_RenderDrawPointsF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawPointsF')); + If Not assigned(SDL_RenderDrawPointsF) Then result := false; + SDL_RenderDrawLineF := TSDL_RenderDrawLineF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawLineF')); + If Not assigned(SDL_RenderDrawLineF) Then result := false; + SDL_RenderDrawLinesF := TSDL_RenderDrawLinesF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawLinesF')); + If Not assigned(SDL_RenderDrawLinesF) Then result := false; + SDL_RenderDrawRectF := TSDL_RenderDrawRectF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawRectF')); + If Not assigned(SDL_RenderDrawRectF) Then result := false; + SDL_RenderDrawRectsF := TSDL_RenderDrawRectsF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawRectsF')); + If Not assigned(SDL_RenderDrawRectsF) Then result := false; + SDL_RenderFillRectF := TSDL_RenderFillRectF_fun(GetProcAddress(LibHandle, 'SDL_RenderFillRectF')); + If Not assigned(SDL_RenderFillRectF) Then result := false; + SDL_RenderFillRectsF := TSDL_RenderFillRectsF_fun(GetProcAddress(LibHandle, 'SDL_RenderFillRectsF')); + If Not assigned(SDL_RenderFillRectsF) Then result := false; + SDL_RenderCopyF := TSDL_RenderCopyF_fun(GetProcAddress(LibHandle, 'SDL_RenderCopyF')); + If Not assigned(SDL_RenderCopyF) Then result := false; + SDL_RenderCopyExF := TSDL_RenderCopyExF_fun(GetProcAddress(LibHandle, 'SDL_RenderCopyExF')); + If Not assigned(SDL_RenderCopyExF) Then result := false; + SDL_RenderGetMetalLayer := TSDL_RenderGetMetalLayer_fun(GetProcAddress(LibHandle, 'SDL_RenderGetMetalLayer')); + If Not assigned(SDL_RenderGetMetalLayer) Then result := false; + SDL_RenderGetMetalCommandEncoder := TSDL_RenderGetMetalCommandEncoder_fun(GetProcAddress(LibHandle, 'SDL_RenderGetMetalCommandEncoder')); + If Not assigned(SDL_RenderGetMetalCommandEncoder) Then result := false; + SDL_UpdateYUVTexture := TSDL_UpdateYUVTexture_fun(GetProcAddress(LibHandle, 'SDL_UpdateYUVTexture')); + If Not assigned(SDL_UpdateYUVTexture) Then result := false; + SDL_RWFromFile := TSDL_RWFromFile_fun(GetProcAddress(LibHandle, 'SDL_RWFromFile')); + If Not assigned(SDL_RWFromFile) Then result := false; + SDL_RWFromFP := TSDL_RWFromFP_fun(GetProcAddress(LibHandle, 'SDL_RWFromFP')); + If Not assigned(SDL_RWFromFP) Then result := false; + SDL_RWFromMem := TSDL_RWFromMem_fun(GetProcAddress(LibHandle, 'SDL_RWFromMem')); + If Not assigned(SDL_RWFromMem) Then result := false; + SDL_RWFromConstMem := TSDL_RWFromConstMem_fun(GetProcAddress(LibHandle, 'SDL_RWFromConstMem')); + If Not assigned(SDL_RWFromConstMem) Then result := false; + SDL_FreeRW := TSDL_FreeRW_proc(GetProcAddress(LibHandle, 'SDL_FreeRW')); + If Not assigned(SDL_FreeRW) Then result := false; + SDL_RWsize := TSDL_RWsize_fun(GetProcAddress(LibHandle, 'SDL_RWsize')); + If Not assigned(SDL_RWsize) Then result := false; + SDL_RWseek := TSDL_RWseek_fun(GetProcAddress(LibHandle, 'SDL_RWseek')); + If Not assigned(SDL_RWseek) Then result := false; + SDL_RWtell := TSDL_RWtell_fun(GetProcAddress(LibHandle, 'SDL_RWtell')); + If Not assigned(SDL_RWtell) Then result := false; + SDL_RWread := TSDL_RWread_fun(GetProcAddress(LibHandle, 'SDL_RWread')); + If Not assigned(SDL_RWread) Then result := false; + SDL_RWwrite := TSDL_RWwrite_fun(GetProcAddress(LibHandle, 'SDL_RWwrite')); + If Not assigned(SDL_RWwrite) Then result := false; + SDL_RWclose := TSDL_RWclose_fun(GetProcAddress(LibHandle, 'SDL_RWclose')); + If Not assigned(SDL_RWclose) Then result := false; + SDL_LoadFile_RW := TSDL_LoadFile_RW_fun(GetProcAddress(LibHandle, 'SDL_LoadFile_RW')); + If Not assigned(SDL_LoadFile_RW) Then result := false; + SDL_LoadFile := TSDL_LoadFile_fun(GetProcAddress(LibHandle, 'SDL_LoadFile')); + If Not assigned(SDL_LoadFile) Then result := false; + SDL_ReadU8 := TSDL_ReadU8_fun(GetProcAddress(LibHandle, 'SDL_ReadU8')); + If Not assigned(SDL_ReadU8) Then result := false; + SDL_ReadLE16 := TSDL_ReadLE16_fun(GetProcAddress(LibHandle, 'SDL_ReadLE16')); + If Not assigned(SDL_ReadLE16) Then result := false; + SDL_ReadBE16 := TSDL_ReadBE16_fun(GetProcAddress(LibHandle, 'SDL_ReadBE16')); + If Not assigned(SDL_ReadBE16) Then result := false; + SDL_ReadLE32 := TSDL_ReadLE32_fun(GetProcAddress(LibHandle, 'SDL_ReadLE32')); + If Not assigned(SDL_ReadLE32) Then result := false; + SDL_ReadBE32 := TSDL_ReadBE32_fun(GetProcAddress(LibHandle, 'SDL_ReadBE32')); + If Not assigned(SDL_ReadBE32) Then result := false; + SDL_ReadLE64 := TSDL_ReadLE64_fun(GetProcAddress(LibHandle, 'SDL_ReadLE64')); + If Not assigned(SDL_ReadLE64) Then result := false; + SDL_ReadBE64 := TSDL_ReadBE64_fun(GetProcAddress(LibHandle, 'SDL_ReadBE64')); + If Not assigned(SDL_ReadBE64) Then result := false; + SDL_WriteU8 := TSDL_WriteU8_fun(GetProcAddress(LibHandle, 'SDL_WriteU8')); + If Not assigned(SDL_WriteU8) Then result := false; + SDL_WriteLE16 := TSDL_WriteLE16_fun(GetProcAddress(LibHandle, 'SDL_WriteLE16')); + If Not assigned(SDL_WriteLE16) Then result := false; + SDL_WriteBE16 := TSDL_WriteBE16_fun(GetProcAddress(LibHandle, 'SDL_WriteBE16')); + If Not assigned(SDL_WriteBE16) Then result := false; + SDL_WriteLE32 := TSDL_WriteLE32_fun(GetProcAddress(LibHandle, 'SDL_WriteLE32')); + If Not assigned(SDL_WriteLE32) Then result := false; + SDL_WriteBE32 := TSDL_WriteBE32_fun(GetProcAddress(LibHandle, 'SDL_WriteBE32')); + If Not assigned(SDL_WriteBE32) Then result := false; + SDL_WriteLE64 := TSDL_WriteLE64_fun(GetProcAddress(LibHandle, 'SDL_WriteLE64')); + If Not assigned(SDL_WriteLE64) Then result := false; + SDL_WriteBE64 := TSDL_WriteBE64_fun(GetProcAddress(LibHandle, 'SDL_WriteBE64')); + If Not assigned(SDL_WriteBE64) Then result := false; + SDL_CreateShapedWindow := TSDL_CreateShapedWindow_fun(GetProcAddress(LibHandle, 'SDL_CreateShapedWindow')); + If Not assigned(SDL_CreateShapedWindow) Then result := false; + SDL_IsShapedWindow := TSDL_IsShapedWindow_fun(GetProcAddress(LibHandle, 'SDL_IsShapedWindow')); + If Not assigned(SDL_IsShapedWindow) Then result := false; + SDL_SetWindowShape := TSDL_SetWindowShape_fun(GetProcAddress(LibHandle, 'SDL_SetWindowShape')); + If Not assigned(SDL_SetWindowShape) Then result := false; + SDL_GetShapedWindowMode := TSDL_GetShapedWindowMode_fun(GetProcAddress(LibHandle, 'SDL_GetShapedWindowMode')); + If Not assigned(SDL_GetShapedWindowMode) Then result := false; + SDL_GetNumAllocations := TSDL_GetNumAllocations_fun(GetProcAddress(LibHandle, 'SDL_GetNumAllocations')); + If Not assigned(SDL_GetNumAllocations) Then result := false; + SDL_malloc := TSDL_malloc_fun(GetProcAddress(LibHandle, 'SDL_malloc')); + If Not assigned(SDL_malloc) Then result := false; + SDL_calloc := TSDL_calloc_fun(GetProcAddress(LibHandle, 'SDL_calloc')); + If Not assigned(SDL_calloc) Then result := false; + SDL_realloc := TSDL_realloc_fun(GetProcAddress(LibHandle, 'SDL_realloc')); + If Not assigned(SDL_realloc) Then result := false; + SDL_free := TSDL_free_proc(GetProcAddress(LibHandle, 'SDL_free')); + If Not assigned(SDL_free) Then result := false; + SDL_isalpha := TSDL_isalpha_fun(GetProcAddress(LibHandle, 'SDL_isalpha')); + If Not assigned(SDL_isalpha) Then result := false; + SDL_isalnum := TSDL_isalnum_fun(GetProcAddress(LibHandle, 'SDL_isalnum')); + If Not assigned(SDL_isalnum) Then result := false; + SDL_isblank := TSDL_isblank_fun(GetProcAddress(LibHandle, 'SDL_isblank')); + If Not assigned(SDL_isblank) Then result := false; + SDL_iscntrl := TSDL_iscntrl_fun(GetProcAddress(LibHandle, 'SDL_iscntrl')); + If Not assigned(SDL_iscntrl) Then result := false; + SDL_isdigit := TSDL_isdigit_fun(GetProcAddress(LibHandle, 'SDL_isdigit')); + If Not assigned(SDL_isdigit) Then result := false; + SDL_isxdigit := TSDL_isxdigit_fun(GetProcAddress(LibHandle, 'SDL_isxdigit')); + If Not assigned(SDL_isxdigit) Then result := false; + SDL_ispunct := TSDL_ispunct_fun(GetProcAddress(LibHandle, 'SDL_ispunct')); + If Not assigned(SDL_ispunct) Then result := false; + SDL_isspace := TSDL_isspace_fun(GetProcAddress(LibHandle, 'SDL_isspace')); + If Not assigned(SDL_isspace) Then result := false; + SDL_isupper := TSDL_isupper_fun(GetProcAddress(LibHandle, 'SDL_isupper')); + If Not assigned(SDL_isupper) Then result := false; + SDL_islower := TSDL_islower_fun(GetProcAddress(LibHandle, 'SDL_islower')); + If Not assigned(SDL_islower) Then result := false; + SDL_isprint := TSDL_isprint_fun(GetProcAddress(LibHandle, 'SDL_isprint')); + If Not assigned(SDL_isprint) Then result := false; + SDL_isgraph := TSDL_isgraph_fun(GetProcAddress(LibHandle, 'SDL_isgraph')); + If Not assigned(SDL_isgraph) Then result := false; + SDL_toupper := TSDL_toupper_fun(GetProcAddress(LibHandle, 'SDL_toupper')); + If Not assigned(SDL_toupper) Then result := false; + SDL_tolower := TSDL_tolower_fun(GetProcAddress(LibHandle, 'SDL_tolower')); + If Not assigned(SDL_tolower) Then result := false; + SDL_acos := TSDL_acos_fun(GetProcAddress(LibHandle, 'SDL_acos')); + If Not assigned(SDL_acos) Then result := false; + SDL_acosf := TSDL_acosf_fun(GetProcAddress(LibHandle, 'SDL_acosf')); + If Not assigned(SDL_acosf) Then result := false; + SDL_asin := TSDL_asin_fun(GetProcAddress(LibHandle, 'SDL_asin')); + If Not assigned(SDL_asin) Then result := false; + SDL_asinf := TSDL_asinf_fun(GetProcAddress(LibHandle, 'SDL_asinf')); + If Not assigned(SDL_asinf) Then result := false; + SDL_atan := TSDL_atan_fun(GetProcAddress(LibHandle, 'SDL_atan')); + If Not assigned(SDL_atan) Then result := false; + SDL_atanf := TSDL_atanf_fun(GetProcAddress(LibHandle, 'SDL_atanf')); + If Not assigned(SDL_atanf) Then result := false; + SDL_atan2 := TSDL_atan2_fun(GetProcAddress(LibHandle, 'SDL_atan2')); + If Not assigned(SDL_atan2) Then result := false; + SDL_atan2f := TSDL_atan2f_fun(GetProcAddress(LibHandle, 'SDL_atan2f')); + If Not assigned(SDL_atan2f) Then result := false; + SDL_ceil := TSDL_ceil_fun(GetProcAddress(LibHandle, 'SDL_ceil')); + If Not assigned(SDL_ceil) Then result := false; + SDL_ceilf := TSDL_ceilf_fun(GetProcAddress(LibHandle, 'SDL_ceilf')); + If Not assigned(SDL_ceilf) Then result := false; + SDL_copysign := TSDL_copysign_fun(GetProcAddress(LibHandle, 'SDL_copysign')); + If Not assigned(SDL_copysign) Then result := false; + SDL_copysignf := TSDL_copysignf_fun(GetProcAddress(LibHandle, 'SDL_copysignf')); + If Not assigned(SDL_copysignf) Then result := false; + SDL_cos := TSDL_cos_fun(GetProcAddress(LibHandle, 'SDL_cos')); + If Not assigned(SDL_cos) Then result := false; + SDL_cosf := TSDL_cosf_fun(GetProcAddress(LibHandle, 'SDL_cosf')); + If Not assigned(SDL_cosf) Then result := false; + SDL_exp := TSDL_exp_fun(GetProcAddress(LibHandle, 'SDL_exp')); + If Not assigned(SDL_exp) Then result := false; + SDL_expf := TSDL_expf_fun(GetProcAddress(LibHandle, 'SDL_expf')); + If Not assigned(SDL_expf) Then result := false; + SDL_fabs := TSDL_fabs_fun(GetProcAddress(LibHandle, 'SDL_fabs')); + If Not assigned(SDL_fabs) Then result := false; + SDL_fabsf := TSDL_fabsf_fun(GetProcAddress(LibHandle, 'SDL_fabsf')); + If Not assigned(SDL_fabsf) Then result := false; + SDL_floor := TSDL_floor_fun(GetProcAddress(LibHandle, 'SDL_floor')); + If Not assigned(SDL_floor) Then result := false; + SDL_floorf := TSDL_floorf_fun(GetProcAddress(LibHandle, 'SDL_floorf')); + If Not assigned(SDL_floorf) Then result := false; + SDL_fmod := TSDL_fmod_fun(GetProcAddress(LibHandle, 'SDL_fmod')); + If Not assigned(SDL_fmod) Then result := false; + SDL_fmodf := TSDL_fmodf_fun(GetProcAddress(LibHandle, 'SDL_fmodf')); + If Not assigned(SDL_fmodf) Then result := false; + SDL_nlog := TSDL_nlog_fun(GetProcAddress(LibHandle, 'SDL_nlog')); + If Not assigned(SDL_nlog) Then result := false; + SDL_nlogf := TSDL_nlogf_fun(GetProcAddress(LibHandle, 'SDL_nlogf')); + If Not assigned(SDL_nlogf) Then result := false; + SDL_log10 := TSDL_log10_fun(GetProcAddress(LibHandle, 'SDL_log10')); + If Not assigned(SDL_log10) Then result := false; + SDL_log10f := TSDL_log10f_fun(GetProcAddress(LibHandle, 'SDL_log10f')); + If Not assigned(SDL_log10f) Then result := false; + SDL_lround := TSDL_lround_fun(GetProcAddress(LibHandle, 'SDL_lround')); + If Not assigned(SDL_lround) Then result := false; + SDL_lroundf := TSDL_lroundf_fun(GetProcAddress(LibHandle, 'SDL_lroundf')); + If Not assigned(SDL_lroundf) Then result := false; + SDL_pow := TSDL_pow_fun(GetProcAddress(LibHandle, 'SDL_pow')); + If Not assigned(SDL_pow) Then result := false; + SDL_powf := TSDL_powf_fun(GetProcAddress(LibHandle, 'SDL_powf')); + If Not assigned(SDL_powf) Then result := false; + SDL_round := TSDL_round_fun(GetProcAddress(LibHandle, 'SDL_round')); + If Not assigned(SDL_round) Then result := false; + SDL_roundf := TSDL_roundf_fun(GetProcAddress(LibHandle, 'SDL_roundf')); + If Not assigned(SDL_roundf) Then result := false; + SDL_scalbn := TSDL_scalbn_fun(GetProcAddress(LibHandle, 'SDL_scalbn')); + If Not assigned(SDL_scalbn) Then result := false; + SDL_scalbnf := TSDL_scalbnf_fun(GetProcAddress(LibHandle, 'SDL_scalbnf')); + If Not assigned(SDL_scalbnf) Then result := false; + SDL_sin := TSDL_sin_fun(GetProcAddress(LibHandle, 'SDL_sin')); + If Not assigned(SDL_sin) Then result := false; + SDL_sinf := TSDL_sinf_fun(GetProcAddress(LibHandle, 'SDL_sinf')); + If Not assigned(SDL_sinf) Then result := false; + SDL_sqrt := TSDL_sqrt_fun(GetProcAddress(LibHandle, 'SDL_sqrt')); + If Not assigned(SDL_sqrt) Then result := false; + SDL_sqrtf := TSDL_sqrtf_fun(GetProcAddress(LibHandle, 'SDL_sqrtf')); + If Not assigned(SDL_sqrtf) Then result := false; + SDL_tan := TSDL_tan_fun(GetProcAddress(LibHandle, 'SDL_tan')); + If Not assigned(SDL_tan) Then result := false; + SDL_tanf := TSDL_tanf_fun(GetProcAddress(LibHandle, 'SDL_tanf')); + If Not assigned(SDL_tanf) Then result := false; + SDL_trunc := TSDL_trunc_fun(GetProcAddress(LibHandle, 'SDL_trunc')); + If Not assigned(SDL_trunc) Then result := false; + SDL_truncf := TSDL_truncf_fun(GetProcAddress(LibHandle, 'SDL_truncf')); + If Not assigned(SDL_truncf) Then result := false; + SDL_iconv_string := TSDL_iconv_string_fun(GetProcAddress(LibHandle, 'SDL_iconv_string')); + If Not assigned(SDL_iconv_string) Then result := false; + SDL_iconv_open := TSDL_iconv_open_fun(GetProcAddress(LibHandle, 'SDL_iconv_open')); + If Not assigned(SDL_iconv_open) Then result := false; + SDL_iconv_close := TSDL_iconv_close_fun(GetProcAddress(LibHandle, 'SDL_iconv_close')); + If Not assigned(SDL_iconv_close) Then result := false; + SDL_iconv := TSDL_iconv_fun(GetProcAddress(LibHandle, 'SDL_iconv')); + If Not assigned(SDL_iconv) Then result := false; + SDL_CreateRGBSurface := TSDL_CreateRGBSurface_fun(GetProcAddress(LibHandle, 'SDL_CreateRGBSurface')); + If Not assigned(SDL_CreateRGBSurface) Then result := false; + SDL_CreateRGBSurfaceWithFormat := TSDL_CreateRGBSurfaceWithFormat_fun(GetProcAddress(LibHandle, 'SDL_CreateRGBSurfaceWithFormat')); + If Not assigned(SDL_CreateRGBSurfaceWithFormat) Then result := false; + SDL_CreateRGBSurfaceFrom := TSDL_CreateRGBSurfaceFrom_fun(GetProcAddress(LibHandle, 'SDL_CreateRGBSurfaceFrom')); + If Not assigned(SDL_CreateRGBSurfaceFrom) Then result := false; + SDL_CreateRGBSurfaceWithFormatFrom := TSDL_CreateRGBSurfaceWithFormatFrom_fun(GetProcAddress(LibHandle, 'SDL_CreateRGBSurfaceWithFormatFrom')); + If Not assigned(SDL_CreateRGBSurfaceWithFormatFrom) Then result := false; + SDL_FreeSurface := TSDL_FreeSurface_proc(GetProcAddress(LibHandle, 'SDL_FreeSurface')); + If Not assigned(SDL_FreeSurface) Then result := false; + SDL_SetSurfacePalette := TSDL_SetSurfacePalette_fun(GetProcAddress(LibHandle, 'SDL_SetSurfacePalette')); + If Not assigned(SDL_SetSurfacePalette) Then result := false; + SDL_LockSurface := TSDL_LockSurface_fun(GetProcAddress(LibHandle, 'SDL_LockSurface')); + If Not assigned(SDL_LockSurface) Then result := false; + SDL_UnlockSurface := TSDL_UnlockSurface_proc(GetProcAddress(LibHandle, 'SDL_UnlockSurface')); + If Not assigned(SDL_UnlockSurface) Then result := false; + SDL_LoadBMP_RW := TSDL_LoadBMP_RW_fun(GetProcAddress(LibHandle, 'SDL_LoadBMP_RW')); + If Not assigned(SDL_LoadBMP_RW) Then result := false; + SDL_SaveBMP_RW := TSDL_SaveBMP_RW_fun(GetProcAddress(LibHandle, 'SDL_SaveBMP_RW')); + If Not assigned(SDL_SaveBMP_RW) Then result := false; + SDL_SetSurfaceRLE := TSDL_SetSurfaceRLE_fun(GetProcAddress(LibHandle, 'SDL_SetSurfaceRLE')); + If Not assigned(SDL_SetSurfaceRLE) Then result := false; + SDL_HasSurfaceRLE := TSDL_HasSurfaceRLE_fun(GetProcAddress(LibHandle, 'SDL_HasSurfaceRLE')); + If Not assigned(SDL_HasSurfaceRLE) Then result := false; + SDL_SetColorKey := TSDL_SetColorKey_fun(GetProcAddress(LibHandle, 'SDL_SetColorKey')); + If Not assigned(SDL_SetColorKey) Then result := false; + SDL_HasColorKey := TSDL_HasColorKey_fun(GetProcAddress(LibHandle, 'SDL_HasColorKey')); + If Not assigned(SDL_HasColorKey) Then result := false; + SDL_GetColorKey := TSDL_GetColorKey_fun(GetProcAddress(LibHandle, 'SDL_GetColorKey')); + If Not assigned(SDL_GetColorKey) Then result := false; + SDL_SetSurfaceColorMod := TSDL_SetSurfaceColorMod_fun(GetProcAddress(LibHandle, 'SDL_SetSurfaceColorMod')); + If Not assigned(SDL_SetSurfaceColorMod) Then result := false; + SDL_GetSurfaceColorMod := TSDL_GetSurfaceColorMod_fun(GetProcAddress(LibHandle, 'SDL_GetSurfaceColorMod')); + If Not assigned(SDL_GetSurfaceColorMod) Then result := false; + SDL_SetSurfaceAlphaMod := TSDL_SetSurfaceAlphaMod_fun(GetProcAddress(LibHandle, 'SDL_SetSurfaceAlphaMod')); + If Not assigned(SDL_SetSurfaceAlphaMod) Then result := false; + SDL_GetSurfaceAlphaMod := TSDL_GetSurfaceAlphaMod_fun(GetProcAddress(LibHandle, 'SDL_GetSurfaceAlphaMod')); + If Not assigned(SDL_GetSurfaceAlphaMod) Then result := false; + SDL_SetSurfaceBlendMode := TSDL_SetSurfaceBlendMode_fun(GetProcAddress(LibHandle, 'SDL_SetSurfaceBlendMode')); + If Not assigned(SDL_SetSurfaceBlendMode) Then result := false; + SDL_GetSurfaceBlendMode := TSDL_GetSurfaceBlendMode_fun(GetProcAddress(LibHandle, 'SDL_GetSurfaceBlendMode')); + If Not assigned(SDL_GetSurfaceBlendMode) Then result := false; + SDL_SetClipRect := TSDL_SetClipRect_fun(GetProcAddress(LibHandle, 'SDL_SetClipRect')); + If Not assigned(SDL_SetClipRect) Then result := false; + SDL_GetClipRect := TSDL_GetClipRect_proc(GetProcAddress(LibHandle, 'SDL_GetClipRect')); + If Not assigned(SDL_GetClipRect) Then result := false; + SDL_DuplicateSurface := TSDL_DuplicateSurface_fun(GetProcAddress(LibHandle, 'SDL_DuplicateSurface')); + If Not assigned(SDL_DuplicateSurface) Then result := false; + SDL_ConvertSurface := TSDL_ConvertSurface_fun(GetProcAddress(LibHandle, 'SDL_ConvertSurface')); + If Not assigned(SDL_ConvertSurface) Then result := false; + SDL_ConvertSurfaceFormat := TSDL_ConvertSurfaceFormat_fun(GetProcAddress(LibHandle, 'SDL_ConvertSurfaceFormat')); + If Not assigned(SDL_ConvertSurfaceFormat) Then result := false; + SDL_ConvertPixels := TSDL_ConvertPixels_fun(GetProcAddress(LibHandle, 'SDL_ConvertPixels')); + If Not assigned(SDL_ConvertPixels) Then result := false; + SDL_FillRect := TSDL_FillRect_fun(GetProcAddress(LibHandle, 'SDL_FillRect')); + If Not assigned(SDL_FillRect) Then result := false; + SDL_FillRects := TSDL_FillRects_fun(GetProcAddress(LibHandle, 'SDL_FillRects')); + If Not assigned(SDL_FillRects) Then result := false; + SDL_BlitSurface := TSDL_BlitSurface_fun(GetProcAddress(LibHandle, 'SDL_BlitSurface')); + If Not assigned(SDL_BlitSurface) Then result := false; + SDL_UpperBlit := TSDL_UpperBlit_fun(GetProcAddress(LibHandle, 'SDL_UpperBlit')); + If Not assigned(SDL_UpperBlit) Then result := false; + SDL_LowerBlit := TSDL_LowerBlit_fun(GetProcAddress(LibHandle, 'SDL_LowerBlit')); + If Not assigned(SDL_LowerBlit) Then result := false; + SDL_SoftStretch := TSDL_SoftStretch_fun(GetProcAddress(LibHandle, 'SDL_SoftStretch')); + If Not assigned(SDL_SoftStretch) Then result := false; + SDL_BlitSurfaceScaled := TSDL_BlitSurfaceScaled_fun(GetProcAddress(LibHandle, 'SDL_BlitSurfaceScaled')); + If Not assigned(SDL_BlitSurfaceScaled) Then result := false; + SDL_UpperBlitScaled := TSDL_UpperBlitScaled_fun(GetProcAddress(LibHandle, 'SDL_UpperBlitScaled')); + If Not assigned(SDL_UpperBlitScaled) Then result := false; + SDL_LowerBlitScaled := TSDL_LowerBlitScaled_fun(GetProcAddress(LibHandle, 'SDL_LowerBlitScaled')); + If Not assigned(SDL_LowerBlitScaled) Then result := false; + SDL_SetYUVConversionMode := TSDL_SetYUVConversionMode_proc(GetProcAddress(LibHandle, 'SDL_SetYUVConversionMode')); + If Not assigned(SDL_SetYUVConversionMode) Then result := false; + SDL_GetYUVConversionModeForResolution := TSDL_GetYUVConversionModeForResolution_fun(GetProcAddress(LibHandle, 'SDL_GetYUVConversionModeForResolution')); + If Not assigned(SDL_GetYUVConversionModeForResolution) Then result := false; + SDL_SetWindowsMessageHook := TSDL_SetWindowsMessageHook_proc(GetProcAddress(LibHandle, 'SDL_SetWindowsMessageHook')); + If Not assigned(SDL_SetWindowsMessageHook) Then result := false; + SDL_Direct3D9GetAdapterIndex := TSDL_Direct3D9GetAdapterIndex_fun(GetProcAddress(LibHandle, 'SDL_Direct3D9GetAdapterIndex')); + If Not assigned(SDL_Direct3D9GetAdapterIndex) Then result := false; + SDL_RenderGetD3D9Device := TSDL_RenderGetD3D9Device_fun(GetProcAddress(LibHandle, 'SDL_RenderGetD3D9Device')); + If Not assigned(SDL_RenderGetD3D9Device) Then result := false; + SDL_RenderGetD3D11Device := TSDL_RenderGetD3D11Device_fun(GetProcAddress(LibHandle, 'SDL_RenderGetD3D11Device')); + If Not assigned(SDL_RenderGetD3D11Device) Then result := false; + SDL_RenderGetD3D12Device := TSDL_RenderGetD3D12Device_fun(GetProcAddress(LibHandle, 'SDL_RenderGetD3D12Device')); + If Not assigned(SDL_RenderGetD3D12Device) Then result := false; + SDL_DXGIGetOutputInfo := TSDL_DXGIGetOutputInfo_fun(GetProcAddress(LibHandle, 'SDL_DXGIGetOutputInfo')); + If Not assigned(SDL_DXGIGetOutputInfo) Then result := false; //*) +{$IFDEF LINUX} + SDL_LinuxSetThreadPriority := TSDL_LinuxSetThreadPriority_fun(GetProcAddress(LibHandle, 'SDL_LinuxSetThreadPriority')); + If Not assigned(SDL_LinuxSetThreadPriority) Then result := false; + SDL_LinuxSetThreadPriorityAndPolicy := TSDL_LinuxSetThreadPriorityAndPolicy_fun(GetProcAddress(LibHandle, 'SDL_LinuxSetThreadPriorityAndPolicy')); + If Not assigned(SDL_LinuxSetThreadPriorityAndPolicy) Then result := false; +{$IFDEF Windows} + SDL_iPhoneSetAnimationCallback := TSDL_iPhoneSetAnimationCallback_fun(GetProcAddress(LibHandle, 'SDL_iPhoneSetAnimationCallback')); + If Not assigned(SDL_iPhoneSetAnimationCallback) Then result := false; + SDL_iPhoneSetEventPump := TSDL_iPhoneSetEventPump_proc(GetProcAddress(LibHandle, 'SDL_iPhoneSetEventPump')); + If Not assigned(SDL_iPhoneSetEventPump) Then result := false; + SDL_AndroidGetJNIEnv := TSDL_AndroidGetJNIEnv_fun(GetProcAddress(LibHandle, 'SDL_AndroidGetJNIEnv')); + If Not assigned(SDL_AndroidGetJNIEnv) Then result := false; + SDL_AndroidGetActivity := TSDL_AndroidGetActivity_fun(GetProcAddress(LibHandle, 'SDL_AndroidGetActivity')); + If Not assigned(SDL_AndroidGetActivity) Then result := false; + SDL_GetAndroidSDKVersion := TSDL_GetAndroidSDKVersion_fun(GetProcAddress(LibHandle, 'SDL_GetAndroidSDKVersion')); + If Not assigned(SDL_GetAndroidSDKVersion) Then result := false; + SDL_IsAndroidTV := TSDL_IsAndroidTV_fun(GetProcAddress(LibHandle, 'SDL_IsAndroidTV')); + If Not assigned(SDL_IsAndroidTV) Then result := false; + SDL_IsChromebook := TSDL_IsChromebook_fun(GetProcAddress(LibHandle, 'SDL_IsChromebook')); + If Not assigned(SDL_IsChromebook) Then result := false; + SDL_IsDeXMode := TSDL_IsDeXMode_fun(GetProcAddress(LibHandle, 'SDL_IsDeXMode')); + If Not assigned(SDL_IsDeXMode) Then result := false; + SDL_AndroidBackButton := TSDL_AndroidBackButton_proc(GetProcAddress(LibHandle, 'SDL_AndroidBackButton')); + If Not assigned(SDL_AndroidBackButton) Then result := false; + SDL_AndroidGetInternalStoragePath := TSDL_AndroidGetInternalStoragePath_fun(GetProcAddress(LibHandle, 'SDL_AndroidGetInternalStoragePath')); + If Not assigned(SDL_AndroidGetInternalStoragePath) Then result := false; + SDL_AndroidGetExternalStorageState := TSDL_AndroidGetExternalStorageState_fun(GetProcAddress(LibHandle, 'SDL_AndroidGetExternalStorageState')); + If Not assigned(SDL_AndroidGetExternalStorageState) Then result := false; + SDL_AndroidGetExternalStoragePath := TSDL_AndroidGetExternalStoragePath_fun(GetProcAddress(LibHandle, 'SDL_AndroidGetExternalStoragePath')); + If Not assigned(SDL_AndroidGetExternalStoragePath) Then result := false; + SDL_AndroidRequestPermission := TSDL_AndroidRequestPermission_fun(GetProcAddress(LibHandle, 'SDL_AndroidRequestPermission')); + If Not assigned(SDL_AndroidRequestPermission) Then result := false; + SDL_AndroidShowToast := TSDL_AndroidShowToast_fun(GetProcAddress(LibHandle, 'SDL_AndroidShowToast')); + If Not assigned(SDL_AndroidShowToast) Then result := false; + SDL_AndroidSendMessage := TSDL_AndroidSendMessage_fun(GetProcAddress(LibHandle, 'SDL_AndroidSendMessage')); + If Not assigned(SDL_AndroidSendMessage) Then result := false; + SDL_WinRTGetFSPathUNICODE := TSDL_WinRTGetFSPathUNICODE_fun(GetProcAddress(LibHandle, 'SDL_WinRTGetFSPathUNICODE')); + If Not assigned(SDL_WinRTGetFSPathUNICODE) Then result := false; + SDL_WinRTGetFSPathUTF8 := TSDL_WinRTGetFSPathUTF8_fun(GetProcAddress(LibHandle, 'SDL_WinRTGetFSPathUTF8')); + If Not assigned(SDL_WinRTGetFSPathUTF8) Then result := false; + SDL_WinRTGetDeviceFamily := TSDL_WinRTGetDeviceFamily_fun(GetProcAddress(LibHandle, 'SDL_WinRTGetDeviceFamily')); + If Not assigned(SDL_WinRTGetDeviceFamily) Then result := false; +{$ENDIF} +{$ENDIF} + SDL_IsTablet := TSDL_IsTablet_fun(GetProcAddress(LibHandle, 'SDL_IsTablet')); + If Not assigned(SDL_IsTablet) Then result := false; + SDL_GetWindowWMInfo := TSDL_GetWindowWMInfo_fun(GetProcAddress(LibHandle, 'SDL_GetWindowWMInfo')); + If Not assigned(SDL_GetWindowWMInfo) Then result := false; + SDL_CreateThread := TSDL_CreateThread_fun(GetProcAddress(LibHandle, 'SDL_CreateThread')); + If Not assigned(SDL_CreateThread) Then result := false; + SDL_CreateThreadWithStackSize := TSDL_CreateThreadWithStackSize_fun(GetProcAddress(LibHandle, 'SDL_CreateThreadWithStackSize')); + If Not assigned(SDL_CreateThreadWithStackSize) Then result := false; + SDL_CreateThread := TSDL_CreateThread_fun(GetProcAddress(LibHandle, 'SDL_CreateThread')); + If Not assigned(SDL_CreateThread) Then result := false; + SDL_CreateThreadWithStackSize := TSDL_CreateThreadWithStackSize_fun(GetProcAddress(LibHandle, 'SDL_CreateThreadWithStackSize')); + If Not assigned(SDL_CreateThreadWithStackSize) Then result := false; + SDL_GetThreadName := TSDL_GetThreadName_fun(GetProcAddress(LibHandle, 'SDL_GetThreadName')); + If Not assigned(SDL_GetThreadName) Then result := false; + SDL_GetThreadID := TSDL_GetThreadID_fun(GetProcAddress(LibHandle, 'SDL_GetThreadID')); + If Not assigned(SDL_GetThreadID) Then result := false; + SDL_SetThreadPriority := TSDL_SetThreadPriority_fun(GetProcAddress(LibHandle, 'SDL_SetThreadPriority')); + If Not assigned(SDL_SetThreadPriority) Then result := false; + SDL_WaitThread := TSDL_WaitThread_proc(GetProcAddress(LibHandle, 'SDL_WaitThread')); + If Not assigned(SDL_WaitThread) Then result := false; + SDL_DetachThread := TSDL_DetachThread_proc(GetProcAddress(LibHandle, 'SDL_DetachThread')); + If Not assigned(SDL_DetachThread) Then result := false; + SDL_TLSGet := TSDL_TLSGet_fun(GetProcAddress(LibHandle, 'SDL_TLSGet')); + If Not assigned(SDL_TLSGet) Then result := false; + SDL_TLSSet := TSDL_TLSSet_fun(GetProcAddress(LibHandle, 'SDL_TLSSet')); + If Not assigned(SDL_TLSSet) Then result := false; + SDL_Delay := TSDL_Delay_proc(GetProcAddress(LibHandle, 'SDL_Delay')); + If Not assigned(SDL_Delay) Then result := false; + SDL_AddTimer := TSDL_AddTimer_fun(GetProcAddress(LibHandle, 'SDL_AddTimer')); + If Not assigned(SDL_AddTimer) Then result := false; + SDL_RemoveTimer := TSDL_RemoveTimer_fun(GetProcAddress(LibHandle, 'SDL_RemoveTimer')); + If Not assigned(SDL_RemoveTimer) Then result := false; + SDL_GetNumTouchDevices := TSDL_GetNumTouchDevices_fun(GetProcAddress(LibHandle, 'SDL_GetNumTouchDevices')); + If Not assigned(SDL_GetNumTouchDevices) Then result := false; + SDL_GetTouchDevice := TSDL_GetTouchDevice_fun(GetProcAddress(LibHandle, 'SDL_GetTouchDevice')); + If Not assigned(SDL_GetTouchDevice) Then result := false; + (* SDL_GetTouchName := TSDL_GetTouchName_fun(GetProcAddress(LibHandle, 'SDL_GetTouchName')); + If Not assigned(SDL_GetTouchName) Then result := false; + SDL_GetTouchDeviceType := TSDL_GetTouchDeviceType_fun(GetProcAddress(LibHandle, 'SDL_GetTouchDeviceType')); + If Not assigned(SDL_GetTouchDeviceType) Then result := false; + SDL_GetNumTouchFingers := TSDL_GetNumTouchFingers_fun(GetProcAddress(LibHandle, 'SDL_GetNumTouchFingers')); + If Not assigned(SDL_GetNumTouchFingers) Then result := false; + SDL_GetTouchFinger := TSDL_GetTouchFinger_fun(GetProcAddress(LibHandle, 'SDL_GetTouchFinger')); + If Not assigned(SDL_GetTouchFinger) Then result := false; //*) + SDL_GetVersion := TSDL_GetVersion_proc(GetProcAddress(LibHandle, 'SDL_GetVersion')); + If Not assigned(SDL_GetVersion) Then result := false; + (* SDL_GetVideoDriver := TSDL_GetVideoDriver_fun(GetProcAddress(LibHandle, 'SDL_GetVideoDriver')); + If Not assigned(SDL_GetVideoDriver) Then result := false; + SDL_VideoInit := TSDL_VideoInit_fun(GetProcAddress(LibHandle, 'SDL_VideoInit')); + If Not assigned(SDL_VideoInit) Then result := false; + SDL_GetDisplayName := TSDL_GetDisplayName_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayName')); + If Not assigned(SDL_GetDisplayName) Then result := false; + SDL_GetDisplayBounds := TSDL_GetDisplayBounds_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayBounds')); + If Not assigned(SDL_GetDisplayBounds) Then result := false; + SDL_GetDisplayUsableBounds := TSDL_GetDisplayUsableBounds_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayUsableBounds')); + If Not assigned(SDL_GetDisplayUsableBounds) Then result := false; + SDL_GetDisplayDPI := TSDL_GetDisplayDPI_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayDPI')); + If Not assigned(SDL_GetDisplayDPI) Then result := false; + SDL_GetDisplayOrientation := TSDL_GetDisplayOrientation_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayOrientation')); + If Not assigned(SDL_GetDisplayOrientation) Then result := false; + SDL_GetNumDisplayModes := TSDL_GetNumDisplayModes_fun(GetProcAddress(LibHandle, 'SDL_GetNumDisplayModes')); + If Not assigned(SDL_GetNumDisplayModes) Then result := false; + SDL_GetDisplayMode := TSDL_GetDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayMode')); + If Not assigned(SDL_GetDisplayMode) Then result := false; + SDL_GetDesktopDisplayMode := TSDL_GetDesktopDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_GetDesktopDisplayMode')); + If Not assigned(SDL_GetDesktopDisplayMode) Then result := false; + SDL_GetCurrentDisplayMode := TSDL_GetCurrentDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_GetCurrentDisplayMode')); + If Not assigned(SDL_GetCurrentDisplayMode) Then result := false; + SDL_GetClosestDisplayMode := TSDL_GetClosestDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_GetClosestDisplayMode')); + If Not assigned(SDL_GetClosestDisplayMode) Then result := false; + SDL_GetPointDisplayIndex := TSDL_GetPointDisplayIndex_fun(GetProcAddress(LibHandle, 'SDL_GetPointDisplayIndex')); + If Not assigned(SDL_GetPointDisplayIndex) Then result := false; + SDL_GetRectDisplayIndex := TSDL_GetRectDisplayIndex_fun(GetProcAddress(LibHandle, 'SDL_GetRectDisplayIndex')); + If Not assigned(SDL_GetRectDisplayIndex) Then result := false; + SDL_GetWindowDisplayIndex := TSDL_GetWindowDisplayIndex_fun(GetProcAddress(LibHandle, 'SDL_GetWindowDisplayIndex')); + If Not assigned(SDL_GetWindowDisplayIndex) Then result := false; + SDL_SetWindowDisplayMode := TSDL_SetWindowDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_SetWindowDisplayMode')); + If Not assigned(SDL_SetWindowDisplayMode) Then result := false; + SDL_GetWindowDisplayMode := TSDL_GetWindowDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_GetWindowDisplayMode')); + If Not assigned(SDL_GetWindowDisplayMode) Then result := false; + SDL_GetWindowICCProfile := TSDL_GetWindowICCProfile_fun(GetProcAddress(LibHandle, 'SDL_GetWindowICCProfile')); + If Not assigned(SDL_GetWindowICCProfile) Then result := false; + SDL_GetWindowPixelFormat := TSDL_GetWindowPixelFormat_fun(GetProcAddress(LibHandle, 'SDL_GetWindowPixelFormat')); + If Not assigned(SDL_GetWindowPixelFormat) Then result := false; + SDL_CreateWindow := TSDL_CreateWindow_fun(GetProcAddress(LibHandle, 'SDL_CreateWindow')); + If Not assigned(SDL_CreateWindow) Then result := false; + SDL_CreateWindowFrom := TSDL_CreateWindowFrom_fun(GetProcAddress(LibHandle, 'SDL_CreateWindowFrom')); + If Not assigned(SDL_CreateWindowFrom) Then result := false; + SDL_GetWindowID := TSDL_GetWindowID_fun(GetProcAddress(LibHandle, 'SDL_GetWindowID')); + If Not assigned(SDL_GetWindowID) Then result := false; + SDL_GetWindowFromID := TSDL_GetWindowFromID_fun(GetProcAddress(LibHandle, 'SDL_GetWindowFromID')); + If Not assigned(SDL_GetWindowFromID) Then result := false; + SDL_GetWindowFlags := TSDL_GetWindowFlags_fun(GetProcAddress(LibHandle, 'SDL_GetWindowFlags')); + If Not assigned(SDL_GetWindowFlags) Then result := false; + SDL_SetWindowTitle := TSDL_SetWindowTitle_proc(GetProcAddress(LibHandle, 'SDL_SetWindowTitle')); + If Not assigned(SDL_SetWindowTitle) Then result := false; + SDL_GetWindowTitle := TSDL_GetWindowTitle_fun(GetProcAddress(LibHandle, 'SDL_GetWindowTitle')); + If Not assigned(SDL_GetWindowTitle) Then result := false; + SDL_SetWindowIcon := TSDL_SetWindowIcon_proc(GetProcAddress(LibHandle, 'SDL_SetWindowIcon')); + If Not assigned(SDL_SetWindowIcon) Then result := false; + SDL_SetWindowData := TSDL_SetWindowData_fun(GetProcAddress(LibHandle, 'SDL_SetWindowData')); + If Not assigned(SDL_SetWindowData) Then result := false; + SDL_GetWindowData := TSDL_GetWindowData_fun(GetProcAddress(LibHandle, 'SDL_GetWindowData')); + If Not assigned(SDL_GetWindowData) Then result := false; + SDL_SetWindowPosition := TSDL_SetWindowPosition_proc(GetProcAddress(LibHandle, 'SDL_SetWindowPosition')); + If Not assigned(SDL_SetWindowPosition) Then result := false; + SDL_GetWindowPosition := TSDL_GetWindowPosition_proc(GetProcAddress(LibHandle, 'SDL_GetWindowPosition')); + If Not assigned(SDL_GetWindowPosition) Then result := false; + SDL_SetWindowSize := TSDL_SetWindowSize_proc(GetProcAddress(LibHandle, 'SDL_SetWindowSize')); + If Not assigned(SDL_SetWindowSize) Then result := false; + SDL_GetWindowSize := TSDL_GetWindowSize_proc(GetProcAddress(LibHandle, 'SDL_GetWindowSize')); + If Not assigned(SDL_GetWindowSize) Then result := false; + SDL_GetWindowBordersSize := TSDL_GetWindowBordersSize_fun(GetProcAddress(LibHandle, 'SDL_GetWindowBordersSize')); + If Not assigned(SDL_GetWindowBordersSize) Then result := false; + SDL_GetWindowSizeInPixels := TSDL_GetWindowSizeInPixels_proc(GetProcAddress(LibHandle, 'SDL_GetWindowSizeInPixels')); + If Not assigned(SDL_GetWindowSizeInPixels) Then result := false; + SDL_SetWindowMinimumSize := TSDL_SetWindowMinimumSize_proc(GetProcAddress(LibHandle, 'SDL_SetWindowMinimumSize')); + If Not assigned(SDL_SetWindowMinimumSize) Then result := false; + SDL_GetWindowMinimumSize := TSDL_GetWindowMinimumSize_proc(GetProcAddress(LibHandle, 'SDL_GetWindowMinimumSize')); + If Not assigned(SDL_GetWindowMinimumSize) Then result := false; + SDL_SetWindowMaximumSize := TSDL_SetWindowMaximumSize_proc(GetProcAddress(LibHandle, 'SDL_SetWindowMaximumSize')); + If Not assigned(SDL_SetWindowMaximumSize) Then result := false; + SDL_GetWindowMaximumSize := TSDL_GetWindowMaximumSize_proc(GetProcAddress(LibHandle, 'SDL_GetWindowMaximumSize')); + If Not assigned(SDL_GetWindowMaximumSize) Then result := false; + SDL_SetWindowBordered := TSDL_SetWindowBordered_proc(GetProcAddress(LibHandle, 'SDL_SetWindowBordered')); + If Not assigned(SDL_SetWindowBordered) Then result := false; + SDL_SetWindowResizable := TSDL_SetWindowResizable_proc(GetProcAddress(LibHandle, 'SDL_SetWindowResizable')); + If Not assigned(SDL_SetWindowResizable) Then result := false; + SDL_SetWindowAlwaysOnTop := TSDL_SetWindowAlwaysOnTop_proc(GetProcAddress(LibHandle, 'SDL_SetWindowAlwaysOnTop')); + If Not assigned(SDL_SetWindowAlwaysOnTop) Then result := false; + SDL_ShowWindow := TSDL_ShowWindow_proc(GetProcAddress(LibHandle, 'SDL_ShowWindow')); + If Not assigned(SDL_ShowWindow) Then result := false; + SDL_HideWindow := TSDL_HideWindow_proc(GetProcAddress(LibHandle, 'SDL_HideWindow')); + If Not assigned(SDL_HideWindow) Then result := false; + SDL_RaiseWindow := TSDL_RaiseWindow_proc(GetProcAddress(LibHandle, 'SDL_RaiseWindow')); + If Not assigned(SDL_RaiseWindow) Then result := false; + SDL_MaximizeWindow := TSDL_MaximizeWindow_proc(GetProcAddress(LibHandle, 'SDL_MaximizeWindow')); + If Not assigned(SDL_MaximizeWindow) Then result := false; + SDL_MinimizeWindow := TSDL_MinimizeWindow_proc(GetProcAddress(LibHandle, 'SDL_MinimizeWindow')); + If Not assigned(SDL_MinimizeWindow) Then result := false; + SDL_RestoreWindow := TSDL_RestoreWindow_proc(GetProcAddress(LibHandle, 'SDL_RestoreWindow')); + If Not assigned(SDL_RestoreWindow) Then result := false; + SDL_SetWindowFullscreen := TSDL_SetWindowFullscreen_fun(GetProcAddress(LibHandle, 'SDL_SetWindowFullscreen')); + If Not assigned(SDL_SetWindowFullscreen) Then result := false; + SDL_HasWindowSurface := TSDL_HasWindowSurface_fun(GetProcAddress(LibHandle, 'SDL_HasWindowSurface')); + If Not assigned(SDL_HasWindowSurface) Then result := false; + SDL_GetWindowSurface := TSDL_GetWindowSurface_fun(GetProcAddress(LibHandle, 'SDL_GetWindowSurface')); + If Not assigned(SDL_GetWindowSurface) Then result := false; + SDL_UpdateWindowSurface := TSDL_UpdateWindowSurface_fun(GetProcAddress(LibHandle, 'SDL_UpdateWindowSurface')); + If Not assigned(SDL_UpdateWindowSurface) Then result := false; + SDL_UpdateWindowSurfaceRects := TSDL_UpdateWindowSurfaceRects_fun(GetProcAddress(LibHandle, 'SDL_UpdateWindowSurfaceRects')); + If Not assigned(SDL_UpdateWindowSurfaceRects) Then result := false; + SDL_DestroyWindowSurface := TSDL_DestroyWindowSurface_fun(GetProcAddress(LibHandle, 'SDL_DestroyWindowSurface')); + If Not assigned(SDL_DestroyWindowSurface) Then result := false; + SDL_SetWindowGrab := TSDL_SetWindowGrab_proc(GetProcAddress(LibHandle, 'SDL_SetWindowGrab')); + If Not assigned(SDL_SetWindowGrab) Then result := false; + SDL_GetWindowGrab := TSDL_GetWindowGrab_fun(GetProcAddress(LibHandle, 'SDL_GetWindowGrab')); + If Not assigned(SDL_GetWindowGrab) Then result := false; + SDL_SetWindowKeyboardGrab := TSDL_SetWindowKeyboardGrab_proc(GetProcAddress(LibHandle, 'SDL_SetWindowKeyboardGrab')); + If Not assigned(SDL_SetWindowKeyboardGrab) Then result := false; + SDL_GetWindowKeyboardGrab := TSDL_GetWindowKeyboardGrab_fun(GetProcAddress(LibHandle, 'SDL_GetWindowKeyboardGrab')); + If Not assigned(SDL_GetWindowKeyboardGrab) Then result := false; + SDL_SetWindowMouseGrab := TSDL_SetWindowMouseGrab_proc(GetProcAddress(LibHandle, 'SDL_SetWindowMouseGrab')); + If Not assigned(SDL_SetWindowMouseGrab) Then result := false; + SDL_GetWindowMouseGrab := TSDL_GetWindowMouseGrab_fun(GetProcAddress(LibHandle, 'SDL_GetWindowMouseGrab')); + If Not assigned(SDL_GetWindowMouseGrab) Then result := false; + SDL_SetWindowMouseRect := TSDL_SetWindowMouseRect_proc(GetProcAddress(LibHandle, 'SDL_SetWindowMouseRect')); + If Not assigned(SDL_SetWindowMouseRect) Then result := false; + SDL_GetWindowMouseRect := TSDL_GetWindowMouseRect_fun(GetProcAddress(LibHandle, 'SDL_GetWindowMouseRect')); + If Not assigned(SDL_GetWindowMouseRect) Then result := false; + SDL_GetGrabbedWindow := TSDL_GetGrabbedWindow_fun(GetProcAddress(LibHandle, 'SDL_GetGrabbedWindow')); + If Not assigned(SDL_GetGrabbedWindow) Then result := false; + SDL_SetWindowBrightness := TSDL_SetWindowBrightness_fun(GetProcAddress(LibHandle, 'SDL_SetWindowBrightness')); + If Not assigned(SDL_SetWindowBrightness) Then result := false; + SDL_GetWindowBrightness := TSDL_GetWindowBrightness_fun(GetProcAddress(LibHandle, 'SDL_GetWindowBrightness')); + If Not assigned(SDL_GetWindowBrightness) Then result := false; + SDL_SetWindowOpacity := TSDL_SetWindowOpacity_fun(GetProcAddress(LibHandle, 'SDL_SetWindowOpacity')); + If Not assigned(SDL_SetWindowOpacity) Then result := false; + SDL_GetWindowOpacity := TSDL_GetWindowOpacity_fun(GetProcAddress(LibHandle, 'SDL_GetWindowOpacity')); + If Not assigned(SDL_GetWindowOpacity) Then result := false; + SDL_SetWindowModalFor := TSDL_SetWindowModalFor_fun(GetProcAddress(LibHandle, 'SDL_SetWindowModalFor')); + If Not assigned(SDL_SetWindowModalFor) Then result := false; + SDL_SetWindowInputFocus := TSDL_SetWindowInputFocus_fun(GetProcAddress(LibHandle, 'SDL_SetWindowInputFocus')); + If Not assigned(SDL_SetWindowInputFocus) Then result := false; + SDL_SetWindowGammaRamp := TSDL_SetWindowGammaRamp_fun(GetProcAddress(LibHandle, 'SDL_SetWindowGammaRamp')); + If Not assigned(SDL_SetWindowGammaRamp) Then result := false; + SDL_GetWindowGammaRamp := TSDL_GetWindowGammaRamp_fun(GetProcAddress(LibHandle, 'SDL_GetWindowGammaRamp')); + If Not assigned(SDL_GetWindowGammaRamp) Then result := false; + SDL_SetWindowHitTest := TSDL_SetWindowHitTest_fun(GetProcAddress(LibHandle, 'SDL_SetWindowHitTest')); + If Not assigned(SDL_SetWindowHitTest) Then result := false; + SDL_FlashWindow := TSDL_FlashWindow_fun(GetProcAddress(LibHandle, 'SDL_FlashWindow')); + If Not assigned(SDL_FlashWindow) Then result := false; + SDL_DestroyWindow := TSDL_DestroyWindow_proc(GetProcAddress(LibHandle, 'SDL_DestroyWindow')); + If Not assigned(SDL_DestroyWindow) Then result := false; + SDL_GL_LoadLibrary := TSDL_GL_LoadLibrary_fun(GetProcAddress(LibHandle, 'SDL_GL_LoadLibrary')); + If Not assigned(SDL_GL_LoadLibrary) Then result := false; + SDL_GL_GetProcAddress := TSDL_GL_GetProcAddress_fun(GetProcAddress(LibHandle, 'SDL_GL_GetProcAddress')); + If Not assigned(SDL_GL_GetProcAddress) Then result := false; + SDL_GL_ExtensionSupported := TSDL_GL_ExtensionSupported_fun(GetProcAddress(LibHandle, 'SDL_GL_ExtensionSupported')); + If Not assigned(SDL_GL_ExtensionSupported) Then result := false; + SDL_GL_ResetAttributes := TSDL_GL_ResetAttributes_proc(GetProcAddress(LibHandle, 'SDL_GL_ResetAttributes')); + If Not assigned(SDL_GL_ResetAttributes) Then result := false; + SDL_GL_SetAttribute := TSDL_GL_SetAttribute_fun(GetProcAddress(LibHandle, 'SDL_GL_SetAttribute')); + If Not assigned(SDL_GL_SetAttribute) Then result := false; + SDL_GL_GetAttribute := TSDL_GL_GetAttribute_fun(GetProcAddress(LibHandle, 'SDL_GL_GetAttribute')); + If Not assigned(SDL_GL_GetAttribute) Then result := false; + SDL_GL_CreateContext := TSDL_GL_CreateContext_fun(GetProcAddress(LibHandle, 'SDL_GL_CreateContext')); + If Not assigned(SDL_GL_CreateContext) Then result := false; + SDL_GL_MakeCurrent := TSDL_GL_MakeCurrent_fun(GetProcAddress(LibHandle, 'SDL_GL_MakeCurrent')); + If Not assigned(SDL_GL_MakeCurrent) Then result := false; + SDL_GL_GetDrawableSize := TSDL_GL_GetDrawableSize_proc(GetProcAddress(LibHandle, 'SDL_GL_GetDrawableSize')); + If Not assigned(SDL_GL_GetDrawableSize) Then result := false; + SDL_GL_SetSwapInterval := TSDL_GL_SetSwapInterval_fun(GetProcAddress(LibHandle, 'SDL_GL_SetSwapInterval')); + If Not assigned(SDL_GL_SetSwapInterval) Then result := false; + SDL_GL_SwapWindow := TSDL_GL_SwapWindow_proc(GetProcAddress(LibHandle, 'SDL_GL_SwapWindow')); + If Not assigned(SDL_GL_SwapWindow) Then result := false; + SDL_GL_DeleteContext := TSDL_GL_DeleteContext_proc(GetProcAddress(LibHandle, 'SDL_GL_DeleteContext')); + If Not assigned(SDL_GL_DeleteContext) Then result := false; + *) + End; + If Not result Then SDL_UnLoadLib(); +End; + +Procedure SDL_UnLoadLib(); +Begin + If LibHandle <> 0 Then Begin + UnloadLibrary(LibHandle); + LibHandle := 0; + End; +End; +{$ENDIF} + diff --git a/units/sdlatomic.inc b/units/sdlatomic.inc index 725a55d0..d380ed40 100644 --- a/units/sdlatomic.inc +++ b/units/sdlatomic.inc @@ -1,109 +1,109 @@ -// from SDL_atomic.h - -{** - * Atomic locks are efficient spinlocks using CPU instructions, - * but are vulnerable to starvation and can spin forever if a thread - * holding a lock has been terminated. For this reason you should - * minimize the code executed inside an atomic lock and never do - * expensive things like API or system calls while holding them. - * - * The atomic locks are not safe to lock recursively. - *} -type - PPSDL_SpinLock = ^PSDL_SpinLock; - PSDL_SpinLock = ^TSDL_SpinLock; - TSDL_SpinLock = type cint; - -{** - * Try to lock a spin lock by setting it to a non-zero value. - *} -function SDL_AtomicTryLock(lock: PSDL_SpinLock): TSDL_bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicTryLock' {$ENDIF} {$ENDIF}; - -{** - * Lock a spin lock by setting it to a non-zero value. - *} -function SDL_AtomicLock(lock: PSDL_SpinLock): TSDL_bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicLock' {$ENDIF} {$ENDIF}; - -{** - * Unlock a spin lock by setting it to 0. - * - * Always returns immediately. - *} -procedure SDL_AtomicUnlock(lock: PSDL_SpinLock); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicUnlock' {$ENDIF} {$ENDIF}; - -{** - * The compiler barrier prevents the compiler from reordering - * reads and writes to globally visible variables across the call. - *} -procedure SDL_CompilerBarrier(); - -type - {** - * A type representing an atomic integer value. It is a record - * so people don't accidentally use numeric operations on it. - *} - PPSDL_Atomic = ^PSDL_Atomic; - PSDL_Atomic = ^TSDL_Atomic; - TSDL_Atomic = record - Value: cint - end; - -{** - * Set an atomic variable to a new value if it is currently an old value. - *} -function SDL_AtomicCAS(atomic: PSDL_Atomic; oldValue, newValue: cint): TSDL_bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicCAS' {$ENDIF} {$ENDIF}; - -{** - * Set an atomic variable to a new value and return the old one. - * - * This function also acts as a full memory barrier. - *} -function SDL_AtomicSet(atomic: PSDL_Atomic; value: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicSet' {$ENDIF} {$ENDIF}; - -{** - * Get the value of an atomic variable. - *} -function SDL_AtomicGet(atomic: PSDL_Atomic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicGet' {$ENDIF} {$ENDIF}; - -{** - * Add to an atomic variable, and return the old value. - * - * This function also acts as a full memory barrier. - *} -function SDL_AtomicAdd(atomic: PSDL_Atomic; value: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicAdd' {$ENDIF} {$ENDIF}; - -{** - * Increment an atomic variable used as a reference count. - *} -function SDL_AtomicIncRef(atomic: PSDL_Atomic): cint; -{** - * Decrement an atomic variable used as a reference count - * and check if it reached zero after decrementing. - *} -function SDL_AtomicDecRef(atomic: PSDL_Atomic): Boolean; - -{** - * Set a pointer to a new value if it is currently an old value. - *} -function SDL_AtomicCASPtr(ptr: PPointer; oldValue, newValue: Pointer): TSDL_bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicCASPtr' {$ENDIF} {$ENDIF}; - -{** - * Set a pointer to a new value atomically, and return the old value. - *} -function SDL_AtomicSetPtr(ptr: PPointer; value: Pointer): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicSetPtr' {$ENDIF} {$ENDIF}; - -{** - * Get the value of a pointer atomically. - *} -function SDL_AtomicGetPtr(ptr: PPointer): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicGetPtr' {$ENDIF} {$ENDIF}; - +// from SDL_atomic.h + +{** + * Atomic locks are efficient spinlocks using CPU instructions, + * but are vulnerable to starvation and can spin forever if a thread + * holding a lock has been terminated. For this reason you should + * minimize the code executed inside an atomic lock and never do + * expensive things like API or system calls while holding them. + * + * The atomic locks are not safe to lock recursively. + *} +type + PPSDL_SpinLock = ^PSDL_SpinLock; + PSDL_SpinLock = ^TSDL_SpinLock; + TSDL_SpinLock = type cint; + +{** + * Try to lock a spin lock by setting it to a non-zero value. + *} +function SDL_AtomicTryLock(lock: PSDL_SpinLock): TSDL_bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicTryLock' {$ENDIF} {$ENDIF}; + +{** + * Lock a spin lock by setting it to a non-zero value. + *} +function SDL_AtomicLock(lock: PSDL_SpinLock): TSDL_bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicLock' {$ENDIF} {$ENDIF}; + +{** + * Unlock a spin lock by setting it to 0. + * + * Always returns immediately. + *} +procedure SDL_AtomicUnlock(lock: PSDL_SpinLock); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicUnlock' {$ENDIF} {$ENDIF}; + +{** + * The compiler barrier prevents the compiler from reordering + * reads and writes to globally visible variables across the call. + *} +procedure SDL_CompilerBarrier(); + +type + {** + * A type representing an atomic integer value. It is a record + * so people don't accidentally use numeric operations on it. + *} + PPSDL_Atomic = ^PSDL_Atomic; + PSDL_Atomic = ^TSDL_Atomic; + TSDL_Atomic = record + Value: cint + end; + +{** + * Set an atomic variable to a new value if it is currently an old value. + *} +function SDL_AtomicCAS(atomic: PSDL_Atomic; oldValue, newValue: cint): TSDL_bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicCAS' {$ENDIF} {$ENDIF}; + +{** + * Set an atomic variable to a new value and return the old one. + * + * This function also acts as a full memory barrier. + *} +function SDL_AtomicSet(atomic: PSDL_Atomic; value: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicSet' {$ENDIF} {$ENDIF}; + +{** + * Get the value of an atomic variable. + *} +function SDL_AtomicGet(atomic: PSDL_Atomic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicGet' {$ENDIF} {$ENDIF}; + +{** + * Add to an atomic variable, and return the old value. + * + * This function also acts as a full memory barrier. + *} +function SDL_AtomicAdd(atomic: PSDL_Atomic; value: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicAdd' {$ENDIF} {$ENDIF}; + +{** + * Increment an atomic variable used as a reference count. + *} +function SDL_AtomicIncRef(atomic: PSDL_Atomic): cint; +{** + * Decrement an atomic variable used as a reference count + * and check if it reached zero after decrementing. + *} +function SDL_AtomicDecRef(atomic: PSDL_Atomic): Boolean; + +{** + * Set a pointer to a new value if it is currently an old value. + *} +function SDL_AtomicCASPtr(ptr: PPointer; oldValue, newValue: Pointer): TSDL_bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicCASPtr' {$ENDIF} {$ENDIF}; + +{** + * Set a pointer to a new value atomically, and return the old value. + *} +function SDL_AtomicSetPtr(ptr: PPointer; value: Pointer): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicSetPtr' {$ENDIF} {$ENDIF}; + +{** + * Get the value of a pointer atomically. + *} +function SDL_AtomicGetPtr(ptr: PPointer): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicGetPtr' {$ENDIF} {$ENDIF}; + diff --git a/units/sdlaudio.inc b/units/sdlaudio.inc index f7d3f491..d30626dc 100644 --- a/units/sdlaudio.inc +++ b/units/sdlaudio.inc @@ -1,1721 +1,1721 @@ -//from sdl_audio.h - {** - * Audio format flags. - * - * These are what the 16 bits in SDL_AudioFormat currently mean... - * (Unspecified bits are always zero). - * - * - ++-----------------------sample is signed if set - || - || ++-----------sample is bigendian if set - || || - || || ++---sample is float if set - || || || - || || || +---sample bit size---+ - || || || | | - 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 - * - * There are macros in SDL 2.0 and later to query these bits. - *} -type - PPSDL_AudioFormat = ^PSDL_AudioFormat; - PSDL_AudioFormat = ^TSDL_AudioFormat; - TSDL_AudioFormat = cuint16; - - {** - * Audio flags - *} -const - SDL_AUDIO_MASK_BITSIZE = ($FF); - SDL_AUDIO_MASK_DATATYPE = (1 shl 8); - SDL_AUDIO_MASK_ENDIAN = (1 shl 12); - SDL_AUDIO_MASK_SIGNED = (1 shl 15); - -function SDL_AUDIO_BITSIZE(x: Cardinal): Cardinal; -function SDL_AUDIO_ISFLOAT(x: Cardinal): Cardinal; -function SDL_AUDIO_ISBIGENDIAN(x: Cardinal): Cardinal; -function SDL_AUDIO_ISSIGNED(x: Cardinal): Cardinal; -function SDL_AUDIO_ISINT(x: Cardinal): Cardinal; -function SDL_AUDIO_ISLITTLEENDIAN(x: Cardinal): Cardinal; -function SDL_AUDIO_ISUNSIGNED(x: Cardinal): Cardinal; - - {** - * Audio format flags - * - * Defaults to LSB byte order. - *} -const - AUDIO_U8 = $0008; {**< Unsigned 8-bit samples *} - AUDIO_S8 = $8008; {**< Signed 8-bit samples *} - AUDIO_U16LSB = $0010; {**< Unsigned 16-bit samples *} - AUDIO_S16LSB = $8010; {**< Signed 16-bit samples *} - AUDIO_U16MSB = $1010; {**< As above, but big-endian byte order *} - AUDIO_S16MSB = $9010; {**< As above, but big-endian byte order *} - AUDIO_U16 = AUDIO_U16LSB; - AUDIO_S16 = AUDIO_S16LSB; - - {** - * int32 support - *} -const - AUDIO_S32LSB = $8020; {**< 32-bit integer samples *} - AUDIO_S32MSB = $9020; {**< As above, but big-endian byte order *} - AUDIO_S32 = AUDIO_S32LSB; - - {** - * float32 support - *} -const - AUDIO_F32LSB = $8120; {**< 32-bit floating point samples *} - AUDIO_F32MSB = $9120; {**< As above, but big-endian byte order *} - AUDIO_F32 = AUDIO_F32LSB; - - {** - * Native audio byte ordering - *} -{$IFDEF FPC} - {$IF DEFINED(ENDIAN_LITTLE)} - AUDIO_U16SYS = AUDIO_U16LSB; - AUDIO_S16SYS = AUDIO_S16LSB; - AUDIO_S32SYS = AUDIO_S32LSB; - AUDIO_F32SYS = AUDIO_F32LSB; - {$ELSEIF DEFINED(ENDIAN_BIG)} - AUDIO_U16SYS = AUDIO_U16MSB; - AUDIO_S16SYS = AUDIO_S16MSB; - AUDIO_S32SYS = AUDIO_S32MSB; - AUDIO_F32SYS = AUDIO_F32MSB; - {$ELSE} - {$FATAL Cannot determine endianness.} - {$IFEND} -{$ENDIF} - - {** - * Allow change flags - * - * Which audio format changes are allowed when opening a device. - *} -const - SDL_AUDIO_ALLOW_FREQUENCY_CHANGE = $00000001; - SDL_AUDIO_ALLOW_FORMAT_CHANGE = $00000002; - SDL_AUDIO_ALLOW_CHANNELS_CHANGE = $00000004; - SDL_AUDIO_ALLOW_ANY_CHANGE = (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE or - SDL_AUDIO_ALLOW_FORMAT_CHANGE or - SDL_AUDIO_ALLOW_CHANNELS_CHANGE); - - {*Audio flags*} - - {** - * This function is called when the audio device needs more data. - * - * \param userdata An application-specific parameter saved in - * the SDL_AudioSpec structure - * \param stream A pointer to the audio data buffer. - * \param len The length of that buffer in bytes. - * - * Once the callback returns, the buffer will no longer be valid. - * Stereo samples are stored in a LRLRLR ordering. - * - * You can choose to avoid callbacks and use SDL_QueueAudio() instead, if - * you like. Just open your audio device with a NULL callback. - *} -type - PPSDL_AudioCallback = ^PSDL_AudioCallback; - PSDL_AudioCallback = ^TSDL_AudioCallback; - TSDL_AudioCallback = procedure(userdata: Pointer; stream: pcuint8; len: cint); cdecl; - - {** - * The calculated values in this structure are calculated by SDL_OpenAudio(). - * - * For multi-channel audio, the default SDL channel mapping is: - * 2: FL FR (stereo) - * 3: FL FR LFE (2.1 surround) - * 4: FL FR BL BR (quad) - * 5: FL FR LFE BL BR (4.1 surround) - * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR) - * 7: FL FR FC LFE BC SL SR (6.1 surround) - * 8: FL FR FC LFE BL BR SL SR (7.1 surround) - *} -type - PPSDL_AudioSpec = ^PSDL_AudioSpec; - PSDL_AudioSpec = ^TSDL_AudioSpec; - TSDL_AudioSpec = record - freq: cint; {**< DSP frequency -- samples per second *} - format: TSDL_AudioFormat; {**< Audio data format *} - channels: cuint8; {**< Number of channels: 1 mono, 2 stereo *} - silence: cuint8; {**< Audio buffer silence value (calculated) *} - samples: cuint16; {**< Audio buffer size in sample FRAMES (total samples divided by channel count) *} - padding: cuint16; {**< Necessary for some compile environments *} - size: cuint32; {**< Audio buffer size in bytes (calculated) *} - callback: TSDL_AudioCallback; {**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). *} - userdata: Pointer; {**< Userdata passed to callback (ignored for NULL callbacks). *} - end; - - {** - * \brief Upper limit of filters in SDL_AudioCVT - * - * The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is - * currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers, - * one of which is the terminating NULL pointer. - *} -const - SDL_AUDIOCVT_MAX_FILTERS = 9; - -type - PPSDL_AudioCVT = ^PSDL_AudioCVT; - PSDL_AudioCVT = ^TSDL_AudioCVT; - TSDL_AudioFilter = procedure(cvt: PSDL_AudioCVT; format: TSDL_AudioFormat); cdecl; - - {** - * \struct SDL_AudioCVT - * \brief A structure to hold a set of audio conversion filters and buffers. - * - * Note that various parts of the conversion pipeline can take advantage - * of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require - * you to pass it aligned data, but can possibly run much faster if you - * set both its (buf) field to a pointer that is aligned to 16 bytes, and its - * (len) field to something that's a multiple of 16, if possible. - *} - TSDL_AudioCVT = record - needed: cint; {**< Set to 1 if conversion possible *} - src_format: TSDL_AudioFormat; {**< Source audio format *} - dst_format: TSDL_AudioFormat; {**< Target audio format *} - rate_incr: cdouble; {**< Rate conversion increment *} - buf: pcuint8; {**< Buffer to hold entire audio data *} - len: cint; {**< Length of original audio buffer *} - len_cvt: cint; {**< Length of converted audio buffer *} - len_mult: cint; {**< buffer must be len*len_mult big *} - len_ratio: cdouble; {**< Given len, final size is len*len_ratio *} - filters: array[0..SDL_AUDIOCVT_MAX_FILTERS] of TSDL_AudioFilter; {**< NULL-terminated list of filter functions *} - filter_index: cint; {**< Current audio conversion function *} - end; - - - {* Function prototypes *} - - {** - * Driver discovery functions - * - * These functions return the list of built in audio drivers, in the - * order that they are normally initialized by default. - *} - - {** - * Use this function to get the number of built-in audio drivers. - * - * This function returns a hardcoded number. This never returns a negative - * value; if there are no drivers compiled into this build of SDL, this - * function returns zero. The presence of a driver in this list does not mean - * it will function, it just means SDL is capable of interacting with that - * interface. For example, a build of SDL might have esound support, but if - * there's no esound server available, SDL's esound driver would fail if used. - * - * By default, SDL tries all drivers, in its preferred order, until one is - * found to be usable. - * - * \returns the number of built-in audio drivers. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetAudioDriver - *} -function SDL_GetNumAudioDrivers: cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumAudioDrivers' {$ENDIF} {$ENDIF}; - -{** - * Use this function to get the name of a built in audio driver. - * - * The list of audio drivers is given in the order that they are normally - * initialized by default; the drivers that seem more reasonable to choose - * first (as far as the SDL developers believe) are earlier in the list. - * - * The names of drivers are all simple, low-ASCII identifiers, like "alsa", - * "coreaudio" or "xaudio2". These never have Unicode characters, and are not - * meant to be proper names. - * - * \param index the index of the audio driver; the value ranges from 0 to - * SDL_GetNumAudioDrivers() - 1 - * \returns the name of the audio driver at the requested index, or NULL if an - * invalid index was specified. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetNumAudioDrivers - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetAudioDriver_fun = function(index: cint): PAnsiChar; cdecl; -Var - SDL_GetAudioDriver : TSDL_GetAudioDriver_fun = Nil; -{$else} - -function SDL_GetAudioDriver(index: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetAudioDriver' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Initialization and cleanup - * - * These functions are used internally, and should not be used unless - * you have a specific need to specify the audio driver you want to - * use. You should normally use SDL_Init() or SDL_InitSubSystem(). - *} - -{** - * Use this function to initialize a particular audio driver. - * - * This function is used internally, and should not be used unless you have a - * specific need to designate the audio driver you want to use. You should - * normally use SDL_Init() or SDL_InitSubSystem(). - * - * \param driver_name the name of the desired audio driver - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AudioQuit - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_AudioInit_fun = function(driver_name: PAnsiChar): cint; cdecl; -Var - SDL_AudioInit : TSDL_AudioInit_fun = Nil; -{$else} - -function SDL_AudioInit(driver_name: PAnsiChar): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioInit' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Use this function to shut down audio if you initialized it with - * SDL_AudioInit(). - * - * This function is used internally, and should not be used unless you have a - * specific need to specify the audio driver you want to use. You should - * normally use SDL_Quit() or SDL_QuitSubSystem(). - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AudioInit - *} -procedure SDL_AudioQuit; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioQuit' {$ENDIF} {$ENDIF}; - - {** - * Get the name of the current audio driver. - * - * The returned string points to internal static memory and thus never becomes - * invalid, even if you quit the audio subsystem and initialize a new driver - * (although such a case would return a different static string from another - * call to this function, of course). As such, you should not modify or free - * the returned string. - * - * \returns the name of the current audio driver or NULL if no driver has been - * initialized. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AudioInit - *} -function SDL_GetCurrentAudioDriver: PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCurrentAudioDriver' {$ENDIF} {$ENDIF}; - -{** - * This function is a legacy means of opening the audio device. - * - * This function remains for compatibility with SDL 1.2, but also because it's - * slightly easier to use than the new functions in SDL 2.0. The new, more - * powerful, and preferred way to do this is SDL_OpenAudioDevice(). - * - * This function is roughly equivalent to: - * - * ```c - * SDL_OpenAudioDevice(NULL, 0, desired, obtained, SDL_AUDIO_ALLOW_ANY_CHANGE); - * ``` - * - * With two notable exceptions: - * - * - If `obtained` is NULL, we use `desired` (and allow no changes), which - * means desired will be modified to have the correct values for silence, - * etc, and SDL will convert any differences between your app's specific - * request and the hardware behind the scenes. - * - The return value is always success or failure, and not a device ID, which - * means you can only have one device open at a time with this function. - * - * \param desired an SDL_AudioSpec structure representing the desired output - * format. Please refer to the SDL_OpenAudioDevice - * documentation for details on how to prepare this structure. - * \param obtained an SDL_AudioSpec structure filled in with the actual - * parameters, or NULL. - * \returns 0 if successful, placing the actual hardware parameters in the - * structure pointed to by `obtained`. - * - * If `obtained` is NULL, the audio data passed to the callback - * function will be guaranteed to be in the requested format, and - * will be automatically converted to the actual hardware audio - * format if necessary. If `obtained` is NULL, `desired` will have - * fields modified. - * - * This function returns a negative error code on failure to open the - * audio device or failure to set up the audio thread; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_CloseAudio - * \sa SDL_LockAudio - * \sa SDL_PauseAudio - * \sa SDL_UnlockAudio - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_OpenAudio_fun = function(desired: PSDL_AudioSpec; obtained: PSDL_AudioSpec): cint; cdecl; -Var - SDL_OpenAudio : TSDL_OpenAudio_fun = Nil; -{$else} - -function SDL_OpenAudio(desired: PSDL_AudioSpec; obtained: PSDL_AudioSpec): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_OpenAudio' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * SDL Audio Device IDs. - * - * A successful call to SDL_OpenAudio() is always device id 1, and legacy - * SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls - * always returns devices >= 2 on success. The legacy calls are good both - * for backwards compatibility and when you don't care about multiple, - * specific, or capture devices. - *} -type - PPSDL_AudioDeviceID = ^PSDL_AudioDeviceID; - PSDL_AudioDeviceID = ^TSDL_AudioDeviceID; - TSDL_AudioDeviceID = cuint32; - -{** - * Get the number of built-in audio devices. - * - * This function is only valid after successfully initializing the audio - * subsystem. - * - * Note that audio capture support is not implemented as of SDL 2.0.4, so the - * `iscapture` parameter is for future expansion and should always be zero for - * now. - * - * This function will return -1 if an explicit list of devices can't be - * determined. Returning -1 is not an error. For example, if SDL is set up to - * talk to a remote audio server, it can't list every one available on the - * Internet, but it will still allow a specific host to be specified in - * SDL_OpenAudioDevice(). - * - * In many common cases, when this function returns a value <= 0, it can still - * successfully open the default device (NULL for first argument of - * SDL_OpenAudioDevice()). - * - * This function may trigger a complete redetect of available hardware. It - * should not be called for each iteration of a loop, but rather once at the - * start of a loop: - * - * ```c - * // Don't do this: - * for (int i = 0; i < SDL_GetNumAudioDevices(0); i++) - * - * // do this instead: - * const int count = SDL_GetNumAudioDevices(0); - * for (int i = 0; i < count; ++i) do_something_here(); - * ``` - * - * \param iscapture zero to request playback devices, non-zero to request - * recording devices - * \returns the number of available devices exposed by the current driver or - * -1 if an explicit list of devices can't be determined. A return - * value of -1 does not necessarily mean an error condition. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetAudioDeviceName - * \sa SDL_OpenAudioDevice - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetNumAudioDevices_fun = function(iscapture: cint): cint; cdecl; -Var - SDL_GetNumAudioDevices : TSDL_GetNumAudioDevices_fun = Nil; -{$else} - -function SDL_GetNumAudioDevices(iscapture: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumAudioDevices' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the human-readable name of a specific audio device. - * - * This function is only valid after successfully initializing the audio - * subsystem. The values returned by this function reflect the latest call to - * SDL_GetNumAudioDevices(); re-call that function to redetect available - * hardware. - * - * The string returned by this function is UTF-8 encoded, read-only, and - * managed internally. You are not to free it. If you need to keep the string - * for any length of time, you should make your own copy of it, as it will be - * invalid next time any of several other SDL functions are called. - * - * \param index the index of the audio device; valid values range from 0 to - * SDL_GetNumAudioDevices() - 1 - * \param iscapture non-zero to query the list of recording devices, zero to - * query the list of output devices. - * \returns the name of the audio device at the requested index, or NULL on - * error. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetNumAudioDevices - * \sa SDL_GetDefaultAudioInfo - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetAudioDeviceName_fun = function(index: cint; iscapture: cint): PAnsiChar; cdecl; -Var - SDL_GetAudioDeviceName : TSDL_GetAudioDeviceName_fun = Nil; -{$else} - -function SDL_GetAudioDeviceName(index: cint; iscapture: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetAudioDeviceName' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Get the preferred audio format of a specific audio device. - * - * This function is only valid after a successfully initializing the audio - * subsystem. The values returned by this function reflect the latest call to - * SDL_GetNumAudioDevices(); re-call that function to redetect available - * hardware. - * - * `spec` will be filled with the sample rate, sample format, and channel - * count. - * - * \param index the index of the audio device; valid values range from 0 to - * SDL_GetNumAudioDevices() - 1 - * \param iscapture non-zero to query the list of recording devices, zero to - * query the list of output devices. - * \param spec The SDL_AudioSpec to be initialized by this function. - * \returns 0 on success, nonzero on error - * - * \since This function is available since SDL 2.0.16. - * - * \sa SDL_GetNumAudioDevices - * \sa SDL_GetDefaultAudioInfo - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetAudioDeviceSpec_fun = function(index: cint; iscapture: cint; spec: PSDL_AudioSpec): cint; cdecl; -Var - SDL_GetAudioDeviceSpec : TSDL_GetAudioDeviceSpec_fun = Nil; -{$else} - -function SDL_GetAudioDeviceSpec(index: cint; iscapture: cint; spec: PSDL_AudioSpec): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetAudioDeviceSpec' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Get the name and preferred format of the default audio device. - * - * Some (but not all!) platforms have an isolated mechanism to get information - * about the "default" device. This can actually be a completely different - * device that's not in the list you get from SDL_GetAudioDeviceSpec(). It can - * even be a network address! (This is discussed in SDL_OpenAudioDevice().) - * - * As a result, this call is not guaranteed to be performant, as it can query - * the sound server directly every time, unlike the other query functions. You - * should call this function sparingly! - * - * `spec` will be filled with the sample rate, sample format, and channel - * count, if a default device exists on the system. If `name` is provided, - * will be filled with either a dynamically-allocated UTF-8 string or nil. - * - * \param name A pointer to be filled with the name of the default device (can - * be nil). Please call SDL_free() when you are done with this - * pointer! - * \param spec The SDL_AudioSpec to be initialized by this function. - * \param iscapture non-zero to query the default recording device, zero to - * query the default output device. - * \returns 0 on success, nonzero on error - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_GetAudioDeviceName - * \sa SDL_GetAudioDeviceSpec - * \sa SDL_OpenAudioDevice - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetDefaultAudioInfo_fun = function(name: PPAnsiChar; spec: PSDL_AudioSpec; iscapture: cint): cint; cdecl; -Var - SDL_GetDefaultAudioInfo : TSDL_GetDefaultAudioInfo_fun = Nil; -{$else} - -function SDL_GetDefaultAudioInfo(name: PPAnsiChar; spec: PSDL_AudioSpec; iscapture: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDefaultAudioInfo' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Open a specific audio device. - * - * SDL_OpenAudio(), unlike this function, always acts on device ID 1. As such, - * this function will never return a 1 so as not to conflict with the legacy - * function. - * - * Please note that SDL 2.0 before 2.0.5 did not support recording; as such, - * this function would fail if `iscapture` was not zero. Starting with SDL - * 2.0.5, recording is implemented and this value can be non-zero. - * - * Passing in a `device` name of NULL requests the most reasonable default - * (and is equivalent to what SDL_OpenAudio() does to choose a device). The - * `device` name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but - * some drivers allow arbitrary and driver-specific strings, such as a - * hostname/IP address for a remote audio server, or a filename in the - * diskaudio driver. - * - * An opened audio device starts out paused, and should be enabled for playing - * by calling SDL_PauseAudioDevice(devid, 0) when you are ready for your audio - * callback function to be called. Since the audio driver may modify the - * requested size of the audio buffer, you should allocate any local mixing - * buffers after you open the audio device. - * - * The audio callback runs in a separate thread in most cases; you can prevent - * race conditions between your callback and other threads without fully - * pausing playback with SDL_LockAudioDevice(). For more information about the - * callback, see SDL_AudioSpec. - * - * Managing the audio spec via 'desired' and 'obtained': - * - * When filling in the desired audio spec structure: - * - * - `desired->freq` should be the frequency in sample-frames-per-second (Hz). - * - `desired->format` should be the audio format (`AUDIO_S16SYS`, etc). - * - `desired->samples` is the desired size of the audio buffer, in _sample - * frames_ (with stereo output, two samples--left and right--would make a - * single sample frame). This number should be a power of two, and may be - * adjusted by the audio driver to a value more suitable for the hardware. - * Good values seem to range between 512 and 8096 inclusive, depending on - * the application and CPU speed. Smaller values reduce latency, but can - * lead to underflow if the application is doing heavy processing and cannot - * fill the audio buffer in time. Note that the number of sample frames is - * directly related to time by the following formula: `ms = - * (sampleframes*1000)/freq` - * - `desired->size` is the size in _bytes_ of the audio buffer, and is - * calculated by SDL_OpenAudioDevice(). You don't initialize this. - * - `desired->silence` is the value used to set the buffer to silence, and is - * calculated by SDL_OpenAudioDevice(). You don't initialize this. - * - `desired->callback` should be set to a function that will be called when - * the audio device is ready for more data. It is passed a pointer to the - * audio buffer, and the length in bytes of the audio buffer. This function - * usually runs in a separate thread, and so you should protect data - * structures that it accesses by calling SDL_LockAudioDevice() and - * SDL_UnlockAudioDevice() in your code. Alternately, you may pass a NULL - * pointer here, and call SDL_QueueAudio() with some frequency, to queue - * more audio samples to be played (or for capture devices, call - * SDL_DequeueAudio() with some frequency, to obtain audio samples). - * - `desired->userdata` is passed as the first parameter to your callback - * function. If you passed a NULL callback, this value is ignored. - * - * `allowed_changes` can have the following flags OR'd together: - * - * - `SDL_AUDIO_ALLOW_FREQUENCY_CHANGE` - * - `SDL_AUDIO_ALLOW_FORMAT_CHANGE` - * - `SDL_AUDIO_ALLOW_CHANNELS_CHANGE` - * - `SDL_AUDIO_ALLOW_SAMPLES_CHANGE` - * - `SDL_AUDIO_ALLOW_ANY_CHANGE` - * - * These flags specify how SDL should behave when a device cannot offer a - * specific feature. If the application requests a feature that the hardware - * doesn't offer, SDL will always try to get the closest equivalent. - * - * For example, if you ask for float32 audio format, but the sound card only - * supports int16, SDL will set the hardware to int16. If you had set - * SDL_AUDIO_ALLOW_FORMAT_CHANGE, SDL will change the format in the `obtained` - * structure. If that flag was *not* set, SDL will prepare to convert your - * callback's float32 audio to int16 before feeding it to the hardware and - * will keep the originally requested format in the `obtained` structure. - * - * The resulting audio specs, varying depending on hardware and on what - * changes were allowed, will then be written back to `obtained`. - * - * If your application can only handle one specific data format, pass a zero - * for `allowed_changes` and let SDL transparently handle any differences. - * - * \param device a UTF-8 string reported by SDL_GetAudioDeviceName() or a - * driver-specific name as appropriate. NULL requests the most - * reasonable default device. - * \param iscapture non-zero to specify a device should be opened for - * recording, not playback - * \param desired an SDL_AudioSpec structure representing the desired output - * format; see SDL_OpenAudio() for more information - * \param obtained an SDL_AudioSpec structure filled in with the actual output - * format; see SDL_OpenAudio() for more information - * \param allowed_changes 0, or one or more flags OR'd together - * \returns a valid device ID that is > 0 on success or 0 on failure; call - * SDL_GetError() for more information. - * - * For compatibility with SDL 1.2, this will never return 1, since - * SDL reserves that ID for the legacy SDL_OpenAudio() function. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_CloseAudioDevice - * \sa SDL_GetAudioDeviceName - * \sa SDL_LockAudioDevice - * \sa SDL_OpenAudio - * \sa SDL_PauseAudioDevice - * \sa SDL_UnlockAudioDevice - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_OpenAudioDevice_fun = function(device: PAnsiChar; - iscapture: cint; - desired: PSDL_AudioSpec; - obtained: PSDL_AudioSpec; - allowed_changes: cint): TSDL_AudioDeviceID; cdecl; -Var - SDL_OpenAudioDevice : TSDL_OpenAudioDevice_fun = Nil; -{$else} - -function SDL_OpenAudioDevice(device: PAnsiChar; - iscapture: cint; - desired: PSDL_AudioSpec; - obtained: PSDL_AudioSpec; - allowed_changes: cint): TSDL_AudioDeviceID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_OpenAudioDevice' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Audio state - * - * Get the current audio state. - *} - -type - PPSDL_AudioStatus = ^PSDL_AudioStatus; - PSDL_AudioStatus = ^TSDL_AudioStatus; - TSDL_AudioStatus = type cint; - -const - SDL_AUDIO_STOPPED = TSDL_AudioStatus(0); - SDL_AUDIO_PLAYING = TSDL_AudioStatus(1); - SDL_AUDIO_PAUSED = TSDL_AudioStatus(2); - -{** - * This function is a legacy means of querying the audio device. - * - * New programs might want to use SDL_GetAudioDeviceStatus() instead. This - * function is equivalent to calling... - * - * ```c - * SDL_GetAudioDeviceStatus(1); - * ``` - * - * ...and is only useful if you used the legacy SDL_OpenAudio() function. - * - * \returns the SDL_AudioStatus of the audio device opened by SDL_OpenAudio(). - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetAudioDeviceStatus - *} -function SDL_GetAudioStatus: TSDL_AudioStatus; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetAudioStatus' {$ENDIF} {$ENDIF}; - -{** - * Use this function to get the current audio state of an audio device. - * - * \param dev the ID of an audio device previously opened with - * SDL_OpenAudioDevice() - * \returns the SDL_AudioStatus of the specified audio device. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_PauseAudioDevice - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetAudioDeviceStatus_fun = function(dev: TSDL_AudioDeviceID): TSDL_AudioStatus; cdecl; -Var - SDL_GetAudioDeviceStatus : TSDL_GetAudioDeviceStatus_fun = Nil; -{$else} - -function SDL_GetAudioDeviceStatus(dev: TSDL_AudioDeviceID): TSDL_AudioStatus; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetAudioDeviceStatus' {$ENDIF} {$ENDIF}; -{$endif} - -{*Audio State*} - - {** - * Pause audio functions - * - * These functions pause and unpause the audio callback processing. - * They should be called with a parameter of 0 after opening the audio - * device to start playing sound. This is so you can safely initialize - * data for your callback function after opening the audio device. - * Silence will be written to the audio device during the pause. - *} - -{** - * This function is a legacy means of pausing the audio device. - * - * New programs might want to use SDL_PauseAudioDevice() instead. This - * function is equivalent to calling... - * - * ```c - * SDL_PauseAudioDevice(1, pause_on); - * ``` - * - * ...and is only useful if you used the legacy SDL_OpenAudio() function. - * - * \param pause_on non-zero to pause, 0 to unpause - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetAudioStatus - * \sa SDL_PauseAudioDevice - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_PauseAudio_proc = procedure(pause_on: cint); cdecl; -Var - SDL_PauseAudio : TSDL_PauseAudio_proc = Nil; -{$else} - -procedure SDL_PauseAudio(pause_on: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PauseAudio' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Use this function to pause and unpause audio playback on a specified - * device. - * - * This function pauses and unpauses the audio callback processing for a given - * device. Newly-opened audio devices start in the paused state, so you must - * call this function with **pause_on**=0 after opening the specified audio - * device to start playing sound. This allows you to safely initialize data - * for your callback function after opening the audio device. Silence will be - * written to the audio device while paused, and the audio callback is - * guaranteed to not be called. Pausing one device does not prevent other - * unpaused devices from running their callbacks. - * - * Pausing state does not stack; even if you pause a device several times, a - * single unpause will start the device playing again, and vice versa. This is - * different from how SDL_LockAudioDevice() works. - * - * If you just need to protect a few variables from race conditions vs your - * callback, you shouldn't pause the audio device, as it will lead to dropouts - * in the audio playback. Instead, you should use SDL_LockAudioDevice(). - * - * \param dev a device opened by SDL_OpenAudioDevice() - * \param pause_on non-zero to pause, 0 to unpause - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_LockAudioDevice - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_PauseAudioDevice_proc = procedure(dev: TSDL_AudioDeviceID; pause_on: cint); cdecl; -Var - SDL_PauseAudioDevice : TSDL_PauseAudioDevice_proc = Nil; -{$else} - -procedure SDL_PauseAudioDevice(dev: TSDL_AudioDeviceID; pause_on: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PauseAudioDevice' {$ENDIF} {$ENDIF}; -{$endif} - -{*Pause audio functions*} - - {** - * Load the audio data of a WAVE file into memory. - * - * Loading a WAVE file requires `src`, `spec`, `audio_buf` and `audio_len` to - * be valid pointers. The entire data portion of the file is then loaded into - * memory and decoded if necessary. - * - * If `freesrc` is non-zero, the data source gets automatically closed and - * freed before the function returns. - * - * Supported formats are RIFF WAVE files with the formats PCM (8, 16, 24, and - * 32 bits), IEEE Float (32 bits), Microsoft ADPCM and IMA ADPCM (4 bits), and - * A-law and mu-law (8 bits). Other formats are currently unsupported and - * cause an error. - * - * If this function succeeds, the pointer returned by it is equal to `spec` - * and the pointer to the audio data allocated by the function is written to - * `audio_buf` and its length in bytes to `audio_len`. The SDL_AudioSpec - * members `freq`, `channels`, and `format` are set to the values of the audio - * data in the buffer. The `samples` member is set to a sane default and all - * others are set to zero. - * - * It's necessary to use SDL_FreeWAV() to free the audio data returned in - * `audio_buf` when it is no longer used. - * - * Because of the underspecification of the .WAV format, there are many - * problematic files in the wild that cause issues with strict decoders. To - * provide compatibility with these files, this decoder is lenient in regards - * to the truncation of the file, the fact chunk, and the size of the RIFF - * chunk. The hints `SDL_HINT_WAVE_RIFF_CHUNK_SIZE`, - * `SDL_HINT_WAVE_TRUNCATION`, and `SDL_HINT_WAVE_FACT_CHUNK` can be used to - * tune the behavior of the loading process. - * - * Any file that is invalid (due to truncation, corruption, or wrong values in - * the headers), too big, or unsupported causes an error. Additionally, any - * critical I/O error from the data source will terminate the loading process - * with an error. The function returns NULL on error and in all cases (with - * the exception of `src` being NULL), an appropriate error message will be - * set. - * - * It is required that the data source supports seeking. - * - * Example: - * - * ```c - * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, &spec, &buf, &len); - * ``` - * - * Note that the SDL_LoadWAV macro does this same thing for you, but in a less - * messy way: - * - * ```c - * SDL_LoadWAV("sample.wav", &spec, &buf, &len); - * ``` - * - * \param src The data source for the WAVE data - * \param freesrc If non-zero, SDL will _always_ free the data source - * \param spec An SDL_AudioSpec that will be filled in with the wave file's - * format details - * \param audio_buf A pointer filled with the audio data, allocated by the - * function. - * \param audio_len A pointer filled with the length of the audio data buffer - * in bytes - * \returns This function, if successfully called, returns `spec`, which will - * be filled with the audio data format of the wave source data. - * `audio_buf` will be filled with a pointer to an allocated buffer - * containing the audio data, and `audio_len` is filled with the - * length of that audio buffer in bytes. - * - * This function returns NULL if the .WAV file cannot be opened, uses - * an unknown data format, or is corrupt; call SDL_GetError() for - * more information. - * - * When the application is done with the data returned in - * `audio_buf`, it should call SDL_FreeWAV() to dispose of it. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_FreeWAV - * \sa SDL_LoadWAV - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LoadWAV_RW_fun = function(src: PSDL_RWops; - freesrc: cint; - spec: PSDL_AudioSpec; - audio_buf: ppcuint8; - audio_len: pcuint32): PSDL_AudioSpec; cdecl; -Var - SDL_LoadWAV_RW : TSDL_LoadWAV_RW_fun = Nil; -{$else} - -function SDL_LoadWAV_RW(src: PSDL_RWops; - freesrc: cint; - spec: PSDL_AudioSpec; - audio_buf: ppcuint8; - audio_len: pcuint32): PSDL_AudioSpec; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadWAV_RW' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Loads a WAV from a file. - * Compatibility convenience function. - *} -function SDL_LoadWAV(file_: PAnsiChar; spec: PSDL_AudioSpec; audio_buf: ppcuint8; audio_len: pcuint32): PSDL_AudioSpec; - -{** - * Free data previously allocated with SDL_LoadWAV() or SDL_LoadWAV_RW(). - * - * After a WAVE file has been opened with SDL_LoadWAV() or SDL_LoadWAV_RW() - * its data can eventually be freed with SDL_FreeWAV(). It is safe to call - * this function with a NULL pointer. - * - * \param audio_buf a pointer to the buffer created by SDL_LoadWAV() or - * SDL_LoadWAV_RW() - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_LoadWAV - * \sa SDL_LoadWAV_RW - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_FreeWAV_proc = procedure(audio_buf: pcuint8); cdecl; -Var - SDL_FreeWAV : TSDL_FreeWAV_proc = Nil; -{$else} - -procedure SDL_FreeWAV(audio_buf: pcuint8); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeWAV' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Initialize an SDL_AudioCVT structure for conversion. - * - * Before an SDL_AudioCVT structure can be used to convert audio data it must - * be initialized with source and destination information. - * - * This function will zero out every field of the SDL_AudioCVT, so it must be - * called before the application fills in the final buffer information. - * - * Once this function has returned successfully, and reported that a - * conversion is necessary, the application fills in the rest of the fields in - * SDL_AudioCVT, now that it knows how large a buffer it needs to allocate, - * and then can call SDL_ConvertAudio() to complete the conversion. - * - * \param cvt an SDL_AudioCVT structure filled in with audio conversion - * information - * \param src_format the source format of the audio data; for more info see - * SDL_AudioFormat - * \param src_channels the number of channels in the source - * \param src_rate the frequency (sample-frames-per-second) of the source - * \param dst_format the destination format of the audio data; for more info - * see SDL_AudioFormat - * \param dst_channels the number of channels in the destination - * \param dst_rate the frequency (sample-frames-per-second) of the destination - * \returns 1 if the audio filter is prepared, 0 if no conversion is needed, - * or a negative error code on failure; call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_ConvertAudio - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_BuildAudioCVT_fun = function(cvt: PSDL_AudioCVT; - src_format: TSDL_AudioFormat; - src_channels: cuint8; - src_rate: cint; - dst_format: TSDL_AudioFormat; - dst_channels: cuint8; - dst_rate: cint): cint; cdecl; -Var - SDL_BuildAudioCVT : TSDL_BuildAudioCVT_fun = Nil; -{$else} - -function SDL_BuildAudioCVT(cvt: PSDL_AudioCVT; - src_format: TSDL_AudioFormat; - src_channels: cuint8; - src_rate: cint; - dst_format: TSDL_AudioFormat; - dst_channels: cuint8; - dst_rate: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_BuildAudioCVT' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Convert audio data to a desired audio format. - * - * This function does the actual audio data conversion, after the application - * has called SDL_BuildAudioCVT() to prepare the conversion information and - * then filled in the buffer details. - * - * Once the application has initialized the `cvt` structure using - * SDL_BuildAudioCVT(), allocated an audio buffer and filled it with audio - * data in the source format, this function will convert the buffer, in-place, - * to the desired format. - * - * The data conversion may go through several passes; any given pass may - * possibly temporarily increase the size of the data. For example, SDL might - * expand 16-bit data to 32 bits before resampling to a lower frequency, - * shrinking the data size after having grown it briefly. Since the supplied - * buffer will be both the source and destination, converting as necessary - * in-place, the application must allocate a buffer that will fully contain - * the data during its largest conversion pass. After SDL_BuildAudioCVT() - * returns, the application should set the `cvt->len` field to the size, in - * bytes, of the source data, and allocate a buffer that is `cvt->len * - * cvt->len_mult` bytes long for the `buf` field. - * - * The source data should be copied into this buffer before the call to - * SDL_ConvertAudio(). Upon successful return, this buffer will contain the - * converted audio, and `cvt->len_cvt` will be the size of the converted data, - * in bytes. Any bytes in the buffer past `cvt->len_cvt` are undefined once - * this function returns. - * - * \param cvt an SDL_AudioCVT structure that was previously set up by - * SDL_BuildAudioCVT(). - * \returns 0 if the conversion was completed successfully or a negative error - * code on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_BuildAudioCVT - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_ConvertAudio_fun = function(cvt: PSDL_AudioCVT): cint; cdecl; -Var - SDL_ConvertAudio : TSDL_ConvertAudio_fun = Nil; -{$else} - -function SDL_ConvertAudio(cvt: PSDL_AudioCVT): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ConvertAudio' {$ENDIF} {$ENDIF}; -{$endif} - -{ SDL_AudioStream is a new audio conversion interface. - The benefits vs SDL_AudioCVT: - - it can handle resampling data in chunks without generating - artifacts, when it doesn't have the complete buffer available. - - it can handle incoming data in any variable size. - - You push data as you have it, and pull it when you need it - } -{ this is opaque to the outside world. } -type - PSDL_AudioStream = type Pointer; - -{* - * Create a new audio stream. - * - * \param src_format The format of the source audio - * \param src_channels The number of channels of the source audio - * \param src_rate The sampling rate of the source audio - * \param dst_format The format of the desired audio output - * \param dst_channels The number of channels of the desired audio output - * \param dst_rate The sampling rate of the desired audio output - * \returns 0 on success, or -1 on error. - * - * \since This function is available since SDL 2.0.7. - * - * \sa SDL_AudioStreamPut - * \sa SDL_AudioStreamGet - * \sa SDL_AudioStreamAvailable - * \sa SDL_AudioStreamFlush - * \sa SDL_AudioStreamClear - * \sa SDL_FreeAudioStream - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_NewAudioStream_fun = function(src_format: TSDL_AudioFormat; src_channels: cuint8; src_rate: cint; dst_format: TSDL_AudioFormat; dst_channels: cuint8; - dst_rate: cint): PSDL_AudioStream; cdecl; -Var - SDL_NewAudioStream : TSDL_NewAudioStream_fun = Nil; -{$else} - -function SDL_NewAudioStream(src_format: TSDL_AudioFormat; src_channels: cuint8; src_rate: cint; dst_format: TSDL_AudioFormat; dst_channels: cuint8; - dst_rate: cint): PSDL_AudioStream; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_NewAudioStream' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Add data to be converted/resampled to the stream. - * - * \param stream The stream the audio data is being added to - * \param buf A pointer to the audio data to add - * \param len The number of bytes to write to the stream - * \returns 0 on success, or -1 on error. - * - * \since This function is available since SDL 2.0.7. - * - * \sa SDL_NewAudioStream - * \sa SDL_AudioStreamGet - * \sa SDL_AudioStreamAvailable - * \sa SDL_AudioStreamFlush - * \sa SDL_AudioStreamClear - * \sa SDL_FreeAudioStream - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_AudioStreamPut_fun = function(stream: PSDL_AudioStream; buf: pointer; len: cint): cint; cdecl; -Var - SDL_AudioStreamPut : TSDL_AudioStreamPut_fun = Nil; -{$else} - -function SDL_AudioStreamPut(stream: PSDL_AudioStream; buf: pointer; len: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioStreamPut' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Get converted/resampled data from the stream - * - * \param stream The stream the audio is being requested from - * \param buf A buffer to fill with audio data - * \param len The maximum number of bytes to fill - * \returns the number of bytes read from the stream, or -1 on error - * - * \since This function is available since SDL 2.0.7. - * - * \sa SDL_NewAudioStream - * \sa SDL_AudioStreamPut - * \sa SDL_AudioStreamAvailable - * \sa SDL_AudioStreamFlush - * \sa SDL_AudioStreamClear - * \sa SDL_FreeAudioStream - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_AudioStreamGet_fun = function(stream: PSDL_AudioStream; buf: pointer; len: cint): cint; cdecl; -Var - SDL_AudioStreamGet : TSDL_AudioStreamGet_fun = Nil; -{$else} - -function SDL_AudioStreamGet(stream: PSDL_AudioStream; buf: pointer; len: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioStreamGet' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Get the number of converted/resampled bytes available. - * - * The stream may be buffering data behind the scenes until it has enough to - * resample correctly, so this number might be lower than what you expect, or - * even be zero. Add more data or flush the stream if you need the data now. - * - * \since This function is available since SDL 2.0.7. - * - * \sa SDL_NewAudioStream - * \sa SDL_AudioStreamPut - * \sa SDL_AudioStreamGet - * \sa SDL_AudioStreamFlush - * \sa SDL_AudioStreamClear - * \sa SDL_FreeAudioStream - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_AudioStreamAvailable_fun = function(stream: PSDL_AudioStream): cint; cdecl; -Var - SDL_AudioStreamAvailable : TSDL_AudioStreamAvailable_fun = Nil; -{$else} - -function SDL_AudioStreamAvailable(stream: PSDL_AudioStream): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioStreamAvailable' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Tell the stream that you're done sending data, and anything being buffered - * should be converted/resampled and made available immediately. - * - * It is legal to add more data to a stream after flushing, but there will be - * audio gaps in the output. Generally this is intended to signal the end of - * input, so the complete output becomes available. - * - * \since This function is available since SDL 2.0.7. - * - * \sa SDL_NewAudioStream - * \sa SDL_AudioStreamPut - * \sa SDL_AudioStreamGet - * \sa SDL_AudioStreamAvailable - * \sa SDL_AudioStreamClear - * \sa SDL_FreeAudioStream - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_AudioStreamFlush_fun = function(stream: PSDL_AudioStream): cint; cdecl; -Var - SDL_AudioStreamFlush : TSDL_AudioStreamFlush_fun = Nil; -{$else} - -function SDL_AudioStreamFlush(stream: PSDL_AudioStream): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioStreamFlush' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Clear any pending data in the stream without converting it - * - * \since This function is available since SDL 2.0.7. - * - * \sa SDL_NewAudioStream - * \sa SDL_AudioStreamPut - * \sa SDL_AudioStreamGet - * \sa SDL_AudioStreamAvailable - * \sa SDL_AudioStreamFlush - * \sa SDL_FreeAudioStream - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_AudioStreamClear_proc = procedure(stream: PSDL_AudioStream); cdecl; -Var - SDL_AudioStreamClear : TSDL_AudioStreamClear_proc = Nil; -{$else} - -procedure SDL_AudioStreamClear(stream: PSDL_AudioStream); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioStreamClear' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Free an audio stream - * - * \since This function is available since SDL 2.0.7. - * - * \sa SDL_NewAudioStream - * \sa SDL_AudioStreamPut - * \sa SDL_AudioStreamGet - * \sa SDL_AudioStreamAvailable - * \sa SDL_AudioStreamFlush - * \sa SDL_AudioStreamClear - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_FreeAudioStream_proc = procedure(stream: PSDL_AudioStream); cdecl; -Var - SDL_FreeAudioStream : TSDL_FreeAudioStream_proc = Nil; -{$else} - -procedure SDL_FreeAudioStream(stream: PSDL_AudioStream); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeAudioStream' {$ENDIF} {$ENDIF}; -{$endif} - -const - SDL_MIX_MAXVOLUME = 128; - -{** - * This function is a legacy means of mixing audio. - * - * This function is equivalent to calling... - * - * ```c - * SDL_MixAudioFormat(dst, src, format, len, volume); - * ``` - * - * ...where `format` is the obtained format of the audio device from the - * legacy SDL_OpenAudio() function. - * - * \param dst the destination for the mixed audio - * \param src the source audio buffer to be mixed - * \param len the length of the audio buffer in bytes - * \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME - * for full audio volume - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_MixAudioFormat - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_MixAudio_proc = procedure(dst: pcuint8; src: pcuint8; len: cuint32; volume: cint); cdecl; -Var - SDL_MixAudio : TSDL_MixAudio_proc = Nil; -{$else} - -procedure SDL_MixAudio(dst: pcuint8; src: pcuint8; len: cuint32; volume: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MixAudio' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Mix audio data in a specified format. - * - * This takes an audio buffer `src` of `len` bytes of `format` data and mixes - * it into `dst`, performing addition, volume adjustment, and overflow - * clipping. The buffer pointed to by `dst` must also be `len` bytes of - * `format` data. - * - * This is provided for convenience -- you can mix your own audio data. - * - * Do not use this function for mixing together more than two streams of - * sample data. The output from repeated application of this function may be - * distorted by clipping, because there is no accumulator with greater range - * than the input (not to mention this being an inefficient way of doing it). - * - * It is a common misconception that this function is required to write audio - * data to an output stream in an audio callback. While you can do that, - * SDL_MixAudioFormat() is really only needed when you're mixing a single - * audio stream with a volume adjustment. - * - * \param dst the destination for the mixed audio - * \param src the source audio buffer to be mixed - * \param format the SDL_AudioFormat structure representing the desired audio - * format - * \param len the length of the audio buffer in bytes - * \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME - * for full audio volume - * - * \since This function is available since SDL 2.0.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_MixAudioFormat_proc = procedure(dst: pcuint8; src: pcuint8; format: TSDL_AudioFormat; len: cuint32; volume: cint); cdecl; -Var - SDL_MixAudioFormat : TSDL_MixAudioFormat_proc = Nil; -{$else} - -procedure SDL_MixAudioFormat(dst: pcuint8; src: pcuint8; format: TSDL_AudioFormat; len: cuint32; volume: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MixAudioFormat' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Queue more audio on non-callback devices. - * - * If you are looking to retrieve queued audio from a non-callback capture - * device, you want SDL_DequeueAudio() instead. SDL_QueueAudio() will return - * -1 to signify an error if you use it with capture devices. - * - * SDL offers two ways to feed audio to the device: you can either supply a - * callback that SDL triggers with some frequency to obtain more audio (pull - * method), or you can supply no callback, and then SDL will expect you to - * supply data at regular intervals (push method) with this function. - * - * There are no limits on the amount of data you can queue, short of - * exhaustion of address space. Queued data will drain to the device as - * necessary without further intervention from you. If the device needs audio - * but there is not enough queued, it will play silence to make up the - * difference. This means you will have skips in your audio playback if you - * aren't routinely queueing sufficient data. - * - * This function copies the supplied data, so you are safe to free it when the - * function returns. This function is thread-safe, but queueing to the same - * device from two threads at once does not promise which buffer will be - * queued first. - * - * You may not queue audio on a device that is using an application-supplied - * callback; doing so returns an error. You have to use the audio callback or - * queue audio with this function, but not both. - * - * You should not call SDL_LockAudio() on the device before queueing; SDL - * handles locking internally for this function. - * - * Note that SDL2 does not support planar audio. You will need to resample - * from planar audio formats into a non-planar one (see SDL_AudioFormat) - * before queuing audio. - * - * \param dev the device ID to which we will queue audio - * \param data the data to queue to the device for later playback - * \param len the number of bytes (not samples!) to which `data` points - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.4. - * - * \sa SDL_ClearQueuedAudio - * \sa SDL_GetQueuedAudioSize - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_QueueAudio_fun = function(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): cint; cdecl; -Var - SDL_QueueAudio : TSDL_QueueAudio_fun = Nil; -{$else} - -function SDL_QueueAudio(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_QueueAudio' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Dequeue more audio on non-callback devices. - * - * If you are looking to queue audio for output on a non-callback playback - * device, you want SDL_QueueAudio() instead. SDL_DequeueAudio() will always - * return 0 if you use it with playback devices. - * - * SDL offers two ways to retrieve audio from a capture device: you can either - * supply a callback that SDL triggers with some frequency as the device - * records more audio data, (push method), or you can supply no callback, and - * then SDL will expect you to retrieve data at regular intervals (pull - * method) with this function. - * - * There are no limits on the amount of data you can queue, short of - * exhaustion of address space. Data from the device will keep queuing as - * necessary without further intervention from you. This means you will - * eventually run out of memory if you aren't routinely dequeueing data. - * - * Capture devices will not queue data when paused; if you are expecting to - * not need captured audio for some length of time, use SDL_PauseAudioDevice() - * to stop the capture device from queueing more data. This can be useful - * during, say, level loading times. When unpaused, capture devices will start - * queueing data from that point, having flushed any capturable data available - * while paused. - * - * This function is thread-safe, but dequeueing from the same device from two - * threads at once does not promise which thread will dequeue data first. - * - * You may not dequeue audio from a device that is using an - * application-supplied callback; doing so returns an error. You have to use - * the audio callback, or dequeue audio with this function, but not both. - * - * You should not call SDL_LockAudio() on the device before dequeueing; SDL - * handles locking internally for this function. - * - * \param dev the device ID from which we will dequeue audio - * \param data a pointer into where audio data should be copied - * \param len the number of bytes (not samples!) to which (data) points - * \returns the number of bytes dequeued, which could be less than requested; - * call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.5. - * - * \sa SDL_ClearQueuedAudio - * \sa SDL_GetQueuedAudioSize - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_DequeueAudio_fun = function(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): cuint32; cdecl; -Var - SDL_DequeueAudio : TSDL_DequeueAudio_fun = Nil; -{$else} - -function SDL_DequeueAudio(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DequeueAudio' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the number of bytes of still-queued audio. - * - * For playback devices: this is the number of bytes that have been queued for - * playback with SDL_QueueAudio(), but have not yet been sent to the hardware. - * - * Once we've sent it to the hardware, this function can not decide the exact - * byte boundary of what has been played. It's possible that we just gave the - * hardware several kilobytes right before you called this function, but it - * hasn't played any of it yet, or maybe half of it, etc. - * - * For capture devices, this is the number of bytes that have been captured by - * the device and are waiting for you to dequeue. This number may grow at any - * time, so this only informs of the lower-bound of available data. - * - * You may not queue or dequeue audio on a device that is using an - * application-supplied callback; calling this function on such a device - * always returns 0. You have to use the audio callback or queue audio, but - * not both. - * - * You should not call SDL_LockAudio() on the device before querying; SDL - * handles locking internally for this function. - * - * \param dev the device ID of which we will query queued audio size - * \returns the number of bytes (not samples!) of queued audio. - * - * \since This function is available since SDL 2.0.4. - * - * \sa SDL_ClearQueuedAudio - * \sa SDL_QueueAudio - * \sa SDL_DequeueAudio - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetQueuedAudioSize_fun = function(dev: TSDL_AudioDeviceID): cuint32; cdecl; -Var - SDL_GetQueuedAudioSize : TSDL_GetQueuedAudioSize_fun = Nil; -{$else} - -function SDL_GetQueuedAudioSize(dev: TSDL_AudioDeviceID): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetQueuedAudioSize' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Drop any queued audio data waiting to be sent to the hardware. - * - * Immediately after this call, SDL_GetQueuedAudioSize() will return 0. For - * output devices, the hardware will start playing silence if more audio isn't - * queued. For capture devices, the hardware will start filling the empty - * queue with new data if the capture device isn't paused. - * - * This will not prevent playback of queued audio that's already been sent to - * the hardware, as we can not undo that, so expect there to be some fraction - * of a second of audio that might still be heard. This can be useful if you - * want to, say, drop any pending music or any unprocessed microphone input - * during a level change in your game. - * - * You may not queue or dequeue audio on a device that is using an - * application-supplied callback; calling this function on such a device - * always returns 0. You have to use the audio callback or queue audio, but - * not both. - * - * You should not call SDL_LockAudio() on the device before clearing the - * queue; SDL handles locking internally for this function. - * - * This function always succeeds and thus returns void. - * - * \param dev the device ID of which to clear the audio queue - * - * \since This function is available since SDL 2.0.4. - * - * \sa SDL_GetQueuedAudioSize - * \sa SDL_QueueAudio - * \sa SDL_DequeueAudio - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_ClearQueuedAudio_proc = procedure(dev: TSDL_AudioDeviceID); cdecl; -Var - SDL_ClearQueuedAudio : TSDL_ClearQueuedAudio_proc = Nil; -{$else} - -procedure SDL_ClearQueuedAudio(dev: TSDL_AudioDeviceID); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ClearQueuedAudio' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Audio lock functions - * - * The lock manipulated by these functions protects the callback function. - * During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that - * the callback function is not running. Do not call these from the callback - * function or you will cause deadlock. - *} - -{** - * This function is a legacy means of locking the audio device. - * - * New programs might want to use SDL_LockAudioDevice() instead. This function - * is equivalent to calling... - * - * ```c - * SDL_LockAudioDevice(1); - * ``` - * - * ...and is only useful if you used the legacy SDL_OpenAudio() function. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_LockAudioDevice - * \sa SDL_UnlockAudio - * \sa SDL_UnlockAudioDevice - *} -procedure SDL_LockAudio; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockAudio' {$ENDIF} {$ENDIF}; - -{** - * Use this function to lock out the audio callback function for a specified - * device. - * - * The lock manipulated by these functions protects the audio callback - * function specified in SDL_OpenAudioDevice(). During a - * SDL_LockAudioDevice()/SDL_UnlockAudioDevice() pair, you can be guaranteed - * that the callback function for that device is not running, even if the - * device is not paused. While a device is locked, any other unpaused, - * unlocked devices may still run their callbacks. - * - * Calling this function from inside your audio callback is unnecessary. SDL - * obtains this lock before calling your function, and releases it when the - * function returns. - * - * You should not hold the lock longer than absolutely necessary. If you hold - * it too long, you'll experience dropouts in your audio playback. Ideally, - * your application locks the device, sets a few variables and unlocks again. - * Do not do heavy work while holding the lock for a device. - * - * It is safe to lock the audio device multiple times, as long as you unlock - * it an equivalent number of times. The callback will not run until the - * device has been unlocked completely in this way. If your application fails - * to unlock the device appropriately, your callback will never run, you might - * hear repeating bursts of audio, and SDL_CloseAudioDevice() will probably - * deadlock. - * - * Internally, the audio device lock is a mutex; if you lock from two threads - * at once, not only will you block the audio callback, you'll block the other - * thread. - * - * \param dev the ID of the device to be locked - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_UnlockAudioDevice - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LockAudioDevice_proc = procedure(dev: TSDL_AudioDeviceID); cdecl; -Var - SDL_LockAudioDevice : TSDL_LockAudioDevice_proc = Nil; -{$else} - -procedure SDL_LockAudioDevice(dev: TSDL_AudioDeviceID); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockAudioDevice' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * This function is a legacy means of unlocking the audio device. - * - * New programs might want to use SDL_UnlockAudioDevice() instead. This - * function is equivalent to calling... - * - * ```c - * SDL_UnlockAudioDevice(1); - * ``` - * - * ...and is only useful if you used the legacy SDL_OpenAudio() function. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_LockAudio - * \sa SDL_UnlockAudioDevice - *} -procedure SDL_UnlockAudio; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Unlock' {$ENDIF} {$ENDIF}; - -{** - * Use this function to unlock the audio callback function for a specified - * device. - * - * This function should be paired with a previous SDL_LockAudioDevice() call. - * - * \param dev the ID of the device to be unlocked - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_LockAudioDevice - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_UnlockAudioDevice_proc = procedure(dev: TSDL_AudioDeviceID); cdecl; -Var - SDL_UnlockAudioDevice : TSDL_UnlockAudioDevice_proc = Nil; -{$else} - -procedure SDL_UnlockAudioDevice(dev: TSDL_AudioDeviceID); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnlockAudioDevice' {$ENDIF} {$ENDIF}; -{$endif} - -{*Audio lock functions*} - -{** - * This function is a legacy means of closing the audio device. - * - * This function is equivalent to calling... - * - * ```c - * SDL_CloseAudioDevice(1); - * ``` - * - * ...and is only useful if you used the legacy SDL_OpenAudio() function. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_OpenAudio - *} -procedure SDL_CloseAudio; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CloseAudio' {$ENDIF} {$ENDIF}; - -{** - * Use this function to shut down audio processing and close the audio device. - * - * The application should close open audio devices once they are no longer - * needed. Calling this function will wait until the device's audio callback - * is not running, release the audio hardware and then clean up internal - * state. No further audio will play from this device once this function - * returns. - * - * This function may block briefly while pending audio data is played by the - * hardware, so that applications don't drop the last buffer of data they - * supplied. - * - * The device ID is invalid as soon as the device is closed, and is eligible - * for reuse in a new SDL_OpenAudioDevice() call immediately. - * - * \param dev an audio device previously opened with SDL_OpenAudioDevice() - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_OpenAudioDevice - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_CloseAudioDevice_proc = procedure(dev: TSDL_AudioDeviceID); cdecl; -Var - SDL_CloseAudioDevice : TSDL_CloseAudioDevice_proc = Nil; -{$else} - -procedure SDL_CloseAudioDevice(dev: TSDL_AudioDeviceID); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CloseAudioDevice' {$ENDIF} {$ENDIF}; -{$endif} - +//from sdl_audio.h + {** + * Audio format flags. + * + * These are what the 16 bits in SDL_AudioFormat currently mean... + * (Unspecified bits are always zero). + * + * + ++-----------------------sample is signed if set + || + || ++-----------sample is bigendian if set + || || + || || ++---sample is float if set + || || || + || || || +---sample bit size---+ + || || || | | + 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 + * + * There are macros in SDL 2.0 and later to query these bits. + *} +type + PPSDL_AudioFormat = ^PSDL_AudioFormat; + PSDL_AudioFormat = ^TSDL_AudioFormat; + TSDL_AudioFormat = cuint16; + + {** + * Audio flags + *} +const + SDL_AUDIO_MASK_BITSIZE = ($FF); + SDL_AUDIO_MASK_DATATYPE = (1 shl 8); + SDL_AUDIO_MASK_ENDIAN = (1 shl 12); + SDL_AUDIO_MASK_SIGNED = (1 shl 15); + +function SDL_AUDIO_BITSIZE(x: Cardinal): Cardinal; +function SDL_AUDIO_ISFLOAT(x: Cardinal): Cardinal; +function SDL_AUDIO_ISBIGENDIAN(x: Cardinal): Cardinal; +function SDL_AUDIO_ISSIGNED(x: Cardinal): Cardinal; +function SDL_AUDIO_ISINT(x: Cardinal): Cardinal; +function SDL_AUDIO_ISLITTLEENDIAN(x: Cardinal): Cardinal; +function SDL_AUDIO_ISUNSIGNED(x: Cardinal): Cardinal; + + {** + * Audio format flags + * + * Defaults to LSB byte order. + *} +const + AUDIO_U8 = $0008; {**< Unsigned 8-bit samples *} + AUDIO_S8 = $8008; {**< Signed 8-bit samples *} + AUDIO_U16LSB = $0010; {**< Unsigned 16-bit samples *} + AUDIO_S16LSB = $8010; {**< Signed 16-bit samples *} + AUDIO_U16MSB = $1010; {**< As above, but big-endian byte order *} + AUDIO_S16MSB = $9010; {**< As above, but big-endian byte order *} + AUDIO_U16 = AUDIO_U16LSB; + AUDIO_S16 = AUDIO_S16LSB; + + {** + * int32 support + *} +const + AUDIO_S32LSB = $8020; {**< 32-bit integer samples *} + AUDIO_S32MSB = $9020; {**< As above, but big-endian byte order *} + AUDIO_S32 = AUDIO_S32LSB; + + {** + * float32 support + *} +const + AUDIO_F32LSB = $8120; {**< 32-bit floating point samples *} + AUDIO_F32MSB = $9120; {**< As above, but big-endian byte order *} + AUDIO_F32 = AUDIO_F32LSB; + + {** + * Native audio byte ordering + *} +{$IFDEF FPC} + {$IF DEFINED(ENDIAN_LITTLE)} + AUDIO_U16SYS = AUDIO_U16LSB; + AUDIO_S16SYS = AUDIO_S16LSB; + AUDIO_S32SYS = AUDIO_S32LSB; + AUDIO_F32SYS = AUDIO_F32LSB; + {$ELSEIF DEFINED(ENDIAN_BIG)} + AUDIO_U16SYS = AUDIO_U16MSB; + AUDIO_S16SYS = AUDIO_S16MSB; + AUDIO_S32SYS = AUDIO_S32MSB; + AUDIO_F32SYS = AUDIO_F32MSB; + {$ELSE} + {$FATAL Cannot determine endianness.} + {$IFEND} +{$ENDIF} + + {** + * Allow change flags + * + * Which audio format changes are allowed when opening a device. + *} +const + SDL_AUDIO_ALLOW_FREQUENCY_CHANGE = $00000001; + SDL_AUDIO_ALLOW_FORMAT_CHANGE = $00000002; + SDL_AUDIO_ALLOW_CHANNELS_CHANGE = $00000004; + SDL_AUDIO_ALLOW_ANY_CHANGE = (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE or + SDL_AUDIO_ALLOW_FORMAT_CHANGE or + SDL_AUDIO_ALLOW_CHANNELS_CHANGE); + + {*Audio flags*} + + {** + * This function is called when the audio device needs more data. + * + * \param userdata An application-specific parameter saved in + * the SDL_AudioSpec structure + * \param stream A pointer to the audio data buffer. + * \param len The length of that buffer in bytes. + * + * Once the callback returns, the buffer will no longer be valid. + * Stereo samples are stored in a LRLRLR ordering. + * + * You can choose to avoid callbacks and use SDL_QueueAudio() instead, if + * you like. Just open your audio device with a NULL callback. + *} +type + PPSDL_AudioCallback = ^PSDL_AudioCallback; + PSDL_AudioCallback = ^TSDL_AudioCallback; + TSDL_AudioCallback = procedure(userdata: Pointer; stream: pcuint8; len: cint); cdecl; + + {** + * The calculated values in this structure are calculated by SDL_OpenAudio(). + * + * For multi-channel audio, the default SDL channel mapping is: + * 2: FL FR (stereo) + * 3: FL FR LFE (2.1 surround) + * 4: FL FR BL BR (quad) + * 5: FL FR LFE BL BR (4.1 surround) + * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR) + * 7: FL FR FC LFE BC SL SR (6.1 surround) + * 8: FL FR FC LFE BL BR SL SR (7.1 surround) + *} +type + PPSDL_AudioSpec = ^PSDL_AudioSpec; + PSDL_AudioSpec = ^TSDL_AudioSpec; + TSDL_AudioSpec = record + freq: cint; {**< DSP frequency -- samples per second *} + format: TSDL_AudioFormat; {**< Audio data format *} + channels: cuint8; {**< Number of channels: 1 mono, 2 stereo *} + silence: cuint8; {**< Audio buffer silence value (calculated) *} + samples: cuint16; {**< Audio buffer size in sample FRAMES (total samples divided by channel count) *} + padding: cuint16; {**< Necessary for some compile environments *} + size: cuint32; {**< Audio buffer size in bytes (calculated) *} + callback: TSDL_AudioCallback; {**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). *} + userdata: Pointer; {**< Userdata passed to callback (ignored for NULL callbacks). *} + end; + + {** + * \brief Upper limit of filters in SDL_AudioCVT + * + * The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is + * currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers, + * one of which is the terminating NULL pointer. + *} +const + SDL_AUDIOCVT_MAX_FILTERS = 9; + +type + PPSDL_AudioCVT = ^PSDL_AudioCVT; + PSDL_AudioCVT = ^TSDL_AudioCVT; + TSDL_AudioFilter = procedure(cvt: PSDL_AudioCVT; format: TSDL_AudioFormat); cdecl; + + {** + * \struct SDL_AudioCVT + * \brief A structure to hold a set of audio conversion filters and buffers. + * + * Note that various parts of the conversion pipeline can take advantage + * of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require + * you to pass it aligned data, but can possibly run much faster if you + * set both its (buf) field to a pointer that is aligned to 16 bytes, and its + * (len) field to something that's a multiple of 16, if possible. + *} + TSDL_AudioCVT = record + needed: cint; {**< Set to 1 if conversion possible *} + src_format: TSDL_AudioFormat; {**< Source audio format *} + dst_format: TSDL_AudioFormat; {**< Target audio format *} + rate_incr: cdouble; {**< Rate conversion increment *} + buf: pcuint8; {**< Buffer to hold entire audio data *} + len: cint; {**< Length of original audio buffer *} + len_cvt: cint; {**< Length of converted audio buffer *} + len_mult: cint; {**< buffer must be len*len_mult big *} + len_ratio: cdouble; {**< Given len, final size is len*len_ratio *} + filters: array[0..SDL_AUDIOCVT_MAX_FILTERS] of TSDL_AudioFilter; {**< NULL-terminated list of filter functions *} + filter_index: cint; {**< Current audio conversion function *} + end; + + + {* Function prototypes *} + + {** + * Driver discovery functions + * + * These functions return the list of built in audio drivers, in the + * order that they are normally initialized by default. + *} + + {** + * Use this function to get the number of built-in audio drivers. + * + * This function returns a hardcoded number. This never returns a negative + * value; if there are no drivers compiled into this build of SDL, this + * function returns zero. The presence of a driver in this list does not mean + * it will function, it just means SDL is capable of interacting with that + * interface. For example, a build of SDL might have esound support, but if + * there's no esound server available, SDL's esound driver would fail if used. + * + * By default, SDL tries all drivers, in its preferred order, until one is + * found to be usable. + * + * \returns the number of built-in audio drivers. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetAudioDriver + *} +function SDL_GetNumAudioDrivers: cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumAudioDrivers' {$ENDIF} {$ENDIF}; + +{** + * Use this function to get the name of a built in audio driver. + * + * The list of audio drivers is given in the order that they are normally + * initialized by default; the drivers that seem more reasonable to choose + * first (as far as the SDL developers believe) are earlier in the list. + * + * The names of drivers are all simple, low-ASCII identifiers, like "alsa", + * "coreaudio" or "xaudio2". These never have Unicode characters, and are not + * meant to be proper names. + * + * \param index the index of the audio driver; the value ranges from 0 to + * SDL_GetNumAudioDrivers() - 1 + * \returns the name of the audio driver at the requested index, or NULL if an + * invalid index was specified. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetNumAudioDrivers + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetAudioDriver_fun = function(index: cint): PAnsiChar; cdecl; +Var + SDL_GetAudioDriver : TSDL_GetAudioDriver_fun = Nil; +{$else} + +function SDL_GetAudioDriver(index: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetAudioDriver' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Initialization and cleanup + * + * These functions are used internally, and should not be used unless + * you have a specific need to specify the audio driver you want to + * use. You should normally use SDL_Init() or SDL_InitSubSystem(). + *} + +{** + * Use this function to initialize a particular audio driver. + * + * This function is used internally, and should not be used unless you have a + * specific need to designate the audio driver you want to use. You should + * normally use SDL_Init() or SDL_InitSubSystem(). + * + * \param driver_name the name of the desired audio driver + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AudioQuit + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AudioInit_fun = function(driver_name: PAnsiChar): cint; cdecl; +Var + SDL_AudioInit : TSDL_AudioInit_fun = Nil; +{$else} + +function SDL_AudioInit(driver_name: PAnsiChar): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioInit' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Use this function to shut down audio if you initialized it with + * SDL_AudioInit(). + * + * This function is used internally, and should not be used unless you have a + * specific need to specify the audio driver you want to use. You should + * normally use SDL_Quit() or SDL_QuitSubSystem(). + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AudioInit + *} +procedure SDL_AudioQuit; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioQuit' {$ENDIF} {$ENDIF}; + + {** + * Get the name of the current audio driver. + * + * The returned string points to internal static memory and thus never becomes + * invalid, even if you quit the audio subsystem and initialize a new driver + * (although such a case would return a different static string from another + * call to this function, of course). As such, you should not modify or free + * the returned string. + * + * \returns the name of the current audio driver or NULL if no driver has been + * initialized. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AudioInit + *} +function SDL_GetCurrentAudioDriver: PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCurrentAudioDriver' {$ENDIF} {$ENDIF}; + +{** + * This function is a legacy means of opening the audio device. + * + * This function remains for compatibility with SDL 1.2, but also because it's + * slightly easier to use than the new functions in SDL 2.0. The new, more + * powerful, and preferred way to do this is SDL_OpenAudioDevice(). + * + * This function is roughly equivalent to: + * + * ```c + * SDL_OpenAudioDevice(NULL, 0, desired, obtained, SDL_AUDIO_ALLOW_ANY_CHANGE); + * ``` + * + * With two notable exceptions: + * + * - If `obtained` is NULL, we use `desired` (and allow no changes), which + * means desired will be modified to have the correct values for silence, + * etc, and SDL will convert any differences between your app's specific + * request and the hardware behind the scenes. + * - The return value is always success or failure, and not a device ID, which + * means you can only have one device open at a time with this function. + * + * \param desired an SDL_AudioSpec structure representing the desired output + * format. Please refer to the SDL_OpenAudioDevice + * documentation for details on how to prepare this structure. + * \param obtained an SDL_AudioSpec structure filled in with the actual + * parameters, or NULL. + * \returns 0 if successful, placing the actual hardware parameters in the + * structure pointed to by `obtained`. + * + * If `obtained` is NULL, the audio data passed to the callback + * function will be guaranteed to be in the requested format, and + * will be automatically converted to the actual hardware audio + * format if necessary. If `obtained` is NULL, `desired` will have + * fields modified. + * + * This function returns a negative error code on failure to open the + * audio device or failure to set up the audio thread; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_CloseAudio + * \sa SDL_LockAudio + * \sa SDL_PauseAudio + * \sa SDL_UnlockAudio + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_OpenAudio_fun = function(desired: PSDL_AudioSpec; obtained: PSDL_AudioSpec): cint; cdecl; +Var + SDL_OpenAudio : TSDL_OpenAudio_fun = Nil; +{$else} + +function SDL_OpenAudio(desired: PSDL_AudioSpec; obtained: PSDL_AudioSpec): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_OpenAudio' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * SDL Audio Device IDs. + * + * A successful call to SDL_OpenAudio() is always device id 1, and legacy + * SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls + * always returns devices >= 2 on success. The legacy calls are good both + * for backwards compatibility and when you don't care about multiple, + * specific, or capture devices. + *} +type + PPSDL_AudioDeviceID = ^PSDL_AudioDeviceID; + PSDL_AudioDeviceID = ^TSDL_AudioDeviceID; + TSDL_AudioDeviceID = cuint32; + +{** + * Get the number of built-in audio devices. + * + * This function is only valid after successfully initializing the audio + * subsystem. + * + * Note that audio capture support is not implemented as of SDL 2.0.4, so the + * `iscapture` parameter is for future expansion and should always be zero for + * now. + * + * This function will return -1 if an explicit list of devices can't be + * determined. Returning -1 is not an error. For example, if SDL is set up to + * talk to a remote audio server, it can't list every one available on the + * Internet, but it will still allow a specific host to be specified in + * SDL_OpenAudioDevice(). + * + * In many common cases, when this function returns a value <= 0, it can still + * successfully open the default device (NULL for first argument of + * SDL_OpenAudioDevice()). + * + * This function may trigger a complete redetect of available hardware. It + * should not be called for each iteration of a loop, but rather once at the + * start of a loop: + * + * ```c + * // Don't do this: + * for (int i = 0; i < SDL_GetNumAudioDevices(0); i++) + * + * // do this instead: + * const int count = SDL_GetNumAudioDevices(0); + * for (int i = 0; i < count; ++i) do_something_here(); + * ``` + * + * \param iscapture zero to request playback devices, non-zero to request + * recording devices + * \returns the number of available devices exposed by the current driver or + * -1 if an explicit list of devices can't be determined. A return + * value of -1 does not necessarily mean an error condition. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetAudioDeviceName + * \sa SDL_OpenAudioDevice + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetNumAudioDevices_fun = function(iscapture: cint): cint; cdecl; +Var + SDL_GetNumAudioDevices : TSDL_GetNumAudioDevices_fun = Nil; +{$else} + +function SDL_GetNumAudioDevices(iscapture: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumAudioDevices' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the human-readable name of a specific audio device. + * + * This function is only valid after successfully initializing the audio + * subsystem. The values returned by this function reflect the latest call to + * SDL_GetNumAudioDevices(); re-call that function to redetect available + * hardware. + * + * The string returned by this function is UTF-8 encoded, read-only, and + * managed internally. You are not to free it. If you need to keep the string + * for any length of time, you should make your own copy of it, as it will be + * invalid next time any of several other SDL functions are called. + * + * \param index the index of the audio device; valid values range from 0 to + * SDL_GetNumAudioDevices() - 1 + * \param iscapture non-zero to query the list of recording devices, zero to + * query the list of output devices. + * \returns the name of the audio device at the requested index, or NULL on + * error. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetNumAudioDevices + * \sa SDL_GetDefaultAudioInfo + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetAudioDeviceName_fun = function(index: cint; iscapture: cint): PAnsiChar; cdecl; +Var + SDL_GetAudioDeviceName : TSDL_GetAudioDeviceName_fun = Nil; +{$else} + +function SDL_GetAudioDeviceName(index: cint; iscapture: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetAudioDeviceName' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get the preferred audio format of a specific audio device. + * + * This function is only valid after a successfully initializing the audio + * subsystem. The values returned by this function reflect the latest call to + * SDL_GetNumAudioDevices(); re-call that function to redetect available + * hardware. + * + * `spec` will be filled with the sample rate, sample format, and channel + * count. + * + * \param index the index of the audio device; valid values range from 0 to + * SDL_GetNumAudioDevices() - 1 + * \param iscapture non-zero to query the list of recording devices, zero to + * query the list of output devices. + * \param spec The SDL_AudioSpec to be initialized by this function. + * \returns 0 on success, nonzero on error + * + * \since This function is available since SDL 2.0.16. + * + * \sa SDL_GetNumAudioDevices + * \sa SDL_GetDefaultAudioInfo + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetAudioDeviceSpec_fun = function(index: cint; iscapture: cint; spec: PSDL_AudioSpec): cint; cdecl; +Var + SDL_GetAudioDeviceSpec : TSDL_GetAudioDeviceSpec_fun = Nil; +{$else} + +function SDL_GetAudioDeviceSpec(index: cint; iscapture: cint; spec: PSDL_AudioSpec): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetAudioDeviceSpec' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get the name and preferred format of the default audio device. + * + * Some (but not all!) platforms have an isolated mechanism to get information + * about the "default" device. This can actually be a completely different + * device that's not in the list you get from SDL_GetAudioDeviceSpec(). It can + * even be a network address! (This is discussed in SDL_OpenAudioDevice().) + * + * As a result, this call is not guaranteed to be performant, as it can query + * the sound server directly every time, unlike the other query functions. You + * should call this function sparingly! + * + * `spec` will be filled with the sample rate, sample format, and channel + * count, if a default device exists on the system. If `name` is provided, + * will be filled with either a dynamically-allocated UTF-8 string or nil. + * + * \param name A pointer to be filled with the name of the default device (can + * be nil). Please call SDL_free() when you are done with this + * pointer! + * \param spec The SDL_AudioSpec to be initialized by this function. + * \param iscapture non-zero to query the default recording device, zero to + * query the default output device. + * \returns 0 on success, nonzero on error + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GetAudioDeviceName + * \sa SDL_GetAudioDeviceSpec + * \sa SDL_OpenAudioDevice + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetDefaultAudioInfo_fun = function(name: PPAnsiChar; spec: PSDL_AudioSpec; iscapture: cint): cint; cdecl; +Var + SDL_GetDefaultAudioInfo : TSDL_GetDefaultAudioInfo_fun = Nil; +{$else} + +function SDL_GetDefaultAudioInfo(name: PPAnsiChar; spec: PSDL_AudioSpec; iscapture: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDefaultAudioInfo' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Open a specific audio device. + * + * SDL_OpenAudio(), unlike this function, always acts on device ID 1. As such, + * this function will never return a 1 so as not to conflict with the legacy + * function. + * + * Please note that SDL 2.0 before 2.0.5 did not support recording; as such, + * this function would fail if `iscapture` was not zero. Starting with SDL + * 2.0.5, recording is implemented and this value can be non-zero. + * + * Passing in a `device` name of NULL requests the most reasonable default + * (and is equivalent to what SDL_OpenAudio() does to choose a device). The + * `device` name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but + * some drivers allow arbitrary and driver-specific strings, such as a + * hostname/IP address for a remote audio server, or a filename in the + * diskaudio driver. + * + * An opened audio device starts out paused, and should be enabled for playing + * by calling SDL_PauseAudioDevice(devid, 0) when you are ready for your audio + * callback function to be called. Since the audio driver may modify the + * requested size of the audio buffer, you should allocate any local mixing + * buffers after you open the audio device. + * + * The audio callback runs in a separate thread in most cases; you can prevent + * race conditions between your callback and other threads without fully + * pausing playback with SDL_LockAudioDevice(). For more information about the + * callback, see SDL_AudioSpec. + * + * Managing the audio spec via 'desired' and 'obtained': + * + * When filling in the desired audio spec structure: + * + * - `desired->freq` should be the frequency in sample-frames-per-second (Hz). + * - `desired->format` should be the audio format (`AUDIO_S16SYS`, etc). + * - `desired->samples` is the desired size of the audio buffer, in _sample + * frames_ (with stereo output, two samples--left and right--would make a + * single sample frame). This number should be a power of two, and may be + * adjusted by the audio driver to a value more suitable for the hardware. + * Good values seem to range between 512 and 8096 inclusive, depending on + * the application and CPU speed. Smaller values reduce latency, but can + * lead to underflow if the application is doing heavy processing and cannot + * fill the audio buffer in time. Note that the number of sample frames is + * directly related to time by the following formula: `ms = + * (sampleframes*1000)/freq` + * - `desired->size` is the size in _bytes_ of the audio buffer, and is + * calculated by SDL_OpenAudioDevice(). You don't initialize this. + * - `desired->silence` is the value used to set the buffer to silence, and is + * calculated by SDL_OpenAudioDevice(). You don't initialize this. + * - `desired->callback` should be set to a function that will be called when + * the audio device is ready for more data. It is passed a pointer to the + * audio buffer, and the length in bytes of the audio buffer. This function + * usually runs in a separate thread, and so you should protect data + * structures that it accesses by calling SDL_LockAudioDevice() and + * SDL_UnlockAudioDevice() in your code. Alternately, you may pass a NULL + * pointer here, and call SDL_QueueAudio() with some frequency, to queue + * more audio samples to be played (or for capture devices, call + * SDL_DequeueAudio() with some frequency, to obtain audio samples). + * - `desired->userdata` is passed as the first parameter to your callback + * function. If you passed a NULL callback, this value is ignored. + * + * `allowed_changes` can have the following flags OR'd together: + * + * - `SDL_AUDIO_ALLOW_FREQUENCY_CHANGE` + * - `SDL_AUDIO_ALLOW_FORMAT_CHANGE` + * - `SDL_AUDIO_ALLOW_CHANNELS_CHANGE` + * - `SDL_AUDIO_ALLOW_SAMPLES_CHANGE` + * - `SDL_AUDIO_ALLOW_ANY_CHANGE` + * + * These flags specify how SDL should behave when a device cannot offer a + * specific feature. If the application requests a feature that the hardware + * doesn't offer, SDL will always try to get the closest equivalent. + * + * For example, if you ask for float32 audio format, but the sound card only + * supports int16, SDL will set the hardware to int16. If you had set + * SDL_AUDIO_ALLOW_FORMAT_CHANGE, SDL will change the format in the `obtained` + * structure. If that flag was *not* set, SDL will prepare to convert your + * callback's float32 audio to int16 before feeding it to the hardware and + * will keep the originally requested format in the `obtained` structure. + * + * The resulting audio specs, varying depending on hardware and on what + * changes were allowed, will then be written back to `obtained`. + * + * If your application can only handle one specific data format, pass a zero + * for `allowed_changes` and let SDL transparently handle any differences. + * + * \param device a UTF-8 string reported by SDL_GetAudioDeviceName() or a + * driver-specific name as appropriate. NULL requests the most + * reasonable default device. + * \param iscapture non-zero to specify a device should be opened for + * recording, not playback + * \param desired an SDL_AudioSpec structure representing the desired output + * format; see SDL_OpenAudio() for more information + * \param obtained an SDL_AudioSpec structure filled in with the actual output + * format; see SDL_OpenAudio() for more information + * \param allowed_changes 0, or one or more flags OR'd together + * \returns a valid device ID that is > 0 on success or 0 on failure; call + * SDL_GetError() for more information. + * + * For compatibility with SDL 1.2, this will never return 1, since + * SDL reserves that ID for the legacy SDL_OpenAudio() function. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_CloseAudioDevice + * \sa SDL_GetAudioDeviceName + * \sa SDL_LockAudioDevice + * \sa SDL_OpenAudio + * \sa SDL_PauseAudioDevice + * \sa SDL_UnlockAudioDevice + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_OpenAudioDevice_fun = function(device: PAnsiChar; + iscapture: cint; + desired: PSDL_AudioSpec; + obtained: PSDL_AudioSpec; + allowed_changes: cint): TSDL_AudioDeviceID; cdecl; +Var + SDL_OpenAudioDevice : TSDL_OpenAudioDevice_fun = Nil; +{$else} + +function SDL_OpenAudioDevice(device: PAnsiChar; + iscapture: cint; + desired: PSDL_AudioSpec; + obtained: PSDL_AudioSpec; + allowed_changes: cint): TSDL_AudioDeviceID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_OpenAudioDevice' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Audio state + * + * Get the current audio state. + *} + +type + PPSDL_AudioStatus = ^PSDL_AudioStatus; + PSDL_AudioStatus = ^TSDL_AudioStatus; + TSDL_AudioStatus = type cint; + +const + SDL_AUDIO_STOPPED = TSDL_AudioStatus(0); + SDL_AUDIO_PLAYING = TSDL_AudioStatus(1); + SDL_AUDIO_PAUSED = TSDL_AudioStatus(2); + +{** + * This function is a legacy means of querying the audio device. + * + * New programs might want to use SDL_GetAudioDeviceStatus() instead. This + * function is equivalent to calling... + * + * ```c + * SDL_GetAudioDeviceStatus(1); + * ``` + * + * ...and is only useful if you used the legacy SDL_OpenAudio() function. + * + * \returns the SDL_AudioStatus of the audio device opened by SDL_OpenAudio(). + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetAudioDeviceStatus + *} +function SDL_GetAudioStatus: TSDL_AudioStatus; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetAudioStatus' {$ENDIF} {$ENDIF}; + +{** + * Use this function to get the current audio state of an audio device. + * + * \param dev the ID of an audio device previously opened with + * SDL_OpenAudioDevice() + * \returns the SDL_AudioStatus of the specified audio device. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_PauseAudioDevice + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetAudioDeviceStatus_fun = function(dev: TSDL_AudioDeviceID): TSDL_AudioStatus; cdecl; +Var + SDL_GetAudioDeviceStatus : TSDL_GetAudioDeviceStatus_fun = Nil; +{$else} + +function SDL_GetAudioDeviceStatus(dev: TSDL_AudioDeviceID): TSDL_AudioStatus; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetAudioDeviceStatus' {$ENDIF} {$ENDIF}; +{$endif} + +{*Audio State*} + + {** + * Pause audio functions + * + * These functions pause and unpause the audio callback processing. + * They should be called with a parameter of 0 after opening the audio + * device to start playing sound. This is so you can safely initialize + * data for your callback function after opening the audio device. + * Silence will be written to the audio device during the pause. + *} + +{** + * This function is a legacy means of pausing the audio device. + * + * New programs might want to use SDL_PauseAudioDevice() instead. This + * function is equivalent to calling... + * + * ```c + * SDL_PauseAudioDevice(1, pause_on); + * ``` + * + * ...and is only useful if you used the legacy SDL_OpenAudio() function. + * + * \param pause_on non-zero to pause, 0 to unpause + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetAudioStatus + * \sa SDL_PauseAudioDevice + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_PauseAudio_proc = procedure(pause_on: cint); cdecl; +Var + SDL_PauseAudio : TSDL_PauseAudio_proc = Nil; +{$else} + +procedure SDL_PauseAudio(pause_on: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PauseAudio' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Use this function to pause and unpause audio playback on a specified + * device. + * + * This function pauses and unpauses the audio callback processing for a given + * device. Newly-opened audio devices start in the paused state, so you must + * call this function with **pause_on**=0 after opening the specified audio + * device to start playing sound. This allows you to safely initialize data + * for your callback function after opening the audio device. Silence will be + * written to the audio device while paused, and the audio callback is + * guaranteed to not be called. Pausing one device does not prevent other + * unpaused devices from running their callbacks. + * + * Pausing state does not stack; even if you pause a device several times, a + * single unpause will start the device playing again, and vice versa. This is + * different from how SDL_LockAudioDevice() works. + * + * If you just need to protect a few variables from race conditions vs your + * callback, you shouldn't pause the audio device, as it will lead to dropouts + * in the audio playback. Instead, you should use SDL_LockAudioDevice(). + * + * \param dev a device opened by SDL_OpenAudioDevice() + * \param pause_on non-zero to pause, 0 to unpause + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_LockAudioDevice + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_PauseAudioDevice_proc = procedure(dev: TSDL_AudioDeviceID; pause_on: cint); cdecl; +Var + SDL_PauseAudioDevice : TSDL_PauseAudioDevice_proc = Nil; +{$else} + +procedure SDL_PauseAudioDevice(dev: TSDL_AudioDeviceID; pause_on: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PauseAudioDevice' {$ENDIF} {$ENDIF}; +{$endif} + +{*Pause audio functions*} + + {** + * Load the audio data of a WAVE file into memory. + * + * Loading a WAVE file requires `src`, `spec`, `audio_buf` and `audio_len` to + * be valid pointers. The entire data portion of the file is then loaded into + * memory and decoded if necessary. + * + * If `freesrc` is non-zero, the data source gets automatically closed and + * freed before the function returns. + * + * Supported formats are RIFF WAVE files with the formats PCM (8, 16, 24, and + * 32 bits), IEEE Float (32 bits), Microsoft ADPCM and IMA ADPCM (4 bits), and + * A-law and mu-law (8 bits). Other formats are currently unsupported and + * cause an error. + * + * If this function succeeds, the pointer returned by it is equal to `spec` + * and the pointer to the audio data allocated by the function is written to + * `audio_buf` and its length in bytes to `audio_len`. The SDL_AudioSpec + * members `freq`, `channels`, and `format` are set to the values of the audio + * data in the buffer. The `samples` member is set to a sane default and all + * others are set to zero. + * + * It's necessary to use SDL_FreeWAV() to free the audio data returned in + * `audio_buf` when it is no longer used. + * + * Because of the underspecification of the .WAV format, there are many + * problematic files in the wild that cause issues with strict decoders. To + * provide compatibility with these files, this decoder is lenient in regards + * to the truncation of the file, the fact chunk, and the size of the RIFF + * chunk. The hints `SDL_HINT_WAVE_RIFF_CHUNK_SIZE`, + * `SDL_HINT_WAVE_TRUNCATION`, and `SDL_HINT_WAVE_FACT_CHUNK` can be used to + * tune the behavior of the loading process. + * + * Any file that is invalid (due to truncation, corruption, or wrong values in + * the headers), too big, or unsupported causes an error. Additionally, any + * critical I/O error from the data source will terminate the loading process + * with an error. The function returns NULL on error and in all cases (with + * the exception of `src` being NULL), an appropriate error message will be + * set. + * + * It is required that the data source supports seeking. + * + * Example: + * + * ```c + * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, &spec, &buf, &len); + * ``` + * + * Note that the SDL_LoadWAV macro does this same thing for you, but in a less + * messy way: + * + * ```c + * SDL_LoadWAV("sample.wav", &spec, &buf, &len); + * ``` + * + * \param src The data source for the WAVE data + * \param freesrc If non-zero, SDL will _always_ free the data source + * \param spec An SDL_AudioSpec that will be filled in with the wave file's + * format details + * \param audio_buf A pointer filled with the audio data, allocated by the + * function. + * \param audio_len A pointer filled with the length of the audio data buffer + * in bytes + * \returns This function, if successfully called, returns `spec`, which will + * be filled with the audio data format of the wave source data. + * `audio_buf` will be filled with a pointer to an allocated buffer + * containing the audio data, and `audio_len` is filled with the + * length of that audio buffer in bytes. + * + * This function returns NULL if the .WAV file cannot be opened, uses + * an unknown data format, or is corrupt; call SDL_GetError() for + * more information. + * + * When the application is done with the data returned in + * `audio_buf`, it should call SDL_FreeWAV() to dispose of it. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_FreeWAV + * \sa SDL_LoadWAV + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LoadWAV_RW_fun = function(src: PSDL_RWops; + freesrc: cint; + spec: PSDL_AudioSpec; + audio_buf: ppcuint8; + audio_len: pcuint32): PSDL_AudioSpec; cdecl; +Var + SDL_LoadWAV_RW : TSDL_LoadWAV_RW_fun = Nil; +{$else} + +function SDL_LoadWAV_RW(src: PSDL_RWops; + freesrc: cint; + spec: PSDL_AudioSpec; + audio_buf: ppcuint8; + audio_len: pcuint32): PSDL_AudioSpec; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadWAV_RW' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Loads a WAV from a file. + * Compatibility convenience function. + *} +function SDL_LoadWAV(file_: PAnsiChar; spec: PSDL_AudioSpec; audio_buf: ppcuint8; audio_len: pcuint32): PSDL_AudioSpec; + +{** + * Free data previously allocated with SDL_LoadWAV() or SDL_LoadWAV_RW(). + * + * After a WAVE file has been opened with SDL_LoadWAV() or SDL_LoadWAV_RW() + * its data can eventually be freed with SDL_FreeWAV(). It is safe to call + * this function with a NULL pointer. + * + * \param audio_buf a pointer to the buffer created by SDL_LoadWAV() or + * SDL_LoadWAV_RW() + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_LoadWAV + * \sa SDL_LoadWAV_RW + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_FreeWAV_proc = procedure(audio_buf: pcuint8); cdecl; +Var + SDL_FreeWAV : TSDL_FreeWAV_proc = Nil; +{$else} + +procedure SDL_FreeWAV(audio_buf: pcuint8); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeWAV' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Initialize an SDL_AudioCVT structure for conversion. + * + * Before an SDL_AudioCVT structure can be used to convert audio data it must + * be initialized with source and destination information. + * + * This function will zero out every field of the SDL_AudioCVT, so it must be + * called before the application fills in the final buffer information. + * + * Once this function has returned successfully, and reported that a + * conversion is necessary, the application fills in the rest of the fields in + * SDL_AudioCVT, now that it knows how large a buffer it needs to allocate, + * and then can call SDL_ConvertAudio() to complete the conversion. + * + * \param cvt an SDL_AudioCVT structure filled in with audio conversion + * information + * \param src_format the source format of the audio data; for more info see + * SDL_AudioFormat + * \param src_channels the number of channels in the source + * \param src_rate the frequency (sample-frames-per-second) of the source + * \param dst_format the destination format of the audio data; for more info + * see SDL_AudioFormat + * \param dst_channels the number of channels in the destination + * \param dst_rate the frequency (sample-frames-per-second) of the destination + * \returns 1 if the audio filter is prepared, 0 if no conversion is needed, + * or a negative error code on failure; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_ConvertAudio + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_BuildAudioCVT_fun = function(cvt: PSDL_AudioCVT; + src_format: TSDL_AudioFormat; + src_channels: cuint8; + src_rate: cint; + dst_format: TSDL_AudioFormat; + dst_channels: cuint8; + dst_rate: cint): cint; cdecl; +Var + SDL_BuildAudioCVT : TSDL_BuildAudioCVT_fun = Nil; +{$else} + +function SDL_BuildAudioCVT(cvt: PSDL_AudioCVT; + src_format: TSDL_AudioFormat; + src_channels: cuint8; + src_rate: cint; + dst_format: TSDL_AudioFormat; + dst_channels: cuint8; + dst_rate: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_BuildAudioCVT' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Convert audio data to a desired audio format. + * + * This function does the actual audio data conversion, after the application + * has called SDL_BuildAudioCVT() to prepare the conversion information and + * then filled in the buffer details. + * + * Once the application has initialized the `cvt` structure using + * SDL_BuildAudioCVT(), allocated an audio buffer and filled it with audio + * data in the source format, this function will convert the buffer, in-place, + * to the desired format. + * + * The data conversion may go through several passes; any given pass may + * possibly temporarily increase the size of the data. For example, SDL might + * expand 16-bit data to 32 bits before resampling to a lower frequency, + * shrinking the data size after having grown it briefly. Since the supplied + * buffer will be both the source and destination, converting as necessary + * in-place, the application must allocate a buffer that will fully contain + * the data during its largest conversion pass. After SDL_BuildAudioCVT() + * returns, the application should set the `cvt->len` field to the size, in + * bytes, of the source data, and allocate a buffer that is `cvt->len * + * cvt->len_mult` bytes long for the `buf` field. + * + * The source data should be copied into this buffer before the call to + * SDL_ConvertAudio(). Upon successful return, this buffer will contain the + * converted audio, and `cvt->len_cvt` will be the size of the converted data, + * in bytes. Any bytes in the buffer past `cvt->len_cvt` are undefined once + * this function returns. + * + * \param cvt an SDL_AudioCVT structure that was previously set up by + * SDL_BuildAudioCVT(). + * \returns 0 if the conversion was completed successfully or a negative error + * code on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_BuildAudioCVT + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ConvertAudio_fun = function(cvt: PSDL_AudioCVT): cint; cdecl; +Var + SDL_ConvertAudio : TSDL_ConvertAudio_fun = Nil; +{$else} + +function SDL_ConvertAudio(cvt: PSDL_AudioCVT): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ConvertAudio' {$ENDIF} {$ENDIF}; +{$endif} + +{ SDL_AudioStream is a new audio conversion interface. + The benefits vs SDL_AudioCVT: + - it can handle resampling data in chunks without generating + artifacts, when it doesn't have the complete buffer available. + - it can handle incoming data in any variable size. + - You push data as you have it, and pull it when you need it + } +{ this is opaque to the outside world. } +type + PSDL_AudioStream = type Pointer; + +{* + * Create a new audio stream. + * + * \param src_format The format of the source audio + * \param src_channels The number of channels of the source audio + * \param src_rate The sampling rate of the source audio + * \param dst_format The format of the desired audio output + * \param dst_channels The number of channels of the desired audio output + * \param dst_rate The sampling rate of the desired audio output + * \returns 0 on success, or -1 on error. + * + * \since This function is available since SDL 2.0.7. + * + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_NewAudioStream_fun = function(src_format: TSDL_AudioFormat; src_channels: cuint8; src_rate: cint; dst_format: TSDL_AudioFormat; dst_channels: cuint8; + dst_rate: cint): PSDL_AudioStream; cdecl; +Var + SDL_NewAudioStream : TSDL_NewAudioStream_fun = Nil; +{$else} + +function SDL_NewAudioStream(src_format: TSDL_AudioFormat; src_channels: cuint8; src_rate: cint; dst_format: TSDL_AudioFormat; dst_channels: cuint8; + dst_rate: cint): PSDL_AudioStream; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_NewAudioStream' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Add data to be converted/resampled to the stream. + * + * \param stream The stream the audio data is being added to + * \param buf A pointer to the audio data to add + * \param len The number of bytes to write to the stream + * \returns 0 on success, or -1 on error. + * + * \since This function is available since SDL 2.0.7. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AudioStreamPut_fun = function(stream: PSDL_AudioStream; buf: pointer; len: cint): cint; cdecl; +Var + SDL_AudioStreamPut : TSDL_AudioStreamPut_fun = Nil; +{$else} + +function SDL_AudioStreamPut(stream: PSDL_AudioStream; buf: pointer; len: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioStreamPut' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get converted/resampled data from the stream + * + * \param stream The stream the audio is being requested from + * \param buf A buffer to fill with audio data + * \param len The maximum number of bytes to fill + * \returns the number of bytes read from the stream, or -1 on error + * + * \since This function is available since SDL 2.0.7. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AudioStreamGet_fun = function(stream: PSDL_AudioStream; buf: pointer; len: cint): cint; cdecl; +Var + SDL_AudioStreamGet : TSDL_AudioStreamGet_fun = Nil; +{$else} + +function SDL_AudioStreamGet(stream: PSDL_AudioStream; buf: pointer; len: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioStreamGet' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get the number of converted/resampled bytes available. + * + * The stream may be buffering data behind the scenes until it has enough to + * resample correctly, so this number might be lower than what you expect, or + * even be zero. Add more data or flush the stream if you need the data now. + * + * \since This function is available since SDL 2.0.7. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AudioStreamAvailable_fun = function(stream: PSDL_AudioStream): cint; cdecl; +Var + SDL_AudioStreamAvailable : TSDL_AudioStreamAvailable_fun = Nil; +{$else} + +function SDL_AudioStreamAvailable(stream: PSDL_AudioStream): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioStreamAvailable' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Tell the stream that you're done sending data, and anything being buffered + * should be converted/resampled and made available immediately. + * + * It is legal to add more data to a stream after flushing, but there will be + * audio gaps in the output. Generally this is intended to signal the end of + * input, so the complete output becomes available. + * + * \since This function is available since SDL 2.0.7. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AudioStreamFlush_fun = function(stream: PSDL_AudioStream): cint; cdecl; +Var + SDL_AudioStreamFlush : TSDL_AudioStreamFlush_fun = Nil; +{$else} + +function SDL_AudioStreamFlush(stream: PSDL_AudioStream): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioStreamFlush' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Clear any pending data in the stream without converting it + * + * \since This function is available since SDL 2.0.7. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_FreeAudioStream + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AudioStreamClear_proc = procedure(stream: PSDL_AudioStream); cdecl; +Var + SDL_AudioStreamClear : TSDL_AudioStreamClear_proc = Nil; +{$else} + +procedure SDL_AudioStreamClear(stream: PSDL_AudioStream); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioStreamClear' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Free an audio stream + * + * \since This function is available since SDL 2.0.7. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_FreeAudioStream_proc = procedure(stream: PSDL_AudioStream); cdecl; +Var + SDL_FreeAudioStream : TSDL_FreeAudioStream_proc = Nil; +{$else} + +procedure SDL_FreeAudioStream(stream: PSDL_AudioStream); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeAudioStream' {$ENDIF} {$ENDIF}; +{$endif} + +const + SDL_MIX_MAXVOLUME = 128; + +{** + * This function is a legacy means of mixing audio. + * + * This function is equivalent to calling... + * + * ```c + * SDL_MixAudioFormat(dst, src, format, len, volume); + * ``` + * + * ...where `format` is the obtained format of the audio device from the + * legacy SDL_OpenAudio() function. + * + * \param dst the destination for the mixed audio + * \param src the source audio buffer to be mixed + * \param len the length of the audio buffer in bytes + * \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME + * for full audio volume + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_MixAudioFormat + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_MixAudio_proc = procedure(dst: pcuint8; src: pcuint8; len: cuint32; volume: cint); cdecl; +Var + SDL_MixAudio : TSDL_MixAudio_proc = Nil; +{$else} + +procedure SDL_MixAudio(dst: pcuint8; src: pcuint8; len: cuint32; volume: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MixAudio' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Mix audio data in a specified format. + * + * This takes an audio buffer `src` of `len` bytes of `format` data and mixes + * it into `dst`, performing addition, volume adjustment, and overflow + * clipping. The buffer pointed to by `dst` must also be `len` bytes of + * `format` data. + * + * This is provided for convenience -- you can mix your own audio data. + * + * Do not use this function for mixing together more than two streams of + * sample data. The output from repeated application of this function may be + * distorted by clipping, because there is no accumulator with greater range + * than the input (not to mention this being an inefficient way of doing it). + * + * It is a common misconception that this function is required to write audio + * data to an output stream in an audio callback. While you can do that, + * SDL_MixAudioFormat() is really only needed when you're mixing a single + * audio stream with a volume adjustment. + * + * \param dst the destination for the mixed audio + * \param src the source audio buffer to be mixed + * \param format the SDL_AudioFormat structure representing the desired audio + * format + * \param len the length of the audio buffer in bytes + * \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME + * for full audio volume + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_MixAudioFormat_proc = procedure(dst: pcuint8; src: pcuint8; format: TSDL_AudioFormat; len: cuint32; volume: cint); cdecl; +Var + SDL_MixAudioFormat : TSDL_MixAudioFormat_proc = Nil; +{$else} + +procedure SDL_MixAudioFormat(dst: pcuint8; src: pcuint8; format: TSDL_AudioFormat; len: cuint32; volume: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MixAudioFormat' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Queue more audio on non-callback devices. + * + * If you are looking to retrieve queued audio from a non-callback capture + * device, you want SDL_DequeueAudio() instead. SDL_QueueAudio() will return + * -1 to signify an error if you use it with capture devices. + * + * SDL offers two ways to feed audio to the device: you can either supply a + * callback that SDL triggers with some frequency to obtain more audio (pull + * method), or you can supply no callback, and then SDL will expect you to + * supply data at regular intervals (push method) with this function. + * + * There are no limits on the amount of data you can queue, short of + * exhaustion of address space. Queued data will drain to the device as + * necessary without further intervention from you. If the device needs audio + * but there is not enough queued, it will play silence to make up the + * difference. This means you will have skips in your audio playback if you + * aren't routinely queueing sufficient data. + * + * This function copies the supplied data, so you are safe to free it when the + * function returns. This function is thread-safe, but queueing to the same + * device from two threads at once does not promise which buffer will be + * queued first. + * + * You may not queue audio on a device that is using an application-supplied + * callback; doing so returns an error. You have to use the audio callback or + * queue audio with this function, but not both. + * + * You should not call SDL_LockAudio() on the device before queueing; SDL + * handles locking internally for this function. + * + * Note that SDL2 does not support planar audio. You will need to resample + * from planar audio formats into a non-planar one (see SDL_AudioFormat) + * before queuing audio. + * + * \param dev the device ID to which we will queue audio + * \param data the data to queue to the device for later playback + * \param len the number of bytes (not samples!) to which `data` points + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.4. + * + * \sa SDL_ClearQueuedAudio + * \sa SDL_GetQueuedAudioSize + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_QueueAudio_fun = function(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): cint; cdecl; +Var + SDL_QueueAudio : TSDL_QueueAudio_fun = Nil; +{$else} + +function SDL_QueueAudio(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_QueueAudio' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Dequeue more audio on non-callback devices. + * + * If you are looking to queue audio for output on a non-callback playback + * device, you want SDL_QueueAudio() instead. SDL_DequeueAudio() will always + * return 0 if you use it with playback devices. + * + * SDL offers two ways to retrieve audio from a capture device: you can either + * supply a callback that SDL triggers with some frequency as the device + * records more audio data, (push method), or you can supply no callback, and + * then SDL will expect you to retrieve data at regular intervals (pull + * method) with this function. + * + * There are no limits on the amount of data you can queue, short of + * exhaustion of address space. Data from the device will keep queuing as + * necessary without further intervention from you. This means you will + * eventually run out of memory if you aren't routinely dequeueing data. + * + * Capture devices will not queue data when paused; if you are expecting to + * not need captured audio for some length of time, use SDL_PauseAudioDevice() + * to stop the capture device from queueing more data. This can be useful + * during, say, level loading times. When unpaused, capture devices will start + * queueing data from that point, having flushed any capturable data available + * while paused. + * + * This function is thread-safe, but dequeueing from the same device from two + * threads at once does not promise which thread will dequeue data first. + * + * You may not dequeue audio from a device that is using an + * application-supplied callback; doing so returns an error. You have to use + * the audio callback, or dequeue audio with this function, but not both. + * + * You should not call SDL_LockAudio() on the device before dequeueing; SDL + * handles locking internally for this function. + * + * \param dev the device ID from which we will dequeue audio + * \param data a pointer into where audio data should be copied + * \param len the number of bytes (not samples!) to which (data) points + * \returns the number of bytes dequeued, which could be less than requested; + * call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.5. + * + * \sa SDL_ClearQueuedAudio + * \sa SDL_GetQueuedAudioSize + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_DequeueAudio_fun = function(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): cuint32; cdecl; +Var + SDL_DequeueAudio : TSDL_DequeueAudio_fun = Nil; +{$else} + +function SDL_DequeueAudio(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DequeueAudio' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the number of bytes of still-queued audio. + * + * For playback devices: this is the number of bytes that have been queued for + * playback with SDL_QueueAudio(), but have not yet been sent to the hardware. + * + * Once we've sent it to the hardware, this function can not decide the exact + * byte boundary of what has been played. It's possible that we just gave the + * hardware several kilobytes right before you called this function, but it + * hasn't played any of it yet, or maybe half of it, etc. + * + * For capture devices, this is the number of bytes that have been captured by + * the device and are waiting for you to dequeue. This number may grow at any + * time, so this only informs of the lower-bound of available data. + * + * You may not queue or dequeue audio on a device that is using an + * application-supplied callback; calling this function on such a device + * always returns 0. You have to use the audio callback or queue audio, but + * not both. + * + * You should not call SDL_LockAudio() on the device before querying; SDL + * handles locking internally for this function. + * + * \param dev the device ID of which we will query queued audio size + * \returns the number of bytes (not samples!) of queued audio. + * + * \since This function is available since SDL 2.0.4. + * + * \sa SDL_ClearQueuedAudio + * \sa SDL_QueueAudio + * \sa SDL_DequeueAudio + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetQueuedAudioSize_fun = function(dev: TSDL_AudioDeviceID): cuint32; cdecl; +Var + SDL_GetQueuedAudioSize : TSDL_GetQueuedAudioSize_fun = Nil; +{$else} + +function SDL_GetQueuedAudioSize(dev: TSDL_AudioDeviceID): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetQueuedAudioSize' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Drop any queued audio data waiting to be sent to the hardware. + * + * Immediately after this call, SDL_GetQueuedAudioSize() will return 0. For + * output devices, the hardware will start playing silence if more audio isn't + * queued. For capture devices, the hardware will start filling the empty + * queue with new data if the capture device isn't paused. + * + * This will not prevent playback of queued audio that's already been sent to + * the hardware, as we can not undo that, so expect there to be some fraction + * of a second of audio that might still be heard. This can be useful if you + * want to, say, drop any pending music or any unprocessed microphone input + * during a level change in your game. + * + * You may not queue or dequeue audio on a device that is using an + * application-supplied callback; calling this function on such a device + * always returns 0. You have to use the audio callback or queue audio, but + * not both. + * + * You should not call SDL_LockAudio() on the device before clearing the + * queue; SDL handles locking internally for this function. + * + * This function always succeeds and thus returns void. + * + * \param dev the device ID of which to clear the audio queue + * + * \since This function is available since SDL 2.0.4. + * + * \sa SDL_GetQueuedAudioSize + * \sa SDL_QueueAudio + * \sa SDL_DequeueAudio + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ClearQueuedAudio_proc = procedure(dev: TSDL_AudioDeviceID); cdecl; +Var + SDL_ClearQueuedAudio : TSDL_ClearQueuedAudio_proc = Nil; +{$else} + +procedure SDL_ClearQueuedAudio(dev: TSDL_AudioDeviceID); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ClearQueuedAudio' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Audio lock functions + * + * The lock manipulated by these functions protects the callback function. + * During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that + * the callback function is not running. Do not call these from the callback + * function or you will cause deadlock. + *} + +{** + * This function is a legacy means of locking the audio device. + * + * New programs might want to use SDL_LockAudioDevice() instead. This function + * is equivalent to calling... + * + * ```c + * SDL_LockAudioDevice(1); + * ``` + * + * ...and is only useful if you used the legacy SDL_OpenAudio() function. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_LockAudioDevice + * \sa SDL_UnlockAudio + * \sa SDL_UnlockAudioDevice + *} +procedure SDL_LockAudio; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockAudio' {$ENDIF} {$ENDIF}; + +{** + * Use this function to lock out the audio callback function for a specified + * device. + * + * The lock manipulated by these functions protects the audio callback + * function specified in SDL_OpenAudioDevice(). During a + * SDL_LockAudioDevice()/SDL_UnlockAudioDevice() pair, you can be guaranteed + * that the callback function for that device is not running, even if the + * device is not paused. While a device is locked, any other unpaused, + * unlocked devices may still run their callbacks. + * + * Calling this function from inside your audio callback is unnecessary. SDL + * obtains this lock before calling your function, and releases it when the + * function returns. + * + * You should not hold the lock longer than absolutely necessary. If you hold + * it too long, you'll experience dropouts in your audio playback. Ideally, + * your application locks the device, sets a few variables and unlocks again. + * Do not do heavy work while holding the lock for a device. + * + * It is safe to lock the audio device multiple times, as long as you unlock + * it an equivalent number of times. The callback will not run until the + * device has been unlocked completely in this way. If your application fails + * to unlock the device appropriately, your callback will never run, you might + * hear repeating bursts of audio, and SDL_CloseAudioDevice() will probably + * deadlock. + * + * Internally, the audio device lock is a mutex; if you lock from two threads + * at once, not only will you block the audio callback, you'll block the other + * thread. + * + * \param dev the ID of the device to be locked + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_UnlockAudioDevice + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LockAudioDevice_proc = procedure(dev: TSDL_AudioDeviceID); cdecl; +Var + SDL_LockAudioDevice : TSDL_LockAudioDevice_proc = Nil; +{$else} + +procedure SDL_LockAudioDevice(dev: TSDL_AudioDeviceID); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockAudioDevice' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * This function is a legacy means of unlocking the audio device. + * + * New programs might want to use SDL_UnlockAudioDevice() instead. This + * function is equivalent to calling... + * + * ```c + * SDL_UnlockAudioDevice(1); + * ``` + * + * ...and is only useful if you used the legacy SDL_OpenAudio() function. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_LockAudio + * \sa SDL_UnlockAudioDevice + *} +procedure SDL_UnlockAudio; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Unlock' {$ENDIF} {$ENDIF}; + +{** + * Use this function to unlock the audio callback function for a specified + * device. + * + * This function should be paired with a previous SDL_LockAudioDevice() call. + * + * \param dev the ID of the device to be unlocked + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_LockAudioDevice + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UnlockAudioDevice_proc = procedure(dev: TSDL_AudioDeviceID); cdecl; +Var + SDL_UnlockAudioDevice : TSDL_UnlockAudioDevice_proc = Nil; +{$else} + +procedure SDL_UnlockAudioDevice(dev: TSDL_AudioDeviceID); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnlockAudioDevice' {$ENDIF} {$ENDIF}; +{$endif} + +{*Audio lock functions*} + +{** + * This function is a legacy means of closing the audio device. + * + * This function is equivalent to calling... + * + * ```c + * SDL_CloseAudioDevice(1); + * ``` + * + * ...and is only useful if you used the legacy SDL_OpenAudio() function. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_OpenAudio + *} +procedure SDL_CloseAudio; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CloseAudio' {$ENDIF} {$ENDIF}; + +{** + * Use this function to shut down audio processing and close the audio device. + * + * The application should close open audio devices once they are no longer + * needed. Calling this function will wait until the device's audio callback + * is not running, release the audio hardware and then clean up internal + * state. No further audio will play from this device once this function + * returns. + * + * This function may block briefly while pending audio data is played by the + * hardware, so that applications don't drop the last buffer of data they + * supplied. + * + * The device ID is invalid as soon as the device is closed, and is eligible + * for reuse in a new SDL_OpenAudioDevice() call immediately. + * + * \param dev an audio device previously opened with SDL_OpenAudioDevice() + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_OpenAudioDevice + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CloseAudioDevice_proc = procedure(dev: TSDL_AudioDeviceID); cdecl; +Var + SDL_CloseAudioDevice : TSDL_CloseAudioDevice_proc = Nil; +{$else} + +procedure SDL_CloseAudioDevice(dev: TSDL_AudioDeviceID); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CloseAudioDevice' {$ENDIF} {$ENDIF}; +{$endif} + diff --git a/units/sdlblendmode.inc b/units/sdlblendmode.inc index 4a6fcb4d..9129c804 100644 --- a/units/sdlblendmode.inc +++ b/units/sdlblendmode.inc @@ -1,90 +1,90 @@ -//from "sdl_blendmode.h" - -{** - * The blend mode used in SDL_RenderCopy() and drawing operations. - *} - -type - PPSDL_BlendMode = ^PSDL_BlendMode; - PSDL_BlendMode = ^TSDL_BlendMode; - TSDL_BlendMode = type DWord; - -const - SDL_BLENDMODE_NONE = TSDL_BlendMode($00000000); {**< no blending - dstRGBA = srcRGBA *} - SDL_BLENDMODE_BLEND = TSDL_BlendMode($00000001); {**< alpha blending - dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)) - dstA = srcA + (dstA * (1-srcA)) *} - SDL_BLENDMODE_ADD = TSDL_BlendMode($00000002); {**< additive blending - dstRGB = (srcRGB * srcA) + dstRGB - dstA = dstA *} - SDL_BLENDMODE_MOD = TSDL_BlendMode($00000004); {**< color modulate - dstRGB = srcRGB * dstRGB - dstA = dstA *} - SDL_BLENDMODE_MUL = TSDL_BlendMode($00000008); {**< color multiply - dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)) - dstA = (srcA * dstA) + (dstA * (1-srcA)) *} - SDL_BLENDMODE_INVALID = TSDL_BlendMode($7FFFFFFF); { } - - {* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() *} - - {** - * \brief The blend operation used when combining source and destination pixel components - *} -type - PPSDL_BlendOperation = ^PSDL_BlendOperation; - PSDL_BlendOperation = ^TSDL_BlendOperation; - TSDL_BlendOperation = type DWord; - -const - SDL_BLENDOPERATION_ADD = TSDL_BlendOperation($1); {**< dst + src: supported by all renderers *} - SDL_BLENDOPERATION_SUBTRACT = TSDL_BlendOperation($2); {**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES} - SDL_BLENDOPERATION_REV_SUBTRACT = TSDL_BlendOperation($3); {**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES} - SDL_BLENDOPERATION_MINIMUM = TSDL_BlendOperation($4); {**< min(dst, src) : supported by D3D11 *} - SDL_BLENDOPERATION_MAXIMUM = TSDL_BlendOperation($5); {**< max(dst, src) : supported by D3D11 *} - - {** - * \brief The normalized factor used to multiply pixel components - *} -type - PPSDL_BlendFactor = ^PSDL_BlendFactor; - PSDL_BlendFactor = ^TSDL_BlendFactor; - TSDL_BlendFactor = type DWord; - -const - SDL_BLENDFACTOR_ZERO = TSDL_BlendFactor($1); {**< 0, 0, 0, 0 *} - SDL_BLENDFACTOR_ONE = TSDL_BlendFactor($2); {**< 1, 1, 1, 1 *} - SDL_BLENDFACTOR_SRC_COLOR = TSDL_BlendFactor($3); {**< srcR, srcG, srcB, srcA *} - SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = TSDL_BlendFactor($4); {**< 1-srcR, 1-srcG, 1-srcB, 1-srcA *} - SDL_BLENDFACTOR_SRC_ALPHA = TSDL_BlendFactor($5); {**< srcA, srcA, srcA, srcA *} - SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = TSDL_BlendFactor($6); {**< 1-srcA, 1-srcA, 1-srcA, 1-srcA *} - SDL_BLENDFACTOR_DST_COLOR = TSDL_BlendFactor($7); {**< dstR, dstG, dstB, dstA *} - SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = TSDL_BlendFactor($8); {**< 1-dstR, 1-dstG, 1-dstB, 1-dstA *} - SDL_BLENDFACTOR_DST_ALPHA = TSDL_BlendFactor($9); {**< dstA, dstA, dstA, dstA *} - SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = TSDL_BlendFactor($A); {**< 1-dstA, 1-dstA, 1-dstA, 1-dstA *} - -{** - * \brief Create a custom blend mode, which may or may not be supported by a given renderer - * - * \param srcColorFactor source color factor - * \param dstColorFactor destination color factor - * \param colorOperation color operation - * \param srcAlphaFactor source alpha factor - * \param dstAlphaFactor destination alpha factor - * \param alphaOperation alpha operation - * - * The result of the blend mode operation will be: - * dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor - * and - * dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_ComposeCustomBlendMode_fun = function(srcColorFactor, dstColorFactor: TSDL_BlendFactor; colorOperation: TSDL_BlendOperation; srcAlphaFactor, dstAlphaFactor: TSDL_BlendFactor; alphaOperation: TSDL_BlendOperation): TSDL_BlendMode; cdecl; -Var - SDL_ComposeCustomBlendMode : TSDL_ComposeCustomBlendMode_fun = Nil; -{$else} - -function SDL_ComposeCustomBlendMode(srcColorFactor, dstColorFactor: TSDL_BlendFactor; colorOperation: TSDL_BlendOperation; srcAlphaFactor, dstAlphaFactor: TSDL_BlendFactor; alphaOperation: TSDL_BlendOperation): TSDL_BlendMode; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ComposeCustomBlendMode' {$ENDIF} {$ENDIF}; -{$endif} +//from "sdl_blendmode.h" + +{** + * The blend mode used in SDL_RenderCopy() and drawing operations. + *} + +type + PPSDL_BlendMode = ^PSDL_BlendMode; + PSDL_BlendMode = ^TSDL_BlendMode; + TSDL_BlendMode = type DWord; + +const + SDL_BLENDMODE_NONE = TSDL_BlendMode($00000000); {**< no blending + dstRGBA = srcRGBA *} + SDL_BLENDMODE_BLEND = TSDL_BlendMode($00000001); {**< alpha blending + dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)) + dstA = srcA + (dstA * (1-srcA)) *} + SDL_BLENDMODE_ADD = TSDL_BlendMode($00000002); {**< additive blending + dstRGB = (srcRGB * srcA) + dstRGB + dstA = dstA *} + SDL_BLENDMODE_MOD = TSDL_BlendMode($00000004); {**< color modulate + dstRGB = srcRGB * dstRGB + dstA = dstA *} + SDL_BLENDMODE_MUL = TSDL_BlendMode($00000008); {**< color multiply + dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)) + dstA = (srcA * dstA) + (dstA * (1-srcA)) *} + SDL_BLENDMODE_INVALID = TSDL_BlendMode($7FFFFFFF); { } + + {* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() *} + + {** + * \brief The blend operation used when combining source and destination pixel components + *} +type + PPSDL_BlendOperation = ^PSDL_BlendOperation; + PSDL_BlendOperation = ^TSDL_BlendOperation; + TSDL_BlendOperation = type DWord; + +const + SDL_BLENDOPERATION_ADD = TSDL_BlendOperation($1); {**< dst + src: supported by all renderers *} + SDL_BLENDOPERATION_SUBTRACT = TSDL_BlendOperation($2); {**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES} + SDL_BLENDOPERATION_REV_SUBTRACT = TSDL_BlendOperation($3); {**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES} + SDL_BLENDOPERATION_MINIMUM = TSDL_BlendOperation($4); {**< min(dst, src) : supported by D3D11 *} + SDL_BLENDOPERATION_MAXIMUM = TSDL_BlendOperation($5); {**< max(dst, src) : supported by D3D11 *} + + {** + * \brief The normalized factor used to multiply pixel components + *} +type + PPSDL_BlendFactor = ^PSDL_BlendFactor; + PSDL_BlendFactor = ^TSDL_BlendFactor; + TSDL_BlendFactor = type DWord; + +const + SDL_BLENDFACTOR_ZERO = TSDL_BlendFactor($1); {**< 0, 0, 0, 0 *} + SDL_BLENDFACTOR_ONE = TSDL_BlendFactor($2); {**< 1, 1, 1, 1 *} + SDL_BLENDFACTOR_SRC_COLOR = TSDL_BlendFactor($3); {**< srcR, srcG, srcB, srcA *} + SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = TSDL_BlendFactor($4); {**< 1-srcR, 1-srcG, 1-srcB, 1-srcA *} + SDL_BLENDFACTOR_SRC_ALPHA = TSDL_BlendFactor($5); {**< srcA, srcA, srcA, srcA *} + SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = TSDL_BlendFactor($6); {**< 1-srcA, 1-srcA, 1-srcA, 1-srcA *} + SDL_BLENDFACTOR_DST_COLOR = TSDL_BlendFactor($7); {**< dstR, dstG, dstB, dstA *} + SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = TSDL_BlendFactor($8); {**< 1-dstR, 1-dstG, 1-dstB, 1-dstA *} + SDL_BLENDFACTOR_DST_ALPHA = TSDL_BlendFactor($9); {**< dstA, dstA, dstA, dstA *} + SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = TSDL_BlendFactor($A); {**< 1-dstA, 1-dstA, 1-dstA, 1-dstA *} + +{** + * \brief Create a custom blend mode, which may or may not be supported by a given renderer + * + * \param srcColorFactor source color factor + * \param dstColorFactor destination color factor + * \param colorOperation color operation + * \param srcAlphaFactor source alpha factor + * \param dstAlphaFactor destination alpha factor + * \param alphaOperation alpha operation + * + * The result of the blend mode operation will be: + * dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor + * and + * dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ComposeCustomBlendMode_fun = function(srcColorFactor, dstColorFactor: TSDL_BlendFactor; colorOperation: TSDL_BlendOperation; srcAlphaFactor, dstAlphaFactor: TSDL_BlendFactor; alphaOperation: TSDL_BlendOperation): TSDL_BlendMode; cdecl; +Var + SDL_ComposeCustomBlendMode : TSDL_ComposeCustomBlendMode_fun = Nil; +{$else} + +function SDL_ComposeCustomBlendMode(srcColorFactor, dstColorFactor: TSDL_BlendFactor; colorOperation: TSDL_BlendOperation; srcAlphaFactor, dstAlphaFactor: TSDL_BlendFactor; alphaOperation: TSDL_BlendOperation): TSDL_BlendMode; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ComposeCustomBlendMode' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlclipboard.inc b/units/sdlclipboard.inc index 2534c1de..470d9837 100644 --- a/units/sdlclipboard.inc +++ b/units/sdlclipboard.inc @@ -1,153 +1,153 @@ - -{* - * \file SDL_clipboard.h - * - * Include file for SDL clipboard handling - } - -{* Function prototypes *} - -{* - * Put UTF-8 text into the clipboard. - * - * \param text the text to store in the clipboard - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetClipboardText - * \sa SDL_HasClipboardText - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetClipboardText_fun = function(text: PAnsiChar): cint; cdecl; -Var - SDL_SetClipboardText : TSDL_SetClipboardText_fun = Nil; -{$else} - -function SDL_SetClipboardText(text: PAnsiChar): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetClipboardText' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Get UTF-8 text from the clipboard, which must be freed with SDL_free(). - * - * This functions returns empty string if there was not enough memory left for - * a copy of the clipboard's content. - * - * \returns the clipboard text on success or an empty string on failure; call - * SDL_GetError() for more information. Caller must call SDL_free() - * on the returned pointer when done with it (even if there was an - * error). - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HasClipboardText - * \sa SDL_SetClipboardText - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetClipboardText_fun = function(): PAnsiChar; cdecl; -Var - SDL_GetClipboardText : TSDL_GetClipboardText_fun = Nil; -{$else} - -function SDL_GetClipboardText(): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetClipboardText' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Query whether the clipboard exists and contains a non-empty text string. - * - * \returns SDL_TRUE if the clipboard has text, or SDL_FALSE if it does not. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetClipboardText - * \sa SDL_SetClipboardText - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HasClipboardText_fun = function(): TSDL_bool; cdecl; -Var - SDL_HasClipboardText : TSDL_HasClipboardText_fun = Nil; -{$else} - -function SDL_HasClipboardText(): TSDL_bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasClipboardText' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Put UTF-8 text into the primary selection. - * - * \param text the text to store in the primary selection - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.26.1. - * - * \sa SDL_GetPrimarySelectionText - * \sa SDL_HasPrimarySelectionText - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetPrimarySelectionText_fun = function(text: PAnsiChar): cint; cdecl; -Var - SDL_SetPrimarySelectionText : TSDL_SetPrimarySelectionText_fun = Nil; -{$else} - -function SDL_SetPrimarySelectionText(text: PAnsiChar): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetPrimarySelectionText' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Get UTF-8 text from the primary selection, which must be freed with - * SDL_free(). - * - * This functions returns empty string if there was not enough memory left for - * a copy of the primary selection's content. - * - * \returns the primary selection text on success or an empty string on - * failure; call SDL_GetError() for more information. Caller must - * call SDL_free() on the returned pointer when done with it (even if - * there was an error). - * - * \since This function is available since SDL 2.26.1. - * - * \sa SDL_HasPrimarySelectionText - * \sa SDL_SetPrimarySelectionText - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetPrimarySelectionText_fun = function(): PAnsiChar; cdecl; -Var - SDL_GetPrimarySelectionText : TSDL_GetPrimarySelectionText_fun = Nil; -{$else} - -function SDL_GetPrimarySelectionText(): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPrimarySelectionText' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Query whether the primary selection exists and contains a non-empty text - * string. - * - * \returns SDL_TRUE if the primary selection has text, or SDL_FALSE if it - * does not. - * - * \since This function is available since SDL 2.26.1. - * - * \sa SDL_GetPrimarySelectionText - * \sa SDL_SetPrimarySelectionText - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HasPrimarySelectionText_fun = function(): TSDL_bool; cdecl; -Var - SDL_HasPrimarySelectionText : TSDL_HasPrimarySelectionText_fun = Nil; -{$else} - -function SDL_HasPrimarySelectionText(): TSDL_bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasPrimarySelectionText' {$ENDIF} {$ENDIF}; -{$endif} + +{* + * \file SDL_clipboard.h + * + * Include file for SDL clipboard handling + } + +{* Function prototypes *} + +{* + * Put UTF-8 text into the clipboard. + * + * \param text the text to store in the clipboard + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetClipboardText + * \sa SDL_HasClipboardText + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetClipboardText_fun = function(text: PAnsiChar): cint; cdecl; +Var + SDL_SetClipboardText : TSDL_SetClipboardText_fun = Nil; +{$else} + +function SDL_SetClipboardText(text: PAnsiChar): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetClipboardText' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get UTF-8 text from the clipboard, which must be freed with SDL_free(). + * + * This functions returns empty string if there was not enough memory left for + * a copy of the clipboard's content. + * + * \returns the clipboard text on success or an empty string on failure; call + * SDL_GetError() for more information. Caller must call SDL_free() + * on the returned pointer when done with it (even if there was an + * error). + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HasClipboardText + * \sa SDL_SetClipboardText + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetClipboardText_fun = function(): PAnsiChar; cdecl; +Var + SDL_GetClipboardText : TSDL_GetClipboardText_fun = Nil; +{$else} + +function SDL_GetClipboardText(): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetClipboardText' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Query whether the clipboard exists and contains a non-empty text string. + * + * \returns SDL_TRUE if the clipboard has text, or SDL_FALSE if it does not. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetClipboardText + * \sa SDL_SetClipboardText + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HasClipboardText_fun = function(): TSDL_bool; cdecl; +Var + SDL_HasClipboardText : TSDL_HasClipboardText_fun = Nil; +{$else} + +function SDL_HasClipboardText(): TSDL_bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasClipboardText' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Put UTF-8 text into the primary selection. + * + * \param text the text to store in the primary selection + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.26.1. + * + * \sa SDL_GetPrimarySelectionText + * \sa SDL_HasPrimarySelectionText + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetPrimarySelectionText_fun = function(text: PAnsiChar): cint; cdecl; +Var + SDL_SetPrimarySelectionText : TSDL_SetPrimarySelectionText_fun = Nil; +{$else} + +function SDL_SetPrimarySelectionText(text: PAnsiChar): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetPrimarySelectionText' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get UTF-8 text from the primary selection, which must be freed with + * SDL_free(). + * + * This functions returns empty string if there was not enough memory left for + * a copy of the primary selection's content. + * + * \returns the primary selection text on success or an empty string on + * failure; call SDL_GetError() for more information. Caller must + * call SDL_free() on the returned pointer when done with it (even if + * there was an error). + * + * \since This function is available since SDL 2.26.1. + * + * \sa SDL_HasPrimarySelectionText + * \sa SDL_SetPrimarySelectionText + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetPrimarySelectionText_fun = function(): PAnsiChar; cdecl; +Var + SDL_GetPrimarySelectionText : TSDL_GetPrimarySelectionText_fun = Nil; +{$else} + +function SDL_GetPrimarySelectionText(): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPrimarySelectionText' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Query whether the primary selection exists and contains a non-empty text + * string. + * + * \returns SDL_TRUE if the primary selection has text, or SDL_FALSE if it + * does not. + * + * \since This function is available since SDL 2.26.1. + * + * \sa SDL_GetPrimarySelectionText + * \sa SDL_SetPrimarySelectionText + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HasPrimarySelectionText_fun = function(): TSDL_bool; cdecl; +Var + SDL_HasPrimarySelectionText : TSDL_HasPrimarySelectionText_fun = Nil; +{$else} + +function SDL_HasPrimarySelectionText(): TSDL_bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasPrimarySelectionText' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlcpuinfo.inc b/units/sdlcpuinfo.inc index e9b99b04..f2c158dd 100644 --- a/units/sdlcpuinfo.inc +++ b/units/sdlcpuinfo.inc @@ -1,223 +1,223 @@ - -{* - * This is a guess for the cacheline size used for padding. - * Most x86 processors have a 64 byte cache line. - * The 64-bit PowerPC processors have a 128 byte cache line. - * We'll use the larger value to be generally safe. - *} -const - SDL_CACHELINE_SIZE = 128; - -{** - * This function returns the number of CPU cores available. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetCPUCount_fun = function(): cint; cdecl; -Var - SDL_GetCPUCount : TSDL_GetCPUCount_fun = Nil; -{$else} - -function SDL_GetCPUCount(): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCPUCount' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * This function returns the L1 cache line size of the CPU. - * - * This is useful for determining multi-threaded structure padding - * or SIMD prefetch sizes. - *} -function SDL_GetCPUCacheLineSize(): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCPUCacheLineSize' {$ENDIF} {$ENDIF}; - -{** - * This function returns true if the CPU has the RDTSC instruction. - * - * This always returns false on CPUs that aren't using Intel instruction sets. - *} -function SDL_HasRDTSC(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasRDTSC' {$ENDIF} {$ENDIF}; - -{** - * This function returns true if the CPU has AltiVec features. - * - * This always returns false on CPUs that aren't using PowerPC - * instruction sets. - *} -function SDL_HasAltiVec(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasAltiVec' {$ENDIF} {$ENDIF}; - -{** - * This function returns true if the CPU has MMX features. - * - * This always returns false on CPUs that aren't using Intel instruction sets. - *} -function SDL_HasMMX(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasMMX' {$ENDIF} {$ENDIF}; - -{** - * This function returns true if the CPU has 3DNow! features. - * - * This always returns false on CPUs that aren't using AMD instruction sets. - *} -function SDL_Has3DNow(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Has3DNow' {$ENDIF} {$ENDIF}; - -{** - * This function returns true if the CPU has SSE features. - * - * This always returns false on CPUs that aren't using Intel instruction sets. - *} -function SDL_HasSSE(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSSE' {$ENDIF} {$ENDIF}; - -{** - * This function returns true if the CPU has SSE2 features. - * - * This always returns false on CPUs that aren't using Intel instruction sets. - *} -function SDL_HasSSE2(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSSE2' {$ENDIF} {$ENDIF}; - -{** - * This function returns true if the CPU has SSE3 features. - * - * This always returns false on CPUs that aren't using Intel instruction sets. - *} -function SDL_HasSSE3(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSSE3' {$ENDIF} {$ENDIF}; - -{** - * This function returns true if the CPU has SSE4.1 features. - * - * This always returns false on CPUs that aren't using Intel instruction sets. - *} -function SDL_HasSSE41(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSSE41' {$ENDIF} {$ENDIF}; - -{** - * This function returns true if the CPU has SSE4.2 features. - * - * This always returns false on CPUs that aren't using Intel instruction sets. - *} -function SDL_HasSSE42(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSSE42' {$ENDIF} {$ENDIF}; - -{** - * This function returns true if the CPU has AVX features. - * - * This always returns false on CPUs that aren't using Intel instruction sets. - *} -function SDL_HasAVX(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasAVX' {$ENDIF} {$ENDIF}; - -{** - * This function returns true if the CPU has AVX2 features. - * - * This always returns false on CPUs that aren't using Intel instruction sets. - *} -function SDL_HasAVX2(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasAVX2' {$ENDIF} {$ENDIF}; - -{** - * Determine whether the CPU has AVX-512F (foundation) features. - * - * This always returns false on CPUs that aren't using Intel instruction sets. - *} -function SDL_HasAVX512F(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasAVX512F' {$ENDIF} {$ENDIF}; - -{** - * Determine whether the CPU has ARM SIMD (ARMv6) features. - * This is different from ARM NEON, which is a different instruction set. - * - * This always returns false on CPUs that aren't using ARM instruction sets. - *} -function SDL_HasARMSIMD(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasARMSIMD' {$ENDIF} {$ENDIF}; - -{** - * Determine whether the CPU has NEON (ARM SIMD) features. - * - * This always returns false on CPUs that aren't using ARM instruction sets. - *} -function SDL_HasNEON(): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasNEON' {$ENDIF} {$ENDIF}; - -{** - * This function returns the amount of RAM configured in the system, in MB. - *} -function SDL_GetSystemRAM(): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetSystemRAM' {$ENDIF} {$ENDIF}; - -{** - * Report the alignment this system needs for SIMD allocations. - * - * This will return the minimum number of bytes to which a pointer must be - * aligned to be compatible with SIMD instructions on the current machine. For - * example, if the machine supports SSE only, it will return 16, but if it - * supports AVX-512F, it'll return 64 (etc). This only reports values for - * instruction sets SDL knows about, so if your SDL build doesn't have - * SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and - * not 64 for the AVX-512 instructions that exist but SDL doesn't know about. - * Plan accordingly. - *} -function SDL_SIMDGetAlignment(): csize_t; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SIMDGetAlignment' {$ENDIF} {$ENDIF}; - -{* - * Allocate memory in a SIMD-friendly way. - * - * This will allocate a block of memory that is suitable for use with SIMD - * instructions. Specifically, it will be properly aligned and padded for the - * system's supported vector instructions. - * - * The memory returned will be padded such that it is safe to read or write an - * incomplete vector at the end of the memory block. This can be useful so you - * don't have to drop back to a scalar fallback at the end of your SIMD - * processing loop to deal with the final elements without overflowing the - * allocated buffer. - * - * You must free this memory with SDL_FreeSIMD(), not free() or SDL_free(). - * - * Note that SDL will only deal with SIMD instruction sets it is aware of; for - * example, SDL 2.0.8 knows that SSE wants 16-byte vectors (SDL_HasSSE()), and - * AVX2 wants 32 bytes (SDL_HasAVX2()), but doesn't know that AVX-512 wants - * 64. To be clear: if you can't decide to use an instruction set with an - * SDL_Has*() function, don't use that instruction set with memory allocated - * through here. - * - * SDL_AllocSIMD(0) will return a non-NULL pointer, assuming the system isn't - * out of memory, but you are not allowed to dereference it (because you only - * own zero bytes of that buffer). - *} -function SDL_SIMDAlloc(const len: csize_t): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SIMDAlloc' {$ENDIF} {$ENDIF}; - -{** - * Reallocate memory obtained from SDL_SIMDAlloc. - * - * It is not valid to use this function on a pointer from anything but - * SDL_SIMDAlloc(). It can't be used on pointers from SDL_malloc, GetMem, etc. - *} -function SDL_SIMDRealloc(mem: Pointer; const len: csize_t): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SIMDRealloc' {$ENDIF} {$ENDIF}; - -{** - * Deallocate memory obtained from SDL_SIMDAlloc. - * - * It is not valid to use this function on a pointer from anything but - * SDL_SIMDAlloc() or SDL_SIMDRealloc(). It can't be used on pointers from - * SDL_malloc, GetMem, etc. - * - * However, SDL_SIMDFree(NIL) is a legal no-op. - * - * The memory pointed to by `mem` is no longer valid for access upon return, - * and may be returned to the system or reused by a future allocation. The - * pointer passed to this function is no longer safe to dereference once this - * function returns, and should be discarded. - *} -procedure SDL_SIMDFree(mem: Pointer); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SIMDFree' {$ENDIF} {$ENDIF}; - + +{* + * This is a guess for the cacheline size used for padding. + * Most x86 processors have a 64 byte cache line. + * The 64-bit PowerPC processors have a 128 byte cache line. + * We'll use the larger value to be generally safe. + *} +const + SDL_CACHELINE_SIZE = 128; + +{** + * This function returns the number of CPU cores available. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetCPUCount_fun = function(): cint; cdecl; +Var + SDL_GetCPUCount : TSDL_GetCPUCount_fun = Nil; +{$else} + +function SDL_GetCPUCount(): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCPUCount' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * This function returns the L1 cache line size of the CPU. + * + * This is useful for determining multi-threaded structure padding + * or SIMD prefetch sizes. + *} +function SDL_GetCPUCacheLineSize(): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCPUCacheLineSize' {$ENDIF} {$ENDIF}; + +{** + * This function returns true if the CPU has the RDTSC instruction. + * + * This always returns false on CPUs that aren't using Intel instruction sets. + *} +function SDL_HasRDTSC(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasRDTSC' {$ENDIF} {$ENDIF}; + +{** + * This function returns true if the CPU has AltiVec features. + * + * This always returns false on CPUs that aren't using PowerPC + * instruction sets. + *} +function SDL_HasAltiVec(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasAltiVec' {$ENDIF} {$ENDIF}; + +{** + * This function returns true if the CPU has MMX features. + * + * This always returns false on CPUs that aren't using Intel instruction sets. + *} +function SDL_HasMMX(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasMMX' {$ENDIF} {$ENDIF}; + +{** + * This function returns true if the CPU has 3DNow! features. + * + * This always returns false on CPUs that aren't using AMD instruction sets. + *} +function SDL_Has3DNow(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Has3DNow' {$ENDIF} {$ENDIF}; + +{** + * This function returns true if the CPU has SSE features. + * + * This always returns false on CPUs that aren't using Intel instruction sets. + *} +function SDL_HasSSE(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSSE' {$ENDIF} {$ENDIF}; + +{** + * This function returns true if the CPU has SSE2 features. + * + * This always returns false on CPUs that aren't using Intel instruction sets. + *} +function SDL_HasSSE2(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSSE2' {$ENDIF} {$ENDIF}; + +{** + * This function returns true if the CPU has SSE3 features. + * + * This always returns false on CPUs that aren't using Intel instruction sets. + *} +function SDL_HasSSE3(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSSE3' {$ENDIF} {$ENDIF}; + +{** + * This function returns true if the CPU has SSE4.1 features. + * + * This always returns false on CPUs that aren't using Intel instruction sets. + *} +function SDL_HasSSE41(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSSE41' {$ENDIF} {$ENDIF}; + +{** + * This function returns true if the CPU has SSE4.2 features. + * + * This always returns false on CPUs that aren't using Intel instruction sets. + *} +function SDL_HasSSE42(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSSE42' {$ENDIF} {$ENDIF}; + +{** + * This function returns true if the CPU has AVX features. + * + * This always returns false on CPUs that aren't using Intel instruction sets. + *} +function SDL_HasAVX(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasAVX' {$ENDIF} {$ENDIF}; + +{** + * This function returns true if the CPU has AVX2 features. + * + * This always returns false on CPUs that aren't using Intel instruction sets. + *} +function SDL_HasAVX2(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasAVX2' {$ENDIF} {$ENDIF}; + +{** + * Determine whether the CPU has AVX-512F (foundation) features. + * + * This always returns false on CPUs that aren't using Intel instruction sets. + *} +function SDL_HasAVX512F(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasAVX512F' {$ENDIF} {$ENDIF}; + +{** + * Determine whether the CPU has ARM SIMD (ARMv6) features. + * This is different from ARM NEON, which is a different instruction set. + * + * This always returns false on CPUs that aren't using ARM instruction sets. + *} +function SDL_HasARMSIMD(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasARMSIMD' {$ENDIF} {$ENDIF}; + +{** + * Determine whether the CPU has NEON (ARM SIMD) features. + * + * This always returns false on CPUs that aren't using ARM instruction sets. + *} +function SDL_HasNEON(): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasNEON' {$ENDIF} {$ENDIF}; + +{** + * This function returns the amount of RAM configured in the system, in MB. + *} +function SDL_GetSystemRAM(): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetSystemRAM' {$ENDIF} {$ENDIF}; + +{** + * Report the alignment this system needs for SIMD allocations. + * + * This will return the minimum number of bytes to which a pointer must be + * aligned to be compatible with SIMD instructions on the current machine. For + * example, if the machine supports SSE only, it will return 16, but if it + * supports AVX-512F, it'll return 64 (etc). This only reports values for + * instruction sets SDL knows about, so if your SDL build doesn't have + * SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and + * not 64 for the AVX-512 instructions that exist but SDL doesn't know about. + * Plan accordingly. + *} +function SDL_SIMDGetAlignment(): csize_t; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SIMDGetAlignment' {$ENDIF} {$ENDIF}; + +{* + * Allocate memory in a SIMD-friendly way. + * + * This will allocate a block of memory that is suitable for use with SIMD + * instructions. Specifically, it will be properly aligned and padded for the + * system's supported vector instructions. + * + * The memory returned will be padded such that it is safe to read or write an + * incomplete vector at the end of the memory block. This can be useful so you + * don't have to drop back to a scalar fallback at the end of your SIMD + * processing loop to deal with the final elements without overflowing the + * allocated buffer. + * + * You must free this memory with SDL_FreeSIMD(), not free() or SDL_free(). + * + * Note that SDL will only deal with SIMD instruction sets it is aware of; for + * example, SDL 2.0.8 knows that SSE wants 16-byte vectors (SDL_HasSSE()), and + * AVX2 wants 32 bytes (SDL_HasAVX2()), but doesn't know that AVX-512 wants + * 64. To be clear: if you can't decide to use an instruction set with an + * SDL_Has*() function, don't use that instruction set with memory allocated + * through here. + * + * SDL_AllocSIMD(0) will return a non-NULL pointer, assuming the system isn't + * out of memory, but you are not allowed to dereference it (because you only + * own zero bytes of that buffer). + *} +function SDL_SIMDAlloc(const len: csize_t): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SIMDAlloc' {$ENDIF} {$ENDIF}; + +{** + * Reallocate memory obtained from SDL_SIMDAlloc. + * + * It is not valid to use this function on a pointer from anything but + * SDL_SIMDAlloc(). It can't be used on pointers from SDL_malloc, GetMem, etc. + *} +function SDL_SIMDRealloc(mem: Pointer; const len: csize_t): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SIMDRealloc' {$ENDIF} {$ENDIF}; + +{** + * Deallocate memory obtained from SDL_SIMDAlloc. + * + * It is not valid to use this function on a pointer from anything but + * SDL_SIMDAlloc() or SDL_SIMDRealloc(). It can't be used on pointers from + * SDL_malloc, GetMem, etc. + * + * However, SDL_SIMDFree(NIL) is a legal no-op. + * + * The memory pointed to by `mem` is no longer valid for access upon return, + * and may be returned to the system or reused by a future allocation. The + * pointer passed to this function is no longer safe to dereference once this + * function returns, and should be discarded. + *} +procedure SDL_SIMDFree(mem: Pointer); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SIMDFree' {$ENDIF} {$ENDIF}; + diff --git a/units/sdlerror.inc b/units/sdlerror.inc index bde7ffcc..0ae79c00 100644 --- a/units/sdlerror.inc +++ b/units/sdlerror.inc @@ -1,102 +1,102 @@ -// based on "sdl_error.h" (2.0.14) - -{** - * \file SDL_error.h - * - * Simple error message routines for SDL. - *} - -{* Public functions *} - - {** - * \brief Set the error message for the current thread - * - * \return -1, there is no error handling for this function - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetError_fun = function(const fmt: PAnsiChar; args: array of const): cint; cdecl; -Var - SDL_SetError : TSDL_SetError_fun = Nil; -{$else} - -function SDL_SetError(const fmt: PAnsiChar; args: array of const): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetError' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * \brief Get the last error message that was set - * - * SDL API functions may set error messages and then succeed, so you should - * only use the error value if a function fails. - * - * This returns a pointer to a static buffer for convenience and should not - * be called by multiple threads simultaneously. - * - * \return a pointer to the last error message that was set - *} -function SDL_GetError: PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetError' {$ENDIF} {$ENDIF}; - -{** - * \brief Get the last error message that was set for the current thread - * - * SDL API functions may set error messages and then succeed, so you should - * only use the error value if a function fails. - * - * \param errstr A buffer to fill with the last error message that was set - * for the current thread - * \param maxlen The size of the buffer pointed to by the errstr parameter - * - * \return errstr - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetErrorMsg_fun = function(const errstr: PAnsiChar; maxlen: cint): PAnsiChar; cdecl; -Var - SDL_GetErrorMsg : TSDL_GetErrorMsg_fun = Nil; -{$else} - -function SDL_GetErrorMsg(const errstr: PAnsiChar; maxlen: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetErrorMsg' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * \brief Clear the error message for the current thread - *} -procedure SDL_ClearError cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ClearError' {$ENDIF} {$ENDIF}; - -{*Internal error functions*} -{** - * Internal error functions - * - * Private error reporting function - used internally. - *} - { -#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)) - } - - -type - PPSDL_ErrorCode = ^PSDL_ErrorCode; - PSDL_ErrorCode = ^TSDL_ErrorCode; - TSDL_ErrorCode = (SDL_ENOMEM, - SDL_EFREAD, - SDL_EFWRITE, - SDL_EFSEEK, - SDL_UNSUPPORTED, - SDL_LASTERROR); - -{* SDL_Error() unconditionally returns -1. *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_Error_fun = function(code: TSDL_ErrorCode): cint; cdecl; -Var - SDL_Error : TSDL_Error_fun = Nil; -{$else} - -function SDL_Error(code: TSDL_ErrorCode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Error' {$ENDIF} {$ENDIF}; -{$endif} +// based on "sdl_error.h" (2.0.14) + +{** + * \file SDL_error.h + * + * Simple error message routines for SDL. + *} + +{* Public functions *} + + {** + * \brief Set the error message for the current thread + * + * \return -1, there is no error handling for this function + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetError_fun = function(const fmt: PAnsiChar; args: array of const): cint; cdecl; +Var + SDL_SetError : TSDL_SetError_fun = Nil; +{$else} + +function SDL_SetError(const fmt: PAnsiChar; args: array of const): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetError' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Get the last error message that was set + * + * SDL API functions may set error messages and then succeed, so you should + * only use the error value if a function fails. + * + * This returns a pointer to a static buffer for convenience and should not + * be called by multiple threads simultaneously. + * + * \return a pointer to the last error message that was set + *} +function SDL_GetError: PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetError' {$ENDIF} {$ENDIF}; + +{** + * \brief Get the last error message that was set for the current thread + * + * SDL API functions may set error messages and then succeed, so you should + * only use the error value if a function fails. + * + * \param errstr A buffer to fill with the last error message that was set + * for the current thread + * \param maxlen The size of the buffer pointed to by the errstr parameter + * + * \return errstr + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetErrorMsg_fun = function(const errstr: PAnsiChar; maxlen: cint): PAnsiChar; cdecl; +Var + SDL_GetErrorMsg : TSDL_GetErrorMsg_fun = Nil; +{$else} + +function SDL_GetErrorMsg(const errstr: PAnsiChar; maxlen: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetErrorMsg' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Clear the error message for the current thread + *} +procedure SDL_ClearError cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ClearError' {$ENDIF} {$ENDIF}; + +{*Internal error functions*} +{** + * Internal error functions + * + * Private error reporting function - used internally. + *} + { +#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)) + } + + +type + PPSDL_ErrorCode = ^PSDL_ErrorCode; + PSDL_ErrorCode = ^TSDL_ErrorCode; + TSDL_ErrorCode = (SDL_ENOMEM, + SDL_EFREAD, + SDL_EFWRITE, + SDL_EFSEEK, + SDL_UNSUPPORTED, + SDL_LASTERROR); + +{* SDL_Error() unconditionally returns -1. *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_Error_fun = function(code: TSDL_ErrorCode): cint; cdecl; +Var + SDL_Error : TSDL_Error_fun = Nil; +{$else} + +function SDL_Error(code: TSDL_ErrorCode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Error' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlevents.inc b/units/sdlevents.inc index 63174872..5f4fe6d1 100644 --- a/units/sdlevents.inc +++ b/units/sdlevents.inc @@ -1,857 +1,857 @@ -//from "sdl_events.h" - -type - PPSDL_EventType = ^PSDL_EventType; - PSDL_EventType = ^TSDL_EventType; - TSDL_EventType = type cuint32; - - {** - * The types of events that can be delivered. - *} -const - - { General keyboard/mouse state definitions } - SDL_RELEASED = 0; - SDL_PRESSED = 1; - - SDL_FIRSTEVENT = TSDL_EventType(0); // Unused (do not remove) (needed in pascal?) - - SDL_COMMONEVENT = TSDL_EventType(1); //added for pascal-compatibility - - { Application events } - SDL_QUITEV = TSDL_EventType($100); // User-requested quit (originally SDL_QUIT, but changed, cause theres a method called SDL_QUIT) - - - { These application events have special meaning on iOS, see README.iOS for details *} - - {* The application is being terminated by the OS. * - * Called on iOS in applicationWillTerminate() * - * Called on Android in onDestroy() *} - SDL_APP_TERMINATING = TSDL_EventType($101); - - {* The application is low on memory, free memory if possible. * - * Called on iOS in applicationDidReceiveMemoryWarning() * - * Called on Android in onLowMemory() *} - SDL_APP_LOWMEMORY = TSDL_EventType($102); - - {* The application is about to enter the background. * - * Called on iOS in applicationWillResignActive() * - * Called on Android in onPause() *} - SDL_APP_WILLENTERBACKGROUND = TSDL_EventType($103); - - {* The application did enter the background and may not get CPU for some time. * - * Called on iOS in applicationDidEnterBackground() * - * Called on Android in onPause() *} - SDL_APP_DIDENTERBACKGROUND = TSDL_EventType($104); - - {* The application is about to enter the foreground. * - * Called on iOS in applicationWillEnterForeground() * - * Called on Android in onResume() *} - SDL_APP_WILLENTERFOREGROUND = TSDL_EventType($105); - - {* The application is now interactive. * - * Called on iOS in applicationDidBecomeActive() * - * Called on Android in onResume() *} - SDL_APP_DIDENTERFOREGROUND = TSDL_EventType($106); - - {* The user's locale preferences have changed. *} - SDL_LOCALECHANGED = TSDL_EventType($107); - - { Display events } - SDL_DISPLAYEVENT = TSDL_EventType($150); // Display state change - - { Window events } - SDL_WINDOWEVENT = TSDL_EventType($200); // Window state change - SDL_SYSWMEVENT = TSDL_EventType($201); // System specific event - - { Keyboard events } - SDL_KEYDOWN = TSDL_EventType($300); // Key pressed - SDL_KEYUP = TSDL_EventType($301); // Key released - SDL_TEXTEDITING = TSDL_EventType($302); // Keyboard text editing (composition) - SDL_TEXTINPUT = TSDL_EventType($303); // Keyboard text input - SDL_KEYMAPCHANGED = TSDL_EventType($304); // Keymap changed due to a system event such as an input language or keyboard layout change. - SDL_TEXTEDITING_EXT = TSDL_EventType($305); // Extended keyboard text editing (composition) - - { Mouse events } - SDL_MOUSEMOTION = TSDL_EventType($400); // Mouse moved - SDL_MOUSEBUTTONDOWN = TSDL_EventType($401); // Mouse button pressed - SDL_MOUSEBUTTONUP = TSDL_EventType($402); // Mouse button released - SDL_MOUSEWHEEL = TSDL_EventType($403); // Mouse wheel motion - - { Joystick events } - SDL_JOYAXISMOTION = TSDL_EventType($600); // Joystick axis motion - SDL_JOYBALLMOTION = TSDL_EventType($601); // Joystick trackball motion - SDL_JOYHATMOTION = TSDL_EventType($602); // Joystick hat position change - SDL_JOYBUTTONDOWN = TSDL_EventType($603); // Joystick button pressed - SDL_JOYBUTTONUP = TSDL_EventType($604); // Joystick button released - SDL_JOYDEVICEADDED = TSDL_EventType($605); // A new joystick has been inserted into the system - SDL_JOYDEVICEREMOVED = TSDL_EventType($606); // An opened joystick has been removed - SDL_JOYBATTERYUPDATED = TSDL_EventType($607); // Joystick battery level change - - { Game controller events } - SDL_CONTROLLERAXISMOTION = TSDL_EventType($650); // Game controller axis motion - SDL_CONTROLLERBUTTONDOWN = TSDL_EventType($651); // Game controller button pressed - SDL_CONTROLLERBUTTONUP = TSDL_EventType($652); // Game controller button released - SDL_CONTROLLERDEVICEADDED = TSDL_EventType($653); // A new Game controller has been inserted into the system - SDL_CONTROLLERDEVICEREMOVED = TSDL_EventType($654); // An opened Game controller has been removed - SDL_CONTROLLERDEVICEREMAPPED = TSDL_EventType($655); // The controller mapping was updated - SDL_CONTROLLERTOUCHPADDOWN = TSDL_EventType($666); // Game controller touchpad was touched - SDL_CONTROLLERTOUCHPADMOTION = TSDL_EventType($667); // Game controller touchpad finger was moved - SDL_CONTROLLERTOUCHPADUP = TSDL_EventType($668); // Game controller touchpad finger was lifted - SDL_CONTROLLERSENSORUPDATE = TSDL_EventType($669); // Game controller sensor was updated - - { Touch events } - SDL_FINGERDOWN = TSDL_EventType($700); - SDL_FINGERUP = TSDL_EventType($701); - SDL_FINGERMOTION = TSDL_EventType($702); - - { Gesture events } - SDL_DOLLARGESTURE = TSDL_EventType($800); - SDL_DOLLARRECORD = TSDL_EventType($801); - SDL_MULTIGESTURE = TSDL_EventType($802); - - { Clipboard events } - SDL_CLIPBOARDUPDATE = TSDL_EventType($900); // The clipboard changed - - { Drag and drop events } - SDL_DROPFILE = TSDL_EventType($1000); // The system requests a file open - SDL_DROPTEXT = TSDL_EventType($1001); // text/plain drag-and-drop event - SDL_DROPBEGIN = TSDL_EventType($1002); // A new set of drops is beginning (NULL filename) - SDL_DROPCOMPLETE = TSDL_EventType($1003); // Current set of drops is now complete (NULL filename) - - { Audio hotplug events } - SDL_AUDIODEVICEADDED = TSDL_EventType($1100); // A new audio device is available - SDL_AUDIODEVICEREMOVED = TSDL_EventType($1101); // An audio device has been removed. - - { Sensor events } - SDL_SENSORUPDATED = TSDL_EventType($1200); // A sensor was updated - - { Render events } - SDL_RENDER_TARGETS_RESET = TSDL_EventType($2000); // The render targets have been reset - SDL_RENDER_DEVICE_RESET = TSDL_EventType($2001); // The device has been reset and all textures need to be recreated - - { Internal events } - SDL_POLLSENTINEL = TSDL_EventType($7F00); // Signals the end of an event poll cycle - - {** Events SDL_USEREVENT through SDL_LASTEVENT are for your use, - * and should be allocated with SDL_RegisterEvents() - *} - SDL_USEREVENT = TSDL_EventType($8000); - - {** - * This last event is only for bounding internal arrays (needed in pascal ??) - *} - SDL_LASTEVENT = TSDL_EventType($FFFF); - -type - {** - * Fields shared by every event - *} - PPSDL_CommonEvent = ^PSDL_CommonEvent; - PSDL_CommonEvent = ^TSDL_CommonEvent; - TSDL_CommonEvent = record - type_: cuint32; - timestamp: cuint32; - end; - - {** - * Display state change event data (event.display.*) - *} - PPSDL_DisplayEvent = ^PSDL_DisplayEvent; - PSDL_DisplayEvent = ^TSDL_DisplayEvent; - TSDL_DisplayEvent = record - type_: cuint32; // SDL_DISPLAYEVENT - timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() - display: cuint32; // The associated display index - event: cuint8; // SDL_DisplayEventID - padding1: cuint8; - padding2: cuint8; - padding3: cuint8; - data1: cint32; // event dependent data - end; - - {** - * Window state change event data (event.window.*) - *} - PPSDL_WindowEvent = ^PSDL_WindowEvent; - PSDL_WindowEvent = ^TSDL_WindowEvent; - TSDL_WindowEvent = record - type_: cuint32; // SDL_WINDOWEVENT - timestamp: cuint32; - windowID: cuint32; // The associated window - event: cuint8; // SDL_WindowEventID - padding1: cuint8; - padding2: cuint8; - padding3: cuint8; - data1: cint32; // event dependent data - data2: cint32; // event dependent data - end; - - {** - * Keyboard button event structure (event.key.*) - *} - PPSDL_KeyboardEvent = ^PSDL_KeyboardEvent; - PSDL_KeyboardEvent = ^TSDL_KeyboardEvent; - TSDL_KeyboardEvent = record - type_: cuint32; // SDL_KEYDOWN or SDL_KEYUP - timestamp: cuint32; - windowID: cuint32; // The window with keyboard focus, if any - state: cuint8; // SDL_PRESSED or SDL_RELEASED - repeat_: cuint8; // Non-zero if this is a key repeat - padding2: cuint8; - padding3: cuint8; - keysym: TSDL_KeySym; // The key that was pressed or released - end; - -const - SDL_TEXTEDITINGEVENT_TEXT_SIZE = 32; - -type - {** - * Keyboard text editing event structure (event.edit.*) - *} - PPSDL_TextEditingEvent = ^PSDL_TextEditingEvent; - PSDL_TextEditingEvent = ^TSDL_TextEditingEvent; - TSDL_TextEditingEvent = record - type_: cuint32; // SDL_TEXTEDITING - timestamp: cuint32; - windowID: cuint32; // The window with keyboard focus, if any - text: array[0..SDL_TEXTEDITINGEVENT_TEXT_SIZE - 1] of Char; // The editing text - start: cint32; // The start cursor of selected editing text - length: cint32; // The length of selected editing text - end; - - {** - * Extended keyboard text editing event structure (event.editExt.*) when text would be - * truncated if stored in the text buffer SDL_TextEditingEvent - *} - PPSDL_TextEditingExtEvent = ^PSDL_TextEditingExtEvent; - PSDL_TextEditingExtEvent = ^TSDL_TextEditingExtEvent; - TSDL_TextEditingExtEvent = record - type_: cuint32; // SDL_TEXTEDITING_EXT - timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() - windowID: cuint32; // The window with keyboard focus, if any - text: PAnsiChar; // The editing text, which should be freed with SDL_free(), and will not be NIL - start: cint32; // The start cursor of selected editing text - length: cint32; // The length of selected editing text - end; - -const - SDL_TEXTINPUTEVENT_TEXT_SIZE = 32; - -type - - {** - * Keyboard text input event structure (event.text.*) - *} - PPSDL_TextInputEvent = ^PSDL_TextInputEvent; - PSDL_TextInputEvent = ^TSDL_TextInputEvent; - TSDL_TextInputEvent = record - type_: cuint32; // SDL_TEXTINPUT - timestamp: cuint32; - windowID: cuint32; // The window with keyboard focus, if any - text: array[0..SDL_TEXTINPUTEVENT_TEXT_SIZE - 1] of Char; // The input text - end; - - {** - * Mouse motion event structure (event.motion.*) - *} - PPSDL_MouseMotionEvent = ^PSDL_MouseMotionEvent; - PSDL_MouseMotionEvent = ^TSDL_MouseMotionEvent; - TSDL_MouseMotionEvent = record - type_: cuint32; // SDL_MOUSEMOTION - timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() - windowID: cuint32; // The window with mouse focus, if any - which: cuint32; // The mouse instance id, or SDL_TOUCH_MOUSEID - state: cuint32; // The current button state - x: cint32; // X coordinate, relative to window - y: cint32; // Y coordinate, relative to window - xrel: cint32; // The relative motion in the X direction - yrel: cint32; // The relative motion in the Y direction - end; - - {** - * Mouse button event structure (event.button.*) - *} - PPSDL_MouseButtonEvent = ^PSDL_MouseButtonEvent; - PSDL_MouseButtonEvent = ^TSDL_MouseButtonEvent; - TSDL_MouseButtonEvent = record - type_: cuint32; // SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP - timestamp: cuint32; - windowID: cuint32; // The window with mouse focus, if any - which: cuint32; // The mouse instance id, or SDL_TOUCH_MOUSEID - button: cuint8; // The mouse button index - state: cuint8; // SDL_PRESSED or SDL_RELEASED - clicks: cuint8; // 1 for single-click, 2 for double-click, etc. - padding1: cuint8; - x: cint32; // X coordinate, relative to window - y: cint32; // Y coordinate, relative to window - end; - - {** - * Mouse wheel event structure (event.wheel.*) - *} - PPSDL_MouseWheelEvent = ^PSDL_MouseWheelEvent; - PSDL_MouseWheelEvent = ^TSDL_MouseWheelEvent; - TSDL_MouseWheelEvent = record - type_: cuint32; // SDL_MOUSEWHEEL - timestamp: cuint32; - windowID: cuint32; // The window with mouse focus, if any - which: cuint32; // The mouse instance id, or SDL_TOUCH_MOUSEID - x: cint32; // The amount scrolled horizontally - y: cint32; // The amount scrolled vertically - direction: cuint32; // Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back - preciseX: cfloat; // The amount scrolled horizontally, positive to the right and negative to the left, with float precision (added in 2.0.18) - preciseY: cfloat; // The amount scrolled vertically, positive away from the user and negative toward the user, with float precision (added in 2.0.18) - mouseX: cint32; // X coordinate, relative to window (added in 2.26.0) - mouseY: cint32; // Y coordinate, relative to window (added in 2.26.0) - end; - - {** - * Joystick axis motion event structure (event.jaxis.*) - *} - PPSDL_JoyAxisEvent = ^PSDL_JoyAxisEvent; - PSDL_JoyAxisEvent = ^TSDL_JoyAxisEvent; - TSDL_JoyAxisEvent = record - type_: cuint32; // SDL_JOYAXISMOTION - timestamp: cuint32; - which: TSDL_JoystickID; // The joystick instance id - axis: cuint8; // The joystick axis index - padding1: cuint8; - padding2: cuint8; - padding3: cuint8; - value: cint16; // The axis value (range: -32768 to 32767) - padding4: cuint16; - end; - - {** - * Joystick trackball motion event structure (event.jball.*) - *} - PPSDL_JoyBallEvent = ^PSDL_JoyBallEvent; - PSDL_JoyBallEvent = ^TSDL_JoyBallEvent; - TSDL_JoyBallEvent = record - type_: cuint32; // SDL_JOYBALLMOTION - timestamp: cuint32; - which: TSDL_JoystickID; // The joystick instance id - ball: cuint8; // The joystick trackball index - padding1: cuint8; - padding2: cuint8; - padding3: cuint8; - xrel: cint16; // The relative motion in the X direction - yrel: cint16; // The relative motion in the Y direction - end; - - {** - * Joystick hat position change event structure (event.jhat.*) - *} - PPSDL_JoyHatEvent = ^PSDL_JoyHatEvent; - PSDL_JoyHatEvent = ^TSDL_JoyHatEvent; - TSDL_JoyHatEvent = record - type_: cuint32; // SDL_JOYHATMOTION - timestamp: cuint32; - which: TSDL_JoystickID; // The joystick instance id - hat: cuint8; // The joystick hat index - value: cuint8; {* The hat position value. - * SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP - * SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT - * SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN - * - * Note that zero means the POV is centered. - *} - padding1: cuint8; - padding2: cuint8; - end; - - {** - * Joystick button event structure (event.jbutton.*) - *} - PPSDL_JoyButtonEvent = ^PSDL_JoyButtonEvent; - PSDL_JoyButtonEvent = ^TSDL_JoyButtonEvent; - TSDL_JoyButtonEvent = record - type_: cuint32; // SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP - timestamp: cuint32; - which: TSDL_JoystickID; // The joystick instance id - button: cuint8; // The joystick button index - state: cuint8; // SDL_PRESSED or SDL_RELEASED - padding1: cuint8; - padding2: cuint8; - end; - - {** - * Joystick device event structure (event.jdevice.*) - *} - PPSDL_JoyDeviceEvent = ^PSDL_JoyDeviceEvent; - PSDL_JoyDeviceEvent = ^TSDL_JoyDeviceEvent; - TSDL_JoyDeviceEvent = record - type_: cuint32; // SDL_JOYDEVICEADDED or SDL_JOYDEVICEREMOVED - timestamp: cuint32; - which: cint32; // The joystick device index for the ADDED event, instance id for the REMOVED event - end; - - {** - * Joysick battery level change event structure (event.jbattery.*) - *} - PPSDL_JoyBatteryEvent = ^PSDL_JoyBatteryEvent; - PSDL_JoyBatteryEvent = ^TSDL_JoyBatteryEvent; - TSDL_JoyBatteryEvent = record - type_: cuint32; // SDL_JOYBATTERYUPDATED - timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() - which: TSDL_JoystickID; // The joystick instance id - level: TSDL_JoystickPowerLevel; // The joystick battery level - end; - - {** - * Game controller axis motion event structure (event.caxis.*) - *} - PPSDL_ControllerAxisEvent = ^PSDL_ControllerAxisEvent; - PSDL_ControllerAxisEvent = ^TSDL_ControllerAxisEvent; - TSDL_ControllerAxisEvent = record - type_: cuint32; // SDL_CONTROLLERAXISMOTION - timestamp: cuint32; - which: TSDL_JoystickID; // The joystick instance id - axis: cuint8; // The controller axis (SDL_GameControllerAxis) - padding1: cuint8; - padding2: cuint8; - padding3: cuint8; - value: cint16; // The axis value (range: -32768 to 32767) - padding4: cuint16; - end; - - {** - * Game controller button event structure (event.cbutton.*) - *} - PPSDL_ControllerButtonEvent = ^PSDL_ControllerButtonEvent; - PSDL_ControllerButtonEvent = ^TSDL_ControllerButtonEvent; - TSDL_ControllerButtonEvent = record - type_: cuint32; // SDL_CONTROLLERBUTTONDOWN or SDL_CONTROLLERBUTTONUP - timestamp: cuint32; - which: TSDL_JoystickID; // The joystick instance id - button: cuint8; // The controller button (SDL_GameControllerButton) - state: cuint8; // SDL_PRESSED or SDL_RELEASED - padding1: cuint8; - padding2: cuint8; - end; - - - {** - * Controller device event structure (event.cdevice.*) - *} - PPSDL_ControllerDeviceEvent = ^PSDL_ControllerDeviceEvent; - PSDL_ControllerDeviceEvent = ^TSDL_ControllerDeviceEvent; - TSDL_ControllerDeviceEvent = record - type_: cuint32; // SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEREMOVED, or SDL_CONTROLLERDEVICEREMAPPED - timestamp: cuint32; - which: cint32; // The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event - end; - - {** - * Game controller touchpad event structure (event.ctouchpad.*) - *} - PPSDL_ControllerTouchpadEvent = ^PSDL_ControllerTouchpadEvent; - PSDL_ControllerTouchpadEvent = ^TSDL_ControllerTouchpadEvent; - TSDL_ControllerTouchpadEvent = record - type_: cuint32; // SDL_CONTROLLERTOUCHPADDOWN or SDL_CONTROLLERTOUCHPADMOTION or SDL_CONTROLLERTOUCHPADUP - timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() - which: TSDL_JoystickID; // The joystick instance id - touchpad: cint32; // The index of the touchpad - finger: cint32; // The index of the finger on the touchpad - x: cfloat; // Normalized in the range 0...1 with 0 being on the left - y: cfloat; // Normalized in the range 0...1 with 0 being at the top - pressure: cfloat; // Normalized in the range 0...1 - end; - - {** - * Game controller sensor event structure (event.csensor.*) - *} - PPSDL_ControllerSensorEvent = ^PSDL_ControllerSensorEvent; - PSDL_ControllerSensorEvent = ^TSDL_ControllerSensorEvent; - TSDL_ControllerSensorEvent = record - type_: cuint32; // SDL_CONTROLLERSENSORUPDATE - timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() - which: TSDL_JoystickID; // The joystick instance id - sensor: cint32; // The type of the sensor, one of the values of SDL_SensorType - data: array[0..2] of cfloat; // Up to 3 values from the sensor, as defined in SDL_sensor.h - end; - - {** - * Audio device event structure (event.adevice.*) - *} - PPSDL_AudioDeviceEvent = ^PSDL_AudioDeviceEvent; - PSDL_AudioDeviceEvent = ^TSDL_AudioDeviceEvent; - TSDL_AudioDeviceEvent = record - type_: cuint32; // ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED - timestamp: cuint32; - which: cuint32; // The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event - iscapture: cuint8; // zero if an output device, non-zero if a capture device. - padding1: cuint8; - padding2: cuint8; - padding3: cuint8; - end; - - - {** - * Touch finger event structure (event.tfinger.*) - *} - PPSDL_TouchFingerEvent = ^PSDL_TouchFingerEvent; - PSDL_TouchFingerEvent = ^TSDL_TouchFingerEvent; - TSDL_TouchFingerEvent = record - type_: cuint32; // SDL_FINGERMOTION or SDL_FINGERDOWN or SDL_FINGERUP - timestamp: cuint32; - touchId: TSDL_TouchID; // The touch device id - fingerId: TSDL_FingerID; - x: cfloat; // Normalized in the range 0...1 - y: cfloat; // Normalized in the range 0...1 - dx: cfloat; // Normalized in the range 0...1 - dy: cfloat; // Normalized in the range 0...1 - pressure: cfloat; // Normalized in the range 0...1 - window: cuint32; // The window underneath the finger, if any - end; - - {** - * Multiple Finger Gesture Event (event.mgesture.*) - *} - PPSDL_MultiGestureEvent = ^PSDL_MultiGestureEvent; - PSDL_MultiGestureEvent = ^TSDL_MultiGestureEvent; - TSDL_MultiGestureEvent = record - type_: cuint32; // SDL_MULTIGESTURE - timestamp: cuint32; - touchId: TSDL_TouchID; // The touch device index - dTheta: cfloat; - dDist: cfloat; - x: cfloat; - y: cfloat; - numFingers: cuint16; - padding: cuint16; - end; - - - {* (event.dgesture.*) *} - PPSDL_DollarGestureEvent = ^PSDL_DollarGestureEvent; - PSDL_DollarGestureEvent = ^TSDL_DollarGestureEvent; - TSDL_DollarGestureEvent = record - type_: cuint32; // SDL_DOLLARGESTURE - timestamp: cuint32; - touchId: TSDL_TouchID; // The touch device id - gestureId: TSDL_GestureID; - numFingers: cuint32; - error: cfloat; - x: cfloat; // Normalized center of gesture - y: cfloat; // Normalized center of gesture - end; - - - {** - * An event used to request a file open by the system (event.drop.*) - * This event is disabled by default, you can enable it with SDL_EventState() - * If you enable this event, you must free the filename in the event. - *} - PPSDL_DropEvent = ^PSDL_DropEvent; - PSDL_DropEvent = ^TSDL_DropEvent; - TSDL_DropEvent = record - type_: cuint32; // SDL_DROPBEGIN or SDL_DROPFILE or SDL_DROPTEXT or SDL_DROPCOMPLETE - timestamp: cuint32; - file_: PAnsiChar; // The file name, which should be freed with SDL_free(), is NIL on begin/complete - windowID: cuint32; // The window that was dropped on, if any - end; - - {** - * Sensor event structure (event.sensor.*) - *} - PPSDL_SensorEvent = ^PSDL_SensorEvent; - PSDL_SensorEvent = ^TSDL_SensorEvent; - TSDL_SensorEvent = record - type_: cuint32; // SDL_SENSORUPDATED - timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() - which: cint32; // The instance ID of the sensor - data: array[0..5] of cfloat; // Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() - end; - - {** - * The "quit requested" event - *} - PPSDL_QuitEvent = ^PSDL_QuitEvent; - PSDL_QuitEvent = ^TSDL_QuitEvent; - TSDL_QuitEvent = record - type_: cuint32; // SDL_QUIT - timestamp: cuint32; - end; - - {** - * A user-defined event type (event.user.*) - *} - PPSDL_UserEvent = ^PSDL_UserEvent; - PSDL_UserEvent = ^TSDL_UserEvent; - TSDL_UserEvent = record - type_: cuint32; // SDL_USEREVENT through SDL_NUMEVENTS-1 - timestamp: cuint32; - windowID: cuint32; // The associated window if any - code: cint32; // User defined event code - data1: Pointer; // User defined data pointer - data2: Pointer; // User defined data pointer - end; - - {** - * A video driver dependent system event (event.syswm.*) - * This event is disabled by default, you can enable it with SDL_EventState() - * - * If you want to use this event, you should include SDL_syswm.h. - *} - PPSDL_SysWMEvent = ^PSDL_SysWMEvent; - PSDL_SysWMEvent = ^TSDL_SysWMEvent; - TSDL_SysWMEvent = record - type_: cuint32; // SDL_SYSWMEVENT - timestamp: cuint32; - msg: PSDL_SysWMmsg; // driver dependent data (defined in SDL_syswm.h) - end; - - {** - * General event structure - *} - PPSDL_Event = ^PSDL_Event; - PSDL_Event = ^TSDL_Event; - TSDL_Event = record - case cint of - 0: (type_: cuint32); - - SDL_COMMONEVENT: (common: TSDL_CommonEvent); - SDL_DISPLAYEVENT: (display: TSDL_DisplayEvent); - SDL_WINDOWEVENT: (window: TSDL_WindowEvent); - - SDL_KEYUP, - SDL_KEYDOWN: (key: TSDL_KeyboardEvent); - SDL_TEXTEDITING: (edit: TSDL_TextEditingEvent); - SDL_TEXTEDITING_EXT: (exitExt: TSDL_TextEditingExtEvent); - SDL_TEXTINPUT: (text: TSDL_TextInputEvent); - - SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent); - SDL_MOUSEBUTTONUP, - SDL_MOUSEBUTTONDOWN: (button: TSDL_MouseButtonEvent); - SDL_MOUSEWHEEL: (wheel: TSDL_MouseWheelEvent); - - SDL_JOYAXISMOTION: (jaxis: TSDL_JoyAxisEvent); - SDL_JOYBALLMOTION: (jball: TSDL_JoyBallEvent); - SDL_JOYHATMOTION: (jhat: TSDL_JoyHatEvent); - SDL_JOYBUTTONDOWN, - SDL_JOYBUTTONUP: (jbutton: TSDL_JoyButtonEvent); - SDL_JOYDEVICEADDED, - SDL_JOYDEVICEREMOVED: (jdevice: TSDL_JoyDeviceEvent); - SDL_JOYBATTERYUPDATED: (jbattery: TSDL_JoyBatteryEvent); - - SDL_CONTROLLERAXISMOTION: (caxis: TSDL_ControllerAxisEvent); - SDL_CONTROLLERBUTTONUP, - SDL_CONTROLLERBUTTONDOWN: (cbutton: TSDL_ControllerButtonEvent); - SDL_CONTROLLERDEVICEADDED, - SDL_CONTROLLERDEVICEREMOVED, - SDL_CONTROLLERDEVICEREMAPPED: (cdevice: TSDL_ControllerDeviceEvent); - SDL_CONTROLLERTOUCHPADDOWN, - SDL_CONTROLLERTOUCHPADMOTION, - SDL_CONTROLLERTOUCHPADUP: (ctouchpad: TSDL_ControllerTouchpadEvent); - SDL_CONTROLLERSENSORUPDATE: (csensor: TSDL_ControllerSensorEvent); - - SDL_AUDIODEVICEADDED, - SDL_AUDIODEVICEREMOVED: (adevice: TSDL_AudioDeviceEvent); - - SDL_SENSORUPDATED: (sensor: TSDL_SensorEvent); - - SDL_QUITEV: (quit: TSDL_QuitEvent); - - SDL_USEREVENT: (user: TSDL_UserEvent); - SDL_SYSWMEVENT: (syswm: TSDL_SysWMEvent); - - SDL_FINGERDOWN, - SDL_FINGERUP, - SDL_FINGERMOTION: (tfinger: TSDL_TouchFingerEvent); - SDL_MULTIGESTURE: (mgesture: TSDL_MultiGestureEvent); - SDL_DOLLARGESTURE,SDL_DOLLARRECORD: (dgesture: TSDL_DollarGestureEvent); - - SDL_DROPFILE: (drop: TSDL_DropEvent); - end; - - - {* Function prototypes *} - - {** - * Pumps the event loop, gathering events from the input devices. - * - * This function updates the event queue and internal input device state. - * - * This should only be run in the thread that sets the video mode. - *} - procedure SDL_PumpEvents cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PumpEvents' {$ENDIF} {$ENDIF}; - -const - SDL_ADDEVENT = 0; - SDL_PEEKEVENT = 1; - SDL_GETEVENT = 2; - -type - PPSDL_EventAction = ^PSDL_EventAction; - PSDL_EventAction = ^TSDL_EventAction; - TSDL_EventAction = Word; - - {** - * Checks the event queue for messages and optionally returns them. - * - * If action is SDL_ADDEVENT, up to numevents events will be added to - * the back of the event queue. - * - * If action is SDL_PEEKEVENT, up to numevents events at the front - * of the event queue, within the specified minimum and maximum type, - * will be returned and will not be removed from the queue. - * - * If action is SDL_GETEVENT, up to numevents events at the front - * of the event queue, within the specified minimum and maximum type, - * will be returned and will be removed from the queue. - * - * Result: The number of events actually stored, or -1 if there was an error. - * - * This function is thread-safe. - *} - - function SDL_PeepEvents(events: PSDL_Event; numevents: cint32; action: TSDL_EventAction; minType, maxType: TSDL_EventType): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PeepEvents' {$ENDIF} {$ENDIF}; - - {** - * Checks to see if certain event types are in the event queue. - *} - - function SDL_HasEvent(type_: TSDL_EventType): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasEvent' {$ENDIF} {$ENDIF}; - function SDL_HasEvents(minType, maxType: TSDL_EventType): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasEvents' {$ENDIF} {$ENDIF}; - - {** - * This function clears events from the event queue - *} - - procedure SDL_FlushEvent(type_: TSDL_EventType) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FlushEvent' {$ENDIF} {$ENDIF}; - procedure SDL_FlushEvents(minType, maxType: TSDL_EventType) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FlushEvents' {$ENDIF} {$ENDIF}; - - {** - * Polls for currently pending events. - * - * 1 if there are any pending events, or 0 if there are none available. - * - * event - If not nil, the next event is removed from the queue and - * stored in that area. - *} - - function SDL_PollEvent(event: PSDL_Event): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PollEvent' {$ENDIF} {$ENDIF}; - - {** - * Waits indefinitely for the next available event. - * - * 1, or 0 if there was an error while waiting for events. - * - * event - If not nil, the next event is removed from the queue and - * stored in that area. - *} - - function SDL_WaitEvent(event: PSDL_Event): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WaitEvent' {$ENDIF} {$ENDIF}; - - {** - * Waits until the specified timeout (in milliseconds) for the next - * available event. - * - * 1, or 0 if there was an error while waiting for events. - * - * event - If not nil, the next event is removed from the queue and - * stored in that area. - *} - - function SDL_WaitEventTimeout(event: PSDL_Event; timeout: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WaitEventTimeout' {$ENDIF} {$ENDIF}; - - {** - * Add an event to the event queue. - * - * 1 on success, 0 if the event was filtered, or -1 if the event queue - * was full or there was some other error. - *} - - function SDL_PushEvent(event: PSDL_Event): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PumpEvents' {$ENDIF} {$ENDIF}; - -type - PPSDL_EventFilter = ^PSDL_EventFilter; - PSDL_EventFilter = ^TSDL_EventFilter; - {$IFNDEF GPC} - TSDL_EventFilter = function(userdata: Pointer; event: PSDL_Event): cint; cdecl; - {$ELSE} - TSDL_EventFilter = function( userdata: Pointer; event: PSDL_Event ): cint; - {$ENDIF} - - {** - * Sets up a filter to process all events before they change internal state and - * are posted to the internal event queue. - * - * If the filter returns 1, then the event will be added to the internal queue. - * If it returns 0, then the event will be dropped from the queue, but the - * internal state will still be updated. This allows selective filtering of - * dynamically arriving events. - * - * Be very careful of what you do in the event filter function, as - * it may run in a different thread! - * - * There is one caveat when dealing with the SDL_QUITEVENT event type. The - * event filter is only called when the window manager desires to close the - * application window. If the event filter returns 1, then the window will - * be closed, otherwise the window will remain open if possible. - * - * If the quit event is generated by an interrupt signal, it will bypass the - * internal queue and be delivered to the application at the next event poll. - *} - - procedure SDL_SetEventFilter(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetEventFilter' {$ENDIF} {$ENDIF}; - - {** - * Return the current event filter - can be used to "chain" filters. - * If there is no event filter set, this function returns SDL_FALSE. - *} - - function SDL_GetEventFilter(var filter: PSDL_EventFilter; var userdata: PPointer): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetEventFilter' {$ENDIF} {$ENDIF}; - - {** - * Add a function which is called when an event is added to the queue. - *} - - procedure SDL_AddEventWatch(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AddEventWatch' {$ENDIF} {$ENDIF}; - - {** - * Remove an event watch function added with SDL_AddEventWatch() - *} - - procedure SDL_DelEventWatch(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DelEventWatch' {$ENDIF} {$ENDIF}; - - {** - * Run the filter function on the current event queue, removing any - * events for which the filter returns 0. - *} - - procedure SDL_FilterEvents(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FilterEvents' {$ENDIF} {$ENDIF}; - -const - - SDL_QUERY = -1; - SDL_IGNORE = 0; - SDL_DISABLE = 0; - SDL_ENABLE = 1; - - {** - * This function allows you to set the state of processing certain events. - * - If state is set to SDL_IGNORE, that event will be automatically - * dropped from the event queue and will not event be filtered. - * - If state is set to SDL_ENABLE, that event will be processed - * normally. - * - If state is set to SDL_QUERY, SDL_EventState() will return the - * current processing state of the specified event. - *} - - function SDL_EventState(type_: TSDL_EventType; state: cint32): cuint8 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EventState' {$ENDIF} {$ENDIF}; - - function SDL_GetEventState(type_: TSDL_EventType): cuint8; - - {** - * This function allocates a set of user-defined events, and returns - * the beginning event number for that set of events. - * - * If there aren't enough user-defined events left, this function - * returns (Uint32)-1 - *} - - function SDL_RegisterEvents(numevents: cint32): cuint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RegisterEvents' {$ENDIF} {$ENDIF}; +//from "sdl_events.h" + +type + PPSDL_EventType = ^PSDL_EventType; + PSDL_EventType = ^TSDL_EventType; + TSDL_EventType = type cuint32; + + {** + * The types of events that can be delivered. + *} +const + + { General keyboard/mouse state definitions } + SDL_RELEASED = 0; + SDL_PRESSED = 1; + + SDL_FIRSTEVENT = TSDL_EventType(0); // Unused (do not remove) (needed in pascal?) + + SDL_COMMONEVENT = TSDL_EventType(1); //added for pascal-compatibility + + { Application events } + SDL_QUITEV = TSDL_EventType($100); // User-requested quit (originally SDL_QUIT, but changed, cause theres a method called SDL_QUIT) + + + { These application events have special meaning on iOS, see README.iOS for details *} + + {* The application is being terminated by the OS. * + * Called on iOS in applicationWillTerminate() * + * Called on Android in onDestroy() *} + SDL_APP_TERMINATING = TSDL_EventType($101); + + {* The application is low on memory, free memory if possible. * + * Called on iOS in applicationDidReceiveMemoryWarning() * + * Called on Android in onLowMemory() *} + SDL_APP_LOWMEMORY = TSDL_EventType($102); + + {* The application is about to enter the background. * + * Called on iOS in applicationWillResignActive() * + * Called on Android in onPause() *} + SDL_APP_WILLENTERBACKGROUND = TSDL_EventType($103); + + {* The application did enter the background and may not get CPU for some time. * + * Called on iOS in applicationDidEnterBackground() * + * Called on Android in onPause() *} + SDL_APP_DIDENTERBACKGROUND = TSDL_EventType($104); + + {* The application is about to enter the foreground. * + * Called on iOS in applicationWillEnterForeground() * + * Called on Android in onResume() *} + SDL_APP_WILLENTERFOREGROUND = TSDL_EventType($105); + + {* The application is now interactive. * + * Called on iOS in applicationDidBecomeActive() * + * Called on Android in onResume() *} + SDL_APP_DIDENTERFOREGROUND = TSDL_EventType($106); + + {* The user's locale preferences have changed. *} + SDL_LOCALECHANGED = TSDL_EventType($107); + + { Display events } + SDL_DISPLAYEVENT = TSDL_EventType($150); // Display state change + + { Window events } + SDL_WINDOWEVENT = TSDL_EventType($200); // Window state change + SDL_SYSWMEVENT = TSDL_EventType($201); // System specific event + + { Keyboard events } + SDL_KEYDOWN = TSDL_EventType($300); // Key pressed + SDL_KEYUP = TSDL_EventType($301); // Key released + SDL_TEXTEDITING = TSDL_EventType($302); // Keyboard text editing (composition) + SDL_TEXTINPUT = TSDL_EventType($303); // Keyboard text input + SDL_KEYMAPCHANGED = TSDL_EventType($304); // Keymap changed due to a system event such as an input language or keyboard layout change. + SDL_TEXTEDITING_EXT = TSDL_EventType($305); // Extended keyboard text editing (composition) + + { Mouse events } + SDL_MOUSEMOTION = TSDL_EventType($400); // Mouse moved + SDL_MOUSEBUTTONDOWN = TSDL_EventType($401); // Mouse button pressed + SDL_MOUSEBUTTONUP = TSDL_EventType($402); // Mouse button released + SDL_MOUSEWHEEL = TSDL_EventType($403); // Mouse wheel motion + + { Joystick events } + SDL_JOYAXISMOTION = TSDL_EventType($600); // Joystick axis motion + SDL_JOYBALLMOTION = TSDL_EventType($601); // Joystick trackball motion + SDL_JOYHATMOTION = TSDL_EventType($602); // Joystick hat position change + SDL_JOYBUTTONDOWN = TSDL_EventType($603); // Joystick button pressed + SDL_JOYBUTTONUP = TSDL_EventType($604); // Joystick button released + SDL_JOYDEVICEADDED = TSDL_EventType($605); // A new joystick has been inserted into the system + SDL_JOYDEVICEREMOVED = TSDL_EventType($606); // An opened joystick has been removed + SDL_JOYBATTERYUPDATED = TSDL_EventType($607); // Joystick battery level change + + { Game controller events } + SDL_CONTROLLERAXISMOTION = TSDL_EventType($650); // Game controller axis motion + SDL_CONTROLLERBUTTONDOWN = TSDL_EventType($651); // Game controller button pressed + SDL_CONTROLLERBUTTONUP = TSDL_EventType($652); // Game controller button released + SDL_CONTROLLERDEVICEADDED = TSDL_EventType($653); // A new Game controller has been inserted into the system + SDL_CONTROLLERDEVICEREMOVED = TSDL_EventType($654); // An opened Game controller has been removed + SDL_CONTROLLERDEVICEREMAPPED = TSDL_EventType($655); // The controller mapping was updated + SDL_CONTROLLERTOUCHPADDOWN = TSDL_EventType($666); // Game controller touchpad was touched + SDL_CONTROLLERTOUCHPADMOTION = TSDL_EventType($667); // Game controller touchpad finger was moved + SDL_CONTROLLERTOUCHPADUP = TSDL_EventType($668); // Game controller touchpad finger was lifted + SDL_CONTROLLERSENSORUPDATE = TSDL_EventType($669); // Game controller sensor was updated + + { Touch events } + SDL_FINGERDOWN = TSDL_EventType($700); + SDL_FINGERUP = TSDL_EventType($701); + SDL_FINGERMOTION = TSDL_EventType($702); + + { Gesture events } + SDL_DOLLARGESTURE = TSDL_EventType($800); + SDL_DOLLARRECORD = TSDL_EventType($801); + SDL_MULTIGESTURE = TSDL_EventType($802); + + { Clipboard events } + SDL_CLIPBOARDUPDATE = TSDL_EventType($900); // The clipboard changed + + { Drag and drop events } + SDL_DROPFILE = TSDL_EventType($1000); // The system requests a file open + SDL_DROPTEXT = TSDL_EventType($1001); // text/plain drag-and-drop event + SDL_DROPBEGIN = TSDL_EventType($1002); // A new set of drops is beginning (NULL filename) + SDL_DROPCOMPLETE = TSDL_EventType($1003); // Current set of drops is now complete (NULL filename) + + { Audio hotplug events } + SDL_AUDIODEVICEADDED = TSDL_EventType($1100); // A new audio device is available + SDL_AUDIODEVICEREMOVED = TSDL_EventType($1101); // An audio device has been removed. + + { Sensor events } + SDL_SENSORUPDATED = TSDL_EventType($1200); // A sensor was updated + + { Render events } + SDL_RENDER_TARGETS_RESET = TSDL_EventType($2000); // The render targets have been reset + SDL_RENDER_DEVICE_RESET = TSDL_EventType($2001); // The device has been reset and all textures need to be recreated + + { Internal events } + SDL_POLLSENTINEL = TSDL_EventType($7F00); // Signals the end of an event poll cycle + + {** Events SDL_USEREVENT through SDL_LASTEVENT are for your use, + * and should be allocated with SDL_RegisterEvents() + *} + SDL_USEREVENT = TSDL_EventType($8000); + + {** + * This last event is only for bounding internal arrays (needed in pascal ??) + *} + SDL_LASTEVENT = TSDL_EventType($FFFF); + +type + {** + * Fields shared by every event + *} + PPSDL_CommonEvent = ^PSDL_CommonEvent; + PSDL_CommonEvent = ^TSDL_CommonEvent; + TSDL_CommonEvent = record + type_: cuint32; + timestamp: cuint32; + end; + + {** + * Display state change event data (event.display.*) + *} + PPSDL_DisplayEvent = ^PSDL_DisplayEvent; + PSDL_DisplayEvent = ^TSDL_DisplayEvent; + TSDL_DisplayEvent = record + type_: cuint32; // SDL_DISPLAYEVENT + timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() + display: cuint32; // The associated display index + event: cuint8; // SDL_DisplayEventID + padding1: cuint8; + padding2: cuint8; + padding3: cuint8; + data1: cint32; // event dependent data + end; + + {** + * Window state change event data (event.window.*) + *} + PPSDL_WindowEvent = ^PSDL_WindowEvent; + PSDL_WindowEvent = ^TSDL_WindowEvent; + TSDL_WindowEvent = record + type_: cuint32; // SDL_WINDOWEVENT + timestamp: cuint32; + windowID: cuint32; // The associated window + event: cuint8; // SDL_WindowEventID + padding1: cuint8; + padding2: cuint8; + padding3: cuint8; + data1: cint32; // event dependent data + data2: cint32; // event dependent data + end; + + {** + * Keyboard button event structure (event.key.*) + *} + PPSDL_KeyboardEvent = ^PSDL_KeyboardEvent; + PSDL_KeyboardEvent = ^TSDL_KeyboardEvent; + TSDL_KeyboardEvent = record + type_: cuint32; // SDL_KEYDOWN or SDL_KEYUP + timestamp: cuint32; + windowID: cuint32; // The window with keyboard focus, if any + state: cuint8; // SDL_PRESSED or SDL_RELEASED + repeat_: cuint8; // Non-zero if this is a key repeat + padding2: cuint8; + padding3: cuint8; + keysym: TSDL_KeySym; // The key that was pressed or released + end; + +const + SDL_TEXTEDITINGEVENT_TEXT_SIZE = 32; + +type + {** + * Keyboard text editing event structure (event.edit.*) + *} + PPSDL_TextEditingEvent = ^PSDL_TextEditingEvent; + PSDL_TextEditingEvent = ^TSDL_TextEditingEvent; + TSDL_TextEditingEvent = record + type_: cuint32; // SDL_TEXTEDITING + timestamp: cuint32; + windowID: cuint32; // The window with keyboard focus, if any + text: array[0..SDL_TEXTEDITINGEVENT_TEXT_SIZE - 1] of Char; // The editing text + start: cint32; // The start cursor of selected editing text + length: cint32; // The length of selected editing text + end; + + {** + * Extended keyboard text editing event structure (event.editExt.*) when text would be + * truncated if stored in the text buffer SDL_TextEditingEvent + *} + PPSDL_TextEditingExtEvent = ^PSDL_TextEditingExtEvent; + PSDL_TextEditingExtEvent = ^TSDL_TextEditingExtEvent; + TSDL_TextEditingExtEvent = record + type_: cuint32; // SDL_TEXTEDITING_EXT + timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() + windowID: cuint32; // The window with keyboard focus, if any + text: PAnsiChar; // The editing text, which should be freed with SDL_free(), and will not be NIL + start: cint32; // The start cursor of selected editing text + length: cint32; // The length of selected editing text + end; + +const + SDL_TEXTINPUTEVENT_TEXT_SIZE = 32; + +type + + {** + * Keyboard text input event structure (event.text.*) + *} + PPSDL_TextInputEvent = ^PSDL_TextInputEvent; + PSDL_TextInputEvent = ^TSDL_TextInputEvent; + TSDL_TextInputEvent = record + type_: cuint32; // SDL_TEXTINPUT + timestamp: cuint32; + windowID: cuint32; // The window with keyboard focus, if any + text: array[0..SDL_TEXTINPUTEVENT_TEXT_SIZE - 1] of Char; // The input text + end; + + {** + * Mouse motion event structure (event.motion.*) + *} + PPSDL_MouseMotionEvent = ^PSDL_MouseMotionEvent; + PSDL_MouseMotionEvent = ^TSDL_MouseMotionEvent; + TSDL_MouseMotionEvent = record + type_: cuint32; // SDL_MOUSEMOTION + timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() + windowID: cuint32; // The window with mouse focus, if any + which: cuint32; // The mouse instance id, or SDL_TOUCH_MOUSEID + state: cuint32; // The current button state + x: cint32; // X coordinate, relative to window + y: cint32; // Y coordinate, relative to window + xrel: cint32; // The relative motion in the X direction + yrel: cint32; // The relative motion in the Y direction + end; + + {** + * Mouse button event structure (event.button.*) + *} + PPSDL_MouseButtonEvent = ^PSDL_MouseButtonEvent; + PSDL_MouseButtonEvent = ^TSDL_MouseButtonEvent; + TSDL_MouseButtonEvent = record + type_: cuint32; // SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP + timestamp: cuint32; + windowID: cuint32; // The window with mouse focus, if any + which: cuint32; // The mouse instance id, or SDL_TOUCH_MOUSEID + button: cuint8; // The mouse button index + state: cuint8; // SDL_PRESSED or SDL_RELEASED + clicks: cuint8; // 1 for single-click, 2 for double-click, etc. + padding1: cuint8; + x: cint32; // X coordinate, relative to window + y: cint32; // Y coordinate, relative to window + end; + + {** + * Mouse wheel event structure (event.wheel.*) + *} + PPSDL_MouseWheelEvent = ^PSDL_MouseWheelEvent; + PSDL_MouseWheelEvent = ^TSDL_MouseWheelEvent; + TSDL_MouseWheelEvent = record + type_: cuint32; // SDL_MOUSEWHEEL + timestamp: cuint32; + windowID: cuint32; // The window with mouse focus, if any + which: cuint32; // The mouse instance id, or SDL_TOUCH_MOUSEID + x: cint32; // The amount scrolled horizontally + y: cint32; // The amount scrolled vertically + direction: cuint32; // Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back + preciseX: cfloat; // The amount scrolled horizontally, positive to the right and negative to the left, with float precision (added in 2.0.18) + preciseY: cfloat; // The amount scrolled vertically, positive away from the user and negative toward the user, with float precision (added in 2.0.18) + mouseX: cint32; // X coordinate, relative to window (added in 2.26.0) + mouseY: cint32; // Y coordinate, relative to window (added in 2.26.0) + end; + + {** + * Joystick axis motion event structure (event.jaxis.*) + *} + PPSDL_JoyAxisEvent = ^PSDL_JoyAxisEvent; + PSDL_JoyAxisEvent = ^TSDL_JoyAxisEvent; + TSDL_JoyAxisEvent = record + type_: cuint32; // SDL_JOYAXISMOTION + timestamp: cuint32; + which: TSDL_JoystickID; // The joystick instance id + axis: cuint8; // The joystick axis index + padding1: cuint8; + padding2: cuint8; + padding3: cuint8; + value: cint16; // The axis value (range: -32768 to 32767) + padding4: cuint16; + end; + + {** + * Joystick trackball motion event structure (event.jball.*) + *} + PPSDL_JoyBallEvent = ^PSDL_JoyBallEvent; + PSDL_JoyBallEvent = ^TSDL_JoyBallEvent; + TSDL_JoyBallEvent = record + type_: cuint32; // SDL_JOYBALLMOTION + timestamp: cuint32; + which: TSDL_JoystickID; // The joystick instance id + ball: cuint8; // The joystick trackball index + padding1: cuint8; + padding2: cuint8; + padding3: cuint8; + xrel: cint16; // The relative motion in the X direction + yrel: cint16; // The relative motion in the Y direction + end; + + {** + * Joystick hat position change event structure (event.jhat.*) + *} + PPSDL_JoyHatEvent = ^PSDL_JoyHatEvent; + PSDL_JoyHatEvent = ^TSDL_JoyHatEvent; + TSDL_JoyHatEvent = record + type_: cuint32; // SDL_JOYHATMOTION + timestamp: cuint32; + which: TSDL_JoystickID; // The joystick instance id + hat: cuint8; // The joystick hat index + value: cuint8; {* The hat position value. + * SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP + * SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT + * SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN + * + * Note that zero means the POV is centered. + *} + padding1: cuint8; + padding2: cuint8; + end; + + {** + * Joystick button event structure (event.jbutton.*) + *} + PPSDL_JoyButtonEvent = ^PSDL_JoyButtonEvent; + PSDL_JoyButtonEvent = ^TSDL_JoyButtonEvent; + TSDL_JoyButtonEvent = record + type_: cuint32; // SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP + timestamp: cuint32; + which: TSDL_JoystickID; // The joystick instance id + button: cuint8; // The joystick button index + state: cuint8; // SDL_PRESSED or SDL_RELEASED + padding1: cuint8; + padding2: cuint8; + end; + + {** + * Joystick device event structure (event.jdevice.*) + *} + PPSDL_JoyDeviceEvent = ^PSDL_JoyDeviceEvent; + PSDL_JoyDeviceEvent = ^TSDL_JoyDeviceEvent; + TSDL_JoyDeviceEvent = record + type_: cuint32; // SDL_JOYDEVICEADDED or SDL_JOYDEVICEREMOVED + timestamp: cuint32; + which: cint32; // The joystick device index for the ADDED event, instance id for the REMOVED event + end; + + {** + * Joysick battery level change event structure (event.jbattery.*) + *} + PPSDL_JoyBatteryEvent = ^PSDL_JoyBatteryEvent; + PSDL_JoyBatteryEvent = ^TSDL_JoyBatteryEvent; + TSDL_JoyBatteryEvent = record + type_: cuint32; // SDL_JOYBATTERYUPDATED + timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() + which: TSDL_JoystickID; // The joystick instance id + level: TSDL_JoystickPowerLevel; // The joystick battery level + end; + + {** + * Game controller axis motion event structure (event.caxis.*) + *} + PPSDL_ControllerAxisEvent = ^PSDL_ControllerAxisEvent; + PSDL_ControllerAxisEvent = ^TSDL_ControllerAxisEvent; + TSDL_ControllerAxisEvent = record + type_: cuint32; // SDL_CONTROLLERAXISMOTION + timestamp: cuint32; + which: TSDL_JoystickID; // The joystick instance id + axis: cuint8; // The controller axis (SDL_GameControllerAxis) + padding1: cuint8; + padding2: cuint8; + padding3: cuint8; + value: cint16; // The axis value (range: -32768 to 32767) + padding4: cuint16; + end; + + {** + * Game controller button event structure (event.cbutton.*) + *} + PPSDL_ControllerButtonEvent = ^PSDL_ControllerButtonEvent; + PSDL_ControllerButtonEvent = ^TSDL_ControllerButtonEvent; + TSDL_ControllerButtonEvent = record + type_: cuint32; // SDL_CONTROLLERBUTTONDOWN or SDL_CONTROLLERBUTTONUP + timestamp: cuint32; + which: TSDL_JoystickID; // The joystick instance id + button: cuint8; // The controller button (SDL_GameControllerButton) + state: cuint8; // SDL_PRESSED or SDL_RELEASED + padding1: cuint8; + padding2: cuint8; + end; + + + {** + * Controller device event structure (event.cdevice.*) + *} + PPSDL_ControllerDeviceEvent = ^PSDL_ControllerDeviceEvent; + PSDL_ControllerDeviceEvent = ^TSDL_ControllerDeviceEvent; + TSDL_ControllerDeviceEvent = record + type_: cuint32; // SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEREMOVED, or SDL_CONTROLLERDEVICEREMAPPED + timestamp: cuint32; + which: cint32; // The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event + end; + + {** + * Game controller touchpad event structure (event.ctouchpad.*) + *} + PPSDL_ControllerTouchpadEvent = ^PSDL_ControllerTouchpadEvent; + PSDL_ControllerTouchpadEvent = ^TSDL_ControllerTouchpadEvent; + TSDL_ControllerTouchpadEvent = record + type_: cuint32; // SDL_CONTROLLERTOUCHPADDOWN or SDL_CONTROLLERTOUCHPADMOTION or SDL_CONTROLLERTOUCHPADUP + timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() + which: TSDL_JoystickID; // The joystick instance id + touchpad: cint32; // The index of the touchpad + finger: cint32; // The index of the finger on the touchpad + x: cfloat; // Normalized in the range 0...1 with 0 being on the left + y: cfloat; // Normalized in the range 0...1 with 0 being at the top + pressure: cfloat; // Normalized in the range 0...1 + end; + + {** + * Game controller sensor event structure (event.csensor.*) + *} + PPSDL_ControllerSensorEvent = ^PSDL_ControllerSensorEvent; + PSDL_ControllerSensorEvent = ^TSDL_ControllerSensorEvent; + TSDL_ControllerSensorEvent = record + type_: cuint32; // SDL_CONTROLLERSENSORUPDATE + timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() + which: TSDL_JoystickID; // The joystick instance id + sensor: cint32; // The type of the sensor, one of the values of SDL_SensorType + data: array[0..2] of cfloat; // Up to 3 values from the sensor, as defined in SDL_sensor.h + end; + + {** + * Audio device event structure (event.adevice.*) + *} + PPSDL_AudioDeviceEvent = ^PSDL_AudioDeviceEvent; + PSDL_AudioDeviceEvent = ^TSDL_AudioDeviceEvent; + TSDL_AudioDeviceEvent = record + type_: cuint32; // ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED + timestamp: cuint32; + which: cuint32; // The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event + iscapture: cuint8; // zero if an output device, non-zero if a capture device. + padding1: cuint8; + padding2: cuint8; + padding3: cuint8; + end; + + + {** + * Touch finger event structure (event.tfinger.*) + *} + PPSDL_TouchFingerEvent = ^PSDL_TouchFingerEvent; + PSDL_TouchFingerEvent = ^TSDL_TouchFingerEvent; + TSDL_TouchFingerEvent = record + type_: cuint32; // SDL_FINGERMOTION or SDL_FINGERDOWN or SDL_FINGERUP + timestamp: cuint32; + touchId: TSDL_TouchID; // The touch device id + fingerId: TSDL_FingerID; + x: cfloat; // Normalized in the range 0...1 + y: cfloat; // Normalized in the range 0...1 + dx: cfloat; // Normalized in the range 0...1 + dy: cfloat; // Normalized in the range 0...1 + pressure: cfloat; // Normalized in the range 0...1 + window: cuint32; // The window underneath the finger, if any + end; + + {** + * Multiple Finger Gesture Event (event.mgesture.*) + *} + PPSDL_MultiGestureEvent = ^PSDL_MultiGestureEvent; + PSDL_MultiGestureEvent = ^TSDL_MultiGestureEvent; + TSDL_MultiGestureEvent = record + type_: cuint32; // SDL_MULTIGESTURE + timestamp: cuint32; + touchId: TSDL_TouchID; // The touch device index + dTheta: cfloat; + dDist: cfloat; + x: cfloat; + y: cfloat; + numFingers: cuint16; + padding: cuint16; + end; + + + {* (event.dgesture.*) *} + PPSDL_DollarGestureEvent = ^PSDL_DollarGestureEvent; + PSDL_DollarGestureEvent = ^TSDL_DollarGestureEvent; + TSDL_DollarGestureEvent = record + type_: cuint32; // SDL_DOLLARGESTURE + timestamp: cuint32; + touchId: TSDL_TouchID; // The touch device id + gestureId: TSDL_GestureID; + numFingers: cuint32; + error: cfloat; + x: cfloat; // Normalized center of gesture + y: cfloat; // Normalized center of gesture + end; + + + {** + * An event used to request a file open by the system (event.drop.*) + * This event is disabled by default, you can enable it with SDL_EventState() + * If you enable this event, you must free the filename in the event. + *} + PPSDL_DropEvent = ^PSDL_DropEvent; + PSDL_DropEvent = ^TSDL_DropEvent; + TSDL_DropEvent = record + type_: cuint32; // SDL_DROPBEGIN or SDL_DROPFILE or SDL_DROPTEXT or SDL_DROPCOMPLETE + timestamp: cuint32; + file_: PAnsiChar; // The file name, which should be freed with SDL_free(), is NIL on begin/complete + windowID: cuint32; // The window that was dropped on, if any + end; + + {** + * Sensor event structure (event.sensor.*) + *} + PPSDL_SensorEvent = ^PSDL_SensorEvent; + PSDL_SensorEvent = ^TSDL_SensorEvent; + TSDL_SensorEvent = record + type_: cuint32; // SDL_SENSORUPDATED + timestamp: cuint32; // In milliseconds, populated using SDL_GetTicks() + which: cint32; // The instance ID of the sensor + data: array[0..5] of cfloat; // Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() + end; + + {** + * The "quit requested" event + *} + PPSDL_QuitEvent = ^PSDL_QuitEvent; + PSDL_QuitEvent = ^TSDL_QuitEvent; + TSDL_QuitEvent = record + type_: cuint32; // SDL_QUIT + timestamp: cuint32; + end; + + {** + * A user-defined event type (event.user.*) + *} + PPSDL_UserEvent = ^PSDL_UserEvent; + PSDL_UserEvent = ^TSDL_UserEvent; + TSDL_UserEvent = record + type_: cuint32; // SDL_USEREVENT through SDL_NUMEVENTS-1 + timestamp: cuint32; + windowID: cuint32; // The associated window if any + code: cint32; // User defined event code + data1: Pointer; // User defined data pointer + data2: Pointer; // User defined data pointer + end; + + {** + * A video driver dependent system event (event.syswm.*) + * This event is disabled by default, you can enable it with SDL_EventState() + * + * If you want to use this event, you should include SDL_syswm.h. + *} + PPSDL_SysWMEvent = ^PSDL_SysWMEvent; + PSDL_SysWMEvent = ^TSDL_SysWMEvent; + TSDL_SysWMEvent = record + type_: cuint32; // SDL_SYSWMEVENT + timestamp: cuint32; + msg: PSDL_SysWMmsg; // driver dependent data (defined in SDL_syswm.h) + end; + + {** + * General event structure + *} + PPSDL_Event = ^PSDL_Event; + PSDL_Event = ^TSDL_Event; + TSDL_Event = record + case cint of + 0: (type_: cuint32); + + SDL_COMMONEVENT: (common: TSDL_CommonEvent); + SDL_DISPLAYEVENT: (display: TSDL_DisplayEvent); + SDL_WINDOWEVENT: (window: TSDL_WindowEvent); + + SDL_KEYUP, + SDL_KEYDOWN: (key: TSDL_KeyboardEvent); + SDL_TEXTEDITING: (edit: TSDL_TextEditingEvent); + SDL_TEXTEDITING_EXT: (exitExt: TSDL_TextEditingExtEvent); + SDL_TEXTINPUT: (text: TSDL_TextInputEvent); + + SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent); + SDL_MOUSEBUTTONUP, + SDL_MOUSEBUTTONDOWN: (button: TSDL_MouseButtonEvent); + SDL_MOUSEWHEEL: (wheel: TSDL_MouseWheelEvent); + + SDL_JOYAXISMOTION: (jaxis: TSDL_JoyAxisEvent); + SDL_JOYBALLMOTION: (jball: TSDL_JoyBallEvent); + SDL_JOYHATMOTION: (jhat: TSDL_JoyHatEvent); + SDL_JOYBUTTONDOWN, + SDL_JOYBUTTONUP: (jbutton: TSDL_JoyButtonEvent); + SDL_JOYDEVICEADDED, + SDL_JOYDEVICEREMOVED: (jdevice: TSDL_JoyDeviceEvent); + SDL_JOYBATTERYUPDATED: (jbattery: TSDL_JoyBatteryEvent); + + SDL_CONTROLLERAXISMOTION: (caxis: TSDL_ControllerAxisEvent); + SDL_CONTROLLERBUTTONUP, + SDL_CONTROLLERBUTTONDOWN: (cbutton: TSDL_ControllerButtonEvent); + SDL_CONTROLLERDEVICEADDED, + SDL_CONTROLLERDEVICEREMOVED, + SDL_CONTROLLERDEVICEREMAPPED: (cdevice: TSDL_ControllerDeviceEvent); + SDL_CONTROLLERTOUCHPADDOWN, + SDL_CONTROLLERTOUCHPADMOTION, + SDL_CONTROLLERTOUCHPADUP: (ctouchpad: TSDL_ControllerTouchpadEvent); + SDL_CONTROLLERSENSORUPDATE: (csensor: TSDL_ControllerSensorEvent); + + SDL_AUDIODEVICEADDED, + SDL_AUDIODEVICEREMOVED: (adevice: TSDL_AudioDeviceEvent); + + SDL_SENSORUPDATED: (sensor: TSDL_SensorEvent); + + SDL_QUITEV: (quit: TSDL_QuitEvent); + + SDL_USEREVENT: (user: TSDL_UserEvent); + SDL_SYSWMEVENT: (syswm: TSDL_SysWMEvent); + + SDL_FINGERDOWN, + SDL_FINGERUP, + SDL_FINGERMOTION: (tfinger: TSDL_TouchFingerEvent); + SDL_MULTIGESTURE: (mgesture: TSDL_MultiGestureEvent); + SDL_DOLLARGESTURE,SDL_DOLLARRECORD: (dgesture: TSDL_DollarGestureEvent); + + SDL_DROPFILE: (drop: TSDL_DropEvent); + end; + + + {* Function prototypes *} + + {** + * Pumps the event loop, gathering events from the input devices. + * + * This function updates the event queue and internal input device state. + * + * This should only be run in the thread that sets the video mode. + *} + procedure SDL_PumpEvents cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PumpEvents' {$ENDIF} {$ENDIF}; + +const + SDL_ADDEVENT = 0; + SDL_PEEKEVENT = 1; + SDL_GETEVENT = 2; + +type + PPSDL_EventAction = ^PSDL_EventAction; + PSDL_EventAction = ^TSDL_EventAction; + TSDL_EventAction = Word; + + {** + * Checks the event queue for messages and optionally returns them. + * + * If action is SDL_ADDEVENT, up to numevents events will be added to + * the back of the event queue. + * + * If action is SDL_PEEKEVENT, up to numevents events at the front + * of the event queue, within the specified minimum and maximum type, + * will be returned and will not be removed from the queue. + * + * If action is SDL_GETEVENT, up to numevents events at the front + * of the event queue, within the specified minimum and maximum type, + * will be returned and will be removed from the queue. + * + * Result: The number of events actually stored, or -1 if there was an error. + * + * This function is thread-safe. + *} + + function SDL_PeepEvents(events: PSDL_Event; numevents: cint32; action: TSDL_EventAction; minType, maxType: TSDL_EventType): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PeepEvents' {$ENDIF} {$ENDIF}; + + {** + * Checks to see if certain event types are in the event queue. + *} + + function SDL_HasEvent(type_: TSDL_EventType): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasEvent' {$ENDIF} {$ENDIF}; + function SDL_HasEvents(minType, maxType: TSDL_EventType): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasEvents' {$ENDIF} {$ENDIF}; + + {** + * This function clears events from the event queue + *} + + procedure SDL_FlushEvent(type_: TSDL_EventType) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FlushEvent' {$ENDIF} {$ENDIF}; + procedure SDL_FlushEvents(minType, maxType: TSDL_EventType) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FlushEvents' {$ENDIF} {$ENDIF}; + + {** + * Polls for currently pending events. + * + * 1 if there are any pending events, or 0 if there are none available. + * + * event - If not nil, the next event is removed from the queue and + * stored in that area. + *} + + function SDL_PollEvent(event: PSDL_Event): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PollEvent' {$ENDIF} {$ENDIF}; + + {** + * Waits indefinitely for the next available event. + * + * 1, or 0 if there was an error while waiting for events. + * + * event - If not nil, the next event is removed from the queue and + * stored in that area. + *} + + function SDL_WaitEvent(event: PSDL_Event): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WaitEvent' {$ENDIF} {$ENDIF}; + + {** + * Waits until the specified timeout (in milliseconds) for the next + * available event. + * + * 1, or 0 if there was an error while waiting for events. + * + * event - If not nil, the next event is removed from the queue and + * stored in that area. + *} + + function SDL_WaitEventTimeout(event: PSDL_Event; timeout: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WaitEventTimeout' {$ENDIF} {$ENDIF}; + + {** + * Add an event to the event queue. + * + * 1 on success, 0 if the event was filtered, or -1 if the event queue + * was full or there was some other error. + *} + + function SDL_PushEvent(event: PSDL_Event): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PumpEvents' {$ENDIF} {$ENDIF}; + +type + PPSDL_EventFilter = ^PSDL_EventFilter; + PSDL_EventFilter = ^TSDL_EventFilter; + {$IFNDEF GPC} + TSDL_EventFilter = function(userdata: Pointer; event: PSDL_Event): cint; cdecl; + {$ELSE} + TSDL_EventFilter = function( userdata: Pointer; event: PSDL_Event ): cint; + {$ENDIF} + + {** + * Sets up a filter to process all events before they change internal state and + * are posted to the internal event queue. + * + * If the filter returns 1, then the event will be added to the internal queue. + * If it returns 0, then the event will be dropped from the queue, but the + * internal state will still be updated. This allows selective filtering of + * dynamically arriving events. + * + * Be very careful of what you do in the event filter function, as + * it may run in a different thread! + * + * There is one caveat when dealing with the SDL_QUITEVENT event type. The + * event filter is only called when the window manager desires to close the + * application window. If the event filter returns 1, then the window will + * be closed, otherwise the window will remain open if possible. + * + * If the quit event is generated by an interrupt signal, it will bypass the + * internal queue and be delivered to the application at the next event poll. + *} + + procedure SDL_SetEventFilter(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetEventFilter' {$ENDIF} {$ENDIF}; + + {** + * Return the current event filter - can be used to "chain" filters. + * If there is no event filter set, this function returns SDL_FALSE. + *} + + function SDL_GetEventFilter(var filter: PSDL_EventFilter; var userdata: PPointer): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetEventFilter' {$ENDIF} {$ENDIF}; + + {** + * Add a function which is called when an event is added to the queue. + *} + + procedure SDL_AddEventWatch(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AddEventWatch' {$ENDIF} {$ENDIF}; + + {** + * Remove an event watch function added with SDL_AddEventWatch() + *} + + procedure SDL_DelEventWatch(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DelEventWatch' {$ENDIF} {$ENDIF}; + + {** + * Run the filter function on the current event queue, removing any + * events for which the filter returns 0. + *} + + procedure SDL_FilterEvents(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FilterEvents' {$ENDIF} {$ENDIF}; + +const + + SDL_QUERY = -1; + SDL_IGNORE = 0; + SDL_DISABLE = 0; + SDL_ENABLE = 1; + + {** + * This function allows you to set the state of processing certain events. + * - If state is set to SDL_IGNORE, that event will be automatically + * dropped from the event queue and will not event be filtered. + * - If state is set to SDL_ENABLE, that event will be processed + * normally. + * - If state is set to SDL_QUERY, SDL_EventState() will return the + * current processing state of the specified event. + *} + + function SDL_EventState(type_: TSDL_EventType; state: cint32): cuint8 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EventState' {$ENDIF} {$ENDIF}; + + function SDL_GetEventState(type_: TSDL_EventType): cuint8; + + {** + * This function allocates a set of user-defined events, and returns + * the beginning event number for that set of events. + * + * If there aren't enough user-defined events left, this function + * returns (Uint32)-1 + *} + + function SDL_RegisterEvents(numevents: cint32): cuint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RegisterEvents' {$ENDIF} {$ENDIF}; diff --git a/units/sdlfilesystem.inc b/units/sdlfilesystem.inc index a9117cc8..039f6da9 100644 --- a/units/sdlfilesystem.inc +++ b/units/sdlfilesystem.inc @@ -1,121 +1,121 @@ -{* - * \file SDL_filesystem.h - * - * \brief Include file for filesystem SDL API functions - } - -{* - * Get the directory where the application was run from. - * - * This is not necessarily a fast call, so you should call this once near - * startup and save the string if you need it. - * - * **Mac OS X and iOS Specific Functionality**: If the application is in a - * ".app" bundle, this function returns the Resource directory (e.g. - * MyApp.app/Contents/Resources/). This behaviour can be overridden by adding - * a property to the Info.plist file. Adding a string key with the name - * SDL_FILESYSTEM_BASE_DIR_TYPE with a supported value will change the - * behaviour. - * - * Supported values for the SDL_FILESYSTEM_BASE_DIR_TYPE property (Given an - * application in /Applications/SDLApp/MyApp.app): - * - * - `resource`: bundle resource directory (the default). For example: - * `/Applications/SDLApp/MyApp.app/Contents/Resources` - * - `bundle`: the Bundle directory. For example: - * `/Applications/SDLApp/MyApp.app/` - * - `parent`: the containing directory of the bundle. For example: - * `/Applications/SDLApp/` - * - * The returned path is guaranteed to end with a path separator ('\' on - * Windows, '/' on most other platforms). - * - * The pointer returned is owned by the caller. Please call SDL_free() on the - * pointer when done with it. - * - * \returns an absolute path in UTF-8 encoding to the application data - * directory. nil will be returned on error or when the platform - * doesn't implement this functionality, call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.1. - * - * \sa SDL_GetPrefPath - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetBasePath_fun = function(): PAnsiChar; cdecl; -Var - SDL_GetBasePath : TSDL_GetBasePath_fun = Nil; -{$else} - -function SDL_GetBasePath(): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetBasePath' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Get the user-and-app-specific path where files can be written. - * - * Get the "pref dir". This is meant to be where users can write personal - * files (preferences and save games, etc) that are specific to your - * application. This directory is unique per user, per application. - * - * This function will decide the appropriate location in the native - * filesystem, create the directory if necessary, and return a string of the - * absolute path to the directory in UTF-8 encoding. - * - * On Windows, the string might look like: - * - * `C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\` - * - * On Linux, the string might look like: - * - * `/home/bob/.local/share/My Program Name/` - * - * On Mac OS X, the string might look like: - * - * `/Users/bob/Library/Application Support/My Program Name/` - * - * You should assume the path returned by this function is the only safe place - * to write files (and that SDL_GetBasePath(), while it might be writable, or - * even the parent of the returned path, isn't where you should be writing - * things). - * - * Both the org and app strings may become part of a directory name, so please - * follow these rules: - * - * - Try to use the same org string (_including case-sensitivity_) for all - * your applications that use this function. - * - Always use a unique app string for each one, and make sure it never - * changes for an app once you've decided on it. - * - Unicode characters are legal, as long as it's UTF-8 encoded, but... - * - ...only use letters, numbers, and spaces. Avoid punctuation like "Game - * Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient. - * - * The returned path is guaranteed to end with a path separator ('\' on - * Windows, '/' on most other platforms). - * - * The pointer returned is owned by the caller. Please call SDL_free() on the - * pointer when done with it. - * - * \param org the name of your organization - * \param app the name of your application - * \returns a UTF-8 string of the user directory in platform-dependent - * notation. nil if there's a problem (creating directory failed, - * etc.). - * - * \since This function is available since SDL 2.0.1. - * - * \sa SDL_GetBasePath - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetPrefPath_fun = function(org: PAnsiChar; app: PAnsiChar): PAnsiChar; cdecl; -Var - SDL_GetPrefPath : TSDL_GetPrefPath_fun = Nil; -{$else} - -function SDL_GetPrefPath(org: PAnsiChar; app: PAnsiChar): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPrefPath' {$ENDIF} {$ENDIF}; -{$endif} - +{* + * \file SDL_filesystem.h + * + * \brief Include file for filesystem SDL API functions + } + +{* + * Get the directory where the application was run from. + * + * This is not necessarily a fast call, so you should call this once near + * startup and save the string if you need it. + * + * **Mac OS X and iOS Specific Functionality**: If the application is in a + * ".app" bundle, this function returns the Resource directory (e.g. + * MyApp.app/Contents/Resources/). This behaviour can be overridden by adding + * a property to the Info.plist file. Adding a string key with the name + * SDL_FILESYSTEM_BASE_DIR_TYPE with a supported value will change the + * behaviour. + * + * Supported values for the SDL_FILESYSTEM_BASE_DIR_TYPE property (Given an + * application in /Applications/SDLApp/MyApp.app): + * + * - `resource`: bundle resource directory (the default). For example: + * `/Applications/SDLApp/MyApp.app/Contents/Resources` + * - `bundle`: the Bundle directory. For example: + * `/Applications/SDLApp/MyApp.app/` + * - `parent`: the containing directory of the bundle. For example: + * `/Applications/SDLApp/` + * + * The returned path is guaranteed to end with a path separator ('\' on + * Windows, '/' on most other platforms). + * + * The pointer returned is owned by the caller. Please call SDL_free() on the + * pointer when done with it. + * + * \returns an absolute path in UTF-8 encoding to the application data + * directory. nil will be returned on error or when the platform + * doesn't implement this functionality, call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.1. + * + * \sa SDL_GetPrefPath + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetBasePath_fun = function(): PAnsiChar; cdecl; +Var + SDL_GetBasePath : TSDL_GetBasePath_fun = Nil; +{$else} + +function SDL_GetBasePath(): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetBasePath' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get the user-and-app-specific path where files can be written. + * + * Get the "pref dir". This is meant to be where users can write personal + * files (preferences and save games, etc) that are specific to your + * application. This directory is unique per user, per application. + * + * This function will decide the appropriate location in the native + * filesystem, create the directory if necessary, and return a string of the + * absolute path to the directory in UTF-8 encoding. + * + * On Windows, the string might look like: + * + * `C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\` + * + * On Linux, the string might look like: + * + * `/home/bob/.local/share/My Program Name/` + * + * On Mac OS X, the string might look like: + * + * `/Users/bob/Library/Application Support/My Program Name/` + * + * You should assume the path returned by this function is the only safe place + * to write files (and that SDL_GetBasePath(), while it might be writable, or + * even the parent of the returned path, isn't where you should be writing + * things). + * + * Both the org and app strings may become part of a directory name, so please + * follow these rules: + * + * - Try to use the same org string (_including case-sensitivity_) for all + * your applications that use this function. + * - Always use a unique app string for each one, and make sure it never + * changes for an app once you've decided on it. + * - Unicode characters are legal, as long as it's UTF-8 encoded, but... + * - ...only use letters, numbers, and spaces. Avoid punctuation like "Game + * Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient. + * + * The returned path is guaranteed to end with a path separator ('\' on + * Windows, '/' on most other platforms). + * + * The pointer returned is owned by the caller. Please call SDL_free() on the + * pointer when done with it. + * + * \param org the name of your organization + * \param app the name of your application + * \returns a UTF-8 string of the user directory in platform-dependent + * notation. nil if there's a problem (creating directory failed, + * etc.). + * + * \since This function is available since SDL 2.0.1. + * + * \sa SDL_GetBasePath + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetPrefPath_fun = function(org: PAnsiChar; app: PAnsiChar): PAnsiChar; cdecl; +Var + SDL_GetPrefPath : TSDL_GetPrefPath_fun = Nil; +{$else} + +function SDL_GetPrefPath(org: PAnsiChar; app: PAnsiChar): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPrefPath' {$ENDIF} {$ENDIF}; +{$endif} + diff --git a/units/sdlgamecontroller.inc b/units/sdlgamecontroller.inc index 416dde8c..b5ee6abb 100644 --- a/units/sdlgamecontroller.inc +++ b/units/sdlgamecontroller.inc @@ -1,978 +1,978 @@ -//from sdl_gamecontroller.h - -{** - * SDL_gamecontroller.h - * - * In order to use these functions, SDL_Init() must have been called - * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system - * for game controllers, and load appropriate drivers. - * - * If you would like to receive controller updates while the application - * is in the background, you should set the following hint before calling - * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS - *} - -{* The gamecontroller structure used to identify an SDL game controller *} -type - PPSDL_GameController = ^PSDL_GameController; - PSDL_GameController = type Pointer; - - PPSDL_GameControllerType = ^PSDL_GameControllerType; - PSDL_GameControllerType = ^TSDL_GameControllerType; - TSDL_GameControllerType = type cint; -const - SDL_CONTROLLER_TYPE_UNKNOWN = TSDL_GameControllerType(0); - SDL_CONTROLLER_TYPE_XBOX360 = TSDL_GameControllerType(1); - SDL_CONTROLLER_TYPE_XBOXONE = TSDL_GameControllerType(2); - SDL_CONTROLLER_TYPE_PS3 = TSDL_GameControllerType(3); - SDL_CONTROLLER_TYPE_PS4 = TSDL_GameControllerType(4); - SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO = TSDL_GameControllerType(5); - SDL_CONTROLLER_TYPE_VIRTUAL = TSDL_GameControllerType(6); - SDL_CONTROLLER_TYPE_PS5 = TSDL_GameControllerType(7); - SDL_CONTROLLER_TYPE_AMAZON_LUNA = TSDL_GameControllerType(8); - SDL_CONTROLLER_TYPE_GOOGLE_STADIA = TSDL_GameControllerType(9); - SDL_CONTROLLER_TYPE_NVIDIA_SHIELD = TSDL_GameControllerType(10); - SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT = TSDL_GameControllerType(11); - SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT = TSDL_GameControllerType(12); - SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR = TSDL_GameControllerType(13); - -type - PPSDL_GameControllerBindType = ^PSDL_GameControllerBindType; - PSDL_GameControllerBindType = ^TSDL_GameControllerBindType; - TSDL_GameControllerBindType = type cint; -const - SDL_CONTROLLER_BINDTYPE_NONE = TSDL_GameControllerBindType(0); - SDL_CONTROLLER_BINDTYPE_BUTTON = TSDL_GameControllerBindType(1); - SDL_CONTROLLER_BINDTYPE_AXIS = TSDL_GameControllerBindType(2); - SDL_CONTROLLER_BINDTYPE_HAT = TSDL_GameControllerBindType(3); - - {** - * Get the SDL joystick layer binding for this controller button/axis mapping - *} -type - THat = record - hat: cint; - hat_mask: cint; - end; - - PPSDL_GameControllerButtonBind = ^PSDL_GameControllerButtonBind; - PSDL_GameControllerButtonBind = ^TSDL_GameControllerButtonBind; - TSDL_GameControllerButtonBind = record - bindType: TSDL_GameControllerBindType; - case cint of - 0: ( button: cint; ); - 1: ( axis: cint; ); - 2: ( hat: THat; ); - end; - - {** - * To count the number of game controllers in the system for the following: - * int nJoysticks = SDL_NumJoysticks(); - * int nGameControllers = 0; - * for ( int i = 0; i < nJoysticks; i++ ) [ - * if ( SDL_IsGameController(i) ) [ - * nGameControllers++; - * - * !! Pascal Conv.: Changed curly to square brackets in above example code - to prevent opening comment blocks! - * - * Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is: - * guid,name,mappings - * - * Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones. - * Under Windows there is a reserved GUID of "xinput" that covers any XInput devices. - * The mapping format for joystick is: - * bX - a joystick button, index X - * hX.Y - hat X with value Y - * aX - axis X of the joystick - * Buttons can be used as a controller axis and vice versa. - * - * This string shows an example of a valid mapping for a controller - * "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7", - * - *} - - {** - * Add or update an existing mapping configuration - * - * 1 if mapping is added, 0 if updated, -1 on error - *} -function SDL_GameControllerAddMapping( mappingString: PAnsiChar ): cint cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerAddMapping' {$ENDIF} {$ENDIF}; - - {** - * Load a set of mappings from a seekable SDL data stream (memory or file), filtered by the current SDL_GetPlatform() - * A community sourced database of controllers is available at https://raw.github.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt - * - * If freerw is non-zero, the stream will be closed after being read. - * - * Returns number of mappings added, -1 on error - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerAddMappingsFromRW_fun = function(rw: PSDL_RWops; freerw: cint32):cint32; - cdecl; -Var - SDL_GameControllerAddMappingsFromRW : TSDL_GameControllerAddMappingsFromRW_fun = Nil; -{$else} - -function SDL_GameControllerAddMappingsFromRW(rw: PSDL_RWops; freerw: cint32):cint32; - cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerAddMappingsFromRW' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the number of mappings installed. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerNumMappings_fun = function():cint; cdecl; -Var - SDL_GameControllerNumMappings : TSDL_GameControllerNumMappings_fun = Nil; -{$else} - -function SDL_GameControllerNumMappings():cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerNumMappings' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get a mapping string for a GUID - * - * the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available - *} -function SDL_GameControllerMappingForGUID( guid: TSDL_JoystickGUID ): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerMappingForGUID' {$ENDIF} {$ENDIF}; - -{** - * Get the mapping at a particular index. - * - * Returns the mapping string. Must be freed with SDL_free(). - * Returns NIL if the index is out of range. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerMappingForIndex_fun = function(mapping_index: cint): PAnsiChar; cdecl; -Var - SDL_GameControllerMappingForIndex : TSDL_GameControllerMappingForIndex_fun = Nil; -{$else} - -function SDL_GameControllerMappingForIndex(mapping_index: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerMappingForIndex' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get a mapping string for an open GameController - * - * the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available - *} -function SDL_GameControllerMapping( gamecontroller: PSDL_GameController ): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerMapping' {$ENDIF} {$ENDIF}; - - {** - * Is the joystick on this index supported by the game controller interface? - *} -function SDL_IsGameController(joystick_index: cint): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsGameController' {$ENDIF} {$ENDIF}; - - {** - * Get the implementation dependent name of a game controller. - * This can be called before any controllers are opened. - * If no name can be found, this function returns NULL. - *} -function SDL_GameControllerNameForIndex(joystick_index: cint): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerNameForIndex' {$ENDIF} {$ENDIF}; - -{** - * Get the implementation dependent path for the game controller. - * - * This function can be called before any controllers are opened. - * - * `joystick_index` is the same as the `device_index` passed to - * SDL_JoystickOpen(). - * - * \param joystick_index the device_index of a device, from zero to - * SDL_NumJoysticks()-1 - * \returns the implementation-dependent path for the game controller, or NIL - * if there is no path or the index is invalid. - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_GameControllerPath - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerPathForIndex_fun = function(joystick_index: cint): PAnsiChar; cdecl; -Var - SDL_GameControllerPathForIndex : TSDL_GameControllerPathForIndex_fun = Nil; -{$else} - -function SDL_GameControllerPathForIndex(joystick_index: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerPathForIndex' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the type of a game controller. - * This can be called before any controllers are opened. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerTypeForIndex_fun = function(joystick_index: cint): TSDL_GameControllerType; cdecl; -Var - SDL_GameControllerTypeForIndex : TSDL_GameControllerTypeForIndex_fun = Nil; -{$else} - -function SDL_GameControllerTypeForIndex(joystick_index: cint): TSDL_GameControllerType; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerTypeForIndex' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the mapping of a game controller. - * This can be called before any controllers are opened. - * - * Returns the mapping string. Must be freed with SDL_free(). - * Returns NIL if no mapping is available. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerMappingForDeviceIndex_fun = function(joystick_index: cint): PAnsiChar; cdecl; -Var - SDL_GameControllerMappingForDeviceIndex : TSDL_GameControllerMappingForDeviceIndex_fun = Nil; -{$else} - -function SDL_GameControllerMappingForDeviceIndex(joystick_index: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerMappingForDeviceIndex' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Open a game controller for use. - * The index passed as an argument refers to the N'th game controller on the system. - * This index is the value which will identify this controller in future controller - * events. - * - * A controller identifier, or NULL if an error occurred. - *} -function SDL_GameControllerOpen(joystick_index: cint): PSDL_GameController cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerOpen' {$ENDIF} {$ENDIF}; - - {** - * Return the SDL_GameController associated with an instance id. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerFromInstanceID_fun = function(joyid: TSDL_JoystickID): PSDL_GameController; cdecl; -Var - SDL_GameControllerFromInstanceID : TSDL_GameControllerFromInstanceID_fun = Nil; -{$else} - -function SDL_GameControllerFromInstanceID(joyid: TSDL_JoystickID): PSDL_GameController; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerFromInstanceID' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the SDL_GameController associated with a player index. - * - * Please note that the player index is _not_ the device index, nor is it the - * instance id! - * - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerFromPlayerIndex_fun = function(player_index: cint): PSDL_GameController; cdecl; -Var - SDL_GameControllerFromPlayerIndex : TSDL_GameControllerFromPlayerIndex_fun = Nil; -{$else} - -function SDL_GameControllerFromPlayerIndex(player_index: cint): PSDL_GameController; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerFromPlayerIndex' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Return the name for this currently opened controller - *} -function SDL_GameControllerName(gamecontroller: PSDL_GameController): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerName' {$ENDIF} {$ENDIF}; - -{** - * Get the implementation-dependent path for an opened game controller. - * - * This is the same path as returned by SDL_GameControllerNameForIndex(), but - * it takes a controller identifier instead of the (unstable) device index. - * - * \param gamecontroller a game controller identifier previously returned by - * SDL_GameControllerOpen() - * \returns the implementation dependent path for the game controller, or NIL - * if there is no path or the identifier passed is invalid. - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_GameControllerPathForIndex - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerPath_fun = function(gamecontroller: PSDL_GameController): PAnsiChar; cdecl; -Var - SDL_GameControllerPath : TSDL_GameControllerPath_fun = Nil; -{$else} - -function SDL_GameControllerPath(gamecontroller: PSDL_GameController): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerPath' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the type of this currently opened controller - * - * This is the same name as returned by SDL_GameControllerTypeForIndex(), but - * it takes a controller identifier instead of the (unstable) device index. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerGetType_fun = function(gamecontroller: PSDL_GameController): TSDL_GameControllerType; cdecl; -Var - SDL_GameControllerGetType : TSDL_GameControllerGetType_fun = Nil; -{$else} - -function SDL_GameControllerGetType(gamecontroller: PSDL_GameController): TSDL_GameControllerType; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetType' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the player index of an opened game controller. - * For XInput controllers this returns the XInput user index. - * - * Returns the player index for controller, or -1 if it's not available. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerGetPlayerIndex_fun = function(gamecontroller: PSDL_GameController): cint; cdecl; -Var - SDL_GameControllerGetPlayerIndex : TSDL_GameControllerGetPlayerIndex_fun = Nil; -{$else} - -function SDL_GameControllerGetPlayerIndex(gamecontroller: PSDL_GameController): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetPlayerIndex' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Set the player index of an opened game controller. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerSetPlayerIndex_proc = procedure(gamecontroller: PSDL_GameController; player_index: cint); cdecl; -Var - SDL_GameControllerSetPlayerIndex : TSDL_GameControllerSetPlayerIndex_proc = Nil; -{$else} - -procedure SDL_GameControllerSetPlayerIndex(gamecontroller: PSDL_GameController; player_index: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerSetPlayerIndex' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the USB vendor ID of an opened controller, if available. - * - * If the vendor ID isn't available this function returns 0. - * - * \param gamecontroller the game controller object to query. - * \return the USB vendor ID, or zero if unavailable. - * - * \since This function is available since SDL 2.0.6. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerGetVendor_fun = function(gamecontroller: PSDL_GameController): cuint16; cdecl; -Var - SDL_GameControllerGetVendor : TSDL_GameControllerGetVendor_fun = Nil; -{$else} - -function SDL_GameControllerGetVendor(gamecontroller: PSDL_GameController): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetVendor' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the USB product ID of an opened controller, if available. - * If the product ID isn't available, this function returns 0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerGetProduct_fun = function(gamecontroller: PSDL_GameController): cuint16; cdecl; -Var - SDL_GameControllerGetProduct : TSDL_GameControllerGetProduct_fun = Nil; -{$else} - -function SDL_GameControllerGetProduct(gamecontroller: PSDL_GameController): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetProduct' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the product version of an opened controller, if available. - * If the product version isn't available, this function returns 0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerGetProductVersion_fun = function(gamecontroller: PSDL_GameController): cuint16; cdecl; -Var - SDL_GameControllerGetProductVersion : TSDL_GameControllerGetProductVersion_fun = Nil; -{$else} - -function SDL_GameControllerGetProductVersion(gamecontroller: PSDL_GameController): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetProductVersion' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the firmware version of an opened controller, if available. - * - * If the firmware version isn't available this function returns 0. - * - * \param gamecontroller the game controller object to query. - * \return the controller firmware version, or zero if unavailable. - * - * \since This function is available since SDL 2.24.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerGetFirmwareVersion_fun = function(gamecontroller: PSDL_GameController): cuint16; cdecl; -Var - SDL_GameControllerGetFirmwareVersion : TSDL_GameControllerGetFirmwareVersion_fun = Nil; -{$else} - -function SDL_GameControllerGetFirmwareVersion(gamecontroller: PSDL_GameController): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetFirmwareVersion' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the serial number of an opened controller, if available. - * - * Returns a string containing the serial number of the controller, - * or NIL if it is not available. Do _not_ free the string with SDL_free(). - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerGetSerial_fun = function(gamecontroller: PSDL_GameController): PAnsiChar; cdecl; -Var - SDL_GameControllerGetSerial : TSDL_GameControllerGetSerial_fun = Nil; -{$else} - -function SDL_GameControllerGetSerial(gamecontroller: PSDL_GameController): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetSerial' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the Steam Input handle of an opened controller, if available. - * - * Returns an InputHandle_t for the controller that can be used with Steam Input API: - * https://partner.steamgames.com/doc/api/ISteamInput - * - * \param gamecontroller the game controller object to query. - * \returns the gamepad handle, or 0 if unavailable. - * - * \since This function is available since SDL 2.30.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerGetSteamHandle_fun = function(gamecontroller: PSDL_GameController): cuint64; cdecl; -Var - SDL_GameControllerGetSteamHandle : TSDL_GameControllerGetSteamHandle_fun = Nil; -{$else} - -function SDL_GameControllerGetSteamHandle(gamecontroller: PSDL_GameController): cuint64; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetSteamHandle' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Returns SDL_TRUE if the controller has been opened and currently connected, - * or SDL_FALSE if it has not. - *} -function SDL_GameControllerGetAttached(gamecontroller: PSDL_GameController): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetAttached' {$ENDIF} {$ENDIF}; - - {** - * Get the underlying joystick object used by a controller - *} -function SDL_GameControllerGetJoystick(gamecontroller: PSDL_GameController): PSDL_Joystick cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetJoystick' {$ENDIF} {$ENDIF}; - - {** - * Enable/disable controller event polling. - * - * If controller events are disabled, you must call SDL_GameControllerUpdate() - * yourself and check the state of the controller when you want controller - * information. - * - * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE. - *} -function SDL_GameControllerEventState(state: cint): cint cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerEventState' {$ENDIF} {$ENDIF}; - - {** - * Update the current state of the open game controllers. - * - * This is called automatically by the event loop if any game controller - * events are enabled. - *} -procedure SDL_GameControllerUpdate() cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerUpdate' {$ENDIF} {$ENDIF}; - - {** - * The list of axes available from a controller - *} - -type - PPSDL_GameControllerAxis = ^PSDL_GameControllerAxis; - PSDL_GameControllerAxis = ^TSDL_GameControllerAxis; - TSDL_GameControllerAxis = type cint; -const - SDL_CONTROLLER_AXIS_INVALID = TSDL_GameControllerAxis(-1); - SDL_CONTROLLER_AXIS_LEFTX = TSDL_GameControllerAxis(0); - SDL_CONTROLLER_AXIS_LEFTY = TSDL_GameControllerAxis(1); - SDL_CONTROLLER_AXIS_RIGHTX = TSDL_GameControllerAxis(2); - SDL_CONTROLLER_AXIS_RIGHTY = TSDL_GameControllerAxis(3); - SDL_CONTROLLER_AXIS_TRIGGERLEFT = TSDL_GameControllerAxis(4); - SDL_CONTROLLER_AXIS_TRIGGERRIGHT = TSDL_GameControllerAxis(5); - SDL_CONTROLLER_AXIS_MAX = TSDL_GameControllerAxis(6); - - {** - * turn this string into a axis mapping - *} -function SDL_GameControllerGetAxisFromString(pchString: PAnsiChar): TSDL_GameControllerAxis cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetAxisFromString' {$ENDIF} {$ENDIF}; - - {** - * turn this axis enum into a string mapping - *} -function SDL_GameControllerGetStringForAxis(axis: TSDL_GameControllerAxis): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetStringForAxis' {$ENDIF} {$ENDIF}; - - {** - * Get the SDL joystick layer binding for this controller button mapping - *} -function SDL_GameControllerGetBindForAxis(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): TSDL_GameControllerButtonBind cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetBindForAxis' {$ENDIF} {$ENDIF}; - -{** - * Query whether a game controller has a given axis. - * - * This merely reports whether the controller's mapping defined this axis, - * as that is all the information SDL has about the physical device. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerHasAxis_fun = function(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): TSDL_Bool; cdecl; -Var - SDL_GameControllerHasAxis : TSDL_GameControllerHasAxis_fun = Nil; -{$else} - -function SDL_GameControllerHasAxis(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasAxis' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the current state of an axis control on a game controller. - * - * The state is a value ranging from -32768 to 32767. - * - * The axis indices start at index 0. - *} -function SDL_GameControllerGetAxis(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): cint16 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetAxis' {$ENDIF} {$ENDIF}; - - {** - * The list of buttons available from a controller - *} -type - PPSDL_GameControllerButton = ^PSDL_GameControllerButton; - PSDL_GameControllerButton = ^TSDL_GameControllerButton; - TSDL_GameControllerButton = type cint; -const - SDL_CONTROLLER_BUTTON_INVALID = TSDL_GameControllerButton(-1); - SDL_CONTROLLER_BUTTON_A = TSDL_GameControllerButton(0); - SDL_CONTROLLER_BUTTON_B = TSDL_GameControllerButton(1); - SDL_CONTROLLER_BUTTON_X = TSDL_GameControllerButton(2); - SDL_CONTROLLER_BUTTON_Y = TSDL_GameControllerButton(3); - SDL_CONTROLLER_BUTTON_BACK = TSDL_GameControllerButton(4); - SDL_CONTROLLER_BUTTON_GUIDE = TSDL_GameControllerButton(5); - SDL_CONTROLLER_BUTTON_START = TSDL_GameControllerButton(6); - SDL_CONTROLLER_BUTTON_LEFTSTICK = TSDL_GameControllerButton(7); - SDL_CONTROLLER_BUTTON_RIGHTSTICK = TSDL_GameControllerButton(8); - SDL_CONTROLLER_BUTTON_LEFTSHOULDER = TSDL_GameControllerButton(9); - SDL_CONTROLLER_BUTTON_RIGHTSHOULDER = TSDL_GameControllerButton(10); - SDL_CONTROLLER_BUTTON_DPAD_UP = TSDL_GameControllerButton(11); - SDL_CONTROLLER_BUTTON_DPAD_DOWN = TSDL_GameControllerButton(12); - SDL_CONTROLLER_BUTTON_DPAD_LEFT = TSDL_GameControllerButton(13); - SDL_CONTROLLER_BUTTON_DPAD_RIGHT = TSDL_GameControllerButton(14); - SDL_CONTROLLER_BUTTON_MISC1 = TSDL_GameControllerButton(15); {**< Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button *} - SDL_CONTROLLER_BUTTON_PADDLE1 = TSDL_GameControllerButton(16); {**< Xbox Elite paddle P1 *} - SDL_CONTROLLER_BUTTON_PADDLE2 = TSDL_GameControllerButton(17); {**< Xbox Elite paddle P3 *} - SDL_CONTROLLER_BUTTON_PADDLE3 = TSDL_GameControllerButton(18); {**< Xbox Elite paddle P2 *} - SDL_CONTROLLER_BUTTON_PADDLE4 = TSDL_GameControllerButton(19); {**< Xbox Elite paddle P4 *} - SDL_CONTROLLER_BUTTON_TOUCHPAD = TSDL_GameControllerButton(20); {**< PS4/PS5 touchpad button *} - SDL_CONTROLLER_BUTTON_MAX = TSDL_GameControllerButton(21); - - {** - * turn this string into a button mapping - *} -function SDL_GameControllerGetButtonFromString(pchString: PAnsiChar): TSDL_GameControllerButton cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetButtonFromString' {$ENDIF} {$ENDIF}; - - {** - * turn this button enum into a string mapping - *} -function SDL_GameControllerGetStringForButton(button: TSDL_GameControllerButton): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetStringForButton' {$ENDIF} {$ENDIF}; - -{** - * Get the SDL joystick layer binding for this controller button mapping - *} -function SDL_GameControllerGetBindForButton(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): TSDL_GameControllerButtonBind cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetBindForButton' {$ENDIF} {$ENDIF}; - -{** - * Query whether a game controller has a given button. - * - * This merely reports whether the controller's mapping defined this button, - * as that is all the information SDL has about the physical device. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerHasButton_fun = function(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): TSDL_Bool; cdecl; -Var - SDL_GameControllerHasButton : TSDL_GameControllerHasButton_fun = Nil; -{$else} - -function SDL_GameControllerHasButton(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasButton' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the current state of a button on a game controller. - * - * The button indices start at index 0. - *} -function SDL_GameControllerGetButton(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): cuint8 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetButton' {$ENDIF} {$ENDIF}; - -{** - * Get the number of touchpads on a game controller. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerGetNumTouchpads_fun = function(gamecontroller: PSDL_GameController): cint; cdecl; -Var - SDL_GameControllerGetNumTouchpads : TSDL_GameControllerGetNumTouchpads_fun = Nil; -{$else} - -function SDL_GameControllerGetNumTouchpads(gamecontroller: PSDL_GameController): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetNumTouchpads' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the number of supported simultaneous fingers on a touchpad on a game controller. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerGetNumTouchpadFingers_fun = function(gamecontroller: PSDL_GameController; touchpad: cint): cint; cdecl; -Var - SDL_GameControllerGetNumTouchpadFingers : TSDL_GameControllerGetNumTouchpadFingers_fun = Nil; -{$else} - -function SDL_GameControllerGetNumTouchpadFingers(gamecontroller: PSDL_GameController; touchpad: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetNumTouchpadFingers' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the current state of a finger on a touchpad on a game controller. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerGetTouchpadFinger_fun = function( - gamecontroller: PSDL_GameController; - touchpad, finger: cint; - state: pcuint8; - x, y, pressure: pcfloat - ): cint; cdecl; -Var - SDL_GameControllerGetTouchpadFinger : TSDL_GameControllerGetTouchpadFinger_fun = Nil; -{$else} - -function SDL_GameControllerGetTouchpadFinger( - gamecontroller: PSDL_GameController; - touchpad, finger: cint; - state: pcuint8; - x, y, pressure: pcfloat -): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetTouchpadFinger' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Return whether a game controller has a particular sensor. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerHasSensor_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): TSDL_Bool; cdecl; -Var - SDL_GameControllerHasSensor : TSDL_GameControllerHasSensor_fun = Nil; -{$else} - -function SDL_GameControllerHasSensor(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasSensor' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Set whether data reporting for a game controller sensor is enabled. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerSetSensorEnabled_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; enabled: TSDL_bool): cint; cdecl; -Var - SDL_GameControllerSetSensorEnabled : TSDL_GameControllerSetSensorEnabled_fun = Nil; -{$else} - -function SDL_GameControllerSetSensorEnabled(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; enabled: TSDL_bool): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerSetSensorEnabled' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Query whether sensor data reporting is enabled for a game controller. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerIsSensorEnabled_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): TSDL_Bool; cdecl; -Var - SDL_GameControllerIsSensorEnabled : TSDL_GameControllerIsSensorEnabled_fun = Nil; -{$else} - -function SDL_GameControllerIsSensorEnabled(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerIsSensorEnabled' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the data rate (number of events per second) of - * a game controller sensor. - * - * Returns the data rate, or 0.0 if the data rate is not available. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerGetSensorDataRate_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): cfloat; cdecl; -Var - SDL_GameControllerGetSensorDataRate : TSDL_GameControllerGetSensorDataRate_fun = Nil; -{$else} - -function SDL_GameControllerGetSensorDataRate(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetSensorDataRate' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the current state of a game controller sensor. - * - * The number of values and interpretation of the data is sensor dependent. - * See sdlsensor.inc for the details for each type of sensor. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerGetSensorData_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; data: pcfloat; num_values: cint): cint; cdecl; -Var - SDL_GameControllerGetSensorData : TSDL_GameControllerGetSensorData_fun = Nil; -{$else} - -function SDL_GameControllerGetSensorData(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; data: pcfloat; num_values: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetSensorData' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the current state of a game controller sensor with the timestamp of the - * last update. - * - * The number of values and interpretation of the data is sensor dependent. - * See SDL_sensor.h for the details for each type of sensor. - * - * \param gamecontroller The controller to query - * \param type The type of sensor to query - * \param timestamp A pointer filled with the timestamp in microseconds of the - * current sensor reading if available, or 0 if not - * \param data A pointer filled with the current sensor state - * \param num_values The number of values to write to data - * \return 0 or -1 if an error occurred. - * - * \since This function is available since SDL 2.26.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerGetSensorDataWithTimestamp_fun = function( - gamecontroller: PSDL_GameController; - senstype: TSDL_SensorType; - timestamp: pcuint64; - data: pcfloat; - num_values: cint - ): cint; cdecl; -Var - SDL_GameControllerGetSensorDataWithTimestamp : TSDL_GameControllerGetSensorDataWithTimestamp_fun = Nil; -{$else} - -function SDL_GameControllerGetSensorDataWithTimestamp( - gamecontroller: PSDL_GameController; - senstype: TSDL_SensorType; - timestamp: pcuint64; - data: pcfloat; - num_values: cint -): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetSensorDataWithTimestamp' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Query whether a game controller has rumble support. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerHasRumble_fun = function(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; -Var - SDL_GameControllerHasRumble : TSDL_GameControllerHasRumble_fun = Nil; -{$else} - -function SDL_GameControllerHasRumble(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasRumble' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Start a rumble effect on a game controller. - * - * Each call to this function cancels any previous rumble effect, and calling - * it with 0 intensity stops any rumbling. - * - * Returns 0, or -1 if rumble isn't supported on this controller. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerRumble_fun = function( - gamecontroller: PSDL_GameController; - low_frequency_rumble, high_frequency_rumble: cuint16; - duration_ms: cuint32 - ): cint; cdecl; - -Var - SDL_GameControllerRumble : TSDL_GameControllerRumble_fun = Nil; -{$else} - -function SDL_GameControllerRumble( - gamecontroller: PSDL_GameController; - low_frequency_rumble, high_frequency_rumble: cuint16; - duration_ms: cuint32 -): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerRumble' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Query whether a game controller has rumble support on triggers. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerHasRumbleTriggers_fun = function(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; -Var - SDL_GameControllerHasRumbleTriggers : TSDL_GameControllerHasRumbleTriggers_fun = Nil; -{$else} - -function SDL_GameControllerHasRumbleTriggers(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasRumbleTriggers' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Start a rumble effect in the game controller's triggers. - * - * Each call to this function cancels any previous trigger rumble effect, and - * calling it with 0 intensity stops any rumbling. - * - * Note that this is rumbling of the _triggers_ and not the game controller as - * a whole. This is currently only supported on Xbox One controllers. If you - * want the (more common) whole-controller rumble, use - * SDL_GameControllerRumble() instead. - * - * Returns 0, or -1 if trigger rumble isn't supported on this controller - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerRumbleTriggers_fun = function( - gamecontroller: PSDL_GameController; - left_rumble, right_rumble: cuint16; - duration_ms: cuint32 - ): cint; cdecl; - -Var - SDL_GameControllerRumbleTriggers : TSDL_GameControllerRumbleTriggers_fun = Nil; -{$else} - -function SDL_GameControllerRumbleTriggers( - gamecontroller: PSDL_GameController; - left_rumble, right_rumble: cuint16; - duration_ms: cuint32 -): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerRumbleTriggers' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Query whether a game controller has an LED. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerHasLED_fun = function(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; -Var - SDL_GameControllerHasLED : TSDL_GameControllerHasLED_fun = Nil; -{$else} - -function SDL_GameControllerHasLED(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasLED' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Update a game controller's LED color. - * - * Returns 0, or -1 if this controller does not have a modifiable LED. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerSetLED_fun = function(gamecontroller: PSDL_GameController; red, green, blue: cuint8): cint; cdecl; -Var - SDL_GameControllerSetLED : TSDL_GameControllerSetLED_fun = Nil; -{$else} - -function SDL_GameControllerSetLED(gamecontroller: PSDL_GameController; red, green, blue: cuint8): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerSetLED' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Send a controller-specific effect packet. - * - * Returns 0, or -1 if this controller or driver does not - * support effect packets. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerSendEffect_fun = function(gamecontroller: PSDL_GameController; data: Pointer; size: cint): cint; cdecl; -Var - SDL_GameControllerSendEffect : TSDL_GameControllerSendEffect_fun = Nil; -{$else} - -function SDL_GameControllerSendEffect(gamecontroller: PSDL_GameController; data: Pointer; size: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerSendEffect' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Close a controller previously opened with SDL_GameControllerOpen(). - *} -procedure SDL_GameControllerClose(gamecontroller: PSDL_GameController) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerClose' {$ENDIF} {$ENDIF}; - -{** - * Return the sfSymbolsName for a given axis on a game controller - * on Apple platforms. - * - * Returns the sfSymbolsName, or NIL if the name can't be found. - * Do _not_ pass this string to SDL_free(). - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerGetAppleSFSymbolsNameForAxis_fun = function(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): PAnsiChar; cdecl; -Var - SDL_GameControllerGetAppleSFSymbolsNameForAxis : TSDL_GameControllerGetAppleSFSymbolsNameForAxis_fun = Nil; -{$else} - -function SDL_GameControllerGetAppleSFSymbolsNameForAxis(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetAppleSFSymbolsNameForAxis' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Return the sfSymbolsName for a given button on a game controller - * on Apple platforms. - * - * Returns the sfSymbolsName, or NIL if the name can't be found. - * Do _not_ pass this string to SDL_free(). - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GameControllerGetAppleSFSymbolsNameForButton_fun = function(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): PAnsiChar; cdecl; -Var - SDL_GameControllerGetAppleSFSymbolsNameForButton : TSDL_GameControllerGetAppleSFSymbolsNameForButton_fun = Nil; -{$else} - -function SDL_GameControllerGetAppleSFSymbolsNameForButton(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetAppleSFSymbolsNameForButton' {$ENDIF} {$ENDIF}; -{$endif} - - -function SDL_GameControllerAddMappingsFromFile(Const FilePath:PAnsiChar):cint32; +//from sdl_gamecontroller.h + +{** + * SDL_gamecontroller.h + * + * In order to use these functions, SDL_Init() must have been called + * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system + * for game controllers, and load appropriate drivers. + * + * If you would like to receive controller updates while the application + * is in the background, you should set the following hint before calling + * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS + *} + +{* The gamecontroller structure used to identify an SDL game controller *} +type + PPSDL_GameController = ^PSDL_GameController; + PSDL_GameController = type Pointer; + + PPSDL_GameControllerType = ^PSDL_GameControllerType; + PSDL_GameControllerType = ^TSDL_GameControllerType; + TSDL_GameControllerType = type cint; +const + SDL_CONTROLLER_TYPE_UNKNOWN = TSDL_GameControllerType(0); + SDL_CONTROLLER_TYPE_XBOX360 = TSDL_GameControllerType(1); + SDL_CONTROLLER_TYPE_XBOXONE = TSDL_GameControllerType(2); + SDL_CONTROLLER_TYPE_PS3 = TSDL_GameControllerType(3); + SDL_CONTROLLER_TYPE_PS4 = TSDL_GameControllerType(4); + SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO = TSDL_GameControllerType(5); + SDL_CONTROLLER_TYPE_VIRTUAL = TSDL_GameControllerType(6); + SDL_CONTROLLER_TYPE_PS5 = TSDL_GameControllerType(7); + SDL_CONTROLLER_TYPE_AMAZON_LUNA = TSDL_GameControllerType(8); + SDL_CONTROLLER_TYPE_GOOGLE_STADIA = TSDL_GameControllerType(9); + SDL_CONTROLLER_TYPE_NVIDIA_SHIELD = TSDL_GameControllerType(10); + SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT = TSDL_GameControllerType(11); + SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT = TSDL_GameControllerType(12); + SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR = TSDL_GameControllerType(13); + +type + PPSDL_GameControllerBindType = ^PSDL_GameControllerBindType; + PSDL_GameControllerBindType = ^TSDL_GameControllerBindType; + TSDL_GameControllerBindType = type cint; +const + SDL_CONTROLLER_BINDTYPE_NONE = TSDL_GameControllerBindType(0); + SDL_CONTROLLER_BINDTYPE_BUTTON = TSDL_GameControllerBindType(1); + SDL_CONTROLLER_BINDTYPE_AXIS = TSDL_GameControllerBindType(2); + SDL_CONTROLLER_BINDTYPE_HAT = TSDL_GameControllerBindType(3); + + {** + * Get the SDL joystick layer binding for this controller button/axis mapping + *} +type + THat = record + hat: cint; + hat_mask: cint; + end; + + PPSDL_GameControllerButtonBind = ^PSDL_GameControllerButtonBind; + PSDL_GameControllerButtonBind = ^TSDL_GameControllerButtonBind; + TSDL_GameControllerButtonBind = record + bindType: TSDL_GameControllerBindType; + case cint of + 0: ( button: cint; ); + 1: ( axis: cint; ); + 2: ( hat: THat; ); + end; + + {** + * To count the number of game controllers in the system for the following: + * int nJoysticks = SDL_NumJoysticks(); + * int nGameControllers = 0; + * for ( int i = 0; i < nJoysticks; i++ ) [ + * if ( SDL_IsGameController(i) ) [ + * nGameControllers++; + * + * !! Pascal Conv.: Changed curly to square brackets in above example code + to prevent opening comment blocks! + * + * Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is: + * guid,name,mappings + * + * Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones. + * Under Windows there is a reserved GUID of "xinput" that covers any XInput devices. + * The mapping format for joystick is: + * bX - a joystick button, index X + * hX.Y - hat X with value Y + * aX - axis X of the joystick + * Buttons can be used as a controller axis and vice versa. + * + * This string shows an example of a valid mapping for a controller + * "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7", + * + *} + + {** + * Add or update an existing mapping configuration + * + * 1 if mapping is added, 0 if updated, -1 on error + *} +function SDL_GameControllerAddMapping( mappingString: PAnsiChar ): cint cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerAddMapping' {$ENDIF} {$ENDIF}; + + {** + * Load a set of mappings from a seekable SDL data stream (memory or file), filtered by the current SDL_GetPlatform() + * A community sourced database of controllers is available at https://raw.github.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt + * + * If freerw is non-zero, the stream will be closed after being read. + * + * Returns number of mappings added, -1 on error + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerAddMappingsFromRW_fun = function(rw: PSDL_RWops; freerw: cint32):cint32; + cdecl; +Var + SDL_GameControllerAddMappingsFromRW : TSDL_GameControllerAddMappingsFromRW_fun = Nil; +{$else} + +function SDL_GameControllerAddMappingsFromRW(rw: PSDL_RWops; freerw: cint32):cint32; + cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerAddMappingsFromRW' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the number of mappings installed. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerNumMappings_fun = function():cint; cdecl; +Var + SDL_GameControllerNumMappings : TSDL_GameControllerNumMappings_fun = Nil; +{$else} + +function SDL_GameControllerNumMappings():cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerNumMappings' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get a mapping string for a GUID + * + * the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available + *} +function SDL_GameControllerMappingForGUID( guid: TSDL_JoystickGUID ): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerMappingForGUID' {$ENDIF} {$ENDIF}; + +{** + * Get the mapping at a particular index. + * + * Returns the mapping string. Must be freed with SDL_free(). + * Returns NIL if the index is out of range. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerMappingForIndex_fun = function(mapping_index: cint): PAnsiChar; cdecl; +Var + SDL_GameControllerMappingForIndex : TSDL_GameControllerMappingForIndex_fun = Nil; +{$else} + +function SDL_GameControllerMappingForIndex(mapping_index: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerMappingForIndex' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get a mapping string for an open GameController + * + * the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available + *} +function SDL_GameControllerMapping( gamecontroller: PSDL_GameController ): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerMapping' {$ENDIF} {$ENDIF}; + + {** + * Is the joystick on this index supported by the game controller interface? + *} +function SDL_IsGameController(joystick_index: cint): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsGameController' {$ENDIF} {$ENDIF}; + + {** + * Get the implementation dependent name of a game controller. + * This can be called before any controllers are opened. + * If no name can be found, this function returns NULL. + *} +function SDL_GameControllerNameForIndex(joystick_index: cint): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerNameForIndex' {$ENDIF} {$ENDIF}; + +{** + * Get the implementation dependent path for the game controller. + * + * This function can be called before any controllers are opened. + * + * `joystick_index` is the same as the `device_index` passed to + * SDL_JoystickOpen(). + * + * \param joystick_index the device_index of a device, from zero to + * SDL_NumJoysticks()-1 + * \returns the implementation-dependent path for the game controller, or NIL + * if there is no path or the index is invalid. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GameControllerPath + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerPathForIndex_fun = function(joystick_index: cint): PAnsiChar; cdecl; +Var + SDL_GameControllerPathForIndex : TSDL_GameControllerPathForIndex_fun = Nil; +{$else} + +function SDL_GameControllerPathForIndex(joystick_index: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerPathForIndex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the type of a game controller. + * This can be called before any controllers are opened. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerTypeForIndex_fun = function(joystick_index: cint): TSDL_GameControllerType; cdecl; +Var + SDL_GameControllerTypeForIndex : TSDL_GameControllerTypeForIndex_fun = Nil; +{$else} + +function SDL_GameControllerTypeForIndex(joystick_index: cint): TSDL_GameControllerType; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerTypeForIndex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the mapping of a game controller. + * This can be called before any controllers are opened. + * + * Returns the mapping string. Must be freed with SDL_free(). + * Returns NIL if no mapping is available. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerMappingForDeviceIndex_fun = function(joystick_index: cint): PAnsiChar; cdecl; +Var + SDL_GameControllerMappingForDeviceIndex : TSDL_GameControllerMappingForDeviceIndex_fun = Nil; +{$else} + +function SDL_GameControllerMappingForDeviceIndex(joystick_index: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerMappingForDeviceIndex' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Open a game controller for use. + * The index passed as an argument refers to the N'th game controller on the system. + * This index is the value which will identify this controller in future controller + * events. + * + * A controller identifier, or NULL if an error occurred. + *} +function SDL_GameControllerOpen(joystick_index: cint): PSDL_GameController cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerOpen' {$ENDIF} {$ENDIF}; + + {** + * Return the SDL_GameController associated with an instance id. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerFromInstanceID_fun = function(joyid: TSDL_JoystickID): PSDL_GameController; cdecl; +Var + SDL_GameControllerFromInstanceID : TSDL_GameControllerFromInstanceID_fun = Nil; +{$else} + +function SDL_GameControllerFromInstanceID(joyid: TSDL_JoystickID): PSDL_GameController; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerFromInstanceID' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the SDL_GameController associated with a player index. + * + * Please note that the player index is _not_ the device index, nor is it the + * instance id! + * + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerFromPlayerIndex_fun = function(player_index: cint): PSDL_GameController; cdecl; +Var + SDL_GameControllerFromPlayerIndex : TSDL_GameControllerFromPlayerIndex_fun = Nil; +{$else} + +function SDL_GameControllerFromPlayerIndex(player_index: cint): PSDL_GameController; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerFromPlayerIndex' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Return the name for this currently opened controller + *} +function SDL_GameControllerName(gamecontroller: PSDL_GameController): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerName' {$ENDIF} {$ENDIF}; + +{** + * Get the implementation-dependent path for an opened game controller. + * + * This is the same path as returned by SDL_GameControllerNameForIndex(), but + * it takes a controller identifier instead of the (unstable) device index. + * + * \param gamecontroller a game controller identifier previously returned by + * SDL_GameControllerOpen() + * \returns the implementation dependent path for the game controller, or NIL + * if there is no path or the identifier passed is invalid. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GameControllerPathForIndex + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerPath_fun = function(gamecontroller: PSDL_GameController): PAnsiChar; cdecl; +Var + SDL_GameControllerPath : TSDL_GameControllerPath_fun = Nil; +{$else} + +function SDL_GameControllerPath(gamecontroller: PSDL_GameController): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerPath' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the type of this currently opened controller + * + * This is the same name as returned by SDL_GameControllerTypeForIndex(), but + * it takes a controller identifier instead of the (unstable) device index. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetType_fun = function(gamecontroller: PSDL_GameController): TSDL_GameControllerType; cdecl; +Var + SDL_GameControllerGetType : TSDL_GameControllerGetType_fun = Nil; +{$else} + +function SDL_GameControllerGetType(gamecontroller: PSDL_GameController): TSDL_GameControllerType; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetType' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the player index of an opened game controller. + * For XInput controllers this returns the XInput user index. + * + * Returns the player index for controller, or -1 if it's not available. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetPlayerIndex_fun = function(gamecontroller: PSDL_GameController): cint; cdecl; +Var + SDL_GameControllerGetPlayerIndex : TSDL_GameControllerGetPlayerIndex_fun = Nil; +{$else} + +function SDL_GameControllerGetPlayerIndex(gamecontroller: PSDL_GameController): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetPlayerIndex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Set the player index of an opened game controller. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerSetPlayerIndex_proc = procedure(gamecontroller: PSDL_GameController; player_index: cint); cdecl; +Var + SDL_GameControllerSetPlayerIndex : TSDL_GameControllerSetPlayerIndex_proc = Nil; +{$else} + +procedure SDL_GameControllerSetPlayerIndex(gamecontroller: PSDL_GameController; player_index: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerSetPlayerIndex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the USB vendor ID of an opened controller, if available. + * + * If the vendor ID isn't available this function returns 0. + * + * \param gamecontroller the game controller object to query. + * \return the USB vendor ID, or zero if unavailable. + * + * \since This function is available since SDL 2.0.6. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetVendor_fun = function(gamecontroller: PSDL_GameController): cuint16; cdecl; +Var + SDL_GameControllerGetVendor : TSDL_GameControllerGetVendor_fun = Nil; +{$else} + +function SDL_GameControllerGetVendor(gamecontroller: PSDL_GameController): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetVendor' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the USB product ID of an opened controller, if available. + * If the product ID isn't available, this function returns 0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetProduct_fun = function(gamecontroller: PSDL_GameController): cuint16; cdecl; +Var + SDL_GameControllerGetProduct : TSDL_GameControllerGetProduct_fun = Nil; +{$else} + +function SDL_GameControllerGetProduct(gamecontroller: PSDL_GameController): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetProduct' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the product version of an opened controller, if available. + * If the product version isn't available, this function returns 0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetProductVersion_fun = function(gamecontroller: PSDL_GameController): cuint16; cdecl; +Var + SDL_GameControllerGetProductVersion : TSDL_GameControllerGetProductVersion_fun = Nil; +{$else} + +function SDL_GameControllerGetProductVersion(gamecontroller: PSDL_GameController): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetProductVersion' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the firmware version of an opened controller, if available. + * + * If the firmware version isn't available this function returns 0. + * + * \param gamecontroller the game controller object to query. + * \return the controller firmware version, or zero if unavailable. + * + * \since This function is available since SDL 2.24.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetFirmwareVersion_fun = function(gamecontroller: PSDL_GameController): cuint16; cdecl; +Var + SDL_GameControllerGetFirmwareVersion : TSDL_GameControllerGetFirmwareVersion_fun = Nil; +{$else} + +function SDL_GameControllerGetFirmwareVersion(gamecontroller: PSDL_GameController): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetFirmwareVersion' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the serial number of an opened controller, if available. + * + * Returns a string containing the serial number of the controller, + * or NIL if it is not available. Do _not_ free the string with SDL_free(). + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetSerial_fun = function(gamecontroller: PSDL_GameController): PAnsiChar; cdecl; +Var + SDL_GameControllerGetSerial : TSDL_GameControllerGetSerial_fun = Nil; +{$else} + +function SDL_GameControllerGetSerial(gamecontroller: PSDL_GameController): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetSerial' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the Steam Input handle of an opened controller, if available. + * + * Returns an InputHandle_t for the controller that can be used with Steam Input API: + * https://partner.steamgames.com/doc/api/ISteamInput + * + * \param gamecontroller the game controller object to query. + * \returns the gamepad handle, or 0 if unavailable. + * + * \since This function is available since SDL 2.30.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetSteamHandle_fun = function(gamecontroller: PSDL_GameController): cuint64; cdecl; +Var + SDL_GameControllerGetSteamHandle : TSDL_GameControllerGetSteamHandle_fun = Nil; +{$else} + +function SDL_GameControllerGetSteamHandle(gamecontroller: PSDL_GameController): cuint64; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetSteamHandle' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Returns SDL_TRUE if the controller has been opened and currently connected, + * or SDL_FALSE if it has not. + *} +function SDL_GameControllerGetAttached(gamecontroller: PSDL_GameController): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetAttached' {$ENDIF} {$ENDIF}; + + {** + * Get the underlying joystick object used by a controller + *} +function SDL_GameControllerGetJoystick(gamecontroller: PSDL_GameController): PSDL_Joystick cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetJoystick' {$ENDIF} {$ENDIF}; + + {** + * Enable/disable controller event polling. + * + * If controller events are disabled, you must call SDL_GameControllerUpdate() + * yourself and check the state of the controller when you want controller + * information. + * + * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE. + *} +function SDL_GameControllerEventState(state: cint): cint cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerEventState' {$ENDIF} {$ENDIF}; + + {** + * Update the current state of the open game controllers. + * + * This is called automatically by the event loop if any game controller + * events are enabled. + *} +procedure SDL_GameControllerUpdate() cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerUpdate' {$ENDIF} {$ENDIF}; + + {** + * The list of axes available from a controller + *} + +type + PPSDL_GameControllerAxis = ^PSDL_GameControllerAxis; + PSDL_GameControllerAxis = ^TSDL_GameControllerAxis; + TSDL_GameControllerAxis = type cint; +const + SDL_CONTROLLER_AXIS_INVALID = TSDL_GameControllerAxis(-1); + SDL_CONTROLLER_AXIS_LEFTX = TSDL_GameControllerAxis(0); + SDL_CONTROLLER_AXIS_LEFTY = TSDL_GameControllerAxis(1); + SDL_CONTROLLER_AXIS_RIGHTX = TSDL_GameControllerAxis(2); + SDL_CONTROLLER_AXIS_RIGHTY = TSDL_GameControllerAxis(3); + SDL_CONTROLLER_AXIS_TRIGGERLEFT = TSDL_GameControllerAxis(4); + SDL_CONTROLLER_AXIS_TRIGGERRIGHT = TSDL_GameControllerAxis(5); + SDL_CONTROLLER_AXIS_MAX = TSDL_GameControllerAxis(6); + + {** + * turn this string into a axis mapping + *} +function SDL_GameControllerGetAxisFromString(pchString: PAnsiChar): TSDL_GameControllerAxis cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetAxisFromString' {$ENDIF} {$ENDIF}; + + {** + * turn this axis enum into a string mapping + *} +function SDL_GameControllerGetStringForAxis(axis: TSDL_GameControllerAxis): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetStringForAxis' {$ENDIF} {$ENDIF}; + + {** + * Get the SDL joystick layer binding for this controller button mapping + *} +function SDL_GameControllerGetBindForAxis(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): TSDL_GameControllerButtonBind cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetBindForAxis' {$ENDIF} {$ENDIF}; + +{** + * Query whether a game controller has a given axis. + * + * This merely reports whether the controller's mapping defined this axis, + * as that is all the information SDL has about the physical device. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerHasAxis_fun = function(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): TSDL_Bool; cdecl; +Var + SDL_GameControllerHasAxis : TSDL_GameControllerHasAxis_fun = Nil; +{$else} + +function SDL_GameControllerHasAxis(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasAxis' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the current state of an axis control on a game controller. + * + * The state is a value ranging from -32768 to 32767. + * + * The axis indices start at index 0. + *} +function SDL_GameControllerGetAxis(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): cint16 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetAxis' {$ENDIF} {$ENDIF}; + + {** + * The list of buttons available from a controller + *} +type + PPSDL_GameControllerButton = ^PSDL_GameControllerButton; + PSDL_GameControllerButton = ^TSDL_GameControllerButton; + TSDL_GameControllerButton = type cint; +const + SDL_CONTROLLER_BUTTON_INVALID = TSDL_GameControllerButton(-1); + SDL_CONTROLLER_BUTTON_A = TSDL_GameControllerButton(0); + SDL_CONTROLLER_BUTTON_B = TSDL_GameControllerButton(1); + SDL_CONTROLLER_BUTTON_X = TSDL_GameControllerButton(2); + SDL_CONTROLLER_BUTTON_Y = TSDL_GameControllerButton(3); + SDL_CONTROLLER_BUTTON_BACK = TSDL_GameControllerButton(4); + SDL_CONTROLLER_BUTTON_GUIDE = TSDL_GameControllerButton(5); + SDL_CONTROLLER_BUTTON_START = TSDL_GameControllerButton(6); + SDL_CONTROLLER_BUTTON_LEFTSTICK = TSDL_GameControllerButton(7); + SDL_CONTROLLER_BUTTON_RIGHTSTICK = TSDL_GameControllerButton(8); + SDL_CONTROLLER_BUTTON_LEFTSHOULDER = TSDL_GameControllerButton(9); + SDL_CONTROLLER_BUTTON_RIGHTSHOULDER = TSDL_GameControllerButton(10); + SDL_CONTROLLER_BUTTON_DPAD_UP = TSDL_GameControllerButton(11); + SDL_CONTROLLER_BUTTON_DPAD_DOWN = TSDL_GameControllerButton(12); + SDL_CONTROLLER_BUTTON_DPAD_LEFT = TSDL_GameControllerButton(13); + SDL_CONTROLLER_BUTTON_DPAD_RIGHT = TSDL_GameControllerButton(14); + SDL_CONTROLLER_BUTTON_MISC1 = TSDL_GameControllerButton(15); {**< Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button *} + SDL_CONTROLLER_BUTTON_PADDLE1 = TSDL_GameControllerButton(16); {**< Xbox Elite paddle P1 *} + SDL_CONTROLLER_BUTTON_PADDLE2 = TSDL_GameControllerButton(17); {**< Xbox Elite paddle P3 *} + SDL_CONTROLLER_BUTTON_PADDLE3 = TSDL_GameControllerButton(18); {**< Xbox Elite paddle P2 *} + SDL_CONTROLLER_BUTTON_PADDLE4 = TSDL_GameControllerButton(19); {**< Xbox Elite paddle P4 *} + SDL_CONTROLLER_BUTTON_TOUCHPAD = TSDL_GameControllerButton(20); {**< PS4/PS5 touchpad button *} + SDL_CONTROLLER_BUTTON_MAX = TSDL_GameControllerButton(21); + + {** + * turn this string into a button mapping + *} +function SDL_GameControllerGetButtonFromString(pchString: PAnsiChar): TSDL_GameControllerButton cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetButtonFromString' {$ENDIF} {$ENDIF}; + + {** + * turn this button enum into a string mapping + *} +function SDL_GameControllerGetStringForButton(button: TSDL_GameControllerButton): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetStringForButton' {$ENDIF} {$ENDIF}; + +{** + * Get the SDL joystick layer binding for this controller button mapping + *} +function SDL_GameControllerGetBindForButton(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): TSDL_GameControllerButtonBind cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetBindForButton' {$ENDIF} {$ENDIF}; + +{** + * Query whether a game controller has a given button. + * + * This merely reports whether the controller's mapping defined this button, + * as that is all the information SDL has about the physical device. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerHasButton_fun = function(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): TSDL_Bool; cdecl; +Var + SDL_GameControllerHasButton : TSDL_GameControllerHasButton_fun = Nil; +{$else} + +function SDL_GameControllerHasButton(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasButton' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the current state of a button on a game controller. + * + * The button indices start at index 0. + *} +function SDL_GameControllerGetButton(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): cuint8 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetButton' {$ENDIF} {$ENDIF}; + +{** + * Get the number of touchpads on a game controller. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetNumTouchpads_fun = function(gamecontroller: PSDL_GameController): cint; cdecl; +Var + SDL_GameControllerGetNumTouchpads : TSDL_GameControllerGetNumTouchpads_fun = Nil; +{$else} + +function SDL_GameControllerGetNumTouchpads(gamecontroller: PSDL_GameController): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetNumTouchpads' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the number of supported simultaneous fingers on a touchpad on a game controller. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetNumTouchpadFingers_fun = function(gamecontroller: PSDL_GameController; touchpad: cint): cint; cdecl; +Var + SDL_GameControllerGetNumTouchpadFingers : TSDL_GameControllerGetNumTouchpadFingers_fun = Nil; +{$else} + +function SDL_GameControllerGetNumTouchpadFingers(gamecontroller: PSDL_GameController; touchpad: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetNumTouchpadFingers' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the current state of a finger on a touchpad on a game controller. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetTouchpadFinger_fun = function( + gamecontroller: PSDL_GameController; + touchpad, finger: cint; + state: pcuint8; + x, y, pressure: pcfloat + ): cint; cdecl; +Var + SDL_GameControllerGetTouchpadFinger : TSDL_GameControllerGetTouchpadFinger_fun = Nil; +{$else} + +function SDL_GameControllerGetTouchpadFinger( + gamecontroller: PSDL_GameController; + touchpad, finger: cint; + state: pcuint8; + x, y, pressure: pcfloat +): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetTouchpadFinger' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Return whether a game controller has a particular sensor. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerHasSensor_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): TSDL_Bool; cdecl; +Var + SDL_GameControllerHasSensor : TSDL_GameControllerHasSensor_fun = Nil; +{$else} + +function SDL_GameControllerHasSensor(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasSensor' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Set whether data reporting for a game controller sensor is enabled. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerSetSensorEnabled_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; enabled: TSDL_bool): cint; cdecl; +Var + SDL_GameControllerSetSensorEnabled : TSDL_GameControllerSetSensorEnabled_fun = Nil; +{$else} + +function SDL_GameControllerSetSensorEnabled(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; enabled: TSDL_bool): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerSetSensorEnabled' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Query whether sensor data reporting is enabled for a game controller. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerIsSensorEnabled_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): TSDL_Bool; cdecl; +Var + SDL_GameControllerIsSensorEnabled : TSDL_GameControllerIsSensorEnabled_fun = Nil; +{$else} + +function SDL_GameControllerIsSensorEnabled(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerIsSensorEnabled' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the data rate (number of events per second) of + * a game controller sensor. + * + * Returns the data rate, or 0.0 if the data rate is not available. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetSensorDataRate_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): cfloat; cdecl; +Var + SDL_GameControllerGetSensorDataRate : TSDL_GameControllerGetSensorDataRate_fun = Nil; +{$else} + +function SDL_GameControllerGetSensorDataRate(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetSensorDataRate' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the current state of a game controller sensor. + * + * The number of values and interpretation of the data is sensor dependent. + * See sdlsensor.inc for the details for each type of sensor. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetSensorData_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; data: pcfloat; num_values: cint): cint; cdecl; +Var + SDL_GameControllerGetSensorData : TSDL_GameControllerGetSensorData_fun = Nil; +{$else} + +function SDL_GameControllerGetSensorData(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; data: pcfloat; num_values: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetSensorData' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the current state of a game controller sensor with the timestamp of the + * last update. + * + * The number of values and interpretation of the data is sensor dependent. + * See SDL_sensor.h for the details for each type of sensor. + * + * \param gamecontroller The controller to query + * \param type The type of sensor to query + * \param timestamp A pointer filled with the timestamp in microseconds of the + * current sensor reading if available, or 0 if not + * \param data A pointer filled with the current sensor state + * \param num_values The number of values to write to data + * \return 0 or -1 if an error occurred. + * + * \since This function is available since SDL 2.26.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetSensorDataWithTimestamp_fun = function( + gamecontroller: PSDL_GameController; + senstype: TSDL_SensorType; + timestamp: pcuint64; + data: pcfloat; + num_values: cint + ): cint; cdecl; +Var + SDL_GameControllerGetSensorDataWithTimestamp : TSDL_GameControllerGetSensorDataWithTimestamp_fun = Nil; +{$else} + +function SDL_GameControllerGetSensorDataWithTimestamp( + gamecontroller: PSDL_GameController; + senstype: TSDL_SensorType; + timestamp: pcuint64; + data: pcfloat; + num_values: cint +): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetSensorDataWithTimestamp' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Query whether a game controller has rumble support. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerHasRumble_fun = function(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; +Var + SDL_GameControllerHasRumble : TSDL_GameControllerHasRumble_fun = Nil; +{$else} + +function SDL_GameControllerHasRumble(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasRumble' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Start a rumble effect on a game controller. + * + * Each call to this function cancels any previous rumble effect, and calling + * it with 0 intensity stops any rumbling. + * + * Returns 0, or -1 if rumble isn't supported on this controller. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerRumble_fun = function( + gamecontroller: PSDL_GameController; + low_frequency_rumble, high_frequency_rumble: cuint16; + duration_ms: cuint32 + ): cint; cdecl; + +Var + SDL_GameControllerRumble : TSDL_GameControllerRumble_fun = Nil; +{$else} + +function SDL_GameControllerRumble( + gamecontroller: PSDL_GameController; + low_frequency_rumble, high_frequency_rumble: cuint16; + duration_ms: cuint32 +): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerRumble' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Query whether a game controller has rumble support on triggers. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerHasRumbleTriggers_fun = function(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; +Var + SDL_GameControllerHasRumbleTriggers : TSDL_GameControllerHasRumbleTriggers_fun = Nil; +{$else} + +function SDL_GameControllerHasRumbleTriggers(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasRumbleTriggers' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Start a rumble effect in the game controller's triggers. + * + * Each call to this function cancels any previous trigger rumble effect, and + * calling it with 0 intensity stops any rumbling. + * + * Note that this is rumbling of the _triggers_ and not the game controller as + * a whole. This is currently only supported on Xbox One controllers. If you + * want the (more common) whole-controller rumble, use + * SDL_GameControllerRumble() instead. + * + * Returns 0, or -1 if trigger rumble isn't supported on this controller + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerRumbleTriggers_fun = function( + gamecontroller: PSDL_GameController; + left_rumble, right_rumble: cuint16; + duration_ms: cuint32 + ): cint; cdecl; + +Var + SDL_GameControllerRumbleTriggers : TSDL_GameControllerRumbleTriggers_fun = Nil; +{$else} + +function SDL_GameControllerRumbleTriggers( + gamecontroller: PSDL_GameController; + left_rumble, right_rumble: cuint16; + duration_ms: cuint32 +): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerRumbleTriggers' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Query whether a game controller has an LED. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerHasLED_fun = function(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; +Var + SDL_GameControllerHasLED : TSDL_GameControllerHasLED_fun = Nil; +{$else} + +function SDL_GameControllerHasLED(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerHasLED' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Update a game controller's LED color. + * + * Returns 0, or -1 if this controller does not have a modifiable LED. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerSetLED_fun = function(gamecontroller: PSDL_GameController; red, green, blue: cuint8): cint; cdecl; +Var + SDL_GameControllerSetLED : TSDL_GameControllerSetLED_fun = Nil; +{$else} + +function SDL_GameControllerSetLED(gamecontroller: PSDL_GameController; red, green, blue: cuint8): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerSetLED' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Send a controller-specific effect packet. + * + * Returns 0, or -1 if this controller or driver does not + * support effect packets. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerSendEffect_fun = function(gamecontroller: PSDL_GameController; data: Pointer; size: cint): cint; cdecl; +Var + SDL_GameControllerSendEffect : TSDL_GameControllerSendEffect_fun = Nil; +{$else} + +function SDL_GameControllerSendEffect(gamecontroller: PSDL_GameController; data: Pointer; size: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerSendEffect' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Close a controller previously opened with SDL_GameControllerOpen(). + *} +procedure SDL_GameControllerClose(gamecontroller: PSDL_GameController) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerClose' {$ENDIF} {$ENDIF}; + +{** + * Return the sfSymbolsName for a given axis on a game controller + * on Apple platforms. + * + * Returns the sfSymbolsName, or NIL if the name can't be found. + * Do _not_ pass this string to SDL_free(). + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetAppleSFSymbolsNameForAxis_fun = function(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): PAnsiChar; cdecl; +Var + SDL_GameControllerGetAppleSFSymbolsNameForAxis : TSDL_GameControllerGetAppleSFSymbolsNameForAxis_fun = Nil; +{$else} + +function SDL_GameControllerGetAppleSFSymbolsNameForAxis(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetAppleSFSymbolsNameForAxis' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Return the sfSymbolsName for a given button on a game controller + * on Apple platforms. + * + * Returns the sfSymbolsName, or NIL if the name can't be found. + * Do _not_ pass this string to SDL_free(). + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GameControllerGetAppleSFSymbolsNameForButton_fun = function(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): PAnsiChar; cdecl; +Var + SDL_GameControllerGetAppleSFSymbolsNameForButton : TSDL_GameControllerGetAppleSFSymbolsNameForButton_fun = Nil; +{$else} + +function SDL_GameControllerGetAppleSFSymbolsNameForButton(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetAppleSFSymbolsNameForButton' {$ENDIF} {$ENDIF}; +{$endif} + + +function SDL_GameControllerAddMappingsFromFile(Const FilePath:PAnsiChar):cint32; diff --git a/units/sdlgesture.inc b/units/sdlgesture.inc index c24c2a8e..5b21c6d6 100644 --- a/units/sdlgesture.inc +++ b/units/sdlgesture.inc @@ -1,104 +1,104 @@ -//from "sdl_gesture.h" - -type - PPSDL_GestureID = ^PSDL_GestureID; - PSDL_GestureID = ^TSDL_GestureID; - TSDL_GestureID = type cint64; - - {* Function prototypes *} - - {/** - * Begin recording a gesture on a specified touch device or all touch devices. - * - * If the parameter `touchId` is -1 (i.e., all devices), this function will - * always return 1, regardless of whether there actually are any devices. - * - * \param touchId the touch device id, or -1 for all touch devices - * \returns 1 on success or 0 if the specified device could not be found. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetTouchDevice - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RecordGesture_fun = function(touchId: TSDL_TouchID): cint; cdecl; -Var - SDL_RecordGesture : TSDL_RecordGesture_fun = Nil; -{$else} - -function SDL_RecordGesture(touchId: TSDL_TouchID): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RecordGesture' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Save all currently loaded Dollar Gesture templates. - * - * \param dst a SDL_RWops to save to - * \returns the number of saved templates on success or 0 on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_LoadDollarTemplates - * \sa SDL_SaveDollarTemplate - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SaveAllDollarTemplates_fun = function(dst: PSDL_RWops): cint; cdecl; -Var - SDL_SaveAllDollarTemplates : TSDL_SaveAllDollarTemplates_fun = Nil; -{$else} - -function SDL_SaveAllDollarTemplates(dst: PSDL_RWops): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SaveAllDollarTemplates' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Save a currently loaded Dollar Gesture template. - * - * \param gestureId a gesture id - * \param dst a SDL_RWops to save to - * \returns 1 on success or 0 on failure; call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_LoadDollarTemplates - * \sa SDL_SaveAllDollarTemplates - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SaveDollarTemplate_fun = function(gestureId: TSDL_GestureID; dst: PSDL_RWops): cint; cdecl; -Var - SDL_SaveDollarTemplate : TSDL_SaveDollarTemplate_fun = Nil; -{$else} - -function SDL_SaveDollarTemplate(gestureId: TSDL_GestureID; dst: PSDL_RWops): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SaveDollarTemplate' {$ENDIF} {$ENDIF}; -{$endif} - - - {** - * Load Dollar Gesture templates from a file. - * - * \param touchId a touch id - * \param src a SDL_RWops to load from - * \returns the number of loaded templates on success or a negative error code - * (or 0) on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_SaveAllDollarTemplates - * \sa SDL_SaveDollarTemplate - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LoadDollarTemplates_fun = function(touchId: TSDL_TouchID; src: PSDL_RWops): cint; cdecl; -Var - SDL_LoadDollarTemplates : TSDL_LoadDollarTemplates_fun = Nil; -{$else} - -function SDL_LoadDollarTemplates(touchId: TSDL_TouchID; src: PSDL_RWops): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadDollarTemplates' {$ENDIF} {$ENDIF}; -{$endif} +//from "sdl_gesture.h" + +type + PPSDL_GestureID = ^PSDL_GestureID; + PSDL_GestureID = ^TSDL_GestureID; + TSDL_GestureID = type cint64; + + {* Function prototypes *} + + {/** + * Begin recording a gesture on a specified touch device or all touch devices. + * + * If the parameter `touchId` is -1 (i.e., all devices), this function will + * always return 1, regardless of whether there actually are any devices. + * + * \param touchId the touch device id, or -1 for all touch devices + * \returns 1 on success or 0 if the specified device could not be found. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetTouchDevice + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RecordGesture_fun = function(touchId: TSDL_TouchID): cint; cdecl; +Var + SDL_RecordGesture : TSDL_RecordGesture_fun = Nil; +{$else} + +function SDL_RecordGesture(touchId: TSDL_TouchID): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RecordGesture' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Save all currently loaded Dollar Gesture templates. + * + * \param dst a SDL_RWops to save to + * \returns the number of saved templates on success or 0 on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_LoadDollarTemplates + * \sa SDL_SaveDollarTemplate + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SaveAllDollarTemplates_fun = function(dst: PSDL_RWops): cint; cdecl; +Var + SDL_SaveAllDollarTemplates : TSDL_SaveAllDollarTemplates_fun = Nil; +{$else} + +function SDL_SaveAllDollarTemplates(dst: PSDL_RWops): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SaveAllDollarTemplates' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Save a currently loaded Dollar Gesture template. + * + * \param gestureId a gesture id + * \param dst a SDL_RWops to save to + * \returns 1 on success or 0 on failure; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_LoadDollarTemplates + * \sa SDL_SaveAllDollarTemplates + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SaveDollarTemplate_fun = function(gestureId: TSDL_GestureID; dst: PSDL_RWops): cint; cdecl; +Var + SDL_SaveDollarTemplate : TSDL_SaveDollarTemplate_fun = Nil; +{$else} + +function SDL_SaveDollarTemplate(gestureId: TSDL_GestureID; dst: PSDL_RWops): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SaveDollarTemplate' {$ENDIF} {$ENDIF}; +{$endif} + + + {** + * Load Dollar Gesture templates from a file. + * + * \param touchId a touch id + * \param src a SDL_RWops to load from + * \returns the number of loaded templates on success or a negative error code + * (or 0) on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_SaveAllDollarTemplates + * \sa SDL_SaveDollarTemplate + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LoadDollarTemplates_fun = function(touchId: TSDL_TouchID; src: PSDL_RWops): cint; cdecl; +Var + SDL_LoadDollarTemplates : TSDL_LoadDollarTemplates_fun = Nil; +{$else} + +function SDL_LoadDollarTemplates(touchId: TSDL_TouchID; src: PSDL_RWops): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadDollarTemplates' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlguid.inc b/units/sdlguid.inc index e2978e95..5441834b 100644 --- a/units/sdlguid.inc +++ b/units/sdlguid.inc @@ -1,76 +1,76 @@ -{** - * \file SDL_guid.h - * - * Include file for handling ::SDL_GUID values. - *} - -{** - * An SDL_GUID is a 128-bit identifier for an input device that - * identifies that device across runs of SDL programs on the same - * platform. If the device is detached and then re-attached to a - * different port, or if the base system is rebooted, the device - * should still report the same GUID. - * - * GUIDs are as precise as possible but are not guaranteed to - * distinguish physically distinct but equivalent devices. For - * example, two game controllers from the same vendor with the same - * product ID and revision may have the same GUID. - * - * GUIDs may be platform-dependent (i.e., the same device may report - * different GUIDs on different operating systems). - *} -type - PPSDL_GUID = ^PSDL_GUID; - PSDL_GUID = ^TSDL_GUID; - TSDL_GUID = record - data: array[0..15] of cuint8; - end; - - {** - * Get an ASCII string representation for a given ::SDL_GUID. - * - * You should supply at least 33 bytes for pszGUID. - * - * \param guid the ::SDL_GUID you wish to convert to string - * \param pszGUID buffer in which to write the ASCII string - * \param cbGUID the size of pszGUID - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_GUIDFromString - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GUIDToString_proc = procedure(guid: TSDL_GUID; pszGUID: PAnsiChar; cbGUID: cint); cdecl; -Var - SDL_GUIDToString : TSDL_GUIDToString_proc = Nil; -{$else} - -procedure SDL_GUIDToString(guid: TSDL_GUID; pszGUID: PAnsiChar; cbGUID: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GUIDToString' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Convert a GUID string into a ::SDL_GUID structure. - * - * Performs no error checking. If this function is given a string containing - * an invalid GUID, the function will silently succeed, but the GUID generated - * will not be useful. - * - * \param pchGUID string containing an ASCII representation of a GUID - * \returns a ::SDL_GUID structure. - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_GUIDToString - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GUIDFromString_fun = function(const pchGUID: PAnsiChar): TSDL_GUID; cdecl; -Var - SDL_GUIDFromString : TSDL_GUIDFromString_fun = Nil; -{$else} - -function SDL_GUIDFromString(const pchGUID: PAnsiChar): TSDL_GUID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GUIDFromString' {$ENDIF} {$ENDIF}; -{$endif} +{** + * \file SDL_guid.h + * + * Include file for handling ::SDL_GUID values. + *} + +{** + * An SDL_GUID is a 128-bit identifier for an input device that + * identifies that device across runs of SDL programs on the same + * platform. If the device is detached and then re-attached to a + * different port, or if the base system is rebooted, the device + * should still report the same GUID. + * + * GUIDs are as precise as possible but are not guaranteed to + * distinguish physically distinct but equivalent devices. For + * example, two game controllers from the same vendor with the same + * product ID and revision may have the same GUID. + * + * GUIDs may be platform-dependent (i.e., the same device may report + * different GUIDs on different operating systems). + *} +type + PPSDL_GUID = ^PSDL_GUID; + PSDL_GUID = ^TSDL_GUID; + TSDL_GUID = record + data: array[0..15] of cuint8; + end; + + {** + * Get an ASCII string representation for a given ::SDL_GUID. + * + * You should supply at least 33 bytes for pszGUID. + * + * \param guid the ::SDL_GUID you wish to convert to string + * \param pszGUID buffer in which to write the ASCII string + * \param cbGUID the size of pszGUID + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GUIDFromString + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GUIDToString_proc = procedure(guid: TSDL_GUID; pszGUID: PAnsiChar; cbGUID: cint); cdecl; +Var + SDL_GUIDToString : TSDL_GUIDToString_proc = Nil; +{$else} + +procedure SDL_GUIDToString(guid: TSDL_GUID; pszGUID: PAnsiChar; cbGUID: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GUIDToString' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Convert a GUID string into a ::SDL_GUID structure. + * + * Performs no error checking. If this function is given a string containing + * an invalid GUID, the function will silently succeed, but the GUID generated + * will not be useful. + * + * \param pchGUID string containing an ASCII representation of a GUID + * \returns a ::SDL_GUID structure. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GUIDToString + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GUIDFromString_fun = function(const pchGUID: PAnsiChar): TSDL_GUID; cdecl; +Var + SDL_GUIDFromString : TSDL_GUIDFromString_fun = Nil; +{$else} + +function SDL_GUIDFromString(const pchGUID: PAnsiChar): TSDL_GUID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GUIDFromString' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlhaptic.inc b/units/sdlhaptic.inc index 43e0d55a..88aaa9e3 100644 --- a/units/sdlhaptic.inc +++ b/units/sdlhaptic.inc @@ -1,1536 +1,1536 @@ -//from "sdl_haptic.h" - -{** - * - * The SDL Haptic subsystem allows you to control haptic (force feedback) - * devices. - * - * The basic usage is as follows: - * - Initialize the Subsystem (::SDL_INIT_HAPTIC). - * - Open a Haptic Device. - * - SDL_HapticOpen() to open from index. - * - SDL_HapticOpenFromJoystick() to open from an existing joystick. - * - Create an effect (::SDL_HapticEffect). - * - Upload the effect with SDL_HapticNewEffect(). - * - Run the effect with SDL_HapticRunEffect(). - * - (optional) Free the effect with SDL_HapticDestroyEffect(). - * - Close the haptic device with SDL_HapticClose(). - * - * Simple rumble example: - * - * SDL_Haptic *haptic; - * - * // Open the device - * haptic = SDL_HapticOpen( 0 ); - * if (haptic == NULL) - * return -1; - * - * // Initialize simple rumble - * if (SDL_HapticRumbleInit( haptic ) != 0) - * return -1; - * - * // Play effect at 50% strength for 2 seconds - * if (SDL_HapticRumblePlay( haptic, 0.5, 2000 ) != 0) - * return -1; - * SDL_Delay( 2000 ); - * - * // Clean up - * SDL_HapticClose( haptic ); - * - * - * Complete example: - * - * int test_haptic( SDL_Joystick * joystick ) - * SDL_Haptic *haptic; - * SDL_HapticEffect effect; - * int effect_id; - * - * // Open the device - * haptic = SDL_HapticOpenFromJoystick( joystick ); - * if (haptic == NULL) return -1; // Most likely joystick isn't haptic - * - * // See if it can do sine waves - * if ((SDL_HapticQuery(haptic) & SDL_HAPTIC_SINE)==0) - * SDL_HapticClose(haptic); // No sine effect - * return -1; - * - * - * // Create the effect - * memset( &effect, 0, sizeof(SDL_HapticEffect) ); // 0 is safe default - * effect.type = SDL_HAPTIC_SINE; - * effect.periodic.direction.type = SDL_HAPTIC_POLAR; // Polar coordinates - * effect.periodic.direction.dir[0] = 18000; // Force comes from south - * effect.periodic.period = 1000; // 1000 ms - * effect.periodic.magnitude = 20000; // 20000/32767 strength - * effect.periodic.length = 5000; // 5 seconds long - * effect.periodic.attack_length = 1000; // Takes 1 second to get max strength - * effect.periodic.fade_length = 1000; // Takes 1 second to fade away - * - * // Upload the effect - * effect_id = SDL_HapticNewEffect( haptic, &effect ); - * - * // Test the effect - * SDL_HapticRunEffect( haptic, effect_id, 1 ); - * SDL_Delay( 5000); // Wait for the effect to finish - * - * // We destroy the effect, although closing the device also does this - * SDL_HapticDestroyEffect( haptic, effect_id ); - * - * // Close the device - * SDL_HapticClose(haptic); - * - * return 0; // Success - *} - - {** - * SDL_Haptic - * - * The haptic structure used to identify an SDL haptic. - * - * SDL_HapticOpen - * SDL_HapticOpenFromJoystick - * SDL_HapticClose - *} -type - PPSDL_Haptic = ^PSDL_Haptic; - PSDL_Haptic = type Pointer; - - {** - * Haptic features - * - * Different haptic features a device can have. - *} - - {** - * Haptic effects - *} - - {** - * Constant effect supported. - * - * Constant haptic effect. - * - * SDL_HapticCondition - *} -const - SDL_HAPTIC_CONSTANT = (1 shl 0); - - {** - * Sine wave effect supported. - * - * Periodic haptic effect that simulates sine waves. - * - * SDL_HapticPeriodic - *} -const - SDL_HAPTIC_SINE = (1 shl 1); - - {** - * Square wave effect supported. - * - * Periodic haptic effect that simulates square waves. - * - * SDL_HapticPeriodic - *} -const - SDL_HAPTIC_LEFTRIGHT = (1 shl 2); - - { !!! FIXME: put this back when we have more bits in 2.1 } - { #define SDL_HAPTIC_SQUARE (1<<2) } - SDL_HAPTIC_SQUARE = (1 shl 2); // SDL2-For-Pascal: Out-commented in C code. - // Why not keeping it for - // compatibility here? - - {** - * Triangle wave effect supported. - * - * Periodic haptic effect that simulates triangular waves. - * - * SDL_HapticPeriodic - *} -const - SDL_HAPTIC_TRIANGLE = (1 shl 3); - - {** - * Sawtoothup wave effect supported. - * - * Periodic haptic effect that simulates saw tooth up waves. - * - * SDL_HapticPeriodic - *} -const - SDL_HAPTIC_SAWTOOTHUP = (1 shl 4); - - {** - * Sawtoothdown wave effect supported. - * - * Periodic haptic effect that simulates saw tooth down waves. - * - * SDL_HapticPeriodic - *} -const - SDL_HAPTIC_SAWTOOTHDOWN = (1 shl 5); - - {** - * Ramp effect supported. - * - * Ramp haptic effect. - * - * SDL_HapticRamp - *} -const - SDL_HAPTIC_RAMP = (1 shl 6); - - {** - * Spring effect supported - uses axes position. - * - * Condition haptic effect that simulates a spring. Effect is based on the - * axes position. - * - * SDL_HapticCondition - *} -const - SDL_HAPTIC_SPRING = (1 shl 7); - - {** - * Damper effect supported - uses axes velocity. - * - * Condition haptic effect that simulates dampening. Effect is based on the - * axes velocity. - * - * SDL_HapticCondition - *} -const - SDL_HAPTIC_DAMPER = (1 shl 8); - - {** - * Inertia effect supported - uses axes acceleration. - * - * Condition haptic effect that simulates inertia. Effect is based on the axes - * acceleration. - * - * SDL_HapticCondition - *} -const - SDL_HAPTIC_INERTIA = (1 shl 9); - - {** - * Friction effect supported - uses axes movement. - * - * Condition haptic effect that simulates friction. Effect is based on the - * axes movement. - * - * SDL_HapticCondition - *} -const - SDL_HAPTIC_FRICTION = (1 shl 10); - - {** - * Custom effect is supported. - * - * User defined custom haptic effect. - *} -const - SDL_HAPTIC_CUSTOM = (1 shl 11); - - {*Haptic effects*} - - {* These last few are features the device has, not effects *} - - {** - * Device can set global gain. - * - * Device supports setting the global gain. - * - * SDL_HapticSetGain - *} -const - SDL_HAPTIC_GAIN = (1 shl 12); - - {** - * Device can set autocenter. - * - * Device supports setting autocenter. - * - * SDL_HapticSetAutocenter - *} -const - SDL_HAPTIC_AUTOCENTER = (1 shl 13); - - {** - * Device can be queried for effect status. - * - * Device can be queried for effect status. - * - * SDL_HapticGetEffectStatus - *} -const - SDL_HAPTIC_STATUS = (1 shl 14); - - {** - * Device can be paused. - * - * SDL_HapticPause - * SDL_HapticUnpause - *} -const - SDL_HAPTIC_PAUSE = (1 shl 15); - - {** - * Direction encodings - *} - - {** - * Uses polar coordinates for the direction. - * - * SDL_HapticDirection - *} -const - SDL_HAPTIC_POLAR = 0; - - {** - * Uses cartesian coordinates for the direction. - * - * SDL_HapticDirection - *} -const - SDL_HAPTIC_CARTESIAN = 1; - - {** - * Uses spherical coordinates for the direction. - * - * SDL_HapticDirection - *} -const - SDL_HAPTIC_SPHERICAL = 2; - - {** - * \brief Use this value to play an effect on the steering wheel axis. This - * provides better compatibility across platforms and devices as SDL will guess - * the correct axis. - * \sa SDL_HapticDirection - *} -const - SDL_HAPTIC_STEERING_AXIS = 3; - - {* - * Misc defines. - *} - - {** - * Used to play a device an infinite number of times. - * - * SDL_HapticRunEffect - *} -const - SDL_HAPTIC_INFINITY = 4294967295; // C: 4294967295U - - {** - * Structure that represents a haptic direction. - * - * Directions can be specified by: - * - SDL_HAPTIC_POLAR : Specified by polar coordinates. - * - SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates. - * - SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates. - * - * Cardinal directions of the haptic device are relative to the positioning - * of the device. North is considered to be away from the user. - * - * The following diagram represents the cardinal directions: - * - .--. - |__| .-------. - |=.| |.-----.| - |--| || || - | | |'-----'| - |__|~')_____(' - [ COMPUTER ] - - - North (0,-1) - ^ - | - | - (1,0) West <----[ HAPTIC ]----> East (-1,0) - | - | - v - South (0,1) - - - [ USER ] - \|||/ - (o o) - ---ooO-(_)-Ooo--- - - * - * If type is SDL_HAPTIC_POLAR, direction is encoded by hundredths of a - * degree starting north and turning clockwise. ::SDL_HAPTIC_POLAR only uses - * the first dir parameter. The cardinal directions would be: - * - North: 0 (0 degrees) - * - East: 9000 (90 degrees) - * - South: 18000 (180 degrees) - * - West: 27000 (270 degrees) - * - * If type is SDL_HAPTIC_CARTESIAN, direction is encoded by three positions - * (X axis, Y axis and Z axis (with 3 axes)). ::SDL_HAPTIC_CARTESIAN uses - * the first three dir parameters. The cardinal directions would be: - * - North: 0,-1, 0 - * - East: -1, 0, 0 - * - South: 0, 1, 0 - * - West: 1, 0, 0 - * - * The Z axis represents the height of the effect if supported, otherwise - * it's unused. In cartesian encoding (1, 2) would be the same as (2, 4), you - * can use any multiple you want, only the direction matters. - * - * If type is SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations. - * The first two dir parameters are used. The dir parameters are as - * follows (all values are in hundredths of degrees): - * - Degrees from (1, 0) rotated towards (0, 1). - * - Degrees towards (0, 0, 1) (device needs at least 3 axes). - * - * - * Example of force coming from the south with all encodings (force coming - * from the south means the user will have to pull the stick to counteract): - * - * SDL_HapticDirection direction; - * - * // Cartesian directions - * direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding. - * direction.dir[0] = 0; // X position - * direction.dir[1] = 1; // Y position - * // Assuming the device has 2 axes, we don't need to specify third parameter. - * - * // Polar directions - * direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding. - * direction.dir[0] = 18000; // Polar only uses first parameter - * - * // Spherical coordinates - * direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding - * direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters. - * - * - * SDL_HAPTIC_POLAR - * SDL_HAPTIC_CARTESIAN - * SDL_HAPTIC_SPHERICAL - * SDL_HapticEffect - * SDL_HapticNumAxes - *} -type - PPSDL_HapticDirection = ^PSDL_HapticDirection; - PSDL_HapticDirection = ^TSDL_HapticDirection; - TSDL_HapticDirection = record - type_: cuint8; {**< The type of encoding. *} - dir: array[0..2] of cint32; {**< The encoded direction. *} - end; - - {** - * A structure containing a template for a Constant effect. - * - * The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect. - * - * A constant effect applies a constant force in the specified direction - * to the joystick. - * - * SDL_HAPTIC_CONSTANT - * SDL_HapticEffect - *} -type - PPSDL_HapticConstant = ^PSDL_HapticConstant; - PSDL_HapticConstant = ^TSDL_HapticConstant; - TSDL_HapticConstant = record - {* Header *} - type_: cuint16; {**< SDL_HAPTIC_CONSTANT *} - direction: TSDL_HapticDirection; {**< Direction of the effect. *} - - {* Replay *} - length: cuint32; {**< Duration of the effect. *} - delay: cuint16; {**< Delay before starting the effect. *} - - {* Trigger *} - button: cuint16; {**< Button that triggers the effect. *} - interval: cuint16; {**< How soon it can be triggered again after button. *} - - {* Constant *} - level: cint16; {**< Strength of the constant effect. *} - - {* Envelope *} - attack_length: cuint16; {**< Duration of the attack. *} - attack_level: cuint16; {**< Level at the start of the attack. *} - fade_length: cuint16; {**< Duration of the fade. *} - fade_level: cuint16; {**< Level at the end of the fade. *} - end; - - {** - * A structure containing a template for a Periodic effect. - * - * The struct handles the following effects: - * - SDL_HAPTIC_SINE - * - SDL_HAPTIC_SQUARE - * - SDL_HAPTIC_TRIANGLE - * - SDL_HAPTIC_SAWTOOTHUP - * - SDL_HAPTIC_SAWTOOTHDOWN - * - * A periodic effect consists in a wave-shaped effect that repeats itself - * over time. The type determines the shape of the wave and the parameters - * determine the dimensions of the wave. - * - * Phase is given by hundredth of a cycle meaning that giving the phase a value - * of 9000 will displace it 25% of its period. Here are sample values: - * - 0: No phase displacement. - * - 9000: Displaced 25% of its period. - * - 18000: Displaced 50% of its period. - * - 27000: Displaced 75% of its period. - * - 36000: Displaced 100% of its period, same as 0, but 0 is preferred. - * - * Examples: - * - SDL_HAPTIC_SINE - __ __ __ __ - / \ / \ / \ / - / \__/ \__/ \__/ - - SDL_HAPTIC_SQUARE - __ __ __ __ __ - | | | | | | | | | | - | |__| |__| |__| |__| | - - SDL_HAPTIC_TRIANGLE - /\ /\ /\ /\ /\ - / \ / \ / \ / \ / - / \/ \/ \/ \/ - - SDL_HAPTIC_SAWTOOTHUP - /| /| /| /| /| /| /| - / | / | / | / | / | / | / | - / |/ |/ |/ |/ |/ |/ | - - SDL_HAPTIC_SAWTOOTHDOWN - \ |\ |\ |\ |\ |\ |\ | - \ | \ | \ | \ | \ | \ | \ | - \| \| \| \| \| \| \| - - * - * SDL_HAPTIC_SINE - * SDL_HAPTIC_SQUARE - * SDL_HAPTIC_TRIANGLE - * SDL_HAPTIC_SAWTOOTHUP - * SDL_HAPTIC_SAWTOOTHDOWN - * SDL_HapticEffect - *} -type - PPSDL_HapticPeriodic = ^PSDL_HapticPeriodic; - PSDL_HapticPeriodic = ^TSDL_HapticPeriodic; - TSDL_HapticPeriodic = record - { Header *} - type_: cuint16; {**< SDL_HAPTIC_SINE, SDL_HAPTIC_SQUARE, - SDL_HAPTIC_TRIANGLE, SDL_HAPTIC_SAWTOOTHUP or - SDL_HAPTIC_SAWTOOTHDOWN *} - direction: TSDL_HapticDirection; {**< Direction of the effect. *} - - {* Replay *} - length: cuint32; {**< Duration of the effect. *} - delay: cuint16; {**< Delay before starting the effect. *} - - {* Trigger *} - button: cuint16; {**< Button that triggers the effect. *} - interval: cuint16; {**< How soon it can be triggered again after button. *} - - {* Periodic *} - period: cuint16; {**< Period of the wave. *} - magnitude: cint16; {**< Peak value. *} - offset: cint16; {**< Mean value of the wave. *} - phase: cuint16; {**< Horizontal shift given by hundredth of a cycle. *} - - {* Envelope *} - attack_length: cuint16; {**< Duration of the attack. *} - attack_level: cuint16; {**< Level at the start of the attack. *} - fade_length: cuint16; {**< Duration of the fade. *} - fade_level: cuint16; {**< Level at the end of the fade. *} - end; - - {** - * A structure containing a template for a Condition effect. - * - * The struct handles the following effects: - * - SDL_HAPTIC_SPRING: Effect based on axes position. - * - SDL_HAPTIC_DAMPER: Effect based on axes velocity. - * - SDL_HAPTIC_INERTIA: Effect based on axes acceleration. - * - SDL_HAPTIC_FRICTION: Effect based on axes movement. - * - * Direction is handled by condition internals instead of a direction member. - * The condition effect specific members have three parameters. The first - * refers to the X axis, the second refers to the Y axis and the third - * refers to the Z axis. The right terms refer to the positive side of the - * axis and the left terms refer to the negative side of the axis. Please - * refer to the ::SDL_HapticDirection diagram for which side is positive and - * which is negative. - * - * SDL_HapticDirection - * SDL_HAPTIC_SPRING - * SDL_HAPTIC_DAMPER - * SDL_HAPTIC_INERTIA - * SDL_HAPTIC_FRICTION - * SDL_HapticEffect - *} -type - PPSDL_HapticCondition = ^PSDL_HapticCondition; - PSDL_HapticCondition = ^TSDL_HapticCondition; - TSDL_HapticCondition = record - {* Header *} - type_: cuint16; {**< SDL_HAPTIC_SPRING, SDL_HAPTIC_DAMPER, - SDL_HAPTIC_INERTIA or SDL_HAPTIC_FRICTION *} - direction: TSDL_HapticDirection; {**< Direction of the effect - Not used ATM. *} - - {* Replay *} - length: cuint32; {**< Duration of the effect. *} - delay: cuint16; {**< Delay before starting the effect. *} - - {* Trigger *} - button: cuint16; {**< Button that triggers the effect. *} - interval: cuint16; {**< How soon it can be triggered again after button. *} - - {* Condition *} - right_sat: array[0..2] of cuint16; {**< Level when joystick is to the positive side. *} - left_sat: array[0..2] of cuint16; {**< Level when joystick is to the negative side. *} - right_coeff: array[0..2] of cint16;{**< How fast to increase the force towards the positive side. *} - left_coeff: array[0..2] of cint16; {**< How fast to increase the force towards the negative side. *} - deadband: array[0..2] of cuint16; {**< Size of the dead zone. *} - center: array[0..2] of cint16; {**< Position of the dead zone. *} - end; - - {** - * A structure containing a template for a Ramp effect. - * - * This struct is exclusively for the ::SDL_HAPTIC_RAMP effect. - * - * The ramp effect starts at start strength and ends at end strength. - * It augments in linear fashion. If you use attack and fade with a ramp - * the effects get added to the ramp effect making the effect become - * quadratic instead of linear. - * - * SDL_HAPTIC_RAMP - * SDL_HapticEffect - *} -type - PPSDL_HapticRamp = ^PSDL_HapticRamp; - PSDL_HapticRamp = ^TSDL_HapticRamp; - TSDL_HapticRamp = record - {* Header *} - type_: cuint16; {**< SDL_HAPTIC_RAMP *} - direction: TSDL_HapticDirection; {**< Direction of the effect. *} - - {* Replay *} - length: cuint32; {**< Duration of the effect. *} - delay: cuint16; {**< Delay before starting the effect. *} - - {* Trigger *} - button: cuint16; {**< Button that triggers the effect. *} - interval: cuint16; {**< How soon it can be triggered again after button. *} - - {* Ramp *} - start: cint16; {**< Beginning strength level. *} - end_: cint16; {**< Ending strength level. *} - - {* Envelope *} - attack_length: cuint16; {**< Duration of the attack. *} - attack_level: cuint16; {**< Level at the start of the attack. *} - fade_length: cuint16; {**< Duration of the fade. *} - fade_level: cuint16; {**< Level at the end of the fade. *} - end; - - {** - * \brief A structure containing a template for a Left/Right effect. - * - * This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect. - * - * The Left/Right effect is used to explicitly control the large and small - * motors, commonly found in modern game controllers. The small (right) motor - * is high frequency, and the large (left) motor is low frequency. - * - * \sa SDL_HAPTIC_LEFTRIGHT - * \sa SDL_HapticEffect - *} -type - TSDL_HapticLeftRight = record - {* Header *} - type_: cuint16; {**< ::SDL_HAPTIC_LEFTRIGHT *} - - {* Replay *} - length: cuint32; {**< Duration of the effect in milliseconds. *} - - {* Rumble *} - large_magnitude: cuint16; {**< Control of the large controller motor. *} - small_magnitude: cuint16; {**< Control of the small controller motor. *} - end; - - {** - * A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect. - * - * A custom force feedback effect is much like a periodic effect, where the - * application can define its exact shape. You will have to allocate the - * data yourself. Data should consist of channels * samples Uint16 samples. - * - * If channels is one, the effect is rotated using the defined direction. - * Otherwise it uses the samples in data for the different axes. - * - * SDL_HAPTIC_CUSTOM - * SDL_HapticEffect - *} -type - PPSDL_HapticCustom = ^PSDL_HapticCustom; - PSDL_HapticCustom = ^TSDL_HapticCustom; - TSDL_HapticCustom = record - {* Header *} - type_: cuint16; {**< SDL_HAPTIC_CUSTOM *} - direction: TSDL_HapticDirection; {**< Direction of the effect. *} - - {* Replay *} - length: cuint32; {**< Duration of the effect. *} - delay: cuint16; {**< Delay before starting the effect. *} - - {* Trigger *} - button: cuint16; {**< Button that triggers the effect. *} - interval: cuint16; {**< How soon it can be triggered again after button. *} - - {* Custom *} - channels: cuint8; {**< Axes to use, minimum of one. *} - period: cuint16; {**< Sample periods. *} - samples: cuint16; {**< Amount of samples. *} - data: pcuint16; {**< Should contain channels*samples items. *} - - {* Envelope *} - attack_length: cuint16; {**< Duration of the attack. *} - attack_level: cuint16; {**< Level at the start of the attack. *} - fade_length: cuint16; {**< Duration of the fade. *} - fade_level: cuint16; {**< Level at the end of the fade. *} - end; - - {** - * The generic template for any haptic effect. - * - * All values max at 32767 (0x7FFF). Signed values also can be negative. - * Time values unless specified otherwise are in milliseconds. - * - * You can also pass SDL_HAPTIC_INFINITY to length instead of a 0-32767 - * value. Neither delay, interval, attack_length nor fade_length support - * SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends. - * - * Additionally, the SDL_HAPTIC_RAMP effect does not support a duration of - * SDL_HAPTIC_INFINITY. - * - * Button triggers may not be supported on all devices, it is advised to not - * use them if possible. Buttons start at index 1 instead of index 0 like - * the joystick. - * - * If both attack_length and fade_level are 0, the envelope is not used, - * otherwise both values are used. - * - * Common parts: - * - * // Replay - All effects have this - * Uint32 length; // Duration of effect (ms). - * Uint16 delay; // Delay before starting effect. - * - * // Trigger - All effects have this - * Uint16 button; // Button that triggers effect. - * Uint16 interval; // How soon before effect can be triggered again. - * - * // Envelope - All effects except condition effects have this - * Uint16 attack_length; // Duration of the attack (ms). - * Uint16 attack_level; // Level at the start of the attack. - * Uint16 fade_length; // Duration of the fade out (ms). - * Uint16 fade_level; // Level at the end of the fade. - * - * - * - * Here we have an example of a constant effect evolution in time: - * - Strength - ^ - | - | effect level --> _________________ - | / \ - | / \ - | / \ - | / \ - | attack_level --> | \ - | | | <--- fade_level - | - +--------------------------------------------------> Time - [--] [---] - attack_length fade_length - - [------------------][-----------------------] - delay length - - * - * Note either the attack_level or the fade_level may be above the actual - * effect level. - * - * SDL_HapticConstant - * SDL_HapticPeriodic - * SDL_HapticCondition - * SDL_HapticRamp - * SDL_HapticCustom - *} -type - PPSDL_HapticEffect = ^PSDL_HapticEffect; - PSDL_HapticEffect = ^TSDL_HapticEffect; - TSDL_HapticEffect = record - case cint of - {* Common for all force feedback effects *} - 0: (type_: cuint16); {**< Effect type. *} - 1: (constant: TSDL_HapticConstant;); {**< Constant effect. *} - 2: (periodic: TSDL_HapticPeriodic;); {**< Periodic effect. *} - 3: (condition: TSDL_HapticCondition;); {**< Condition effect. *} - 4: (ramp: TSDL_HapticRamp;); {**< Ramp effect. *} - 5: (leftright: TSDL_HapticLeftRight;); {**< Custom effect. *} - 6: (custom: TSDL_HapticCustom;); {**< Custom effect. *} - end; - - {* Function prototypes *} - - {** - * Count the number of haptic devices attached to the system. - * - * \returns the number of haptic devices detected on the system or a negative - * error code on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticName - *} -function SDL_NumHaptics: cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_NumHaptics' {$ENDIF} {$ENDIF}; - - {** - * Get the implementation dependent name of a haptic device. - * - * This can be called before any joysticks are opened. If no name can be - * found, this function returns NULL. - * - * \param device_index index of the device to query. - * \returns the name of the device or NULL on failure; call SDL_GetError() for - * more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_NumHaptics - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticName_fun = function(device_index: cint): PAnsiChar; cdecl; -Var - SDL_HapticName : TSDL_HapticName_fun = Nil; -{$else} - -function SDL_HapticName(device_index: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticName' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Open a haptic device for use. - * - * The index passed as an argument refers to the N'th haptic device on this - * system. - * - * When opening a haptic device, its gain will be set to maximum and - * autocenter will be disabled. To modify these values use SDL_HapticSetGain() - * and SDL_HapticSetAutocenter(). - * - * \param device_index index of the device to open - * \returns the device identifier or NULL on failure; call SDL_GetError() for - * more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticClose - * \sa SDL_HapticIndex - * \sa SDL_HapticOpenFromJoystick - * \sa SDL_HapticOpenFromMouse - * \sa SDL_HapticPause - * \sa SDL_HapticSetAutocenter - * \sa SDL_HapticSetGain - * \sa SDL_HapticStopAll - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticOpen_fun = function(device_index: cint): PSDL_Haptic; cdecl; -Var - SDL_HapticOpen : TSDL_HapticOpen_fun = Nil; -{$else} - -function SDL_HapticOpen(device_index: cint): PSDL_Haptic; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticOpen' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Check if the haptic device at the designated index has been opened. - * - * \param device_index the index of the device to query - * \returns 1 if it has been opened, 0 if it hasn't or on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticIndex - * \sa SDL_HapticOpen - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticOpened_fun = function(device_index: cint): cint; cdecl; -Var - SDL_HapticOpened : TSDL_HapticOpened_fun = Nil; -{$else} - -function SDL_HapticOpened(device_index: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticOpened' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the index of a haptic device. - * - * \param haptic the SDL_Haptic device to query - * \returns the index of the specified haptic device or a negative error code - * on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticOpen - * \sa SDL_HapticOpened - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticIndex_fun = function(haptic: PSDL_Haptic): cint; cdecl; -Var - SDL_HapticIndex : TSDL_HapticIndex_fun = Nil; -{$else} - -function SDL_HapticIndex(haptic: PSDL_Haptic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticIndex' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Query whether or not the current mouse has haptic capabilities. - * - * \returns SDL_TRUE if the mouse is haptic or SDL_FALSE if it isn't. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticOpenFromMouse - *} -function SDL_MouseIsHaptic: cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MouseInHaptic' {$ENDIF} {$ENDIF}; - - {** - * Try to open a haptic device from the current mouse. - * - * \returns the haptic device identifier or NULL on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticOpen - * \sa SDL_MouseIsHaptic - *} -function SDL_HapticOpenFromMouse: PSDL_Haptic; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticOpenFromMouse' {$ENDIF} {$ENDIF}; - - {** - * Query if a joystick has haptic features. - * - * \param joystick the SDL_Joystick to test for haptic capabilities - * \returns SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't, or a - * negative error code on failure; call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticOpenFromJoystick - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickIsHaptic_fun = function(joystick: PSDL_Joystick): cint; cdecl; -Var - SDL_JoystickIsHaptic : TSDL_JoystickIsHaptic_fun = Nil; -{$else} - -function SDL_JoystickIsHaptic(joystick: PSDL_Joystick): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickIsHaptic' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Open a haptic device for use from a joystick device. - * - * You must still close the haptic device separately. It will not be closed - * with the joystick. - * - * When opened from a joystick you should first close the haptic device before - * closing the joystick device. If not, on some implementations the haptic - * device will also get unallocated and you'll be unable to use force feedback - * on that device. - * - * \param joystick the SDL_Joystick to create a haptic device from - * \returns a valid haptic device identifier on success or NULL on failure; - * call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticClose - * \sa SDL_HapticOpen - * \sa SDL_JoystickIsHaptic - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticOpenFromJoystick_fun = function(joystick: PSDL_Joystick): PSDL_Haptic; cdecl; -Var - SDL_HapticOpenFromJoystick : TSDL_HapticOpenFromJoystick_fun = Nil; -{$else} - -function SDL_HapticOpenFromJoystick(joystick: PSDL_Joystick): PSDL_Haptic; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticOpenFromJoystick' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Close a haptic device previously opened with SDL_HapticOpen(). - * - * \param haptic the SDL_Haptic device to close - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticOpen - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticClose_proc = procedure(haptic: PSDL_Haptic); cdecl; -Var - SDL_HapticClose : TSDL_HapticClose_proc = Nil; -{$else} - -procedure SDL_HapticClose(haptic: PSDL_Haptic); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticClose' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the number of effects a haptic device can store. - * - * On some platforms this isn't fully supported, and therefore is an - * approximation. Always check to see if your created effect was actually - * created and do not rely solely on SDL_HapticNumEffects(). - * - * \param haptic the SDL_Haptic device to query - * \returns the number of effects the haptic device can store or a negative - * error code on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticNumEffectsPlaying - * \sa SDL_HapticQuery - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticNumEffects_fun = function(haptic: PSDL_Haptic): cint; cdecl; -Var - SDL_HapticNumEffects : TSDL_HapticNumEffects_fun = Nil; -{$else} - -function SDL_HapticNumEffects(haptic: PSDL_Haptic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticNumEffects' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the number of effects a haptic device can play at the same time. - * - * This is not supported on all platforms, but will always return a value. - * - * \param haptic the SDL_Haptic device to query maximum playing effects - * \returns the number of effects the haptic device can play at the same time - * or a negative error code on failure; call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticNumEffects - * \sa SDL_HapticQuery - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticNumEffectsPlaying_fun = function(haptic: PSDL_Haptic): cint; cdecl; -Var - SDL_HapticNumEffectsPlaying : TSDL_HapticNumEffectsPlaying_fun = Nil; -{$else} - -function SDL_HapticNumEffectsPlaying(haptic: PSDL_Haptic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticNumEffectsPlaying' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the haptic device's supported features in bitwise manner. - * - * \param haptic the SDL_Haptic device to query - * \returns a list of supported haptic features in bitwise manner (OR'd), or 0 - * on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticEffectSupported - * \sa SDL_HapticNumEffects - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticQuery_fun = function(haptic: PSDL_Haptic): cint; cdecl; -Var - SDL_HapticQuery : TSDL_HapticQuery_fun = Nil; -{$else} - -function SDL_HapticQuery(haptic: PSDL_Haptic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticQuery' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the number of haptic axes the device has. - * - * The number of haptic axes might be useful if working with the - * SDL_HapticDirection effect. - * - * \param haptic the SDL_Haptic device to query - * \returns the number of axes on success or a negative error code on failure; - * call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticNumAxes_fun = function(haptic: PSDL_Haptic): cint; cdecl; -Var - SDL_HapticNumAxes : TSDL_HapticNumAxes_fun = Nil; -{$else} - -function SDL_HapticNumAxes(haptic: PSDL_Haptic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticNumAxes' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Check to see if an effect is supported by a haptic device. - * - * \param haptic the SDL_Haptic device to query - * \param effect the desired effect to query - * \returns SDL_TRUE if effect is supported, SDL_FALSE if it isn't, or a - * negative error code on failure; call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticNewEffect - * \sa SDL_HapticQuery - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticEffectSupported_fun = function(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): cint; cdecl; -Var - SDL_HapticEffectSupported : TSDL_HapticEffectSupported_fun = Nil; -{$else} - -function SDL_HapticEffectSupported(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticEffectSupported' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Create a new haptic effect on a specified device. - * - * \param haptic an SDL_Haptic device to create the effect on - * \param effect an SDL_HapticEffect structure containing the properties of - * the effect to create - * \returns the ID of the effect on success or a negative error code on - * failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticDestroyEffect - * \sa SDL_HapticRunEffect - * \sa SDL_HapticUpdateEffect - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticNewEffect_fun = function(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): cint; cdecl; -Var - SDL_HapticNewEffect : TSDL_HapticNewEffect_fun = Nil; -{$else} - -function SDL_HapticNewEffect(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticNewEffect' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Update the properties of an effect. - * - * Can be used dynamically, although behavior when dynamically changing - * direction may be strange. Specifically the effect may re-upload itself and - * start playing from the start. You also cannot change the type either when - * running SDL_HapticUpdateEffect(). - * - * \param haptic the SDL_Haptic device that has the effect - * \param effect the identifier of the effect to update - * \param data an SDL_HapticEffect structure containing the new effect - * properties to use - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticDestroyEffect - * \sa SDL_HapticNewEffect - * \sa SDL_HapticRunEffect - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticUpdateEffect_fun = function(haptic: PSDL_Haptic; effect: cint; data: PSDL_HapticEffect): cint; cdecl; -Var - SDL_HapticUpdateEffect : TSDL_HapticUpdateEffect_fun = Nil; -{$else} - -function SDL_HapticUpdateEffect(haptic: PSDL_Haptic; effect: cint; data: PSDL_HapticEffect): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticUpdateEffect' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Run the haptic effect on its associated haptic device. - * - * To repeat the effect over and over indefinitely, set `iterations` to - * `SDL_HAPTIC_INFINITY`. (Repeats the envelope - attack and fade.) To make - * one instance of the effect last indefinitely (so the effect does not fade), - * set the effect's `length` in its structure/union to `SDL_HAPTIC_INFINITY` - * instead. - * - * \param haptic the SDL_Haptic device to run the effect on - * \param effect the ID of the haptic effect to run - * \param iterations the number of iterations to run the effect; use - * `SDL_HAPTIC_INFINITY` to repeat forever - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticDestroyEffect - * \sa SDL_HapticGetEffectStatus - * \sa SDL_HapticStopEffect - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticRunEffect_fun = function(haptic: PSDL_Haptic; effect: cint; iterations: cuint32): cint; cdecl; -Var - SDL_HapticRunEffect : TSDL_HapticRunEffect_fun = Nil; -{$else} - -function SDL_HapticRunEffect(haptic: PSDL_Haptic; effect: cint; iterations: cuint32): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticRunEffect' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Stop the haptic effect on its associated haptic device. - * - * * - * - * \param haptic the SDL_Haptic device to stop the effect on - * \param effect the ID of the haptic effect to stop - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticDestroyEffect - * \sa SDL_HapticRunEffect - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticStopEffect_fun = function(haptic: PSDL_Haptic; effect: cint): cint; cdecl; -Var - SDL_HapticStopEffect : TSDL_HapticStopEffect_fun = Nil; -{$else} - -function SDL_HapticStopEffect(haptic: PSDL_Haptic; effect: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticStopEffect' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Destroy a haptic effect on the device. - * - * This will stop the effect if it's running. Effects are automatically - * destroyed when the device is closed. - * - * \param haptic the SDL_Haptic device to destroy the effect on - * \param effect the ID of the haptic effect to destroy - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticNewEffect - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticDestroyEffect_proc = procedure(haptic: PSDL_Haptic; effect: cint); cdecl; -Var - SDL_HapticDestroyEffect : TSDL_HapticDestroyEffect_proc = Nil; -{$else} - -procedure SDL_HapticDestroyEffect(haptic: PSDL_Haptic; effect: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticDestroyEffect' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the status of the current effect on the specified haptic device. - * - * Device must support the SDL_HAPTIC_STATUS feature. - * - * \param haptic the SDL_Haptic device to query for the effect status on - * \param effect the ID of the haptic effect to query its status - * \returns 0 if it isn't playing, 1 if it is playing, or a negative error - * code on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticRunEffect - * \sa SDL_HapticStopEffect - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticGetEffectStatus_fun = function(haptic: PSDL_Haptic; effect: cint): cint; cdecl; -Var - SDL_HapticGetEffectStatus : TSDL_HapticGetEffectStatus_fun = Nil; -{$else} - -function SDL_HapticGetEffectStatus(haptic: PSDL_Haptic; effect: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticGetEffectStatus' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Set the global gain of the specified haptic device. - * - * Device must support the SDL_HAPTIC_GAIN feature. - * - * The user may specify the maximum gain by setting the environment variable - * `SDL_HAPTIC_GAIN_MAX` which should be between 0 and 100. All calls to - * SDL_HapticSetGain() will scale linearly using `SDL_HAPTIC_GAIN_MAX` as the - * maximum. - * - * \param haptic the SDL_Haptic device to set the gain on - * \param gain value to set the gain to, should be between 0 and 100 (0 - 100) - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticQuery - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticSetGain_fun = function(haptic: PSDL_Haptic; gain: cint): cint; cdecl; -Var - SDL_HapticSetGain : TSDL_HapticSetGain_fun = Nil; -{$else} - -function SDL_HapticSetGain(haptic: PSDL_Haptic; gain: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticSetGain' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Set the global autocenter of the device. - * - * Autocenter should be between 0 and 100. Setting it to 0 will disable - * autocentering. - * - * Device must support the SDL_HAPTIC_AUTOCENTER feature. - * - * \param haptic the SDL_Haptic device to set autocentering on - * \param autocenter value to set autocenter to (0-100) - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticQuery - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticSetAutocenter_fun = function(haptic: PSDL_Haptic; autocenter: cint): cint; cdecl; -Var - SDL_HapticSetAutocenter : TSDL_HapticSetAutocenter_fun = Nil; -{$else} - -function SDL_HapticSetAutocenter(haptic: PSDL_Haptic; autocenter: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticSetAutocenter' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Pause a haptic device. - * - * Device must support the `SDL_HAPTIC_PAUSE` feature. Call - * SDL_HapticUnpause() to resume playback. - * - * Do not modify the effects nor add new ones while the device is paused. That - * can cause all sorts of weird errors. - * - * \param haptic the SDL_Haptic device to pause - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticUnpause - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticPause_fun = function(haptic: PSDL_Haptic): cint; cdecl; -Var - SDL_HapticPause : TSDL_HapticPause_fun = Nil; -{$else} - -function SDL_HapticPause(haptic: PSDL_Haptic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticPause' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Unpause a haptic device. - * - * Call to unpause after SDL_HapticPause(). - * - * \param haptic the SDL_Haptic device to unpause - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticPause - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticUnpause_fun = function(haptic: PSDL_Haptic): cint; cdecl; -Var - SDL_HapticUnpause : TSDL_HapticUnpause_fun = Nil; -{$else} - -function SDL_HapticUnpause(haptic: PSDL_Haptic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticUnPause' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Stop all the currently playing effects on a haptic device. - * - * \param haptic the SDL_Haptic device to stop - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticStopAll_fun = function(haptic: PSDL_Haptic): cint; cdecl; -Var - SDL_HapticStopAll : TSDL_HapticStopAll_fun = Nil; -{$else} - -function SDL_HapticStopAll(haptic: PSDL_Haptic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticStopAll' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Check whether rumble is supported on a haptic device. - * - * \param haptic haptic device to check for rumble support - * \returns SDL_TRUE if effect is supported, SDL_FALSE if it isn't, or a - * negative error code on failure; call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticRumbleInit - * \sa SDL_HapticRumblePlay - * \sa SDL_HapticRumbleStop - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticRumbleSupported_fun = function(haptic: PSDL_Haptic): cint; cdecl; -Var - SDL_HapticRumbleSupported : TSDL_HapticRumbleSupported_fun = Nil; -{$else} - -function SDL_HapticRumbleSupported(haptic: PSDL_Haptic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticRumbleSupported' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Initialize a haptic device for simple rumble playback. - * - * \param haptic the haptic device to initialize for simple rumble playback - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticOpen - * \sa SDL_HapticRumblePlay - * \sa SDL_HapticRumbleStop - * \sa SDL_HapticRumbleSupported - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticRumbleInit_fun = function(haptic: PSDL_Haptic): cint; cdecl; -Var - SDL_HapticRumbleInit : TSDL_HapticRumbleInit_fun = Nil; -{$else} - -function SDL_HapticRumbleInit(haptic: PSDL_Haptic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticRumbleInit' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Run a simple rumble effect on a haptic device. - * - * \param haptic the haptic device to play the rumble effect on - * \param strength strength of the rumble to play as a 0-1 float value - * \param length length of the rumble to play in milliseconds - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticRumbleInit - * \sa SDL_HapticRumbleStop - * \sa SDL_HapticRumbleSupported - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticRumblePlay_fun = function(haptic: PSDL_Haptic; strength: cfloat; length: cuint32): cint; cdecl; -Var - SDL_HapticRumblePlay : TSDL_HapticRumblePlay_fun = Nil; -{$else} - -function SDL_HapticRumblePlay(haptic: PSDL_Haptic; strength: cfloat; length: cuint32): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticRumblePlay' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Stop the simple rumble on a haptic device. - * - * \param haptic the haptic device to stop the rumble effect on - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HapticRumbleInit - * \sa SDL_HapticRumblePlay - * \sa SDL_HapticRumbleSupported - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HapticRumbleStop_fun = function(haptic: PSDL_Haptic): cint; cdecl; -Var - SDL_HapticRumbleStop : TSDL_HapticRumbleStop_fun = Nil; -{$else} - -function SDL_HapticRumbleStop(haptic: PSDL_Haptic): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticRumbleStop' {$ENDIF} {$ENDIF}; -{$endif} - +//from "sdl_haptic.h" + +{** + * + * The SDL Haptic subsystem allows you to control haptic (force feedback) + * devices. + * + * The basic usage is as follows: + * - Initialize the Subsystem (::SDL_INIT_HAPTIC). + * - Open a Haptic Device. + * - SDL_HapticOpen() to open from index. + * - SDL_HapticOpenFromJoystick() to open from an existing joystick. + * - Create an effect (::SDL_HapticEffect). + * - Upload the effect with SDL_HapticNewEffect(). + * - Run the effect with SDL_HapticRunEffect(). + * - (optional) Free the effect with SDL_HapticDestroyEffect(). + * - Close the haptic device with SDL_HapticClose(). + * + * Simple rumble example: + * + * SDL_Haptic *haptic; + * + * // Open the device + * haptic = SDL_HapticOpen( 0 ); + * if (haptic == NULL) + * return -1; + * + * // Initialize simple rumble + * if (SDL_HapticRumbleInit( haptic ) != 0) + * return -1; + * + * // Play effect at 50% strength for 2 seconds + * if (SDL_HapticRumblePlay( haptic, 0.5, 2000 ) != 0) + * return -1; + * SDL_Delay( 2000 ); + * + * // Clean up + * SDL_HapticClose( haptic ); + * + * + * Complete example: + * + * int test_haptic( SDL_Joystick * joystick ) + * SDL_Haptic *haptic; + * SDL_HapticEffect effect; + * int effect_id; + * + * // Open the device + * haptic = SDL_HapticOpenFromJoystick( joystick ); + * if (haptic == NULL) return -1; // Most likely joystick isn't haptic + * + * // See if it can do sine waves + * if ((SDL_HapticQuery(haptic) & SDL_HAPTIC_SINE)==0) + * SDL_HapticClose(haptic); // No sine effect + * return -1; + * + * + * // Create the effect + * memset( &effect, 0, sizeof(SDL_HapticEffect) ); // 0 is safe default + * effect.type = SDL_HAPTIC_SINE; + * effect.periodic.direction.type = SDL_HAPTIC_POLAR; // Polar coordinates + * effect.periodic.direction.dir[0] = 18000; // Force comes from south + * effect.periodic.period = 1000; // 1000 ms + * effect.periodic.magnitude = 20000; // 20000/32767 strength + * effect.periodic.length = 5000; // 5 seconds long + * effect.periodic.attack_length = 1000; // Takes 1 second to get max strength + * effect.periodic.fade_length = 1000; // Takes 1 second to fade away + * + * // Upload the effect + * effect_id = SDL_HapticNewEffect( haptic, &effect ); + * + * // Test the effect + * SDL_HapticRunEffect( haptic, effect_id, 1 ); + * SDL_Delay( 5000); // Wait for the effect to finish + * + * // We destroy the effect, although closing the device also does this + * SDL_HapticDestroyEffect( haptic, effect_id ); + * + * // Close the device + * SDL_HapticClose(haptic); + * + * return 0; // Success + *} + + {** + * SDL_Haptic + * + * The haptic structure used to identify an SDL haptic. + * + * SDL_HapticOpen + * SDL_HapticOpenFromJoystick + * SDL_HapticClose + *} +type + PPSDL_Haptic = ^PSDL_Haptic; + PSDL_Haptic = type Pointer; + + {** + * Haptic features + * + * Different haptic features a device can have. + *} + + {** + * Haptic effects + *} + + {** + * Constant effect supported. + * + * Constant haptic effect. + * + * SDL_HapticCondition + *} +const + SDL_HAPTIC_CONSTANT = (1 shl 0); + + {** + * Sine wave effect supported. + * + * Periodic haptic effect that simulates sine waves. + * + * SDL_HapticPeriodic + *} +const + SDL_HAPTIC_SINE = (1 shl 1); + + {** + * Square wave effect supported. + * + * Periodic haptic effect that simulates square waves. + * + * SDL_HapticPeriodic + *} +const + SDL_HAPTIC_LEFTRIGHT = (1 shl 2); + + { !!! FIXME: put this back when we have more bits in 2.1 } + { #define SDL_HAPTIC_SQUARE (1<<2) } + SDL_HAPTIC_SQUARE = (1 shl 2); // SDL2-For-Pascal: Out-commented in C code. + // Why not keeping it for + // compatibility here? + + {** + * Triangle wave effect supported. + * + * Periodic haptic effect that simulates triangular waves. + * + * SDL_HapticPeriodic + *} +const + SDL_HAPTIC_TRIANGLE = (1 shl 3); + + {** + * Sawtoothup wave effect supported. + * + * Periodic haptic effect that simulates saw tooth up waves. + * + * SDL_HapticPeriodic + *} +const + SDL_HAPTIC_SAWTOOTHUP = (1 shl 4); + + {** + * Sawtoothdown wave effect supported. + * + * Periodic haptic effect that simulates saw tooth down waves. + * + * SDL_HapticPeriodic + *} +const + SDL_HAPTIC_SAWTOOTHDOWN = (1 shl 5); + + {** + * Ramp effect supported. + * + * Ramp haptic effect. + * + * SDL_HapticRamp + *} +const + SDL_HAPTIC_RAMP = (1 shl 6); + + {** + * Spring effect supported - uses axes position. + * + * Condition haptic effect that simulates a spring. Effect is based on the + * axes position. + * + * SDL_HapticCondition + *} +const + SDL_HAPTIC_SPRING = (1 shl 7); + + {** + * Damper effect supported - uses axes velocity. + * + * Condition haptic effect that simulates dampening. Effect is based on the + * axes velocity. + * + * SDL_HapticCondition + *} +const + SDL_HAPTIC_DAMPER = (1 shl 8); + + {** + * Inertia effect supported - uses axes acceleration. + * + * Condition haptic effect that simulates inertia. Effect is based on the axes + * acceleration. + * + * SDL_HapticCondition + *} +const + SDL_HAPTIC_INERTIA = (1 shl 9); + + {** + * Friction effect supported - uses axes movement. + * + * Condition haptic effect that simulates friction. Effect is based on the + * axes movement. + * + * SDL_HapticCondition + *} +const + SDL_HAPTIC_FRICTION = (1 shl 10); + + {** + * Custom effect is supported. + * + * User defined custom haptic effect. + *} +const + SDL_HAPTIC_CUSTOM = (1 shl 11); + + {*Haptic effects*} + + {* These last few are features the device has, not effects *} + + {** + * Device can set global gain. + * + * Device supports setting the global gain. + * + * SDL_HapticSetGain + *} +const + SDL_HAPTIC_GAIN = (1 shl 12); + + {** + * Device can set autocenter. + * + * Device supports setting autocenter. + * + * SDL_HapticSetAutocenter + *} +const + SDL_HAPTIC_AUTOCENTER = (1 shl 13); + + {** + * Device can be queried for effect status. + * + * Device can be queried for effect status. + * + * SDL_HapticGetEffectStatus + *} +const + SDL_HAPTIC_STATUS = (1 shl 14); + + {** + * Device can be paused. + * + * SDL_HapticPause + * SDL_HapticUnpause + *} +const + SDL_HAPTIC_PAUSE = (1 shl 15); + + {** + * Direction encodings + *} + + {** + * Uses polar coordinates for the direction. + * + * SDL_HapticDirection + *} +const + SDL_HAPTIC_POLAR = 0; + + {** + * Uses cartesian coordinates for the direction. + * + * SDL_HapticDirection + *} +const + SDL_HAPTIC_CARTESIAN = 1; + + {** + * Uses spherical coordinates for the direction. + * + * SDL_HapticDirection + *} +const + SDL_HAPTIC_SPHERICAL = 2; + + {** + * \brief Use this value to play an effect on the steering wheel axis. This + * provides better compatibility across platforms and devices as SDL will guess + * the correct axis. + * \sa SDL_HapticDirection + *} +const + SDL_HAPTIC_STEERING_AXIS = 3; + + {* + * Misc defines. + *} + + {** + * Used to play a device an infinite number of times. + * + * SDL_HapticRunEffect + *} +const + SDL_HAPTIC_INFINITY = 4294967295; // C: 4294967295U + + {** + * Structure that represents a haptic direction. + * + * Directions can be specified by: + * - SDL_HAPTIC_POLAR : Specified by polar coordinates. + * - SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates. + * - SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates. + * + * Cardinal directions of the haptic device are relative to the positioning + * of the device. North is considered to be away from the user. + * + * The following diagram represents the cardinal directions: + * + .--. + |__| .-------. + |=.| |.-----.| + |--| || || + | | |'-----'| + |__|~')_____(' + [ COMPUTER ] + + + North (0,-1) + ^ + | + | + (1,0) West <----[ HAPTIC ]----> East (-1,0) + | + | + v + South (0,1) + + + [ USER ] + \|||/ + (o o) + ---ooO-(_)-Ooo--- + + * + * If type is SDL_HAPTIC_POLAR, direction is encoded by hundredths of a + * degree starting north and turning clockwise. ::SDL_HAPTIC_POLAR only uses + * the first dir parameter. The cardinal directions would be: + * - North: 0 (0 degrees) + * - East: 9000 (90 degrees) + * - South: 18000 (180 degrees) + * - West: 27000 (270 degrees) + * + * If type is SDL_HAPTIC_CARTESIAN, direction is encoded by three positions + * (X axis, Y axis and Z axis (with 3 axes)). ::SDL_HAPTIC_CARTESIAN uses + * the first three dir parameters. The cardinal directions would be: + * - North: 0,-1, 0 + * - East: -1, 0, 0 + * - South: 0, 1, 0 + * - West: 1, 0, 0 + * + * The Z axis represents the height of the effect if supported, otherwise + * it's unused. In cartesian encoding (1, 2) would be the same as (2, 4), you + * can use any multiple you want, only the direction matters. + * + * If type is SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations. + * The first two dir parameters are used. The dir parameters are as + * follows (all values are in hundredths of degrees): + * - Degrees from (1, 0) rotated towards (0, 1). + * - Degrees towards (0, 0, 1) (device needs at least 3 axes). + * + * + * Example of force coming from the south with all encodings (force coming + * from the south means the user will have to pull the stick to counteract): + * + * SDL_HapticDirection direction; + * + * // Cartesian directions + * direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding. + * direction.dir[0] = 0; // X position + * direction.dir[1] = 1; // Y position + * // Assuming the device has 2 axes, we don't need to specify third parameter. + * + * // Polar directions + * direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding. + * direction.dir[0] = 18000; // Polar only uses first parameter + * + * // Spherical coordinates + * direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding + * direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters. + * + * + * SDL_HAPTIC_POLAR + * SDL_HAPTIC_CARTESIAN + * SDL_HAPTIC_SPHERICAL + * SDL_HapticEffect + * SDL_HapticNumAxes + *} +type + PPSDL_HapticDirection = ^PSDL_HapticDirection; + PSDL_HapticDirection = ^TSDL_HapticDirection; + TSDL_HapticDirection = record + type_: cuint8; {**< The type of encoding. *} + dir: array[0..2] of cint32; {**< The encoded direction. *} + end; + + {** + * A structure containing a template for a Constant effect. + * + * The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect. + * + * A constant effect applies a constant force in the specified direction + * to the joystick. + * + * SDL_HAPTIC_CONSTANT + * SDL_HapticEffect + *} +type + PPSDL_HapticConstant = ^PSDL_HapticConstant; + PSDL_HapticConstant = ^TSDL_HapticConstant; + TSDL_HapticConstant = record + {* Header *} + type_: cuint16; {**< SDL_HAPTIC_CONSTANT *} + direction: TSDL_HapticDirection; {**< Direction of the effect. *} + + {* Replay *} + length: cuint32; {**< Duration of the effect. *} + delay: cuint16; {**< Delay before starting the effect. *} + + {* Trigger *} + button: cuint16; {**< Button that triggers the effect. *} + interval: cuint16; {**< How soon it can be triggered again after button. *} + + {* Constant *} + level: cint16; {**< Strength of the constant effect. *} + + {* Envelope *} + attack_length: cuint16; {**< Duration of the attack. *} + attack_level: cuint16; {**< Level at the start of the attack. *} + fade_length: cuint16; {**< Duration of the fade. *} + fade_level: cuint16; {**< Level at the end of the fade. *} + end; + + {** + * A structure containing a template for a Periodic effect. + * + * The struct handles the following effects: + * - SDL_HAPTIC_SINE + * - SDL_HAPTIC_SQUARE + * - SDL_HAPTIC_TRIANGLE + * - SDL_HAPTIC_SAWTOOTHUP + * - SDL_HAPTIC_SAWTOOTHDOWN + * + * A periodic effect consists in a wave-shaped effect that repeats itself + * over time. The type determines the shape of the wave and the parameters + * determine the dimensions of the wave. + * + * Phase is given by hundredth of a cycle meaning that giving the phase a value + * of 9000 will displace it 25% of its period. Here are sample values: + * - 0: No phase displacement. + * - 9000: Displaced 25% of its period. + * - 18000: Displaced 50% of its period. + * - 27000: Displaced 75% of its period. + * - 36000: Displaced 100% of its period, same as 0, but 0 is preferred. + * + * Examples: + * + SDL_HAPTIC_SINE + __ __ __ __ + / \ / \ / \ / + / \__/ \__/ \__/ + + SDL_HAPTIC_SQUARE + __ __ __ __ __ + | | | | | | | | | | + | |__| |__| |__| |__| | + + SDL_HAPTIC_TRIANGLE + /\ /\ /\ /\ /\ + / \ / \ / \ / \ / + / \/ \/ \/ \/ + + SDL_HAPTIC_SAWTOOTHUP + /| /| /| /| /| /| /| + / | / | / | / | / | / | / | + / |/ |/ |/ |/ |/ |/ | + + SDL_HAPTIC_SAWTOOTHDOWN + \ |\ |\ |\ |\ |\ |\ | + \ | \ | \ | \ | \ | \ | \ | + \| \| \| \| \| \| \| + + * + * SDL_HAPTIC_SINE + * SDL_HAPTIC_SQUARE + * SDL_HAPTIC_TRIANGLE + * SDL_HAPTIC_SAWTOOTHUP + * SDL_HAPTIC_SAWTOOTHDOWN + * SDL_HapticEffect + *} +type + PPSDL_HapticPeriodic = ^PSDL_HapticPeriodic; + PSDL_HapticPeriodic = ^TSDL_HapticPeriodic; + TSDL_HapticPeriodic = record + { Header *} + type_: cuint16; {**< SDL_HAPTIC_SINE, SDL_HAPTIC_SQUARE, + SDL_HAPTIC_TRIANGLE, SDL_HAPTIC_SAWTOOTHUP or + SDL_HAPTIC_SAWTOOTHDOWN *} + direction: TSDL_HapticDirection; {**< Direction of the effect. *} + + {* Replay *} + length: cuint32; {**< Duration of the effect. *} + delay: cuint16; {**< Delay before starting the effect. *} + + {* Trigger *} + button: cuint16; {**< Button that triggers the effect. *} + interval: cuint16; {**< How soon it can be triggered again after button. *} + + {* Periodic *} + period: cuint16; {**< Period of the wave. *} + magnitude: cint16; {**< Peak value. *} + offset: cint16; {**< Mean value of the wave. *} + phase: cuint16; {**< Horizontal shift given by hundredth of a cycle. *} + + {* Envelope *} + attack_length: cuint16; {**< Duration of the attack. *} + attack_level: cuint16; {**< Level at the start of the attack. *} + fade_length: cuint16; {**< Duration of the fade. *} + fade_level: cuint16; {**< Level at the end of the fade. *} + end; + + {** + * A structure containing a template for a Condition effect. + * + * The struct handles the following effects: + * - SDL_HAPTIC_SPRING: Effect based on axes position. + * - SDL_HAPTIC_DAMPER: Effect based on axes velocity. + * - SDL_HAPTIC_INERTIA: Effect based on axes acceleration. + * - SDL_HAPTIC_FRICTION: Effect based on axes movement. + * + * Direction is handled by condition internals instead of a direction member. + * The condition effect specific members have three parameters. The first + * refers to the X axis, the second refers to the Y axis and the third + * refers to the Z axis. The right terms refer to the positive side of the + * axis and the left terms refer to the negative side of the axis. Please + * refer to the ::SDL_HapticDirection diagram for which side is positive and + * which is negative. + * + * SDL_HapticDirection + * SDL_HAPTIC_SPRING + * SDL_HAPTIC_DAMPER + * SDL_HAPTIC_INERTIA + * SDL_HAPTIC_FRICTION + * SDL_HapticEffect + *} +type + PPSDL_HapticCondition = ^PSDL_HapticCondition; + PSDL_HapticCondition = ^TSDL_HapticCondition; + TSDL_HapticCondition = record + {* Header *} + type_: cuint16; {**< SDL_HAPTIC_SPRING, SDL_HAPTIC_DAMPER, + SDL_HAPTIC_INERTIA or SDL_HAPTIC_FRICTION *} + direction: TSDL_HapticDirection; {**< Direction of the effect - Not used ATM. *} + + {* Replay *} + length: cuint32; {**< Duration of the effect. *} + delay: cuint16; {**< Delay before starting the effect. *} + + {* Trigger *} + button: cuint16; {**< Button that triggers the effect. *} + interval: cuint16; {**< How soon it can be triggered again after button. *} + + {* Condition *} + right_sat: array[0..2] of cuint16; {**< Level when joystick is to the positive side. *} + left_sat: array[0..2] of cuint16; {**< Level when joystick is to the negative side. *} + right_coeff: array[0..2] of cint16;{**< How fast to increase the force towards the positive side. *} + left_coeff: array[0..2] of cint16; {**< How fast to increase the force towards the negative side. *} + deadband: array[0..2] of cuint16; {**< Size of the dead zone. *} + center: array[0..2] of cint16; {**< Position of the dead zone. *} + end; + + {** + * A structure containing a template for a Ramp effect. + * + * This struct is exclusively for the ::SDL_HAPTIC_RAMP effect. + * + * The ramp effect starts at start strength and ends at end strength. + * It augments in linear fashion. If you use attack and fade with a ramp + * the effects get added to the ramp effect making the effect become + * quadratic instead of linear. + * + * SDL_HAPTIC_RAMP + * SDL_HapticEffect + *} +type + PPSDL_HapticRamp = ^PSDL_HapticRamp; + PSDL_HapticRamp = ^TSDL_HapticRamp; + TSDL_HapticRamp = record + {* Header *} + type_: cuint16; {**< SDL_HAPTIC_RAMP *} + direction: TSDL_HapticDirection; {**< Direction of the effect. *} + + {* Replay *} + length: cuint32; {**< Duration of the effect. *} + delay: cuint16; {**< Delay before starting the effect. *} + + {* Trigger *} + button: cuint16; {**< Button that triggers the effect. *} + interval: cuint16; {**< How soon it can be triggered again after button. *} + + {* Ramp *} + start: cint16; {**< Beginning strength level. *} + end_: cint16; {**< Ending strength level. *} + + {* Envelope *} + attack_length: cuint16; {**< Duration of the attack. *} + attack_level: cuint16; {**< Level at the start of the attack. *} + fade_length: cuint16; {**< Duration of the fade. *} + fade_level: cuint16; {**< Level at the end of the fade. *} + end; + + {** + * \brief A structure containing a template for a Left/Right effect. + * + * This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect. + * + * The Left/Right effect is used to explicitly control the large and small + * motors, commonly found in modern game controllers. The small (right) motor + * is high frequency, and the large (left) motor is low frequency. + * + * \sa SDL_HAPTIC_LEFTRIGHT + * \sa SDL_HapticEffect + *} +type + TSDL_HapticLeftRight = record + {* Header *} + type_: cuint16; {**< ::SDL_HAPTIC_LEFTRIGHT *} + + {* Replay *} + length: cuint32; {**< Duration of the effect in milliseconds. *} + + {* Rumble *} + large_magnitude: cuint16; {**< Control of the large controller motor. *} + small_magnitude: cuint16; {**< Control of the small controller motor. *} + end; + + {** + * A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect. + * + * A custom force feedback effect is much like a periodic effect, where the + * application can define its exact shape. You will have to allocate the + * data yourself. Data should consist of channels * samples Uint16 samples. + * + * If channels is one, the effect is rotated using the defined direction. + * Otherwise it uses the samples in data for the different axes. + * + * SDL_HAPTIC_CUSTOM + * SDL_HapticEffect + *} +type + PPSDL_HapticCustom = ^PSDL_HapticCustom; + PSDL_HapticCustom = ^TSDL_HapticCustom; + TSDL_HapticCustom = record + {* Header *} + type_: cuint16; {**< SDL_HAPTIC_CUSTOM *} + direction: TSDL_HapticDirection; {**< Direction of the effect. *} + + {* Replay *} + length: cuint32; {**< Duration of the effect. *} + delay: cuint16; {**< Delay before starting the effect. *} + + {* Trigger *} + button: cuint16; {**< Button that triggers the effect. *} + interval: cuint16; {**< How soon it can be triggered again after button. *} + + {* Custom *} + channels: cuint8; {**< Axes to use, minimum of one. *} + period: cuint16; {**< Sample periods. *} + samples: cuint16; {**< Amount of samples. *} + data: pcuint16; {**< Should contain channels*samples items. *} + + {* Envelope *} + attack_length: cuint16; {**< Duration of the attack. *} + attack_level: cuint16; {**< Level at the start of the attack. *} + fade_length: cuint16; {**< Duration of the fade. *} + fade_level: cuint16; {**< Level at the end of the fade. *} + end; + + {** + * The generic template for any haptic effect. + * + * All values max at 32767 (0x7FFF). Signed values also can be negative. + * Time values unless specified otherwise are in milliseconds. + * + * You can also pass SDL_HAPTIC_INFINITY to length instead of a 0-32767 + * value. Neither delay, interval, attack_length nor fade_length support + * SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends. + * + * Additionally, the SDL_HAPTIC_RAMP effect does not support a duration of + * SDL_HAPTIC_INFINITY. + * + * Button triggers may not be supported on all devices, it is advised to not + * use them if possible. Buttons start at index 1 instead of index 0 like + * the joystick. + * + * If both attack_length and fade_level are 0, the envelope is not used, + * otherwise both values are used. + * + * Common parts: + * + * // Replay - All effects have this + * Uint32 length; // Duration of effect (ms). + * Uint16 delay; // Delay before starting effect. + * + * // Trigger - All effects have this + * Uint16 button; // Button that triggers effect. + * Uint16 interval; // How soon before effect can be triggered again. + * + * // Envelope - All effects except condition effects have this + * Uint16 attack_length; // Duration of the attack (ms). + * Uint16 attack_level; // Level at the start of the attack. + * Uint16 fade_length; // Duration of the fade out (ms). + * Uint16 fade_level; // Level at the end of the fade. + * + * + * + * Here we have an example of a constant effect evolution in time: + * + Strength + ^ + | + | effect level --> _________________ + | / \ + | / \ + | / \ + | / \ + | attack_level --> | \ + | | | <--- fade_level + | + +--------------------------------------------------> Time + [--] [---] + attack_length fade_length + + [------------------][-----------------------] + delay length + + * + * Note either the attack_level or the fade_level may be above the actual + * effect level. + * + * SDL_HapticConstant + * SDL_HapticPeriodic + * SDL_HapticCondition + * SDL_HapticRamp + * SDL_HapticCustom + *} +type + PPSDL_HapticEffect = ^PSDL_HapticEffect; + PSDL_HapticEffect = ^TSDL_HapticEffect; + TSDL_HapticEffect = record + case cint of + {* Common for all force feedback effects *} + 0: (type_: cuint16); {**< Effect type. *} + 1: (constant: TSDL_HapticConstant;); {**< Constant effect. *} + 2: (periodic: TSDL_HapticPeriodic;); {**< Periodic effect. *} + 3: (condition: TSDL_HapticCondition;); {**< Condition effect. *} + 4: (ramp: TSDL_HapticRamp;); {**< Ramp effect. *} + 5: (leftright: TSDL_HapticLeftRight;); {**< Custom effect. *} + 6: (custom: TSDL_HapticCustom;); {**< Custom effect. *} + end; + + {* Function prototypes *} + + {** + * Count the number of haptic devices attached to the system. + * + * \returns the number of haptic devices detected on the system or a negative + * error code on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticName + *} +function SDL_NumHaptics: cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_NumHaptics' {$ENDIF} {$ENDIF}; + + {** + * Get the implementation dependent name of a haptic device. + * + * This can be called before any joysticks are opened. If no name can be + * found, this function returns NULL. + * + * \param device_index index of the device to query. + * \returns the name of the device or NULL on failure; call SDL_GetError() for + * more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_NumHaptics + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticName_fun = function(device_index: cint): PAnsiChar; cdecl; +Var + SDL_HapticName : TSDL_HapticName_fun = Nil; +{$else} + +function SDL_HapticName(device_index: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticName' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Open a haptic device for use. + * + * The index passed as an argument refers to the N'th haptic device on this + * system. + * + * When opening a haptic device, its gain will be set to maximum and + * autocenter will be disabled. To modify these values use SDL_HapticSetGain() + * and SDL_HapticSetAutocenter(). + * + * \param device_index index of the device to open + * \returns the device identifier or NULL on failure; call SDL_GetError() for + * more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticClose + * \sa SDL_HapticIndex + * \sa SDL_HapticOpenFromJoystick + * \sa SDL_HapticOpenFromMouse + * \sa SDL_HapticPause + * \sa SDL_HapticSetAutocenter + * \sa SDL_HapticSetGain + * \sa SDL_HapticStopAll + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticOpen_fun = function(device_index: cint): PSDL_Haptic; cdecl; +Var + SDL_HapticOpen : TSDL_HapticOpen_fun = Nil; +{$else} + +function SDL_HapticOpen(device_index: cint): PSDL_Haptic; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticOpen' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Check if the haptic device at the designated index has been opened. + * + * \param device_index the index of the device to query + * \returns 1 if it has been opened, 0 if it hasn't or on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticIndex + * \sa SDL_HapticOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticOpened_fun = function(device_index: cint): cint; cdecl; +Var + SDL_HapticOpened : TSDL_HapticOpened_fun = Nil; +{$else} + +function SDL_HapticOpened(device_index: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticOpened' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the index of a haptic device. + * + * \param haptic the SDL_Haptic device to query + * \returns the index of the specified haptic device or a negative error code + * on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticOpen + * \sa SDL_HapticOpened + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticIndex_fun = function(haptic: PSDL_Haptic): cint; cdecl; +Var + SDL_HapticIndex : TSDL_HapticIndex_fun = Nil; +{$else} + +function SDL_HapticIndex(haptic: PSDL_Haptic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticIndex' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Query whether or not the current mouse has haptic capabilities. + * + * \returns SDL_TRUE if the mouse is haptic or SDL_FALSE if it isn't. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticOpenFromMouse + *} +function SDL_MouseIsHaptic: cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MouseInHaptic' {$ENDIF} {$ENDIF}; + + {** + * Try to open a haptic device from the current mouse. + * + * \returns the haptic device identifier or NULL on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticOpen + * \sa SDL_MouseIsHaptic + *} +function SDL_HapticOpenFromMouse: PSDL_Haptic; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticOpenFromMouse' {$ENDIF} {$ENDIF}; + + {** + * Query if a joystick has haptic features. + * + * \param joystick the SDL_Joystick to test for haptic capabilities + * \returns SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't, or a + * negative error code on failure; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticOpenFromJoystick + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickIsHaptic_fun = function(joystick: PSDL_Joystick): cint; cdecl; +Var + SDL_JoystickIsHaptic : TSDL_JoystickIsHaptic_fun = Nil; +{$else} + +function SDL_JoystickIsHaptic(joystick: PSDL_Joystick): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickIsHaptic' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Open a haptic device for use from a joystick device. + * + * You must still close the haptic device separately. It will not be closed + * with the joystick. + * + * When opened from a joystick you should first close the haptic device before + * closing the joystick device. If not, on some implementations the haptic + * device will also get unallocated and you'll be unable to use force feedback + * on that device. + * + * \param joystick the SDL_Joystick to create a haptic device from + * \returns a valid haptic device identifier on success or NULL on failure; + * call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticClose + * \sa SDL_HapticOpen + * \sa SDL_JoystickIsHaptic + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticOpenFromJoystick_fun = function(joystick: PSDL_Joystick): PSDL_Haptic; cdecl; +Var + SDL_HapticOpenFromJoystick : TSDL_HapticOpenFromJoystick_fun = Nil; +{$else} + +function SDL_HapticOpenFromJoystick(joystick: PSDL_Joystick): PSDL_Haptic; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticOpenFromJoystick' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Close a haptic device previously opened with SDL_HapticOpen(). + * + * \param haptic the SDL_Haptic device to close + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticClose_proc = procedure(haptic: PSDL_Haptic); cdecl; +Var + SDL_HapticClose : TSDL_HapticClose_proc = Nil; +{$else} + +procedure SDL_HapticClose(haptic: PSDL_Haptic); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticClose' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the number of effects a haptic device can store. + * + * On some platforms this isn't fully supported, and therefore is an + * approximation. Always check to see if your created effect was actually + * created and do not rely solely on SDL_HapticNumEffects(). + * + * \param haptic the SDL_Haptic device to query + * \returns the number of effects the haptic device can store or a negative + * error code on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticNumEffectsPlaying + * \sa SDL_HapticQuery + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticNumEffects_fun = function(haptic: PSDL_Haptic): cint; cdecl; +Var + SDL_HapticNumEffects : TSDL_HapticNumEffects_fun = Nil; +{$else} + +function SDL_HapticNumEffects(haptic: PSDL_Haptic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticNumEffects' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the number of effects a haptic device can play at the same time. + * + * This is not supported on all platforms, but will always return a value. + * + * \param haptic the SDL_Haptic device to query maximum playing effects + * \returns the number of effects the haptic device can play at the same time + * or a negative error code on failure; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticNumEffects + * \sa SDL_HapticQuery + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticNumEffectsPlaying_fun = function(haptic: PSDL_Haptic): cint; cdecl; +Var + SDL_HapticNumEffectsPlaying : TSDL_HapticNumEffectsPlaying_fun = Nil; +{$else} + +function SDL_HapticNumEffectsPlaying(haptic: PSDL_Haptic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticNumEffectsPlaying' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the haptic device's supported features in bitwise manner. + * + * \param haptic the SDL_Haptic device to query + * \returns a list of supported haptic features in bitwise manner (OR'd), or 0 + * on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticEffectSupported + * \sa SDL_HapticNumEffects + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticQuery_fun = function(haptic: PSDL_Haptic): cint; cdecl; +Var + SDL_HapticQuery : TSDL_HapticQuery_fun = Nil; +{$else} + +function SDL_HapticQuery(haptic: PSDL_Haptic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticQuery' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the number of haptic axes the device has. + * + * The number of haptic axes might be useful if working with the + * SDL_HapticDirection effect. + * + * \param haptic the SDL_Haptic device to query + * \returns the number of axes on success or a negative error code on failure; + * call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticNumAxes_fun = function(haptic: PSDL_Haptic): cint; cdecl; +Var + SDL_HapticNumAxes : TSDL_HapticNumAxes_fun = Nil; +{$else} + +function SDL_HapticNumAxes(haptic: PSDL_Haptic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticNumAxes' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Check to see if an effect is supported by a haptic device. + * + * \param haptic the SDL_Haptic device to query + * \param effect the desired effect to query + * \returns SDL_TRUE if effect is supported, SDL_FALSE if it isn't, or a + * negative error code on failure; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticNewEffect + * \sa SDL_HapticQuery + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticEffectSupported_fun = function(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): cint; cdecl; +Var + SDL_HapticEffectSupported : TSDL_HapticEffectSupported_fun = Nil; +{$else} + +function SDL_HapticEffectSupported(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticEffectSupported' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Create a new haptic effect on a specified device. + * + * \param haptic an SDL_Haptic device to create the effect on + * \param effect an SDL_HapticEffect structure containing the properties of + * the effect to create + * \returns the ID of the effect on success or a negative error code on + * failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticDestroyEffect + * \sa SDL_HapticRunEffect + * \sa SDL_HapticUpdateEffect + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticNewEffect_fun = function(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): cint; cdecl; +Var + SDL_HapticNewEffect : TSDL_HapticNewEffect_fun = Nil; +{$else} + +function SDL_HapticNewEffect(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticNewEffect' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Update the properties of an effect. + * + * Can be used dynamically, although behavior when dynamically changing + * direction may be strange. Specifically the effect may re-upload itself and + * start playing from the start. You also cannot change the type either when + * running SDL_HapticUpdateEffect(). + * + * \param haptic the SDL_Haptic device that has the effect + * \param effect the identifier of the effect to update + * \param data an SDL_HapticEffect structure containing the new effect + * properties to use + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticDestroyEffect + * \sa SDL_HapticNewEffect + * \sa SDL_HapticRunEffect + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticUpdateEffect_fun = function(haptic: PSDL_Haptic; effect: cint; data: PSDL_HapticEffect): cint; cdecl; +Var + SDL_HapticUpdateEffect : TSDL_HapticUpdateEffect_fun = Nil; +{$else} + +function SDL_HapticUpdateEffect(haptic: PSDL_Haptic; effect: cint; data: PSDL_HapticEffect): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticUpdateEffect' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Run the haptic effect on its associated haptic device. + * + * To repeat the effect over and over indefinitely, set `iterations` to + * `SDL_HAPTIC_INFINITY`. (Repeats the envelope - attack and fade.) To make + * one instance of the effect last indefinitely (so the effect does not fade), + * set the effect's `length` in its structure/union to `SDL_HAPTIC_INFINITY` + * instead. + * + * \param haptic the SDL_Haptic device to run the effect on + * \param effect the ID of the haptic effect to run + * \param iterations the number of iterations to run the effect; use + * `SDL_HAPTIC_INFINITY` to repeat forever + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticDestroyEffect + * \sa SDL_HapticGetEffectStatus + * \sa SDL_HapticStopEffect + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticRunEffect_fun = function(haptic: PSDL_Haptic; effect: cint; iterations: cuint32): cint; cdecl; +Var + SDL_HapticRunEffect : TSDL_HapticRunEffect_fun = Nil; +{$else} + +function SDL_HapticRunEffect(haptic: PSDL_Haptic; effect: cint; iterations: cuint32): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticRunEffect' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Stop the haptic effect on its associated haptic device. + * + * * + * + * \param haptic the SDL_Haptic device to stop the effect on + * \param effect the ID of the haptic effect to stop + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticDestroyEffect + * \sa SDL_HapticRunEffect + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticStopEffect_fun = function(haptic: PSDL_Haptic; effect: cint): cint; cdecl; +Var + SDL_HapticStopEffect : TSDL_HapticStopEffect_fun = Nil; +{$else} + +function SDL_HapticStopEffect(haptic: PSDL_Haptic; effect: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticStopEffect' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Destroy a haptic effect on the device. + * + * This will stop the effect if it's running. Effects are automatically + * destroyed when the device is closed. + * + * \param haptic the SDL_Haptic device to destroy the effect on + * \param effect the ID of the haptic effect to destroy + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticNewEffect + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticDestroyEffect_proc = procedure(haptic: PSDL_Haptic; effect: cint); cdecl; +Var + SDL_HapticDestroyEffect : TSDL_HapticDestroyEffect_proc = Nil; +{$else} + +procedure SDL_HapticDestroyEffect(haptic: PSDL_Haptic; effect: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticDestroyEffect' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the status of the current effect on the specified haptic device. + * + * Device must support the SDL_HAPTIC_STATUS feature. + * + * \param haptic the SDL_Haptic device to query for the effect status on + * \param effect the ID of the haptic effect to query its status + * \returns 0 if it isn't playing, 1 if it is playing, or a negative error + * code on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticRunEffect + * \sa SDL_HapticStopEffect + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticGetEffectStatus_fun = function(haptic: PSDL_Haptic; effect: cint): cint; cdecl; +Var + SDL_HapticGetEffectStatus : TSDL_HapticGetEffectStatus_fun = Nil; +{$else} + +function SDL_HapticGetEffectStatus(haptic: PSDL_Haptic; effect: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticGetEffectStatus' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the global gain of the specified haptic device. + * + * Device must support the SDL_HAPTIC_GAIN feature. + * + * The user may specify the maximum gain by setting the environment variable + * `SDL_HAPTIC_GAIN_MAX` which should be between 0 and 100. All calls to + * SDL_HapticSetGain() will scale linearly using `SDL_HAPTIC_GAIN_MAX` as the + * maximum. + * + * \param haptic the SDL_Haptic device to set the gain on + * \param gain value to set the gain to, should be between 0 and 100 (0 - 100) + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticQuery + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticSetGain_fun = function(haptic: PSDL_Haptic; gain: cint): cint; cdecl; +Var + SDL_HapticSetGain : TSDL_HapticSetGain_fun = Nil; +{$else} + +function SDL_HapticSetGain(haptic: PSDL_Haptic; gain: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticSetGain' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the global autocenter of the device. + * + * Autocenter should be between 0 and 100. Setting it to 0 will disable + * autocentering. + * + * Device must support the SDL_HAPTIC_AUTOCENTER feature. + * + * \param haptic the SDL_Haptic device to set autocentering on + * \param autocenter value to set autocenter to (0-100) + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticQuery + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticSetAutocenter_fun = function(haptic: PSDL_Haptic; autocenter: cint): cint; cdecl; +Var + SDL_HapticSetAutocenter : TSDL_HapticSetAutocenter_fun = Nil; +{$else} + +function SDL_HapticSetAutocenter(haptic: PSDL_Haptic; autocenter: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticSetAutocenter' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Pause a haptic device. + * + * Device must support the `SDL_HAPTIC_PAUSE` feature. Call + * SDL_HapticUnpause() to resume playback. + * + * Do not modify the effects nor add new ones while the device is paused. That + * can cause all sorts of weird errors. + * + * \param haptic the SDL_Haptic device to pause + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticUnpause + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticPause_fun = function(haptic: PSDL_Haptic): cint; cdecl; +Var + SDL_HapticPause : TSDL_HapticPause_fun = Nil; +{$else} + +function SDL_HapticPause(haptic: PSDL_Haptic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticPause' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Unpause a haptic device. + * + * Call to unpause after SDL_HapticPause(). + * + * \param haptic the SDL_Haptic device to unpause + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticPause + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticUnpause_fun = function(haptic: PSDL_Haptic): cint; cdecl; +Var + SDL_HapticUnpause : TSDL_HapticUnpause_fun = Nil; +{$else} + +function SDL_HapticUnpause(haptic: PSDL_Haptic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticUnPause' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Stop all the currently playing effects on a haptic device. + * + * \param haptic the SDL_Haptic device to stop + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticStopAll_fun = function(haptic: PSDL_Haptic): cint; cdecl; +Var + SDL_HapticStopAll : TSDL_HapticStopAll_fun = Nil; +{$else} + +function SDL_HapticStopAll(haptic: PSDL_Haptic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticStopAll' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Check whether rumble is supported on a haptic device. + * + * \param haptic haptic device to check for rumble support + * \returns SDL_TRUE if effect is supported, SDL_FALSE if it isn't, or a + * negative error code on failure; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticRumbleInit + * \sa SDL_HapticRumblePlay + * \sa SDL_HapticRumbleStop + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticRumbleSupported_fun = function(haptic: PSDL_Haptic): cint; cdecl; +Var + SDL_HapticRumbleSupported : TSDL_HapticRumbleSupported_fun = Nil; +{$else} + +function SDL_HapticRumbleSupported(haptic: PSDL_Haptic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticRumbleSupported' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Initialize a haptic device for simple rumble playback. + * + * \param haptic the haptic device to initialize for simple rumble playback + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticOpen + * \sa SDL_HapticRumblePlay + * \sa SDL_HapticRumbleStop + * \sa SDL_HapticRumbleSupported + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticRumbleInit_fun = function(haptic: PSDL_Haptic): cint; cdecl; +Var + SDL_HapticRumbleInit : TSDL_HapticRumbleInit_fun = Nil; +{$else} + +function SDL_HapticRumbleInit(haptic: PSDL_Haptic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticRumbleInit' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Run a simple rumble effect on a haptic device. + * + * \param haptic the haptic device to play the rumble effect on + * \param strength strength of the rumble to play as a 0-1 float value + * \param length length of the rumble to play in milliseconds + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticRumbleInit + * \sa SDL_HapticRumbleStop + * \sa SDL_HapticRumbleSupported + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticRumblePlay_fun = function(haptic: PSDL_Haptic; strength: cfloat; length: cuint32): cint; cdecl; +Var + SDL_HapticRumblePlay : TSDL_HapticRumblePlay_fun = Nil; +{$else} + +function SDL_HapticRumblePlay(haptic: PSDL_Haptic; strength: cfloat; length: cuint32): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticRumblePlay' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Stop the simple rumble on a haptic device. + * + * \param haptic the haptic device to stop the rumble effect on + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HapticRumbleInit + * \sa SDL_HapticRumblePlay + * \sa SDL_HapticRumbleSupported + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HapticRumbleStop_fun = function(haptic: PSDL_Haptic): cint; cdecl; +Var + SDL_HapticRumbleStop : TSDL_HapticRumbleStop_fun = Nil; +{$else} + +function SDL_HapticRumbleStop(haptic: PSDL_Haptic): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticRumbleStop' {$ENDIF} {$ENDIF}; +{$endif} + diff --git a/units/sdlhidapi.inc b/units/sdlhidapi.inc index 314ac651..570d2c70 100644 --- a/units/sdlhidapi.inc +++ b/units/sdlhidapi.inc @@ -1,426 +1,426 @@ -// from SDL_hidapi.h - -(** - * Header file for SDL HIDAPI functions. - * - * This is an adaptation of the original HIDAPI interface by Alan Ott, - * and includes source code licensed under the following BSD license: - * - Copyright (c) 2010, Alan Ott, Signal 11 Software - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of Signal 11 Software nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - * - * If you would like a version of SDL without this code, you can build SDL - * with SDL_HIDAPI_DISABLED defined to 1. You might want to do this for example - * on iOS or tvOS to avoid a dependency on the CoreBluetooth framework. - *) - -type - (** - * \brief A handle representing an open HID device. - *) - PSDL_hid_device = type Pointer; - - PSDL_hid_device_info = ^TSDL_hid_device_info; - - (** - * \brief Information about a connected HID device - *) - TSDL_hid_device_info = record - (** Platform-specific device path *) - path: PAnsiChar; - (** Device Vendor ID *) - vendor_id: pcushort; - (** Device Product ID *) - product_id: pcushort; - (** Serial Number *) - serial_number: pcwchar_t; - (** Device Release Number in binary-coded decimal, also known as Device Version Number *) - release_number: cushort; - (** Manufacturer String *) - manufacturer_string: pcwchar_t; - (** Product string *) - product_string: pcwchar_t; - (** Usage Page for this Device/Interface (Windows/Mac only). *) - usage_page: cushort; - (** Usage for this Device/Interface (Windows/Mac only). *) - usage: cushort; - (** - * The USB interface which this logical device represents. - * Valid on both Linux implementations in all cases. - * Valid on the Windows implementation only if the device - * contains more than one interface. - *) - interface_number: cint; - - (** - * Additional information about the USB interface. - * Valid on libusb and Android implementations. - *) - interface_class: cint; - interface_subclass: cint; - interface_protocol: cint; - - (** Pointer to the next device *) - next: PSDL_hid_device_info; - end; - -(** - * Initialize the HIDAPI library. - * - * This function initializes the HIDAPI library. Calling it is not strictly - * necessary, as it will be called automatically by SDL_hid_enumerate() and - * any of the SDL_hid_open_*() functions if it is needed. This function should - * be called at the beginning of execution however, if there is a chance of - * HIDAPI handles being opened by different threads simultaneously. - * - * Each call to this function should have a matching call to SDL_hid_exit() - * - * \returns 0 on success and -1 on error. - * - * \since This function is available since SDL 2.0.18. - * - * \sa SDL_hid_exit - *) -function SDL_hid_init(): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_init' {$ENDIF} {$ENDIF}; - -(** - * Finalize the HIDAPI library. - * - * This function frees all of the static data associated with HIDAPI. It - * should be called at the end of execution to avoid memory leaks. - * - * \returns 0 on success and -1 on error. - * - * \since This function is available since SDL 2.0.18. - * - * \sa SDL_hid_init - *) -function SDL_hid_exit(): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_exit' {$ENDIF} {$ENDIF}; - -(** - * Check to see if devices may have been added or removed. - * - * Enumerating the HID devices is an expensive operation, so you can call this - * to see if there have been any system device changes since the last call to - * this function. A change in the counter returned doesn't necessarily mean - * that anything has changed, but you can call SDL_hid_enumerate() to get an - * updated device list. - * - * Calling this function for the first time may cause a thread or other system - * resource to be allocated to track device change notifications. - * - * \returns a change counter that is incremented with each potential device - * change, or 0 if device change detection isn't available. - * - * \since This function is available since SDL 2.0.18. - * - * \sa SDL_hid_enumerate - *) -function SDL_hid_device_change_count(): cUint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_device_change_count' {$ENDIF} {$ENDIF}; - -(** - * Enumerate the HID Devices. - * - * This function returns a linked list of all the HID devices attached to the - * system which match vendor_id and product_id. If `vendor_id` is set to 0 - * then any vendor matches. If `product_id` is set to 0 then any product - * matches. If `vendor_id` and `product_id` are both set to 0, then all HID - * devices will be returned. - * - * \param vendor_id The Vendor ID (VID) of the types of device to open. - * \param product_id The Product ID (PID) of the types of device to open. - * \returns a pointer to a linked list of type SDL_hid_device_info, containing - * information about the HID devices attached to the system, or NIL - * in the case of failure. Free this linked list by calling - * SDL_hid_free_enumeration(). - * - * \since This function is available since SDL 2.0.18. - * - * \sa SDL_hid_device_change_count - *) -function SDL_hid_enumerate(vendor_id, product_id: cushort): PSDL_hid_device_info; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_enumerate' {$ENDIF} {$ENDIF}; - -(** - * Free an enumeration Linked List - * - * This function frees a linked list created by SDL_hid_enumerate(). - * - * \param devs Pointer to a list of struct_device returned from - * SDL_hid_enumerate(). - * - * \since This function is available since SDL 2.0.18. - *) -procedure SDL_hid_free_enumeration(devs: PSDL_hid_device_info); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_free_enumeration' {$ENDIF} {$ENDIF}; - -(** - * Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally - * a serial number. - * - * If `serial_number` is NULL, the first device with the specified VID and PID - * is opened. - * - * \param vendor_id The Vendor ID (VID) of the device to open. - * \param product_id The Product ID (PID) of the device to open. - * \param serial_number The Serial Number of the device to open - * (optionally NIL). - * \returns a pointer to a SDL_hid_device object on success or NIL on - * failure. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_open(vendor_id, product_id: cushort; serial_number: pcwchar_t): PSDL_hid_device; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_open' {$ENDIF} {$ENDIF}; - -(** - * Open a HID device by its path name. - * - * The path name be determined by calling SDL_hid_enumerate(), or a - * platform-specific path name can be used (eg: /dev/hidraw0 on Linux). - * - * \param path The path name of the device to open - * \returns a pointer to a SDL_hid_device object on success - * or NIL on failure. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_open_path(path: PAnsiChar; bExclusive: cuint): PSDL_hid_device; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_open_path' {$ENDIF} {$ENDIF}; - -(** - * Write an Output report to a HID device. - * - * The first byte of `data` must contain the Report ID. For devices which only - * support a single report, this must be set to 0x0. The remaining bytes - * contain the report data. Since the Report ID is mandatory, calls to - * SDL_hid_write() will always contain one more byte than the report contains. - * For example, if a hid report is 16 bytes long, 17 bytes must be passed to - * SDL_hid_write(), the Report ID (or 0x0, for devices with a single report), - * followed by the report data (16 bytes). In this example, the length passed - * in would be 17. - * - * SDL_hid_write() will send the data on the first OUT endpoint, if one - * exists. If it does not, it will send the data through the Control Endpoint - * (Endpoint 0). - * - * \param dev A device handle returned from SDL_hid_open(). - * \param data The data to send, including the report number as the first - * byte. - * \param length The length in bytes of the data to send. - * \returns the actual number of bytes written and -1 on error. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_write(dev: PSDL_hid_device; data: pcUint8; length: csize_t): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_write' {$ENDIF} {$ENDIF}; - -(** - * Read an Input report from a HID device with timeout. - * - * Input reports are returned to the host through the INTERRUPT IN endpoint. - * The first byte will contain the Report number if the device uses numbered - * reports. - * - * \param dev A device handle returned from SDL_hid_open(). - * \param data A buffer to put the read data into. - * \param length The number of bytes to read. For devices with multiple - * reports, make sure to read an extra byte for the report - * number. - * \param milliseconds timeout in milliseconds or -1 for blocking wait. - * \returns the actual number of bytes read and -1 on error. If no packet was - * available to be read within the timeout period, this function - * returns 0. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_read_timeout(dev: PSDL_hid_device; data: pcUint8; length: csize_t; milliseconds: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_read_timeout' {$ENDIF} {$ENDIF}; - -(** - * Read an Input report from a HID device. - * - * Input reports are returned to the host through the INTERRUPT IN endpoint. - * The first byte will contain the Report number if the device uses numbered - * reports. - * - * \param dev A device handle returned from SDL_hid_open(). - * \param data A buffer to put the read data into. - * \param length The number of bytes to read. For devices with multiple - * reports, make sure to read an extra byte for the report - * number. - * \returns the actual number of bytes read and -1 on error. If no packet was - * available to be read and the handle is in non-blocking mode, this - * function returns 0. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_read(dev: PSDL_hid_device; data: pcUint8; length: csize_t): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_read' {$ENDIF} {$ENDIF}; - -(** - * Set the device handle to be non-blocking. - * - * In non-blocking mode calls to SDL_hid_read() will return immediately with a - * value of 0 if there is no data to be read. In blocking mode, SDL_hid_read() - * will wait (block) until there is data to read before returning. - * - * Nonblocking can be turned on and off at any time. - * - * \param dev A device handle returned from SDL_hid_open(). - * \param nonblock enable or not the nonblocking reads - 1 to enable - * nonblocking - 0 to disable nonblocking. - * \returns 0 on success and -1 on error. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_set_nonblocking(dev: PSDL_hid_device; nonblock: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_set_nonblocking' {$ENDIF} {$ENDIF}; - -(** - * Send a Feature report to the device. - * - * Feature reports are sent over the Control endpoint as a Set_Report - * transfer. The first byte of `data` must contain the Report ID. For devices - * which only support a single report, this must be set to 0x0. The remaining - * bytes contain the report data. Since the Report ID is mandatory, calls to - * SDL_hid_send_feature_report() will always contain one more byte than the - * report contains. For example, if a hid report is 16 bytes long, 17 bytes - * must be passed to SDL_hid_send_feature_report(): the Report ID (or 0x0, for - * devices which do not use numbered reports), followed by the report data (16 - * bytes). In this example, the length passed in would be 17. - * - * \param dev A device handle returned from SDL_hid_open(). - * \param data The data to send, including the report number as the first - * byte. - * \param length The length in bytes of the data to send, including the report - * number. - * \returns the actual number of bytes written and -1 on error. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_send_feature_report(dev: PSDL_hid_device; data: pcUint8; length: csize_t): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_send_feature_report' {$ENDIF} {$ENDIF}; - -(** - * Get a feature report from a HID device. - * - * Set the first byte of `data` to the Report ID of the report to be read. - * Make sure to allow space for this extra byte in `data`. Upon return, the - * first byte will still contain the Report ID, and the report data will start - * in data[1]. - * - * \param dev A device handle returned from SDL_hid_open(). - * \param data A buffer to put the read data into, including the Report ID. - * Set the first byte of `data` to the Report ID of the report to - * be read, or set it to zero if your device does not use numbered - * reports. - * \param length The number of bytes to read, including an extra byte for the - * report ID. The buffer can be longer than the actual report. - * \returns the number of bytes read plus one for the report ID (which is - * still in the first byte), or -1 on error. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_get_feature_report(dev: PSDL_hid_device; data: pcUint8; length: csize_t): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_get_feature_report' {$ENDIF} {$ENDIF}; - -(** - * Close a HID device. - * - * \param dev A device handle returned from SDL_hid_open(). - * - * \since This function is available since SDL 2.0.18. - *) -procedure SDL_hid_close(dev: PSDL_hid_device); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_close' {$ENDIF} {$ENDIF}; - -(** - * Get The Manufacturer String from a HID device. - * - * \param dev A device handle returned from SDL_hid_open(). - * \param string A wide string buffer to put the data into. - * \param maxlen The length of the buffer in multiples of wchar_t. - * \returns 0 on success and -1 on error. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_get_manufacturer_string(dev: PSDL_hid_device; str: pcwchar_t; maxlen: csize_t): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_get_manufacturer_string' {$ENDIF} {$ENDIF}; - -(** - * Get The Product String from a HID device. - * - * \param dev A device handle returned from SDL_hid_open(). - * \param string A wide string buffer to put the data into. - * \param maxlen The length of the buffer in multiples of wchar_t. - * \returns 0 on success and -1 on error. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_get_product_string(dev: PSDL_hid_device; str: pcwchar_t; maxlen: csize_t): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_get_product_string' {$ENDIF} {$ENDIF}; - -(** - * Get The Serial Number String from a HID device. - * - * \param dev A device handle returned from SDL_hid_open(). - * \param string A wide string buffer to put the data into. - * \param maxlen The length of the buffer in multiples of wchar_t. - * \returns 0 on success and -1 on error. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_get_serial_number_string(dev: PSDL_hid_device; str: pcwchar_t; maxlen: csize_t): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_get_serial_number_string' {$ENDIF} {$ENDIF}; - -(** - * Get a string from a HID device, based on its string index. - * - * \param dev A device handle returned from SDL_hid_open(). - * \param string_index The index of the string to get. - * \param string A wide string buffer to put the data into. - * \param maxlen The length of the buffer in multiples of wchar_t. - * \returns 0 on success and -1 on error. - * - * \since This function is available since SDL 2.0.18. - *) -function SDL_hid_get_indexed_string(dev: PSDL_hid_device; string_index: cint; str: pcwchar_t; maxlen: csize_t): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_get_indexed_string' {$ENDIF} {$ENDIF}; - -(** - * Start or stop a BLE scan on iOS and tvOS to pair Steam Controllers - * - * \param active SDL_TRUE to start the scan, SDL_FALSE to stop the scan - * - * \since This function is available since SDL 2.0.18. - *) -procedure SDL_hid_ble_scan(active: TSDL_bool); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_ble_scan' {$ENDIF} {$ENDIF}; +// from SDL_hidapi.h + +(** + * Header file for SDL HIDAPI functions. + * + * This is an adaptation of the original HIDAPI interface by Alan Ott, + * and includes source code licensed under the following BSD license: + * + Copyright (c) 2010, Alan Ott, Signal 11 Software + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Signal 11 Software nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + * + * If you would like a version of SDL without this code, you can build SDL + * with SDL_HIDAPI_DISABLED defined to 1. You might want to do this for example + * on iOS or tvOS to avoid a dependency on the CoreBluetooth framework. + *) + +type + (** + * \brief A handle representing an open HID device. + *) + PSDL_hid_device = type Pointer; + + PSDL_hid_device_info = ^TSDL_hid_device_info; + + (** + * \brief Information about a connected HID device + *) + TSDL_hid_device_info = record + (** Platform-specific device path *) + path: PAnsiChar; + (** Device Vendor ID *) + vendor_id: pcushort; + (** Device Product ID *) + product_id: pcushort; + (** Serial Number *) + serial_number: pcwchar_t; + (** Device Release Number in binary-coded decimal, also known as Device Version Number *) + release_number: cushort; + (** Manufacturer String *) + manufacturer_string: pcwchar_t; + (** Product string *) + product_string: pcwchar_t; + (** Usage Page for this Device/Interface (Windows/Mac only). *) + usage_page: cushort; + (** Usage for this Device/Interface (Windows/Mac only). *) + usage: cushort; + (** + * The USB interface which this logical device represents. + * Valid on both Linux implementations in all cases. + * Valid on the Windows implementation only if the device + * contains more than one interface. + *) + interface_number: cint; + + (** + * Additional information about the USB interface. + * Valid on libusb and Android implementations. + *) + interface_class: cint; + interface_subclass: cint; + interface_protocol: cint; + + (** Pointer to the next device *) + next: PSDL_hid_device_info; + end; + +(** + * Initialize the HIDAPI library. + * + * This function initializes the HIDAPI library. Calling it is not strictly + * necessary, as it will be called automatically by SDL_hid_enumerate() and + * any of the SDL_hid_open_*() functions if it is needed. This function should + * be called at the beginning of execution however, if there is a chance of + * HIDAPI handles being opened by different threads simultaneously. + * + * Each call to this function should have a matching call to SDL_hid_exit() + * + * \returns 0 on success and -1 on error. + * + * \since This function is available since SDL 2.0.18. + * + * \sa SDL_hid_exit + *) +function SDL_hid_init(): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_init' {$ENDIF} {$ENDIF}; + +(** + * Finalize the HIDAPI library. + * + * This function frees all of the static data associated with HIDAPI. It + * should be called at the end of execution to avoid memory leaks. + * + * \returns 0 on success and -1 on error. + * + * \since This function is available since SDL 2.0.18. + * + * \sa SDL_hid_init + *) +function SDL_hid_exit(): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_exit' {$ENDIF} {$ENDIF}; + +(** + * Check to see if devices may have been added or removed. + * + * Enumerating the HID devices is an expensive operation, so you can call this + * to see if there have been any system device changes since the last call to + * this function. A change in the counter returned doesn't necessarily mean + * that anything has changed, but you can call SDL_hid_enumerate() to get an + * updated device list. + * + * Calling this function for the first time may cause a thread or other system + * resource to be allocated to track device change notifications. + * + * \returns a change counter that is incremented with each potential device + * change, or 0 if device change detection isn't available. + * + * \since This function is available since SDL 2.0.18. + * + * \sa SDL_hid_enumerate + *) +function SDL_hid_device_change_count(): cUint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_device_change_count' {$ENDIF} {$ENDIF}; + +(** + * Enumerate the HID Devices. + * + * This function returns a linked list of all the HID devices attached to the + * system which match vendor_id and product_id. If `vendor_id` is set to 0 + * then any vendor matches. If `product_id` is set to 0 then any product + * matches. If `vendor_id` and `product_id` are both set to 0, then all HID + * devices will be returned. + * + * \param vendor_id The Vendor ID (VID) of the types of device to open. + * \param product_id The Product ID (PID) of the types of device to open. + * \returns a pointer to a linked list of type SDL_hid_device_info, containing + * information about the HID devices attached to the system, or NIL + * in the case of failure. Free this linked list by calling + * SDL_hid_free_enumeration(). + * + * \since This function is available since SDL 2.0.18. + * + * \sa SDL_hid_device_change_count + *) +function SDL_hid_enumerate(vendor_id, product_id: cushort): PSDL_hid_device_info; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_enumerate' {$ENDIF} {$ENDIF}; + +(** + * Free an enumeration Linked List + * + * This function frees a linked list created by SDL_hid_enumerate(). + * + * \param devs Pointer to a list of struct_device returned from + * SDL_hid_enumerate(). + * + * \since This function is available since SDL 2.0.18. + *) +procedure SDL_hid_free_enumeration(devs: PSDL_hid_device_info); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_free_enumeration' {$ENDIF} {$ENDIF}; + +(** + * Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally + * a serial number. + * + * If `serial_number` is NULL, the first device with the specified VID and PID + * is opened. + * + * \param vendor_id The Vendor ID (VID) of the device to open. + * \param product_id The Product ID (PID) of the device to open. + * \param serial_number The Serial Number of the device to open + * (optionally NIL). + * \returns a pointer to a SDL_hid_device object on success or NIL on + * failure. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_open(vendor_id, product_id: cushort; serial_number: pcwchar_t): PSDL_hid_device; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_open' {$ENDIF} {$ENDIF}; + +(** + * Open a HID device by its path name. + * + * The path name be determined by calling SDL_hid_enumerate(), or a + * platform-specific path name can be used (eg: /dev/hidraw0 on Linux). + * + * \param path The path name of the device to open + * \returns a pointer to a SDL_hid_device object on success + * or NIL on failure. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_open_path(path: PAnsiChar; bExclusive: cuint): PSDL_hid_device; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_open_path' {$ENDIF} {$ENDIF}; + +(** + * Write an Output report to a HID device. + * + * The first byte of `data` must contain the Report ID. For devices which only + * support a single report, this must be set to 0x0. The remaining bytes + * contain the report data. Since the Report ID is mandatory, calls to + * SDL_hid_write() will always contain one more byte than the report contains. + * For example, if a hid report is 16 bytes long, 17 bytes must be passed to + * SDL_hid_write(), the Report ID (or 0x0, for devices with a single report), + * followed by the report data (16 bytes). In this example, the length passed + * in would be 17. + * + * SDL_hid_write() will send the data on the first OUT endpoint, if one + * exists. If it does not, it will send the data through the Control Endpoint + * (Endpoint 0). + * + * \param dev A device handle returned from SDL_hid_open(). + * \param data The data to send, including the report number as the first + * byte. + * \param length The length in bytes of the data to send. + * \returns the actual number of bytes written and -1 on error. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_write(dev: PSDL_hid_device; data: pcUint8; length: csize_t): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_write' {$ENDIF} {$ENDIF}; + +(** + * Read an Input report from a HID device with timeout. + * + * Input reports are returned to the host through the INTERRUPT IN endpoint. + * The first byte will contain the Report number if the device uses numbered + * reports. + * + * \param dev A device handle returned from SDL_hid_open(). + * \param data A buffer to put the read data into. + * \param length The number of bytes to read. For devices with multiple + * reports, make sure to read an extra byte for the report + * number. + * \param milliseconds timeout in milliseconds or -1 for blocking wait. + * \returns the actual number of bytes read and -1 on error. If no packet was + * available to be read within the timeout period, this function + * returns 0. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_read_timeout(dev: PSDL_hid_device; data: pcUint8; length: csize_t; milliseconds: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_read_timeout' {$ENDIF} {$ENDIF}; + +(** + * Read an Input report from a HID device. + * + * Input reports are returned to the host through the INTERRUPT IN endpoint. + * The first byte will contain the Report number if the device uses numbered + * reports. + * + * \param dev A device handle returned from SDL_hid_open(). + * \param data A buffer to put the read data into. + * \param length The number of bytes to read. For devices with multiple + * reports, make sure to read an extra byte for the report + * number. + * \returns the actual number of bytes read and -1 on error. If no packet was + * available to be read and the handle is in non-blocking mode, this + * function returns 0. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_read(dev: PSDL_hid_device; data: pcUint8; length: csize_t): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_read' {$ENDIF} {$ENDIF}; + +(** + * Set the device handle to be non-blocking. + * + * In non-blocking mode calls to SDL_hid_read() will return immediately with a + * value of 0 if there is no data to be read. In blocking mode, SDL_hid_read() + * will wait (block) until there is data to read before returning. + * + * Nonblocking can be turned on and off at any time. + * + * \param dev A device handle returned from SDL_hid_open(). + * \param nonblock enable or not the nonblocking reads - 1 to enable + * nonblocking - 0 to disable nonblocking. + * \returns 0 on success and -1 on error. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_set_nonblocking(dev: PSDL_hid_device; nonblock: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_set_nonblocking' {$ENDIF} {$ENDIF}; + +(** + * Send a Feature report to the device. + * + * Feature reports are sent over the Control endpoint as a Set_Report + * transfer. The first byte of `data` must contain the Report ID. For devices + * which only support a single report, this must be set to 0x0. The remaining + * bytes contain the report data. Since the Report ID is mandatory, calls to + * SDL_hid_send_feature_report() will always contain one more byte than the + * report contains. For example, if a hid report is 16 bytes long, 17 bytes + * must be passed to SDL_hid_send_feature_report(): the Report ID (or 0x0, for + * devices which do not use numbered reports), followed by the report data (16 + * bytes). In this example, the length passed in would be 17. + * + * \param dev A device handle returned from SDL_hid_open(). + * \param data The data to send, including the report number as the first + * byte. + * \param length The length in bytes of the data to send, including the report + * number. + * \returns the actual number of bytes written and -1 on error. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_send_feature_report(dev: PSDL_hid_device; data: pcUint8; length: csize_t): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_send_feature_report' {$ENDIF} {$ENDIF}; + +(** + * Get a feature report from a HID device. + * + * Set the first byte of `data` to the Report ID of the report to be read. + * Make sure to allow space for this extra byte in `data`. Upon return, the + * first byte will still contain the Report ID, and the report data will start + * in data[1]. + * + * \param dev A device handle returned from SDL_hid_open(). + * \param data A buffer to put the read data into, including the Report ID. + * Set the first byte of `data` to the Report ID of the report to + * be read, or set it to zero if your device does not use numbered + * reports. + * \param length The number of bytes to read, including an extra byte for the + * report ID. The buffer can be longer than the actual report. + * \returns the number of bytes read plus one for the report ID (which is + * still in the first byte), or -1 on error. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_get_feature_report(dev: PSDL_hid_device; data: pcUint8; length: csize_t): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_get_feature_report' {$ENDIF} {$ENDIF}; + +(** + * Close a HID device. + * + * \param dev A device handle returned from SDL_hid_open(). + * + * \since This function is available since SDL 2.0.18. + *) +procedure SDL_hid_close(dev: PSDL_hid_device); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_close' {$ENDIF} {$ENDIF}; + +(** + * Get The Manufacturer String from a HID device. + * + * \param dev A device handle returned from SDL_hid_open(). + * \param string A wide string buffer to put the data into. + * \param maxlen The length of the buffer in multiples of wchar_t. + * \returns 0 on success and -1 on error. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_get_manufacturer_string(dev: PSDL_hid_device; str: pcwchar_t; maxlen: csize_t): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_get_manufacturer_string' {$ENDIF} {$ENDIF}; + +(** + * Get The Product String from a HID device. + * + * \param dev A device handle returned from SDL_hid_open(). + * \param string A wide string buffer to put the data into. + * \param maxlen The length of the buffer in multiples of wchar_t. + * \returns 0 on success and -1 on error. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_get_product_string(dev: PSDL_hid_device; str: pcwchar_t; maxlen: csize_t): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_get_product_string' {$ENDIF} {$ENDIF}; + +(** + * Get The Serial Number String from a HID device. + * + * \param dev A device handle returned from SDL_hid_open(). + * \param string A wide string buffer to put the data into. + * \param maxlen The length of the buffer in multiples of wchar_t. + * \returns 0 on success and -1 on error. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_get_serial_number_string(dev: PSDL_hid_device; str: pcwchar_t; maxlen: csize_t): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_get_serial_number_string' {$ENDIF} {$ENDIF}; + +(** + * Get a string from a HID device, based on its string index. + * + * \param dev A device handle returned from SDL_hid_open(). + * \param string_index The index of the string to get. + * \param string A wide string buffer to put the data into. + * \param maxlen The length of the buffer in multiples of wchar_t. + * \returns 0 on success and -1 on error. + * + * \since This function is available since SDL 2.0.18. + *) +function SDL_hid_get_indexed_string(dev: PSDL_hid_device; string_index: cint; str: pcwchar_t; maxlen: csize_t): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_get_indexed_string' {$ENDIF} {$ENDIF}; + +(** + * Start or stop a BLE scan on iOS and tvOS to pair Steam Controllers + * + * \param active SDL_TRUE to start the scan, SDL_FALSE to stop the scan + * + * \since This function is available since SDL 2.0.18. + *) +procedure SDL_hid_ble_scan(active: TSDL_bool); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_ble_scan' {$ENDIF} {$ENDIF}; diff --git a/units/sdlhints.inc b/units/sdlhints.inc index e0747c58..c15cfa84 100644 --- a/units/sdlhints.inc +++ b/units/sdlhints.inc @@ -1,2588 +1,2588 @@ -// from "SDL_hints.h" - -{** - * \file SDL_hints.h - * - * Official documentation for SDL configuration variables - * - * This file contains functions to set and get configuration hints, - * as well as listing each of them alphabetically. - * - * The convention for naming hints is SDL_HINT_X, where "SDL_X" is - * the environment variable that can be used to override the default. - * - * In general these hints are just that - they may or may not be - * supported or applicable on any given platform, but they provide - * a way for an application or user to give the library a hint as - * to how they would like the library to work. - *} - -const - -{/** - * \brief Override for SDL_GetDisplayUsableBounds() - * - * If set, this hint will override the expected results for - * SDL_GetDisplayUsableBounds() for display index 0. Generally you don't want - * to do this, but this allows an embedded system to request that some of the - * screen be reserved for other uses when paired with a well-behaved - * application. - * - * The contents of this hint must be 4 comma-separated integers, the first - * is the bounds x, then y, width and height, in that order. - */} -SDL_HINT_DISPLAY_USABLE_BOUNDS = 'SDL_DISPLAY_USABLE_BOUNDS'; - -{/** - * \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs - * - * The variable can be set to the following values: - * "0" - Do not scan for Steam Controllers - * "1" - Scan for Steam Controllers (the default) - * - * The default value is "1". This hint must be set before initializing the joystick subsystem. - */} -SDL_HINT_ENABLE_STEAM_CONTROLLERS = 'SDL_ENABLE_STEAM_CONTROLLERS'; - -{/** - * \brief A variable controlling whether SDL logs all events pushed onto its internal queue. - * - * This variable can be set to the following values: - * - * "0" - Don't log any events (default) - * "1" - Log all events except mouse and finger motion, which are pretty spammy. - * "2" - Log all events. - * - * This is generally meant to be used to debug SDL itself, but can be useful - * for application developers that need better visibility into what is going - * on in the event queue. Logged events are sent through SDL_Log(), which - * means by default they appear on stdout on most platforms or maybe - * OutputDebugString() on Windows, and can be funneled by the app with - * SDL_LogSetOutputFunction(), etc. - * - * This hint can be toggled on and off at runtime, if you only need to log - * events for a small subset of program execution. - */} -SDL_HINT_EVENT_LOGGING = 'SDL_EVENT_LOGGING'; - -{** - * \brief A variable controlling whether raising the window should be done more forcefully - * - * This variable can be set to the following values: - * "0" - No forcing (the default) - * "1" - Extra level of forcing - * - * At present, this is only an issue under MS Windows, which makes it nearly impossible to - * programmatically move a window to the foreground, for "security" reasons. See - * http://stackoverflow.com/a/34414846 for a discussion. - *} -SDL_HINT_FORCE_RAISEWINDOW = 'SDL_HINT_FORCE_RAISEWINDOW'; - -{/** - * \brief A variable controlling how 3D acceleration is used to accelerate the SDL screen surface. - * - * SDL can try to accelerate the SDL screen surface by using streaming - * textures with a 3D rendering engine. This variable controls whether and - * how this is done. - * - * This variable can be set to the following values: - * "0" - Disable 3D acceleration - * "1" - Enable 3D acceleration, using the default renderer. - * "X" - Enable 3D acceleration, using X where X is one of the valid rendering drivers. (e.g. "direct3d", "opengl", etc.) - * - * By default SDL tries to make a best guess for each platform whether - * to use acceleration or not. - */} -SDL_HINT_FRAMEBUFFER_ACCELERATION = 'SDL_FRAMEBUFFER_ACCELERATION'; - -{/** - * \brief Determines whether SDL enforces that DRM master is required in order - * to initialize the KMSDRM video backend. - * - * The DRM subsystem has a concept of a "DRM master" which is a DRM client that - * has the ability to set planes, set cursor, etc. When SDL is DRM master, it - * can draw to the screen using the SDL rendering APIs. Without DRM master, SDL - * is still able to process input and query attributes of attached displays, - * but it cannot change display state or draw to the screen directly. - * - * In some cases, it can be useful to have the KMSDRM backend even if it cannot - * be used for rendering. An app may want to use SDL for input processing while - * using another rendering API (such as an MMAL overlay on Raspberry Pi) or - * using its own code to render to DRM overlays that SDL doesn't support. - * - * This hint must be set before initializing the video subsystem. - * - * This variable can be set to the following values: - * "0" - SDL will allow usage of the KMSDRM backend without DRM master - * "1" - SDL will require DRM master to use the KMSDRM backend (default) - */} -SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER = 'SDL_KMSDRM_REQUIRE_DRM_MASTER'; - -{/** - * \brief A variable controlling whether the 2D render API is compatible or efficient. - * - * This variable can be set to the following values: - * - * "0" - Don't use batching to make rendering more efficient. - * "1" - Use batching, but might cause problems if app makes its own direct OpenGL calls. - * - * Up to SDL 2.0.9, the render API would draw immediately when requested. Now - * it batches up draw requests and sends them all to the GPU only when forced - * to (during SDL_RenderPresent, when changing render targets, by updating a - * texture that the batch needs, etc). This is significantly more efficient, - * but it can cause problems for apps that expect to render on top of the - * render API's output. As such, SDL will disable batching if a specific - * render backend is requested (since this might indicate that the app is - * planning to use the underlying graphics API directly). This hint can - * be used to explicitly request batching in this instance. It is a contract - * that you will either never use the underlying graphics API directly, or - * if you do, you will call SDL_RenderFlush() before you do so any current - * batch goes to the GPU before your work begins. Not following this contract - * will result in undefined behavior. - */} -SDL_HINT_RENDER_BATCHING = 'SDL_RENDER_BATCHING'; - -{/** - * \brief A variable specifying which render driver to use. - * - * If the application doesn't pick a specific renderer to use, this variable - * specifies the name of the preferred renderer. If the preferred renderer - * can't be initialized, the normal default renderer is used. - * - * This variable is case insensitive and can be set to the following values: - * "direct3d" - * "opengl" - * "opengles2" - * "opengles" - * "software" - * - * The default varies by platform, but it's the first one in the list that - * is available on the current platform. - */} -SDL_HINT_RENDER_DRIVER = 'SDL_RENDER_DRIVER'; - -{/** - * \brief A variable controlling how the 2D render API renders lines - * - * This variable can be set to the following values: - * "0" - Use the default line drawing method (Bresenham's line algorithm as of SDL 2.0.20) - * "1" - Use the driver point API using Bresenham's line algorithm (correct, draws many points) - * "2" - Use the driver line API (occasionally misses line endpoints based on hardware driver quirks, was the default before 2.0.20) - * "3" - Use the driver geometry API (correct, draws thicker diagonal lines) - * - * This variable should be set when the renderer is created. - */} -SDL_HINT_RENDER_LINE_METHOD = 'SDL_RENDER_LINE_METHOD'; - -{/** - * \brief A variable controlling the scaling policy for SDL_RenderSetLogicalSize. - * - * This variable can be set to the following values: - * "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen - * "1" or "overscan" - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen - * - * By default letterbox is used - */} -SDL_HINT_RENDER_LOGICAL_SIZE_MODE = 'SDL_RENDER_LOGICAL_SIZE_MODE'; - -{/** - * \brief A variable controlling whether the OpenGL render driver uses shaders if they are available. - * - * This variable can be set to the following values: - * "0" - Disable shaders - * "1" - Enable shaders - * - * By default shaders are used if OpenGL supports them. - */} -SDL_HINT_RENDER_OPENGL_SHADERS = 'SDL_RENDER_OPENGL_SHADERS'; - -{/** - * \brief A variable controlling whether the Direct3D device is initialized for thread-safe operations. - * - * This variable can be set to the following values: - * "0" - Thread-safety is not enabled (faster) - * "1" - Thread-safety is enabled - * - * By default the Direct3D device is created with thread-safety disabled. - */} -SDL_HINT_RENDER_DIRECT3D_THREADSAFE = 'SDL_RENDER_DIRECT3D_THREADSAFE'; - -{/** - * \brief A variable controlling whether to enable Direct3D 11+'s Debug Layer. - * - * This variable does not have any effect on the Direct3D 9 based renderer. - * - * This variable can be set to the following values: - * "0" - Disable Debug Layer use - * "1" - Enable Debug Layer use - * - * By default, SDL does not use Direct3D Debug Layer. - */} -SDL_HINT_RENDER_DIRECT3D11_DEBUG = 'SDL_RENDER_DIRECT3D11_DEBUG'; - -{/** - * \brief A variable controlling the scaling quality - * - * This variable can be set to the following values: - * "0" or "nearest" - Nearest pixel sampling - * "1" or "linear" - Linear filtering (supported by OpenGL and Direct3D) - * "2" or "best" - Currently this is the same as "linear" - * - * By default nearest pixel sampling is used - */} -SDL_HINT_RENDER_SCALE_QUALITY = 'SDL_RENDER_SCALE_QUALITY'; - -{/** - * \brief A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing. - * - * This variable can be set to the following values: - * "0" - Disable vsync - * "1" - Enable vsync - * - * By default SDL does not sync screen surface updates with vertical refresh. - */} -SDL_HINT_RENDER_VSYNC = 'SDL_RENDER_VSYNC'; - -{** - * \brief A variable controlling if VSYNC is automatically disable if doesn't reach the enough FPS - * - * This variable can be set to the following values: - * "0" - It will be using VSYNC as defined in the main flag. Default - * "1" - If VSYNC was previously enabled, then it will disable VSYNC if doesn't reach enough speed - * - * By default SDL does not enable the automatic VSYNC - *} -SDL_HINT_PS2_DYNAMIC_VSYNC = 'SDL_PS2_DYNAMIC_VSYNC'; - -{/** - * \brief A variable controlling whether the screensaver is enabled. - * - * This variable can be set to the following values: - * "0" - Disable screensaver - * "1" - Enable screensaver - * - * By default SDL will disable the screensaver. - */} -SDL_HINT_VIDEO_ALLOW_SCREENSAVER = 'SDL_VIDEO_ALLOW_SCREENSAVER'; - -{/** - * \brief Tell the video driver that we only want a double buffer. - * - * By default, most lowlevel 2D APIs will use a triple buffer scheme that - * wastes no CPU time on waiting for vsync after issuing a flip, but - * introduces a frame of latency. On the other hand, using a double buffer - * scheme instead is recommended for cases where low latency is an important - * factor because we save a whole frame of latency. - * We do so by waiting for vsync immediately after issuing a flip, usually just - * after eglSwapBuffers call in the backend's *_SwapWindow function. - * - * Since it's driver-specific, it's only supported where possible and - * implemented. Currently supported the following drivers: - * - * - KMSDRM (kmsdrm) - * - Raspberry Pi (raspberrypi) - */} -SDL_HINT_VIDEO_DOUBLE_BUFFER = 'SDL_VIDEO_DOUBLE_BUFFER'; - -{/** - * \brief A variable controlling whether the EGL window is allowed to be - * composited as transparent, rather than opaque. - * - * Most window systems will always render windows opaque, even if the surface - * format has an alpha channel. This is not always true, however, so by default - * SDL will try to enforce opaque composition. To override this behavior, you - * can set this hint to "1". - */} -SDL_HINT_VIDEO_EGL_ALLOW_TRANSPARENCY = 'SDL_VIDEO_EGL_ALLOW_TRANSPARENCY'; - -{/** - * \brief A variable controlling whether the graphics context is externally managed. - * - * This variable can be set to the following values: - * "0" - SDL will manage graphics contexts that are attached to windows. - * "1" - Disable graphics context management on windows. - * - * By default SDL will manage OpenGL contexts in certain situations. For example, on Android the - * context will be automatically saved and restored when pausing the application. Additionally, some - * platforms will assume usage of OpenGL if Vulkan isn't used. Setting this to "1" will prevent this - * behavior, which is desireable when the application manages the graphics context, such as - * an externally managed OpenGL context or attaching a Vulkan surface to the window. - */} -SDL_HINT_VIDEO_EXTERNAL_CONTEXT = 'SDL_VIDEO_EXTERNAL_CONTEXT'; - -{/** - * \brief A variable controlling whether the libdecor Wayland backend is allowed to be used. - * - * This variable can be set to the following values: - * "0" - libdecor use is disabled. - * "1" - libdecor use is enabled (default). - * - * libdecor is used over xdg-shell when xdg-decoration protocol is unavailable. - */} -SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR = 'SDL_VIDEO_WAYLAND_ALLOW_LIBDECOR'; - -{** - * \brief A variable controlling whether the libdecor Wayland backend is preferred over native decrations. - * - * When this hint is set, libdecor will be used to provide window decorations, even if xdg-decoration is - * available. (Note that, by default, libdecor will use xdg-decoration itself if available). - * - * This variable can be set to the following values: - * "0" - libdecor is enabled only if server-side decorations are unavailable. - * "1" - libdecor is always enabled if available. - * - * libdecor is used over xdg-shell when xdg-decoration protocol is unavailable. - *} -SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR = 'SDL_VIDEO_WAYLAND_PREFER_LIBDECOR'; - -{** - * \brief A variable controlling whether video mode emulation is enabled under Wayland. - * - * When this hint is set, a standard set of emulated CVT video modes will be exposed for use by the application. - * If it is disabled, the only modes exposed will be the logical desktop size and, in the case of a scaled - * desktop, the native display resolution. - * - * This variable can be set to the following values: - * "0" - Video mode emulation is disabled. - * "1" - Video mode emulation is enabled. - * - * By default video mode emulation is enabled. - *} -SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION = 'SDL_VIDEO_WAYLAND_MODE_EMULATION'; - -{** - * \brief Enable or disable mouse pointer warp emulation, needed by some older games. - * - * When this hint is set, any SDL will emulate mouse warps using relative mouse mode. - * This is required for some older games (such as Source engine games), which warp the - * mouse to the centre of the screen rather than using relative mouse motion. Note that - * relative mouse mode may have different mouse acceleration behaviour than pointer warps. - * - * This variable can be set to the following values: - * "0" - All mouse warps fail, as mouse warping is not available under Wayland. - * "1" - Some mouse warps will be emulated by forcing relative mouse mode. - * - * If not set, this is automatically enabled unless an application uses - * relative mouse mode directly. - * - * This hint is available since SDL 2.26.0. - *} -SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP = 'SDL_VIDEO_WAYLAND_EMULATE_MOUSE_WARP'; - -{/** - * \brief Specify an "activity name" for screensaver inhibition. - * - * Some platforms, notably Linux desktops, list the applications which are - * inhibiting the screensaver or other power-saving features. - * - * This hint lets you specify the "activity name" sent to the OS when - * SDL_DisableScreenSaver() is used (or the screensaver is automatically - * disabled). The contents of this hint are used when the screensaver is - * disabled. You should use a string that describes what your program is doing - * (and, therefore, why the screensaver is disabled). For example, "Playing a - * game" or "Watching a video". - * - * Setting this to "" or leaving it unset will have SDL use a reasonable - * default: "Playing a game" or something similar. - * - * On targets where this is not supported, this hint does nothing. - */} -SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME = 'SDL_SCREENSAVER_INHIBIT_ACTIVITY_NAME'; - -{/** - * \brief A variable controlling whether X11 should use GLX or EGL by default - * - * This variable can be set to the following values: - * "0" - Use GLX - * "1" - Use EGL - * - * By default SDL will use GLX when both are present. - */} -SDL_HINT_VIDEO_X11_FORCE_EGL = 'SDL_VIDEO_X11_FORCE_EGL'; - -{/** - * \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used. - * - * This variable can be set to the following values: - * "0" - Disable _NET_WM_BYPASS_COMPOSITOR - * "1" - Enable _NET_WM_BYPASS_COMPOSITOR - * - * By default SDL will use _NET_WM_BYPASS_COMPOSITOR - * - */} -SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR = 'SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR'; - -{/** - * \brief A variable forcing the visual ID chosen for new X11 windows - * - */} -SDL_HINT_VIDEO_X11_WINDOW_VISUALID = 'SDL_VIDEO_X11_WINDOW_VISUALID'; - -{/** - * \brief A variable controlling whether the X11 VidMode extension should be used. - * - * This variable can be set to the following values: - * "0" - Disable XVidMode - * "1" - Enable XVidMode - * - * By default SDL will use XVidMode if it is available. - */} -SDL_HINT_VIDEO_X11_XVIDMODE = 'SDL_VIDEO_X11_XVIDMODE'; - -{/** - * \brief A variable controlling whether the X11 Xinerama extension should be used. - * - * This variable can be set to the following values: - * "0" - Disable Xinerama - * "1" - Enable Xinerama - * - * By default SDL will use Xinerama if it is available. - */} -SDL_HINT_VIDEO_X11_XINERAMA = 'SDL_VIDEO_X11_XINERAMA'; - -{/** - * \brief A variable controlling whether the X11 XRandR extension should be used. - * - * This variable can be set to the following values: - * "0" - Disable XRandR - * "1" - Enable XRandR - * - * By default SDL will not use XRandR because of window manager issues. - */} -SDL_HINT_VIDEO_X11_XRANDR = 'SDL_VIDEO_X11_XRANDR'; - -{/** - * \brief A variable controlling whether the X11 _NET_WM_PING protocol should be supported. - * - * This variable can be set to the following values: - * "0" - Disable _NET_WM_PING - * "1" - Enable _NET_WM_PING - * - * By default SDL will use _NET_WM_PING, but for applications that know they - * will not always be able to respond to ping requests in a timely manner they can - * turn it off to avoid the window manager thinking the app is hung. - * The hint is checked in CreateWindow. - */} -SDL_HINT_VIDEO_X11_NET_WM_PING = 'SDL_VIDEO_X11_NET_WM_PING'; - -{/** - * \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden - * - * This variable can be set to the following values: - * "0" - The window frame is not interactive when the cursor is hidden (no move, resize, etc) - * "1" - The window frame is interactive when the cursor is hidden - * - * By default SDL will allow interaction with the window frame when the cursor is hidden - */} -SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN = 'SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN'; - -{/** -* \brief A variable controlling whether the window is activated when the SDL_ShowWindow function is called -* -* This variable can be set to the following values: -* "0" - The window is activated when the SDL_ShowWindow function is called -* "1" - The window is not activated when the SDL_ShowWindow function is called -* -* By default SDL will activate the window when the SDL_ShowWindow function is called -*/} -SDL_HINT_WINDOW_NO_ACTIVATION_WHEN_SHOWN = 'SDL_WINDOW_NO_ACTIVATION_WHEN_SHOWN'; - -{/** - * \brief A variable controlling whether the windows message loop is processed by SDL - * - * This variable can be set to the following values: - * "0" - The window message loop is not run - * "1" - The window message loop is processed in SDL_PumpEvents() - * - * By default SDL will process the windows message loop - */} -SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP = 'SDL_WINDOWS_ENABLE_MESSAGELOOP'; - -{/** - * \brief Force SDL to use Critical Sections for mutexes on Windows. - * On Windows 7 and newer, Slim Reader/Writer Locks are available. - * They offer better performance, allocate no kernel ressources and - * use less memory. SDL will fall back to Critical Sections on older - * OS versions or if forced to by this hint. - * - * This variable can be set to the following values: - * "0" - Use SRW Locks when available. If not, fall back to Critical Sections. (default) - * "1" - Force the use of Critical Sections in all cases. - * - */} -SDL_HINT_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS = 'SDL_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS'; - -{/** - * \brief Force SDL to use Kernel Semaphores on Windows. - * Kernel Semaphores are inter-process and require a context - * switch on every interaction. On Windows 8 and newer, the - * WaitOnAddress API is available. Using that and atomics to - * implement semaphores increases performance. - * SDL will fall back to Kernel Objects on older OS versions - * or if forced to by this hint. - * - * This variable can be set to the following values: - * "0" - Use Atomics and WaitOnAddress API when available. If not, fall back to Kernel Objects. (default) - * "1" - Force the use of Kernel Objects in all cases. - * - */} -SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL = 'SDL_WINDOWS_FORCE_SEMAPHORE_KERNEL'; - -{/** - * \brief A variable to specify custom icon resource id from RC file on Windows platform - */} -SDL_HINT_WINDOWS_INTRESOURCE_ICON = 'SDL_WINDOWS_INTRESOURCE_ICON'; -SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL = 'SDL_WINDOWS_INTRESOURCE_ICON_SMALL'; - -{/** - * \brief Use the D3D9Ex API introduced in Windows Vista, instead of normal D3D9. - * Direct3D 9Ex contains changes to state management that can eliminate device - * loss errors during scenarios like Alt+Tab or UAC prompts. D3D9Ex may require - * some changes to your application to cope with the new behavior, so this - * is disabled by default. - * - * This hint must be set before initializing the video subsystem. - * - * For more information on Direct3D 9Ex, see: - * - https://docs.microsoft.com/en-us/windows/win32/direct3darticles/graphics-apis-in-windows-vista#direct3d-9ex - * - https://docs.microsoft.com/en-us/windows/win32/direct3darticles/direct3d-9ex-improvements - * - * This variable can be set to the following values: - * "0" - Use the original Direct3D 9 API (default) - * "1" - Use the Direct3D 9Ex API on Vista and later (and fall back if D3D9Ex is unavailable) - * - */} -SDL_HINT_WINDOWS_USE_D3D9EX = 'SDL_WINDOWS_USE_D3D9EX'; - -{** - * \brief Controls whether SDL will declare the process to be DPI aware. - * - * This hint must be set before initializing the video subsystem. - * - * The main purpose of declaring DPI awareness is to disable OS bitmap scaling of SDL windows on monitors with - * a DPI scale factor. - * - * This hint is equivalent to requesting DPI awareness via external means (e.g. calling SetProcessDpiAwarenessContext) - * and does not cause SDL to use a virtualized coordinate system, so it will generally give you 1 SDL coordinate = 1 pixel - * even on high-DPI displays. - * - * For more information, see: - * https://docs.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows - * - * This variable can be set to the following values: - * "" - Do not change the DPI awareness (default). - * "unaware" - Declare the process as DPI unaware. (Windows 8.1 and later). - * "system" - Request system DPI awareness. (Vista and later). - * "permonitor" - Request per-monitor DPI awareness. (Windows 8.1 and later). - * "permonitorv2" - Request per-monitor V2 DPI awareness. (Windows 10, version 1607 and later). - * The most visible difference from "permonitor" is that window title bar will be scaled - * to the visually correct size when dragging between monitors with different scale factors. - * This is the preferred DPI awareness level. - * - * If the requested DPI awareness is not available on the currently running OS, SDL will try to request the best - * available match. - *} -SDL_HINT_WINDOWS_DPI_AWARENESS = 'SDL_WINDOWS_DPI_AWARENESS'; - -{** - * \brief Uses DPI-scaled points as the SDL coordinate system on Windows. - * - * This changes the SDL coordinate system units to be DPI-scaled points, rather than pixels everywhere. - * This means windows will be appropriately sized, even when created on high-DPI displays with scaling. - * - * e.g. requesting a 640x480 window from SDL, on a display with 125% scaling in Windows display settings, - * will create a window with an 800x600 client area (in pixels). - * - * Setting this to "1" implicitly requests process DPI awareness (setting SDL_WINDOWS_DPI_AWARENESS is unnecessary), - * and forces SDL_WINDOW_ALLOW_HIGHDPI on all windows. - * - * This variable can be set to the following values: - * "0" - SDL coordinates equal Windows coordinates. No automatic window resizing when dragging - * between monitors with different scale factors (unless this is performed by - * Windows itself, which is the case when the process is DPI unaware). - * "1" - SDL coordinates are in DPI-scaled points. Automatically resize windows as needed on - * displays with non-100% scale factors. - *} -SDL_HINT_WINDOWS_DPI_SCALING = 'SDL_WINDOWS_DPI_SCALING'; - -{/** - * \brief A variable controlling whether grabbing input grabs the keyboard - * - * This variable can be set to the following values: - * "0" - Grab will affect only the mouse - * "1" - Grab will affect mouse and keyboard - * - * By default SDL will not grab the keyboard so system shortcuts still work. - */} -SDL_HINT_GRAB_KEYBOARD = 'SDL_GRAB_KEYBOARD'; - -{** - * \brief A variable containing a list of devices to ignore in SDL_hid_enumerate() - * - * For example, to ignore the Shanwan DS3 controller and any Valve controller, you might - * have the string "0x2563/0x0523,0x28de/0x0000". - * - * This hint is available since SDL 2.26.0. - *} -SDL_HINT_HIDAPI_IGNORE_DEVICES = 'SDL_HIDAPI_IGNORE_DEVICES'; - -{** - * \brief A variable controlling whether the mouse is captured while mouse buttons are pressed - * - * This variable can be set to the following values: - * "0" - The mouse is not captured while mouse buttons are pressed - * "1" - The mouse is captured while mouse buttons are pressed - * - * By default the mouse is captured while mouse buttons are pressed so if the mouse is dragged - * outside the window, the application continues to receive mouse events until the button is - * released. - *} -SDL_HINT_MOUSE_AUTO_CAPTURE = 'SDL_MOUSE_AUTO_CAPTURE'; - -{/** - * \brief A variable setting the double click radius, in pixels. - */} -SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS = 'SDL_MOUSE_DOUBLE_CLICK_RADIUS'; - -{/** - * \brief A variable setting the double click time, in milliseconds. - */} -SDL_HINT_MOUSE_DOUBLE_CLICK_TIME = 'SDL_MOUSE_DOUBLE_CLICK_TIME'; - -{/** - * \brief Allow mouse click events when clicking to focus an SDL window - * - * This variable can be set to the following values: - * "0" - Ignore mouse clicks that activate a window - * "1" - Generate events for mouse clicks that activate a window - * - * By default SDL will ignore mouse clicks that activate a window - */} -SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH = 'SDL_MOUSE_FOCUS_CLICKTHROUGH'; - -{/** - * \brief A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode - */} -SDL_HINT_MOUSE_NORMAL_SPEED_SCALE = 'SDL_MOUSE_NORMAL_SPEED_SCALE'; - -{** - * \brief A variable controlling whether relative mouse mode constrains the mouse to the center of the window - * - * This variable can be set to the following values: - * "0" - Relative mouse mode constrains the mouse to the window - * "1" - Relative mouse mode constrains the mouse to the center of the window - * - * Constraining to the center of the window works better for FPS games and when the - * application is running over RDP. Constraining to the whole window works better - * for 2D games and increases the chance that the mouse will be in the correct - * position when using high DPI mice. - * - * By default SDL will constrain the mouse to the center of the window - *} -SDL_HINT_MOUSE_RELATIVE_MODE_CENTER = 'SDL_MOUSE_RELATIVE_MODE_CENTER'; - -{/** - * \brief A variable controlling whether relative mouse mode is implemented using mouse warping - * - * This variable can be set to the following values: - * "0" - Relative mouse mode uses raw input - * "1" - Relative mouse mode uses mouse warping - * - * By default SDL will use raw input for relative mouse mode - */} -SDL_HINT_MOUSE_RELATIVE_MODE_WARP = 'SDL_MOUSE_RELATIVE_MODE_WARP'; - -{/** - * \brief A variable controlling whether relative mouse motion is affected by renderer scaling - * - * This variable can be set to the following values: - * "0" - Relative motion is unaffected by DPI or renderer's logical size - * "1" - Relative motion is scaled according to DPI scaling and logical size - * - * By default relative mouse deltas are affected by DPI and renderer scaling - */} -SDL_HINT_MOUSE_RELATIVE_SCALING = 'SDL_MOUSE_RELATIVE_SCALING'; - -{/** - * \brief A variable setting the scale for mouse motion, in floating point, when the mouse is in relative mode - */} -SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE = 'SDL_MOUSE_RELATIVE_SPEED_SCALE'; - -{** - * \brief A variable controlling whether the system mouse acceleration curve is used for relative mouse motion. - * - * This variable can be set to the following values: - * "0" - Relative mouse motion will be unscaled (the default) - * "1" - Relative mouse motion will be scaled using the system mouse acceleration curve. - * - * If SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE is set, that will override the system speed scale. - * - * This hint is available since SDL 2.26.0. - *} -SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE = 'SDL_MOUSE_RELATIVE_SYSTEM_SCALE'; - -{** - * \brief A variable controlling whether a motion event should be generated for mouse warping in relative mode. - * - * This variable can be set to the following values: - * "0" - Warping the mouse will not generate a motion event in relative mode - * "1" - Warping the mouse will generate a motion event in relative mode - * - * By default warping the mouse will not generate motion events in relative mode. This avoids the application having to filter out large relative motion due to warping. - *} -SDL_HINT_MOUSE_RELATIVE_WARP_MOTION = 'SDL_MOUSE_RELATIVE_WARP_MOTION'; - -{/** - * \brief A variable controlling whether mouse events should generate synthetic touch events - * - * This variable can be set to the following values: - * "0" - Mouse events will not generate touch events (default for desktop platforms) - * "1" - Mouse events will generate touch events (default for mobile platforms, such as Android and iOS) - */} -SDL_HINT_MOUSE_TOUCH_EVENTS = 'SDL_MOUSE_TOUCH_EVENTS'; - -{/** - * \brief Controls how the fact chunk affects the loading of a WAVE file. - * - * The fact chunk stores information about the number of samples of a WAVE - * file. The Standards Update from Microsoft notes that this value can be used - * to 'determine the length of the data in seconds'. This is especially useful - * for compressed formats (for which this is a mandatory chunk) if they produce - * multiple sample frames per block and truncating the block is not allowed. - * The fact chunk can exactly specify how many sample frames there should be - * in this case. - * - * Unfortunately, most application seem to ignore the fact chunk and so SDL - * ignores it by default as well. - * - * This variable can be set to the following values: - * - * "truncate" - Use the number of samples to truncate the wave data if - * the fact chunk is present and valid - * "strict" - Like "truncate", but raise an error if the fact chunk - * is invalid, not present for non-PCM formats, or if the - * data chunk doesn't have that many samples - * "ignorezero" - Like "truncate", but ignore fact chunk if the number of - * samples is zero - * "ignore" - Ignore fact chunk entirely (default) - */} -SDL_HINT_WAVE_FACT_CHUNK = 'SDL_WAVE_FACT_CHUNK'; - -{/** - * \brief Controls how the size of the RIFF chunk affects the loading of a WAVE file. - * - * The size of the RIFF chunk (which includes all the sub-chunks of the WAVE - * file) is not always reliable. In case the size is wrong, it's possible to - * just ignore it and step through the chunks until a fixed limit is reached. - * - * Note that files that have trailing data unrelated to the WAVE file or - * corrupt files may slow down the loading process without a reliable boundary. - * By default, SDL stops after 10000 chunks to prevent wasting time. Use the - * environment variable SDL_WAVE_CHUNK_LIMIT to adjust this value. - * - * This variable can be set to the following values: - * - * "force" - Always use the RIFF chunk size as a boundary for the chunk search - * "ignorezero" - Like "force", but a zero size searches up to 4 GiB (default) - * "ignore" - Ignore the RIFF chunk size and always search up to 4 GiB - * "maximum" - Search for chunks until the end of file (not recommended) - */} -SDL_HINT_WAVE_RIFF_CHUNK_SIZE = 'SDL_WAVE_RIFF_CHUNK_SIZE'; - -{/** - * \brief Controls how a truncated WAVE file is handled. - * - * A WAVE file is considered truncated if any of the chunks are incomplete or - * the data chunk size is not a multiple of the block size. By default, SDL - * decodes until the first incomplete block, as most applications seem to do. - * - * This variable can be set to the following values: - * - * "verystrict" - Raise an error if the file is truncated - * "strict" - Like "verystrict", but the size of the RIFF chunk is ignored - * "dropframe" - Decode until the first incomplete sample frame - * "dropblock" - Decode until the first incomplete block (default) - */} -SDL_HINT_WAVE_TRUNCATION = 'SDL_WAVE_TRUNCATION'; - -{/** - * \brief Minimize your SDL_Window if it loses key focus when in Fullscreen mode. Defaults to true. - * - */} -SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS = 'SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS'; - -{/** - * \brief A variable controlling whether the idle timer is disabled on iOS. - * - * When an iOS app does not receive touches for some time, the screen is - * dimmed automatically. For games where the accelerometer is the only input - * this is problematic. This functionality can be disabled by setting this - * hint. - * - * As of SDL 2.0.4, SDL_EnableScreenSaver() and SDL_DisableScreenSaver() - * accomplish the same thing on iOS. They should be preferred over this hint. - * - * This variable can be set to the following values: - * "0" - Enable idle timer - * "1" - Disable idle timer - */} -SDL_HINT_IDLE_TIMER_DISABLED = 'SDL_IOS_IDLE_TIMER_DISABLED'; - -{/** - * \brief A variable controlling what driver to use for OpenGL ES contexts. - * - * On some platforms, currently Windows and X11, OpenGL drivers may support - * creating contexts with an OpenGL ES profile. By default SDL uses these - * profiles, when available, otherwise it attempts to load an OpenGL ES - * library, e.g. that provided by the ANGLE project. This variable controls - * whether SDL follows this default behaviour or will always load an - * OpenGL ES library. - * - * Circumstances where this is useful include - * - Testing an app with a particular OpenGL ES implementation, e.g ANGLE, - * or emulator, e.g. those from ARM, Imagination or Qualcomm. - * - Resolving OpenGL ES function addresses at link time by linking with - * the OpenGL ES library instead of querying them at run time with - * SDL_GL_GetProcAddress(). - * - * Caution: for an application to work with the default behaviour across - * different OpenGL drivers it must query the OpenGL ES function - * addresses at run time using SDL_GL_GetProcAddress(). - * - * This variable is ignored on most platforms because OpenGL ES is native - * or not supported. - * - * This variable can be set to the following values: - * "0" - Use ES profile of OpenGL, if available. (Default when not set.) - * "1" - Load OpenGL ES library using the default library names. - * - */} -SDL_HINT_OPENGL_ES_DRIVER = 'SDL_OPENGL_ES_DRIVER'; - -{/** - * \brief A variable controlling which orientations are allowed on iOS. - * - * In some circumstances it is necessary to be able to explicitly control - * which UI orientations are allowed. - * - * This variable is a space delimited list of the following values: - * "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown" - */} -SDL_HINT_ORIENTATIONS = 'SDL_IOS_ORIENTATIONS'; - -{/** - * \brief A variable controlling the use of a sentinel event when polling the event queue - * - * This variable can be set to the following values: - * "0" - Disable poll sentinels - * "1" - Enable poll sentinels - * - * When polling for events, SDL_PumpEvents is used to gather new events from devices. - * If a device keeps producing new events between calls to SDL_PumpEvents, a poll loop will - * become stuck until the new events stop. - * This is most noticable when moving a high frequency mouse. - * - * By default, poll sentinels are enabled. - */} -SDL_HINT_POLL_SENTINEL = 'SDL_POLL_SENTINEL'; - -{/** - * \brief Override for SDL_GetPreferredLocales() - * - * If set, this will be favored over anything the OS might report for the - * user's preferred locales. Changing this hint at runtime will not generate - * a SDL_LOCALECHANGED event (but if you can change the hint, you can push - * your own event, if you want). - * - * The format of this hint is a comma-separated list of language and locale, - * combined with an underscore, as is a common format: "en_GB". Locale is - * optional: "en". So you might have a list like this: "en_GB,jp,es_PT" - */} -SDL_HINT_PREFERRED_LOCALES = 'SDL_PREFERRED_LOCALES'; - -{/** - * \brief A variable describing the content orientation on QtWayland-based platforms. - * - * On QtWayland platforms, windows are rotated client-side to allow for custom - * transitions. In order to correctly position overlays (e.g. volume bar) and - * gestures (e.g. events view, close/minimize gestures), the system needs to - * know in which orientation the application is currently drawing its contents. - * - * This does not cause the window to be rotated or resized, the application - * needs to take care of drawing the content in the right orientation (the - * framebuffer is always in portrait mode). - * - * This variable can be one of the following values: - * "primary" (default), "portrait", "landscape", "inverted-portrait", "inverted-landscape" - */} -SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION = 'SDL_QTWAYLAND_CONTENT_ORIENTATION'; - -{/** - * \brief Flags to set on QtWayland windows to integrate with the native window manager. - * - * On QtWayland platforms, this hint controls the flags to set on the windows. - * For example, on Sailfish OS "OverridesSystemGestures" disables swipe gestures. - * - * This variable is a space-separated list of the following values (empty = no flags): - * "OverridesSystemGestures", "StaysOnTop", "BypassWindowManager" - */} -SDL_HINT_QTWAYLAND_WINDOW_FLAGS = 'SDL_QTWAYLAND_WINDOW_FLAGS'; - -{** - * \brief Specify an application name. - * - * This hint lets you specify the application name sent to the OS when - * required. For example, this will often appear in volume control applets for - * audio streams, and in lists of applications which are inhibiting the - * screensaver. You should use a string that describes your program ("My Game - * 2: The Revenge") - * - * Setting this to "" or leaving it unset will have SDL use a reasonable - * default: probably the application's name or "SDL Application" if SDL - * doesn't have any better information. - * - * Note that, for audio streams, this can be overridden with - * SDL_HINT_AUDIO_DEVICE_APP_NAME. - * - * On targets where this is not supported, this hint does nothing. - *} -SDL_HINT_APP_NAME = 'SDL_APP_NAME'; - -{/** - * \brief A variable controlling whether controllers used with the Apple TV - * generate UI events. - * - * When UI events are generated by controller input, the app will be - * backgrounded when the Apple TV remote's menu button is pressed, and when the - * pause or B buttons on gamepads are pressed. - * - * More information about properly making use of controllers for the Apple TV - * can be found here: - * https://developer.apple.com/tvos/human-interface-guidelines/remote-and-controllers/ - * - * This variable can be set to the following values: - * "0" - Controller input does not generate UI events (the default). - * "1" - Controller input generates UI events. - */} -SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS = 'SDL_APPLE_TV_CONTROLLER_UI_EVENTS'; - -{/** - * \brief A variable controlling whether the Apple TV remote's joystick axes - * will automatically match the rotation of the remote. - * - * This variable can be set to the following values: - * "0" - Remote orientation does not affect joystick axes (the default). - * "1" - Joystick axes are based on the orientation of the remote. - */} -SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION = 'SDL_APPLE_TV_REMOTE_ALLOW_ROTATION'; - -{/** - * \brief A variable controlling whether the Android / iOS built-in - * accelerometer should be listed as a joystick device, rather than listing - * actual joysticks only. - * - * This variable can be set to the following values: - * "0" - List only real joysticks and accept input from them - * "1" - List real joysticks along with the accelerometer as if it were a 3 axis joystick (the default). - */} -SDL_HINT_ACCELEROMETER_AS_JOYSTICK = 'SDL_ACCELEROMETER_AS_JOYSTICK'; - -{/** - * \brief Specify the behavior of Alt+Tab while the keyboard is grabbed. - * - * By default, SDL emulates Alt+Tab functionality while the keyboard is grabbed - * and your window is full-screen. This prevents the user from getting stuck in - * your application if you've enabled keyboard grab. - * - * The variable can be set to the following values: - * "0" - SDL will not handle Alt+Tab. Your application is responsible - for handling Alt+Tab while the keyboard is grabbed. - * "1" - SDL will minimize your window when Alt+Tab is pressed (default) -*/} -SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED = 'SDL_ALLOW_ALT_TAB_WHILE_GRABBED'; - -{/** - * \brief A variable controlling the audio category on iOS and Mac OS X - * - * This variable can be set to the following values: - * - * "ambient" - Use the AVAudioSessionCategoryAmbient audio category, will be muted by the phone mute switch (default) - * "playback" - Use the AVAudioSessionCategoryPlayback category - * - * For more information, see Apple's documentation: - * https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategoriesandModes/AudioSessionCategoriesandModes.html - */} -SDL_HINT_AUDIO_CATEGORY = 'SDL_AUDIO_CATEGORY'; - -{/** - * \brief Specify an application name for an audio device. - * - * Some audio backends (such as PulseAudio) allow you to describe your audio - * stream. Among other things, this description might show up in a system - * control panel that lets the user adjust the volume on specific audio - * streams instead of using one giant master volume slider. - * - * This hints lets you transmit that information to the OS. The contents of - * this hint are used while opening an audio device. You should use a string - * that describes your program ("My Game 2: The Revenge") - * - * Setting this to "" or leaving it unset will have SDL use a reasonable - * default: this will be the name set with SDL_HINT_APP_NAME, if that hint is - * set. Otherwise, it'll probably the application's name or "SDL Application" - * if SDL doesn't have any better information. - * - * On targets where this is not supported, this hint does nothing. - *} -SDL_HINT_AUDIO_DEVICE_APP_NAME = 'SDL_AUDIO_DEVICE_APP_NAME'; - -{/** - * \brief Specify an application name for an audio device. - * - * Some audio backends (such as PulseAudio) allow you to describe your audio - * stream. Among other things, this description might show up in a system - * control panel that lets the user adjust the volume on specific audio - * streams instead of using one giant master volume slider. - * - * This hints lets you transmit that information to the OS. The contents of - * this hint are used while opening an audio device. You should use a string - * that describes your what your program is playing ("audio stream" is - * probably sufficient in many cases, but this could be useful for something - * like "team chat" if you have a headset playing VoIP audio separately). - * - * Setting this to "" or leaving it unset will have SDL use a reasonable - * default: "audio stream" or something similar. - * - * On targets where this is not supported, this hint does nothing. - */} -SDL_HINT_AUDIO_DEVICE_STREAM_NAME = 'SDL_AUDIO_DEVICE_STREAM_NAME'; - -{/** - * \brief Specify an application role for an audio device. - * - * Some audio backends (such as Pipewire) allow you to describe the role of - * your audio stream. Among other things, this description might show up in - * a system control panel or software for displaying and manipulating media - * playback/capture graphs. - * - * This hints lets you transmit that information to the OS. The contents of - * this hint are used while opening an audio device. You should use a string - * that describes your what your program is playing (Game, Music, Movie, - * etc...). - * - * Setting this to "" or leaving it unset will have SDL use a reasonable - * default: "Game" or something similar. - * - * On targets where this is not supported, this hint does nothing. - */} -SDL_HINT_AUDIO_DEVICE_STREAM_ROLE = 'SDL_AUDIO_DEVICE_STREAM_ROLE'; - -{/** - * \brief A variable that causes SDL to not ignore audio "monitors" - * - * This is currently only used for PulseAudio and ignored elsewhere. - * - * By default, SDL ignores audio devices that aren't associated with physical - * hardware. Changing this hint to "1" will expose anything SDL sees that - * appears to be an audio source or sink. This will add "devices" to the list - * that the user probably doesn't want or need, but it can be useful in - * scenarios where you want to hook up SDL to some sort of virtual device, - * etc. - * - * The default value is "0". This hint must be set before SDL_Init(). - * - * This hint is available since SDL 2.0.16. Before then, virtual devices are - * always ignored. - */} -SDL_HINT_AUDIO_INCLUDE_MONITORS = 'SDL_AUDIO_INCLUDE_MONITORS'; - -{/** - * \brief A variable controlling speed/quality tradeoff of audio resampling. - * - * If available, SDL can use libsamplerate ( http://www.mega-nerd.com/SRC/ ) - * to handle audio resampling. There are different resampling modes available - * that produce different levels of quality, using more CPU. - * - * If this hint isn't specified to a valid setting, or libsamplerate isn't - * available, SDL will use the default, internal resampling algorithm. - * - * Note that this is currently only applicable to resampling audio that is - * being written to a device for playback or audio being read from a device - * for capture. SDL_AudioCVT always uses the default resampler (although this - * might change for SDL 2.1). - * - * This hint is currently only checked at audio subsystem initialization. - * - * This variable can be set to the following values: - * - * "0" or "default" - Use SDL's internal resampling (Default when not set - low quality, fast) - * "1" or "fast" - Use fast, slightly higher quality resampling, if available - * "2" or "medium" - Use medium quality resampling, if available - * "3" or "best" - Use high quality resampling, if available - */} -SDL_HINT_AUDIO_RESAMPLING_MODE = 'SDL_AUDIO_RESAMPLING_MODE'; - -{** - * \brief A variable controlling whether SDL updates joystick state when getting input events - * - * This variable can be set to the following values: - * - * "0" - You'll call SDL_JoystickUpdate() manually - * "1" - SDL will automatically call SDL_JoystickUpdate() (default) - * - * This hint can be toggled on and off at runtime. - */} -SDL_HINT_AUTO_UPDATE_JOYSTICKS = 'SDL_AUTO_UPDATE_JOYSTICKS'; - -{/** - * \brief A variable controlling whether SDL updates sensor state when getting input events - * - * This variable can be set to the following values: - * - * "0" - You'll call SDL_SensorUpdate() manually - * "1" - SDL will automatically call SDL_SensorUpdate() (default) - * - * This hint can be toggled on and off at runtime. - */} -SDL_HINT_AUTO_UPDATE_SENSORS = 'SDL_AUTO_UPDATE_SENSORS'; - -{/** - * \brief Mark X11 windows as override-redirect. - * - * If set, this _might_ increase framerate at the expense of the desktop - * not working as expected. Override-redirect windows aren't noticed by the - * window manager at all. - * - * You should probably only use this for fullscreen windows, and you probably - * shouldn't even use it for that. But it's here if you want to try! - */} -SDL_HINT_X11_FORCE_OVERRIDE_REDIRECT = 'SDL_X11_FORCE_OVERRIDE_REDIRECT'; - -{** - * \brief A variable that forces X11 windows to create as a custom type. - * - * This is currently only used for X11 and ignored elsewhere. - * - * During SDL_CreateWindow, SDL uses the _NET_WM_WINDOW_TYPE X11 property - * to report to the window manager the type of window it wants to create. - * This might be set to various things if SDL_WINDOW_TOOLTIP or - * SDL_WINDOW_POPUP_MENU, etc, were specified. For "normal" windows that - * haven't set a specific type, this hint can be used to specify a custom - * type. For example, a dock window might set this to - * "_NET_WM_WINDOW_TYPE_DOCK". - * - * If not set or set to "", this hint is ignored. This hint must be set - * before the SDL_CreateWindow() call that it is intended to affect. - * - *} -SDL_HINT_X11_WINDOW_TYPE = 'SDL_X11_WINDOW_TYPE'; - -{/** - * \brief A variable that lets you disable the detection and use of Xinput gamepad devices - * - * The variable can be set to the following values: - * "0" - Disable XInput timer (only uses direct input) - * "1" - Enable XInput timer (the default) - */} -SDL_HINT_XINPUT_ENABLED = 'SDL_XINPUT_ENABLED'; - -{** - * \brief A variable that lets you disable the detection and use of DirectInput gamepad devices - * - * The variable can be set to the following values: - * "0" - Disable DirectInput detection (only uses XInput) - * "1" - Enable DirectInput detection (the default) - *} -SDL_HINT_DIRECTINPUT_ENABLED = 'SDL_DIRECTINPUT_ENABLED'; - -{** - * \brief A variable that causes SDL to use the old axis and button mapping for XInput devices. - * - * This hint is for backwards compatibility only and will be removed in SDL 2.1 - * - * The default value is "0". This hint must be set before SDL_Init() - *} -SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING = 'SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING'; - -{/** - * \brief A variable that lets you manually hint extra gamecontroller db entries - * - * The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h - * - * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) - * You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping() - */} -SDL_HINT_GAMECONTROLLERCONFIG = 'SDL_GAMECONTROLLERCONFIG'; - -{/** - * \brief A variable that lets you provide a file with extra gamecontroller db entries. - * - * The file should contain lines of gamecontroller config data, see SDL_gamecontroller.h - * - * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) - * You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping() - */} -SDL_HINT_GAMECONTROLLERCONFIG_FILE = 'SDL_GAMECONTROLLERCONFIG_FILE'; - -{/** - * \brief A variable that overrides the automatic controller type detection - * - * The variable should be comma separated entries, in the form: VID/PID=type - * - * The VID and PID should be hexadecimal with exactly 4 digits, e.g. 0x00fd - * - * The type should be one of: - * Xbox360 - * XboxOne - * PS3 - * PS4 - * PS5 - * SwitchPro - * - * This hint affects what driver is used, and must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) - */} -SDL_HINT_GAMECONTROLLERTYPE = 'SDL_GAMECONTROLLERTYPE'; - -{/** - * \brief A variable containing a list of devices to skip when scanning for game controllers. - * - * The format of the string is a comma separated list of USB VID/PID pairs - * in hexadecimal form, e.g. - * - * 0xAAAA/0xBBBB,0xCCCC/0xDDDD - * - * The variable can also take the form of @file, in which case the named - * file will be loaded and interpreted as the value of the variable. - */} -SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES = 'SDL_GAMECONTROLLER_IGNORE_DEVICES'; - -{/** - * \brief If set, all devices will be skipped when scanning for game controllers except for the ones listed in this variable. - * - * The format of the string is a comma separated list of USB VID/PID pairs - * in hexadecimal form, e.g. - * - * 0xAAAA/0xBBBB,0xCCCC/0xDDDD - * - * The variable can also take the form of @file, in which case the named - * file will be loaded and interpreted as the value of the variable. - */} -SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT = 'SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT'; - -{/** - * \brief If set, game controller face buttons report their values according to their labels instead of their positional layout. - * - * For example, on Nintendo Switch controllers, normally you'd get: - * - * (Y) - * (X) (B) - * (A) - * - * but if this hint is set, you'll get: - * - * (X) - * (Y) (A) - * (B) - * - * The variable can be set to the following values: - * "0" - Report the face buttons by position, as though they were on an Xbox controller. - * "1" - Report the face buttons by label instead of position - * - * The default value is "1". This hint may be set at any time. - */} -SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS = 'SDL_GAMECONTROLLER_USE_BUTTON_LABELS'; - -{/** - * \brief A variable controlling whether the home indicator bar on iPhone X - * should be hidden. - * - * This variable can be set to the following values: - * "0" - The indicator bar is not hidden (default for windowed applications) - * "1" - The indicator bar is hidden and is shown when the screen is touched (useful for movie playback applications) - * "2" - The indicator bar is dim and the first swipe makes it visible and the second swipe performs the "home" action (default for fullscreen applications) - */} -SDL_HINT_IOS_HIDE_HOME_INDICATOR = 'SDL_IOS_HIDE_HOME_INDICATOR'; - -{/** - * \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background. - * - * The variable can be set to the following values: - * "0" - Disable joystick & gamecontroller input events when the - * application is in the background. - * "1" - Enable joystick & gamecontroller input events when the - * application is in the backgroumd. - * - * The default value is "0". This hint may be set at any time. - */} -SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS = 'SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS'; - -{/** - * \brief A comma separated list of devices to open as joysticks - * - * This variable is currently only used by the Linux joystick driver. - *} -SDL_HINT_JOYSTICK_DEVICE = 'SDL_JOYSTICK_DEVICE'; - -{** - * \brief A variable controlling whether "low_frequency_rumble" and "high_frequency_rumble" is used to implement - * the GameCube controller's 3 rumble modes, Stop(0), Rumble(1), and StopHard(2) - * this is useful for applications that need full compatibility for things like ADSR envelopes. - * Stop is implemented by setting "low_frequency_rumble" to "0" and "high_frequency_rumble" ">0" - * Rumble is both at any arbitrary value, - * StopHard is implemented by setting both "low_frequency_rumble" and "high_frequency_rumble" to "0" - * - * This variable can be set to the following values: - * "0" - Normal rumble behavior is behavior is used (default) - * "1" - Proper GameCube controller rumble behavior is used - * - *} -SDL_HINT_JOYSTICK_GAMECUBE_RUMBLE_BRAKE = 'SDL_JOYSTICK_GAMECUBE_RUMBLE_BRAKE'; - -{/** - * \brief A variable controlling whether the HIDAPI joystick drivers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI drivers are not used - * "1" - HIDAPI drivers are used (the default) - * - * This variable is the default for all drivers, but can be overridden by the hints for specific drivers below. - */} -SDL_HINT_JOYSTICK_HIDAPI = 'SDL_JOYSTICK_HIDAPI'; - -{/** - * \brief A variable controlling whether the HIDAPI driver for Nintendo GameCube controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI - */} -SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE = 'SDL_JOYSTICK_HIDAPI_GAMECUBE'; - -{/** - * \brief A variable controlling whether Switch Joy-Cons should be treated the same as Switch Pro Controllers when using the HIDAPI driver. - * - * This variable can be set to the following values: - * "0" - basic Joy-Con support with no analog input (the default) - * "1" - Joy-Cons treated as half full Pro Controllers with analog inputs and sensors - * - * This does not combine Joy-Cons into a single controller. That's up to the user. - */} -SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS = 'SDL_JOYSTICK_HIDAPI_JOY_CONS'; - -{** - * \brief A variable controlling whether Nintendo Switch Joy-Con controllers will be combined into a single Pro-like controller when using the HIDAPI driver - * - * This variable can be set to the following values: - * "0" - Left and right Joy-Con controllers will not be combined and each will be a mini-gamepad - * "1" - Left and right Joy-Con controllers will be combined into a single controller (the default) - *} -SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS = 'SDL_JOYSTICK_HIDAPI_COMBINE_JOY_CONS'; - -{** - * \brief A variable controlling whether Nintendo Switch Joy-Con controllers will be in vertical mode when using the HIDAPI driver - * - * This variable can be set to the following values: - * "0" - Left and right Joy-Con controllers will not be in vertical mode (the default) - * "1" - Left and right Joy-Con controllers will be in vertical mode - * - * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER). - * - * This hint is available since SDL 2.26.0. - *} -SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS = 'SDL_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS'; - -{/** - * \brief A variable controlling whether the HIDAPI driver for Amazon Luna controllers connected via Bluetooth should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI - */} -SDL_HINT_JOYSTICK_HIDAPI_LUNA = 'SDL_JOYSTICK_HIDAPI_LUNA'; - -{** - * \brief A variable controlling whether the HIDAPI driver for Nintendo Online classic controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI - *} -SDL_HINT_JOYSTICK_HIDAPI_NINTENDO_CLASSIC = 'SDL_JOYSTICK_HIDAPI_NINTENDO_CLASSIC'; - -{** - * \brief A variable controlling whether the HIDAPI driver for NVIDIA SHIELD controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI - *} -SDL_HINT_JOYSTICK_HIDAPI_SHIELD = 'SDL_JOYSTICK_HIDAPI_SHIELD'; - -{** - * \brief A variable controlling whether the HIDAPI driver for PS3 controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI on macOS, and "0" on other platforms. - * - * It is not possible to use this driver on Windows, due to limitations in the default drivers - * installed. See https://github.com/ViGEm/DsHidMini for an alternative driver on Windows. - * - * This hint is available since SDL 2.26.0. - *} -SDL_HINT_JOYSTICK_HIDAPI_PS3 = 'SDL_JOYSTICK_HIDAPI_PS3'; - -{/** - * \brief A variable controlling whether the HIDAPI driver for PS4 controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI - */} -SDL_HINT_JOYSTICK_HIDAPI_PS4 = 'SDL_JOYSTICK_HIDAPI_PS4'; - -{/** - * \brief A variable controlling whether extended input reports should be used for PS4 controllers when using the HIDAPI driver. - * - * This variable can be set to the following values: - * "0" - extended reports are not enabled (the default) - * "1" - extended reports - * - * Extended input reports allow rumble on Bluetooth PS4 controllers, but - * break DirectInput handling for applications that don't use SDL. - * - * Once extended reports are enabled, they can not be disabled without - * power cycling the controller. - * - * For compatibility with applications written for versions of SDL prior - * to the introduction of PS5 controller support, this value will also - * control the state of extended reports on PS5 controllers when the - * SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE hint is not explicitly set. - */} -SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE = 'SDL_JOYSTICK_HIDAPI_PS4_RUMBLE'; - -{/** - * \brief A variable controlling whether the HIDAPI driver for PS5 controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI - */} -SDL_HINT_JOYSTICK_HIDAPI_PS5 = 'SDL_JOYSTICK_HIDAPI_PS5'; - -{/** - * \brief A variable controlling whether the player LEDs should be lit to indicate which player is associated with a PS5 controller. - * - * This variable can be set to the following values: - * "0" - player LEDs are not enabled - * "1" - player LEDs are enabled (the default) - */} -SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED = 'SDL_JOYSTICK_HIDAPI_PS5_PLAYER_LED'; - -{/** - * \brief A variable controlling whether extended input reports should be used for PS5 controllers when using the HIDAPI driver. - * - * This variable can be set to the following values: - * "0" - extended reports are not enabled (the default) - * "1" - extended reports - * - * Extended input reports allow rumble on Bluetooth PS5 controllers, but - * break DirectInput handling for applications that don't use SDL. - * - * Once extended reports are enabled, they can not be disabled without - * power cycling the controller. - * - * For compatibility with applications written for versions of SDL prior - * to the introduction of PS5 controller support, this value defaults to - * the value of SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE. - */} -SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE = 'SDL_JOYSTICK_HIDAPI_PS5_RUMBLE'; - -{/** - * \brief A variable controlling whether the HIDAPI driver for Google Stadia controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI - */} -SDL_HINT_JOYSTICK_HIDAPI_STADIA = 'SDL_JOYSTICK_HIDAPI_STADIA'; - -{/** - * \brief A variable controlling whether the HIDAPI driver for Steam Controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used for Steam Controllers, which requires Bluetooth access - * and may prompt the user for permission on iOS and Android. - * - * The default is "0" - */} -SDL_HINT_JOYSTICK_HIDAPI_STEAM = 'SDL_JOYSTICK_HIDAPI_STEAM'; - -{/** - * \brief A variable controlling whether the HIDAPI driver for Nintendo Switch controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI - */} -SDL_HINT_JOYSTICK_HIDAPI_SWITCH = 'SDL_JOYSTICK_HIDAPI_SWITCH'; - -{/** - * \brief A variable controlling whether the Home button LED should be turned on when a Nintendo Switch controller is opened - * - * This variable can be set to the following values: - * "0" - home button LED is turned off - * "1" - home button LED is turned on - * - * By default the Home button LED state is not changed. - */} -SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED = 'SDL_JOYSTICK_HIDAPI_SWITCH_HOME_LED'; - -{** - * \brief A variable controlling whether the Home button LED should be turned on when a Nintendo Switch Joy-Con controller is opened - * - * This variable can be set to the following values: - * "0" - home button LED is turned off - * "1" - home button LED is turned on - * - * By default the Home button LED state is not changed. This hint can also be set to a floating point value between 0.0 and 1.0 which controls the brightness of the Home button LED. - *} -SDL_HINT_JOYSTICK_HIDAPI_JOYCON_HOME_LED = 'SDL_JOYSTICK_HIDAPI_JOYCON_HOME_LED'; - -{** - * \brief A variable controlling whether the player LEDs should be lit to indicate which player is associated with a Nintendo Switch controller. - * - * This variable can be set to the following values: - * "0" - player LEDs are not enabled - * "1" - player LEDs are enabled (the default) - *} -SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED = 'SDL_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED'; - -{** - * \brief A variable controlling whether the HIDAPI driver for Nintendo Wii and Wii U controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * This driver doesn't work with the dolphinbar, so the default is SDL_FALSE for now. - * - * This hint is available since SDL 2.26.0. - *} -SDL_HINT_JOYSTICK_HIDAPI_WII = 'SDL_JOYSTICK_HIDAPI_WII'; - -{** - * \brief A variable controlling whether the player LEDs should be lit to indicate which player is associated with a Wii controller. - * - * This variable can be set to the following values: - * "0" - player LEDs are not enabled - * "1" - player LEDs are enabled (the default) - * - * This hiny is available since SDL 2.26.0. - *} -SDL_HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED = 'SDL_JOYSTICK_HIDAPI_WII_PLAYER_LED'; - -{/** - * \brief A variable controlling whether the HIDAPI driver for XBox controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is "0" on Windows, otherwise the value of SDL_HINT_JOYSTICK_HIDAPI - */} -SDL_HINT_JOYSTICK_HIDAPI_XBOX = 'SDL_JOYSTICK_HIDAPI_XBOX'; - -{** - * \brief A variable controlling whether the HIDAPI driver for XBox 360 controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI_XBOX. - * - * This hint is available since SDL 2.26.0. - *} -SDL_HINT_JOYSTICK_HIDAPI_XBOX_360 = 'SDL_JOYSTICK_HIDAPI_XBOX_360'; - -{** - * \brief A variable controlling whether the player LEDs should be lit to indicate which player is associated with an Xbox 360 controller. - * - * This variable can be set to the following values: - * "0" - player LEDs are not enabled - * "1" - player LEDs are enabled (the default) - * - * This hint is available since SDL 2.26.0. - *} -SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED = 'SDL_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED'; - -{** - * \brief A variable controlling whether the HIDAPI driver for XBox 360 wireless controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI_XBOX_360. - * - * This hint is available since SDL 2.26.0. - *} -SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS = 'SDL_JOYSTICK_HIDAPI_XBOX_360_WIRELESS'; - -{** - * \brief A variable controlling whether the HIDAPI driver for XBox One controllers should be used. - * - * This variable can be set to the following values: - * "0" - HIDAPI driver is not used - * "1" - HIDAPI driver is used - * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI_XBOX. - * - * This hint is available since SDL 2.26.0. - *} -SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE = 'SDL_JOYSTICK_HIDAPI_XBOX_ONE'; - -{** - * \brief A variable controlling whether the Home button LED should be turned on when an Xbox One controller is opened - * - * This variable can be set to the following values: - * "0" - home button LED is turned off - * "1" - home button LED is turned on - * - * By default the Home button LED state is not changed. This hint can also - * be set to a floating point value between 0.0 and 1.0 which controls - * the brightness of the Home button LED. The default brightness is 0.4. - * - * This hint is available since SDL 2.26.0. - *} -SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED = 'SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED'; - -{/** - * \brief A variable controlling whether the RAWINPUT joystick drivers should be used for better handling XInput-capable devices. - * - * This variable can be set to the following values: - * "0" - RAWINPUT drivers are not used - * "1" - RAWINPUT drivers are used (the default) - * - */} -SDL_HINT_JOYSTICK_RAWINPUT = 'SDL_JOYSTICK_RAWINPUT'; - -{/** - * \brief A variable controlling whether the RAWINPUT driver should pull correlated data from XInput. - * - * This variable can be set to the following values: - * "0" - RAWINPUT driver will only use data from raw input APIs - * "1" - RAWINPUT driver will also pull data from XInput, providing - * better trigger axes, guide button presses, and rumble support - * for Xbox controllers - * - * The default is "1". This hint applies to any joysticks opened after setting the hint. - */} -SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT = 'SDL_JOYSTICK_RAWINPUT_CORRELATE_XINPUT'; - -{** - * \brief A variable controlling whether the ROG Chakram mice should show up as joysticks - * - * This variable can be set to the following values: - * "0" - ROG Chakram mice do not show up as joysticks (the default) - * "1" - ROG Chakram mice show up as joysticks - *} -SDL_HINT_JOYSTICK_ROG_CHAKRAM = 'SDL_JOYSTICK_ROG_CHAKRAM'; - -{/** - * \brief A variable controlling whether a separate thread should be used - * for handling joystick detection and raw input messages on Windows - * - * This variable can be set to the following values: - * "0" - A separate thread is not used (the default) - * "1" - A separate thread is used for handling raw input messages - * - */} -SDL_HINT_JOYSTICK_THREAD = 'SDL_JOYSTICK_THREAD'; - -{/** - * \brief If set to 0 then never set the top most bit on a SDL Window, even if the video mode expects it. - * This is a debugging aid for developers and not expected to be used by end users. The default is "1" - * - * This variable can be set to the following values: - * "0" - don't allow topmost - * "1" - allow topmost - */} -SDL_HINT_ALLOW_TOPMOST = 'SDL_ALLOW_TOPMOST'; - -{/** - * \brief A variable that controls the timer resolution, in milliseconds. - * - * The higher resolution the timer, the more frequently the CPU services - * timer interrupts, and the more precise delays are, but this takes up - * power and CPU time. This hint is only used on Windows 7 and earlier. - * - * See this blog post for more information: - * http://randomascii.wordpress.com/2013/07/08/windows-timer-resolution-megawatts-wasted/ - * - * If this variable is set to "0", the system timer resolution is not set. - * - * The default value is "1". This hint may be set at any time. - */} -SDL_HINT_TIMER_RESOLUTION = 'SDL_TIMER_RESOLUTION'; - -{/** - * \brief Specifies whether SDL_THREAD_PRIORITY_TIME_CRITICAL should be treated as realtime. - * - * On some platforms, like Linux, a realtime priority thread may be subject to restrictions - * that require special handling by the application. This hint exists to let SDL know that - * the app is prepared to handle said restrictions. - * - * On Linux, SDL will apply the following configuration to any thread that becomes realtime: - * * The SCHED_RESET_ON_FORK bit will be set on the scheduling policy, - * * An RLIMIT_RTTIME budget will be configured to the rtkit specified limit. - * * Exceeding this limit will result in the kernel sending SIGKILL to the app, - * * Refer to the man pages for more information. - * - * This variable can be set to the following values: - * "0" - default platform specific behaviour - * "1" - Force SDL_THREAD_PRIORITY_TIME_CRITICAL to a realtime scheduling policy - */} -SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL = 'SDL_THREAD_FORCE_REALTIME_TIME_CRITICAL'; - -{/** -* \brief A string specifying additional information to use with SDL_SetThreadPriority. -* -* By default SDL_SetThreadPriority will make appropriate system changes in order to -* apply a thread priority. For example on systems using pthreads the scheduler policy -* is changed automatically to a policy that works well with a given priority. -* Code which has specific requirements can override SDL's default behavior with this hint. -* -* pthread hint values are "current", "other", "fifo" and "rr". -* Currently no other platform hint values are defined but may be in the future. -* -* \note On Linux, the kernel may send SIGKILL to realtime tasks which exceed the distro -* configured execution budget for rtkit. This budget can be queried through RLIMIT_RTTIME -* after calling SDL_SetThreadPriority(). -*/} -SDL_HINT_THREAD_PRIORITY_POLICY = 'SDL_THREAD_PRIORITY_POLICY'; - -{/** - * \brief A string specifying SDL's threads stack size in bytes or "0" for the backend's default size - * - * Use this hint in case you need to set SDL's threads stack size to other than the default. - * This is specially useful if you build SDL against a non glibc libc library (such as musl) which - * provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses). - * Support for this hint is currently available only in the pthread, Windows, and PSP backend. - */} -SDL_HINT_THREAD_STACK_SIZE = 'SDL_THREAD_STACK_SIZE'; - -{/** - * \brief A variable controlling whether touch events should generate synthetic mouse events - * - * This variable can be set to the following values: - * "0" - Touch events will not generate mouse events - * "1" - Touch events will generate mouse events - * - * By default SDL will generate mouse events for touch events - */} -SDL_HINT_TOUCH_MOUSE_EVENTS = 'SDL_TOUCH_MOUSE_EVENTS'; - -{** - * \brief A variable controlling which touchpad should generate synthetic mouse events - * - * This variable can be set to the following values: - * "0" - Only front touchpad should generate mouse events. Default - * "1" - Only back touchpad should generate mouse events. - * "2" - Both touchpads should generate mouse events. - * - * By default SDL will generate mouse events for all touch devices - *} -SDL_HINT_VITA_TOUCH_MOUSE_DEVICE = 'SDL_HINT_VITA_TOUCH_MOUSE_DEVICE'; - -{/** - * \brief A variable controlling whether the Android / tvOS remotes - * should be listed as joystick devices, instead of sending keyboard events. - * - * This variable can be set to the following values: - * "0" - Remotes send enter/escape/arrow key events - * "1" - Remotes are available as 2 axis, 2 button joysticks (the default). - */} -SDL_HINT_TV_REMOTE_AS_JOYSTICK = 'SDL_TV_REMOTE_AS_JOYSTICK'; - -{/** - * \brief If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and iOS) - */} -SDL_HINT_VIDEO_HIGHDPI_DISABLED = 'SDL_VIDEO_HIGHDPI_DISABLED'; - -{** - * \brief A variable controlling whether joysticks on Linux will always treat 'hat' axis inputs (ABS_HAT0X - ABS_HAT3Y) as 8-way digital hats without checking whether they may be analog. - * - * This variable can be set to the following values: - * "0" - Only map hat axis inputs to digital hat outputs if the input axes appear to actually be digital (the default) - * "1" - Always handle the input axes numbered ABS_HAT0X to ABS_HAT3Y as digital hats - *} -SDL_HINT_LINUX_DIGITAL_HATS = 'SDL_LINUX_DIGITAL_HATS'; - -{** - * \brief A variable controlling whether digital hats on Linux will apply deadzones to their underlying input axes or use unfiltered values. - * - * This variable can be set to the following values: - * "0" - Return digital hat values based on unfiltered input axis values - * "1" - Return digital hat values with deadzones on the input axes taken into account (the default) - *} -SDL_HINT_LINUX_HAT_DEADZONES = 'SDL_LINUX_HAT_DEADZONES'; - -{/** - * \brief A variable controlling whether to use the classic /dev/input/js* joystick interface or the newer /dev/input/event* joystick interface on Linux - * - * This variable can be set to the following values: - * "0" - Use /dev/input/event* - * "1" - Use /dev/input/js* - * - * By default the /dev/input/event* interfaces are used - */} -SDL_HINT_LINUX_JOYSTICK_CLASSIC = 'SDL_LINUX_JOYSTICK_CLASSIC'; - -{/** - * \brief A variable controlling whether joysticks on Linux adhere to their HID-defined deadzones or return unfiltered values. - * - * This variable can be set to the following values: - * "0" - Return unfiltered joystick axis values (the default) - * "1" - Return axis values with deadzones taken into account - */} -SDL_HINT_LINUX_JOYSTICK_DEADZONES = 'SDL_LINUX_JOYSTICK_DEADZONES'; - -{/** - * \brief A variable that determines whether ctrl+click should generate a right-click event on Mac - * - * If present, holding ctrl while left clicking will generate a right click - * event when on Mac. - */} -SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK = 'SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK'; - -{** - * \brief A variable controlling whether dispatching OpenGL context updates should block the dispatching thread until the main thread finishes processing - * - * This variable can be set to the following values: - * "0" - Dispatching OpenGL context updates will block the dispatching thread until the main thread finishes processing (default). - * "1" - Dispatching OpenGL context updates will allow the dispatching thread to continue execution. - * - * Generally you want the default, but if you have OpenGL code in a background thread on a Mac, and the main thread - * hangs because it's waiting for that background thread, but that background thread is also hanging because it's - * waiting for the main thread to do an update, this might fix your issue. - * - * This hint only applies to macOS. - * - * This hint is available since SDL 2.24.0. - *} -SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH = 'SDL_MAC_OPENGL_ASYNC_DISPATCH'; - -{/** - * \brief A variable specifying which shader compiler to preload when using the Chrome ANGLE binaries - * - * SDL has EGL and OpenGL ES2 support on Windows via the ANGLE project. It - * can use two different sets of binaries, those compiled by the user from source - * or those provided by the Chrome browser. In the later case, these binaries require - * that SDL loads a DLL providing the shader compiler. - * - * This variable can be set to the following values: - * "d3dcompiler_46.dll" - default, best for Vista or later. - * "d3dcompiler_43.dll" - for XP support. - * "none" - do not load any library, useful if you compiled ANGLE from source and included the compiler in your binaries. - * - */} -SDL_HINT_VIDEO_WIN_D3DCOMPILER = 'SDL_VIDEO_WIN_D3DCOMPILER'; - -{/** - * \brief A variable that is the address of another SDL_Window* (as a hex string formatted with "%p"). - * - * If this hint is set before SDL_CreateWindowFrom() and the SDL_Window* it is set to has - * SDL_WINDOW_OPENGL set (and running on WGL only, currently), then two things will occur on the newly - * created SDL_Window: - * - * 1. Its pixel format will be set to the same pixel format as this SDL_Window. This is - * needed for example when sharing an OpenGL context across multiple windows. - * - * 2. The flag SDL_WINDOW_OPENGL will be set on the new window so it can be used for - * OpenGL rendering. - * - * This variable can be set to the following values: - * The address (as a string "%p") of the SDL_Window* that new windows created with SDL_CreateWindowFrom() should - * share a pixel format with. - */} -SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT = 'SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT'; - -{** - * \brief When calling SDL_CreateWindowFrom(), make the window compatible with OpenGL. - * - * This variable can be set to the following values: - * "0" - Don't add any graphics flags to the SDL_WindowFlags - * "1" - Add SDL_WINDOW_OPENGL to the SDL_WindowFlags - * - * By default SDL will not make the foreign window compatible with OpenGL. - *} -SDL_HINT_VIDEO_FOREIGN_WINDOW_OPENGL = 'SDL_VIDEO_FOREIGN_WINDOW_OPENGL'; - -{** - * \brief When calling SDL_CreateWindowFrom(), make the window compatible with Vulkan. - * - * This variable can be set to the following values: - * "0" - Don't add any graphics flags to the SDL_WindowFlags - * "1" - Add SDL_WINDOW_VULKAN to the SDL_WindowFlags - * - * By default SDL will not make the foreign window compatible with Vulkan. - *} -SDL_HINT_VIDEO_FOREIGN_WINDOW_VULKAN = 'SDL_VIDEO_FOREIGN_WINDOW_VULKAN'; - -{/** - * \brief A URL to a WinRT app's privacy policy - * - * All network-enabled WinRT apps must make a privacy policy available to its - * users. On Windows 8, 8.1, and RT, Microsoft mandates that this policy be - * be available in the Windows Settings charm, as accessed from within the app. - * SDL provides code to add a URL-based link there, which can point to the app's - * privacy policy. - * - * To setup a URL to an app's privacy policy, set SDL_HINT_WINRT_PRIVACY_POLICY_URL - * before calling any SDL_Init() functions. The contents of the hint should - * be a valid URL. For example, "http://www.example.com". - * - * The default value is "", which will prevent SDL from adding a privacy policy - * link to the Settings charm. This hint should only be set during app init. - * - * The label text of an app's "Privacy Policy" link may be customized via another - * hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL. - * - * Please note that on Windows Phone, Microsoft does not provide standard UI - * for displaying a privacy policy link, and as such, SDL_HINT_WINRT_PRIVACY_POLICY_URL - * will not get used on that platform. Network-enabled phone apps should display - * their privacy policy through some other, in-app means. - */} -SDL_HINT_WINRT_PRIVACY_POLICY_URL = 'SDL_WINRT_PRIVACY_POLICY_URL'; - -{/** - * \brief Label text for a WinRT app's privacy policy link - * - * Network-enabled WinRT apps must include a privacy policy. On Windows 8, 8.1, and RT, - * Microsoft mandates that this policy be available via the Windows Settings charm. - * SDL provides code to add a link there, with its label text being set via the - * optional hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL. - * - * Please note that a privacy policy's contents are not set via this hint. A separate - * hint, SDL_HINT_WINRT_PRIVACY_POLICY_URL, is used to link to the actual text of the - * policy. - * - * The contents of this hint should be encoded as a UTF8 string. - * - * The default value is "Privacy Policy". This hint should only be set during app - * initialization, preferably before any calls to SDL_Init(). - * - * For additional information on linking to a privacy policy, see the documentation for - * SDL_HINT_WINRT_PRIVACY_POLICY_URL. - */} -SDL_HINT_WINRT_PRIVACY_POLICY_LABEL = 'SDL_WINRT_PRIVACY_POLICY_LABEL'; - -{/** - * \brief Allows back-button-press events on Windows Phone to be marked as handled - * - * Windows Phone devices typically feature a Back button. When pressed, - * the OS will emit back-button-press events, which apps are expected to - * handle in an appropriate manner. If apps do not explicitly mark these - * events as 'Handled', then the OS will invoke its default behavior for - * unhandled back-button-press events, which on Windows Phone 8 and 8.1 is to - * terminate the app (and attempt to switch to the previous app, or to the - * device's home screen). - * - * Setting the SDL_HINT_WINRT_HANDLE_BACK_BUTTON hint to "1" will cause SDL - * to mark back-button-press events as Handled, if and when one is sent to - * the app. - * - * Internally, Windows Phone sends back button events as parameters to - * special back-button-press callback functions. Apps that need to respond - * to back-button-press events are expected to register one or more - * callback functions for such, shortly after being launched (during the - * app's initialization phase). After the back button is pressed, the OS - * will invoke these callbacks. If the app's callback(s) do not explicitly - * mark the event as handled by the time they return, or if the app never - * registers one of these callback, the OS will consider the event - * un-handled, and it will apply its default back button behavior (terminate - * the app). - * - * SDL registers its own back-button-press callback with the Windows Phone - * OS. This callback will emit a pair of SDL key-press events (SDL_KEYDOWN - * and SDL_KEYUP), each with a scancode of SDL_SCANCODE_AC_BACK, after which - * it will check the contents of the hint, SDL_HINT_WINRT_HANDLE_BACK_BUTTON. - * If the hint's value is set to "1", the back button event's Handled - * property will get set to 'true'. If the hint's value is set to something - * else, or if it is unset, SDL will leave the event's Handled property - * alone. (By default, the OS sets this property to 'false', to note.) - * - * SDL apps can either set SDL_HINT_WINRT_HANDLE_BACK_BUTTON well before a - * back button is pressed, or can set it in direct-response to a back button - * being pressed. - * - * In order to get notified when a back button is pressed, SDL apps should - * register a callback function with SDL_AddEventWatch(), and have it listen - * for SDL_KEYDOWN events that have a scancode of SDL_SCANCODE_AC_BACK. - * (Alternatively, SDL_KEYUP events can be listened-for. Listening for - * either event type is suitable.) Any value of SDL_HINT_WINRT_HANDLE_BACK_BUTTON - * set by such a callback, will be applied to the OS' current - * back-button-press event. - * - * More details on back button behavior in Windows Phone apps can be found - * at the following page, on Microsoft's developer site: - * http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx - */} -SDL_HINT_WINRT_HANDLE_BACK_BUTTON = 'SDL_WINRT_HANDLE_BACK_BUTTON'; - -{/** - * \brief A variable that dictates policy for fullscreen Spaces on Mac OS X. - * - * This hint only applies to Mac OS X. - * - * The variable can be set to the following values: - * "0" - Disable Spaces support (FULLSCREEN_DESKTOP won't use them and - * SDL_WINDOW_RESIZABLE windows won't offer the "fullscreen" - * button on their titlebars). - * "1" - Enable Spaces support (FULLSCREEN_DESKTOP will use them and - * SDL_WINDOW_RESIZABLE windows will offer the "fullscreen" - * button on their titlebars). - * - * The default value is "1". Spaces are disabled regardless of this hint if - * the OS isn't at least Mac OS X Lion (10.7). This hint must be set before - * any windows are created. - */} -SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES = 'SDL_VIDEO_MAC_FULLSCREEN_SPACES'; - -{/** - * \brief When set don't force the SDL app to become a foreground process - * - * This hint only applies to Mac OS X. - * - */} -SDL_HINT_MAC_BACKGROUND_APP = 'SDL_MAC_BACKGROUND_APP'; - -{/** - * \brief Android APK expansion main file version. Should be a string number like "1", "2" etc. - * - * Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION. - * - * If both hints were set then SDL_RWFromFile() will look into expansion files - * after a given relative path was not found in the internal storage and assets. - * - * By default this hint is not set and the APK expansion files are not searched. - */} -SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION = 'SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION'; - -{/** - * \brief Android APK expansion patch file version. Should be a string number like "1", "2" etc. - * - * Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION. - * - * If both hints were set then SDL_RWFromFile() will look into expansion files - * after a given relative path was not found in the internal storage and assets. - * - * By default this hint is not set and the APK expansion files are not searched. - */} -SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION = 'SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION'; - -{/** - * \brief A variable to control whether the event loop will block itself when the app is paused. - * - * The variable can be set to the following values: - * "0" - Non blocking. - * "1" - Blocking. (default) - * - * The value should be set before SDL is initialized. - */} -SDL_HINT_ANDROID_BLOCK_ON_PAUSE = 'SDL_ANDROID_BLOCK_ON_PAUSE'; - -{/** - * \brief A variable to control whether SDL will pause audio in background - * (Requires SDL_ANDROID_BLOCK_ON_PAUSE as "Non blocking") - * - * The variable can be set to the following values: - * "0" - Non paused. - * "1" - Paused. (default) - * - * The value should be set before SDL is initialized. - */} -SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO = 'SDL_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO'; - -{/** - * \brief A variable to control whether we trap the Android back button to handle it manually. - * This is necessary for the right mouse button to work on some Android devices, or - * to be able to trap the back button for use in your code reliably. If set to true, - * the back button will show up as an SDL_KEYDOWN / SDL_KEYUP pair with a keycode of - * SDL_SCANCODE_AC_BACK. - * - * The variable can be set to the following values: - * "0" - Back button will be handled as usual for system. (default) - * "1" - Back button will be trapped, allowing you to handle the key press - * manually. (This will also let right mouse click work on systems - * where the right mouse button functions as back.) - * - * The value of this hint is used at runtime, so it can be changed at any time. - */} -SDL_HINT_ANDROID_TRAP_BACK_BUTTON = 'SDL_ANDROID_TRAP_BACK_BUTTON'; - -{/** - * \brief A variable to control whether certain IMEs should handle text editing internally instead of sending SDL_TEXTEDITING events. - * - * The variable can be set to the following values: - * "0" - SDL_TEXTEDITING events are sent, and it is the application's - * responsibility to render the text from these events and - * differentiate it somehow from committed text. (default) - * "1" - If supported by the IME then SDL_TEXTEDITING events are not sent, - * and text that is being composed will be rendered in its own UI. - */} -SDL_HINT_IME_INTERNAL_EDITING = 'SDL_IME_INTERNAL_EDITING'; - -{/** - * \brief A variable to control whether certain IMEs should show native UI components (such as the Candidate List) instead of suppressing them. - * - * The variable can be set to the following values: - * "0" - Native UI components are not display. (default) - * "1" - Native UI components are displayed. - */} -SDL_HINT_IME_SHOW_UI = 'SDL_IME_SHOW_UI'; - -{** - * \brief A variable to control if extended IME text support is enabled. - * If enabled then SDL_TextEditingExtEvent will be issued if the text would be truncated otherwise. - * Additionally SDL_TextInputEvent will be dispatched multiple times so that it is not truncated. - * - * The variable can be set to the following values: - * "0" - Legacy behavior. Text can be truncated, no heap allocations. (default) - * "1" - Modern behavior. - *} -SDL_HINT_IME_SUPPORT_EXTENDED_TEXT = 'SDL_IME_SUPPORT_EXTENDED_TEXT'; - -{/** - * \brief A variable to control whether mouse and touch events are to be treated together or separately - * - * The variable can be set to the following values: - * "0" - Mouse events will be handled as touch events, and touch will raise fake mouse - * events. This is the behaviour of SDL <= 2.0.3. (default) - * "1" - Mouse events will be handled separately from pure touch events. - * - * NOTE: This hint is no longer supported on SDL >= 2.0.10. - * Use SDL_HINT_MOUSE_TOUCH_EVENTS and SDL_HINT_TOUCH_MOUSE_EVENTS - * for generating synthetic touch/mouse events. - */} -SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH = 'SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH' - deprecated 'This hint is no longer supported on SDL >= 2.0.10. Use SDL_HINT_MOUSE_TOUCH_EVENTS and SDL_HINT_TOUCH_MOUSE_EVENTS instead.'; - -{/** - * \brief Disable giving back control to the browser automatically - * when running with asyncify - * - * With -s ASYNCIFY, SDL2 calls emscripten_sleep during operations - * such as refreshing the screen or polling events. - * - * This hint only applies to the emscripten platform - * - * The variable can be set to the following values: - * "0" - Disable emscripten_sleep calls (if you give back browser control manually or use asyncify for other purposes) - * "1" - Enable emscripten_sleep calls (the default) - */} -SDL_HINT_EMSCRIPTEN_ASYNCIFY = 'SDL_EMSCRIPTEN_ASYNCIFY'; - -{/** - * \brief override the binding element for keyboard inputs for Emscripten builds - * - * This hint only applies to the emscripten platform - * - * The variable can be one of - * "#window" - The javascript window object (this is the default) - * "#document" - The javascript document object - * "#screen" - the javascript window.screen object - * "#canvas" - the WebGL canvas element - * any other string without a leading # sign applies to the element on the page with that ID. - */} -SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT = 'SDL_EMSCRIPTEN_KEYBOARD_ELEMENT'; - -{/** - * \brief Tell SDL not to catch the SIGINT or SIGTERM signals. - * - * This hint only applies to Unix-like platforms. - * - * The variable can be set to the following values: - * "0" - SDL will install a SIGINT and SIGTERM handler, and when it - * catches a signal, convert it into an SDL_QUIT event. - * "1" - SDL will not install a signal handler at all. - */} -SDL_HINT_NO_SIGNAL_HANDLERS = 'SDL_NO_SIGNAL_HANDLERS'; - -{** - * \brief A variable that decides whether to send SDL_QUIT when closing the final window. - * - * By default, SDL sends an SDL_QUIT event when there is only one window - * and it receives an SDL_WINDOWEVENT_CLOSE event, under the assumption most - * apps would also take the loss of this window as a signal to terminate the - * program. - * - * However, it's not unreasonable in some cases to have the program continue - * to live on, perhaps to create new windows later. - * - * Changing this hint to "0" will cause SDL to not send an SDL_QUIT event - * when the final window is requesting to close. Note that in this case, - * there are still other legitimate reasons one might get an SDL_QUIT - * event: choosing "Quit" from the macOS menu bar, sending a SIGINT (ctrl-c) - * on Unix, etc. - * - * The default value is "1". This hint can be changed at any time. - * - * This hint is available since SDL 2.0.22. Before then, you always get - * an SDL_QUIT event when closing the final window. - *} -SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE = 'SDL_QUIT_ON_LAST_WINDOW_CLOSE'; - -{/** - * \brief Tell SDL not to generate window-close events for Alt+F4 on Windows. - * - * The variable can be set to the following values: - * "0" - SDL will generate a window-close event when it sees Alt+F4. - * "1" - SDL will only do normal key handling for Alt+F4. - */} -SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 = 'SDL_WINDOWS_NO_CLOSE_ON_ALT_F4'; - -{/** - * \brief Prevent SDL from using version 4 of the bitmap header when saving BMPs. - * - * The bitmap header version 4 is required for proper alpha channel support and - * SDL will use it when required. Should this not be desired, this hint can - * force the use of the 40 byte header version which is supported everywhere. - * - * The variable can be set to the following values: - * "0" - Surfaces with a colorkey or an alpha channel are saved to a - * 32-bit BMP file with an alpha mask. SDL will use the bitmap - * header version 4 and set the alpha mask accordingly. - * "1" - Surfaces with a colorkey or an alpha channel are saved to a - * 32-bit BMP file without an alpha mask. The alpha channel data - * will be in the file, but applications are going to ignore it. - * - * The default value is "0". - */} -SDL_HINT_BMP_SAVE_LEGACY_FORMAT = 'SDL_BMP_SAVE_LEGACY_FORMAT'; - -{/** - * \brief Tell SDL not to name threads on Windows. - * - * The variable can be set to the following values: - * "0" - SDL will raise the 0x406D1388 Exception to name threads. - * This is the default behavior of SDL <= 2.0.4. (default) - * "1" - SDL will not raise this exception, and threads will be unnamed. - * For .NET languages this is required when running under a debugger. - */} -SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING = 'SDL_WINDOWS_DISABLE_THREAD_NAMING'; - -{/** - * \brief A variable to control whether the return key on the soft keyboard - * should hide the soft keyboard on Android and iOS. - * - * The variable can be set to the following values: - * "0" - The return key will be handled as a key event. This is the behaviour of SDL <= 2.0.3. (default) - * "1" - The return key will hide the keyboard. - * - * The value of this hint is used at runtime, so it can be changed at any time. - */} -SDL_HINT_RETURN_KEY_HIDES_IME = 'SDL_RETURN_KEY_HIDES_IME'; - -{/** - * \brief Tell SDL which Dispmanx layer to use on a Raspberry PI - * - * Also known as Z-order. The variable can take a negative or positive value. - * The default is 10000. - */} -SDL_HINT_RPI_VIDEO_LAYER = 'SDL_RPI_VIDEO_LAYER'; - -{** - * \brief A variable that decides what audio backend to use. - * - * By default, SDL will try all available audio backends in a reasonable - * order until it finds one that can work, but this hint allows the app - * or user to force a specific target, such as "alsa" if, say, you are - * on PulseAudio but want to try talking to the lower level instead. - * - * This functionality has existed since SDL 2.0.0 (indeed, before that) - * but before 2.0.22 this was an environment variable only. In 2.0.22, - * it was upgraded to a full SDL hint, so you can set the environment - * variable as usual or programatically set the hint with SDL_SetHint, - * which won't propagate to child processes. - * - * The default value is unset, in which case SDL will try to figure out - * the best audio backend on your behalf. This hint needs to be set - * before SDL_Init() is called to be useful. - * - * This hint is available since SDL 2.0.22. Before then, you could set - * the environment variable to get the same effect. - *} -SDL_HINT_AUDIODRIVER = 'SDL_AUDIODRIVER'; - -{** - * \brief A variable that decides what video backend to use. - * - * By default, SDL will try all available video backends in a reasonable - * order until it finds one that can work, but this hint allows the app - * or user to force a specific target, such as "x11" if, say, you are - * on Wayland but want to try talking to the X server instead. - * - * This functionality has existed since SDL 2.0.0 (indeed, before that) - * but before 2.0.22 this was an environment variable only. In 2.0.22, - * it was upgraded to a full SDL hint, so you can set the environment - * variable as usual or programatically set the hint with SDL_SetHint, - * which won't propagate to child processes. - * - * The default value is unset, in which case SDL will try to figure out - * the best video backend on your behalf. This hint needs to be set - * before SDL_Init() is called to be useful. - * - * This hint is available since SDL 2.0.22. Before then, you could set - * the environment variable to get the same effect. - *} -SDL_HINT_VIDEODRIVER = 'SDL_VIDEODRIVER'; - -{** - * \brief A variable that decides what KMSDRM device to use. - * - * Internally, SDL might open something like "/dev/dri/cardNN" to - * access KMSDRM functionality, where "NN" is a device index number. - * - * SDL makes a guess at the best index to use (usually zero), but the - * app or user can set this hint to a number between 0 and 99 to - * force selection. - * - * This hint is available since SDL 2.24.0. - *} -SDL_HINT_KMSDRM_DEVICE_INDEX = 'SDL_KMSDRM_DEVICE_INDEX'; - -{** - * \brief A variable that treats trackpads as touch devices. - * - * On macOS (and possibly other platforms in the future), SDL will report - * touches on a trackpad as mouse input, which is generally what users - * expect from this device; however, these are often actually full - * multitouch-capable touch devices, so it might be preferable to some apps - * to treat them as such. - * - * Setting this hint to true will make the trackpad input report as a - * multitouch device instead of a mouse. The default is false. - * - * Note that most platforms don't support this hint. As of 2.24.0, it - * only supports MacBooks' trackpads on macOS. Others may follow later. - * - * This hint is checked during SDL_Init and can not be changed after. - * - * This hint is available since SDL 2.24.0. - *} -SDL_HINT_TRACKPAD_IS_TOUCH_ONLY = 'SDL_TRACKPAD_IS_TOUCH_ONLY'; - -{/** - * \brief An enumeration of hint priorities - */} -type - PPSDL_HintPriority = ^PSDL_HintPriority; - PSDL_HintPriority = ^TSDL_HintPriority; - TSDL_HintPriority = type Integer; - -const - SDL_HINT_DEFAULT = TSDL_HintPriority(0); - SDL_HINT_NORMAL = TSDL_HintPriority(1); - SDL_HINT_OVERRIDE = TSDL_HintPriority(2); - -{/** - * \brief Set a hint with a specific priority - * - * The priority controls the behavior when setting a hint that already - * has a value. Hints will replace existing hints of their priority and - * lower. Environment variables are considered to have override priority. - * - * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise - */} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetHintWithPriority_fun = function(const name: PAnsiChar; const value: PAnsiChar; priority: TSDL_HintPriority): TSDL_Bool; cdecl; -Var - SDL_SetHintWithPriority : TSDL_SetHintWithPriority_fun = Nil; -{$else} - -function SDL_SetHintWithPriority(const name: PAnsiChar; const value: PAnsiChar; priority: TSDL_HintPriority): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetHintWithPriority' {$ENDIF} {$ENDIF}; -{$endif} - -{/** - * \brief Set a hint with normal priority - * - * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise - */} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetHint_fun = function(const name: PAnsiChar; const value: PAnsiChar): TSDL_Bool; cdecl; -Var - SDL_SetHint : TSDL_SetHint_fun = Nil; -{$else} - -function SDL_SetHint(const name: PAnsiChar; const value: PAnsiChar): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetHint' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Reset a hint to the default value. - * - * This will reset a hint to the value of the environment variable, - * or NIL if the environment isn't set. Callbacks will be called normally - * with this change. - * - * \param name the hint to set - * \returns SDL_TRUE if the hint was set, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.24.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_ResetHint_fun = function(const name: PAnsiChar): TSDL_Bool; cdecl; -Var - SDL_ResetHint : TSDL_ResetHint_fun = Nil; -{$else} - -function SDL_ResetHint(const name: PAnsiChar): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ResetHint' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Reset all hints to the default values. - * - * This will reset all hints to the value of the associated environment - * variable, or NIL if the environment isn't set. Callbacks will be called - * normally with this change. - * - * \since This function is available since SDL 2.26.0. - * - * \sa SDL_GetHint - * \sa SDL_SetHint - * \sa SDL_ResetHint - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_ResetHints_proc = procedure(); cdecl; -Var - SDL_ResetHints : TSDL_ResetHints_proc = Nil; -{$else} - -procedure SDL_ResetHints(); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ResetHints' {$ENDIF} {$ENDIF}; -{$endif} - -{/** - * \brief Get a hint - * - * \return The string value of a hint variable. - */} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetHint_fun = function(const name: PAnsiChar): PAnsiChar; cdecl; -Var - SDL_GetHint : TSDL_GetHint_fun = Nil; -{$else} - -function SDL_GetHint(const name: PAnsiChar): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetHint' {$ENDIF} {$ENDIF}; -{$endif} - -{/** - * \brief Get a hint - * - * \return The boolean value of a hint variable. - */} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetHintBoolean_fun = function(const name: PAnsiChar; default_value: TSDL_Bool): TSDL_Bool; cdecl; -Var - SDL_GetHintBoolean : TSDL_GetHintBoolean_fun = Nil; -{$else} - -function SDL_GetHintBoolean(const name: PAnsiChar; default_value: TSDL_Bool): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetHintBoolean' {$ENDIF} {$ENDIF}; -{$endif} - -{/** - * \brief Add a function to watch a particular hint - * - * \param name The hint to watch - * \param callback The function to call when the hint value changes - * \param userdata A pointer to pass to the callback function - */} -type - PPSDL_HintCallback = ^PSDL_HintCallback; - PSDL_HintCallback = ^TSDL_HintCallback; - TSDL_HintCallback = procedure(userdata: Pointer; const name: PAnsiChar; const oldValue: PAnsiChar; const newValue: PAnsiChar); cdecl; - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_AddHintCallback_proc = procedure(const name: PAnsiChar; callback: TSDL_HintCallback; userdata: Pointer); cdecl; -Var - SDL_AddHintCallback : TSDL_AddHintCallback_proc = Nil; -{$else} - -procedure SDL_AddHintCallback(const name: PAnsiChar; callback: TSDL_HintCallback; userdata: Pointer); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AddHintCallback' {$ENDIF} {$ENDIF}; -{$endif} - -{/** - * \brief Remove a function watching a particular hint - * - * \param name The hint being watched - * \param callback The function being called when the hint value changes - * \param userdata A pointer being passed to the callback function - */} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_DelHintCallback_proc = procedure(const name: PAnsiChar; callback: TSDL_HintCallback; userdata: Pointer); cdecl; -Var - SDL_DelHintCallback : TSDL_DelHintCallback_proc = Nil; -{$else} - -procedure SDL_DelHintCallback(const name: PAnsiChar; callback: TSDL_HintCallback; userdata: Pointer); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DelHintCallback' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Clear all hints. - * - * This function is automatically called during SDL_Quit(), and deletes all - * callbacks without calling them and frees all memory associated with hints. - * If you're calling this from application code you probably want to call - * SDL_ResetHints() instead. - * - * This function will be removed from the API the next time we rev the ABI. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_ResetHints - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_ClearHints_proc = procedure(); cdecl; -Var - SDL_ClearHints : TSDL_ClearHints_proc = Nil; -{$else} - -procedure SDL_ClearHints(); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ClearHints' {$ENDIF} {$ENDIF}; -{$endif} +// from "SDL_hints.h" + +{** + * \file SDL_hints.h + * + * Official documentation for SDL configuration variables + * + * This file contains functions to set and get configuration hints, + * as well as listing each of them alphabetically. + * + * The convention for naming hints is SDL_HINT_X, where "SDL_X" is + * the environment variable that can be used to override the default. + * + * In general these hints are just that - they may or may not be + * supported or applicable on any given platform, but they provide + * a way for an application or user to give the library a hint as + * to how they would like the library to work. + *} + +const + +{/** + * \brief Override for SDL_GetDisplayUsableBounds() + * + * If set, this hint will override the expected results for + * SDL_GetDisplayUsableBounds() for display index 0. Generally you don't want + * to do this, but this allows an embedded system to request that some of the + * screen be reserved for other uses when paired with a well-behaved + * application. + * + * The contents of this hint must be 4 comma-separated integers, the first + * is the bounds x, then y, width and height, in that order. + */} +SDL_HINT_DISPLAY_USABLE_BOUNDS = 'SDL_DISPLAY_USABLE_BOUNDS'; + +{/** + * \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs + * + * The variable can be set to the following values: + * "0" - Do not scan for Steam Controllers + * "1" - Scan for Steam Controllers (the default) + * + * The default value is "1". This hint must be set before initializing the joystick subsystem. + */} +SDL_HINT_ENABLE_STEAM_CONTROLLERS = 'SDL_ENABLE_STEAM_CONTROLLERS'; + +{/** + * \brief A variable controlling whether SDL logs all events pushed onto its internal queue. + * + * This variable can be set to the following values: + * + * "0" - Don't log any events (default) + * "1" - Log all events except mouse and finger motion, which are pretty spammy. + * "2" - Log all events. + * + * This is generally meant to be used to debug SDL itself, but can be useful + * for application developers that need better visibility into what is going + * on in the event queue. Logged events are sent through SDL_Log(), which + * means by default they appear on stdout on most platforms or maybe + * OutputDebugString() on Windows, and can be funneled by the app with + * SDL_LogSetOutputFunction(), etc. + * + * This hint can be toggled on and off at runtime, if you only need to log + * events for a small subset of program execution. + */} +SDL_HINT_EVENT_LOGGING = 'SDL_EVENT_LOGGING'; + +{** + * \brief A variable controlling whether raising the window should be done more forcefully + * + * This variable can be set to the following values: + * "0" - No forcing (the default) + * "1" - Extra level of forcing + * + * At present, this is only an issue under MS Windows, which makes it nearly impossible to + * programmatically move a window to the foreground, for "security" reasons. See + * http://stackoverflow.com/a/34414846 for a discussion. + *} +SDL_HINT_FORCE_RAISEWINDOW = 'SDL_HINT_FORCE_RAISEWINDOW'; + +{/** + * \brief A variable controlling how 3D acceleration is used to accelerate the SDL screen surface. + * + * SDL can try to accelerate the SDL screen surface by using streaming + * textures with a 3D rendering engine. This variable controls whether and + * how this is done. + * + * This variable can be set to the following values: + * "0" - Disable 3D acceleration + * "1" - Enable 3D acceleration, using the default renderer. + * "X" - Enable 3D acceleration, using X where X is one of the valid rendering drivers. (e.g. "direct3d", "opengl", etc.) + * + * By default SDL tries to make a best guess for each platform whether + * to use acceleration or not. + */} +SDL_HINT_FRAMEBUFFER_ACCELERATION = 'SDL_FRAMEBUFFER_ACCELERATION'; + +{/** + * \brief Determines whether SDL enforces that DRM master is required in order + * to initialize the KMSDRM video backend. + * + * The DRM subsystem has a concept of a "DRM master" which is a DRM client that + * has the ability to set planes, set cursor, etc. When SDL is DRM master, it + * can draw to the screen using the SDL rendering APIs. Without DRM master, SDL + * is still able to process input and query attributes of attached displays, + * but it cannot change display state or draw to the screen directly. + * + * In some cases, it can be useful to have the KMSDRM backend even if it cannot + * be used for rendering. An app may want to use SDL for input processing while + * using another rendering API (such as an MMAL overlay on Raspberry Pi) or + * using its own code to render to DRM overlays that SDL doesn't support. + * + * This hint must be set before initializing the video subsystem. + * + * This variable can be set to the following values: + * "0" - SDL will allow usage of the KMSDRM backend without DRM master + * "1" - SDL will require DRM master to use the KMSDRM backend (default) + */} +SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER = 'SDL_KMSDRM_REQUIRE_DRM_MASTER'; + +{/** + * \brief A variable controlling whether the 2D render API is compatible or efficient. + * + * This variable can be set to the following values: + * + * "0" - Don't use batching to make rendering more efficient. + * "1" - Use batching, but might cause problems if app makes its own direct OpenGL calls. + * + * Up to SDL 2.0.9, the render API would draw immediately when requested. Now + * it batches up draw requests and sends them all to the GPU only when forced + * to (during SDL_RenderPresent, when changing render targets, by updating a + * texture that the batch needs, etc). This is significantly more efficient, + * but it can cause problems for apps that expect to render on top of the + * render API's output. As such, SDL will disable batching if a specific + * render backend is requested (since this might indicate that the app is + * planning to use the underlying graphics API directly). This hint can + * be used to explicitly request batching in this instance. It is a contract + * that you will either never use the underlying graphics API directly, or + * if you do, you will call SDL_RenderFlush() before you do so any current + * batch goes to the GPU before your work begins. Not following this contract + * will result in undefined behavior. + */} +SDL_HINT_RENDER_BATCHING = 'SDL_RENDER_BATCHING'; + +{/** + * \brief A variable specifying which render driver to use. + * + * If the application doesn't pick a specific renderer to use, this variable + * specifies the name of the preferred renderer. If the preferred renderer + * can't be initialized, the normal default renderer is used. + * + * This variable is case insensitive and can be set to the following values: + * "direct3d" + * "opengl" + * "opengles2" + * "opengles" + * "software" + * + * The default varies by platform, but it's the first one in the list that + * is available on the current platform. + */} +SDL_HINT_RENDER_DRIVER = 'SDL_RENDER_DRIVER'; + +{/** + * \brief A variable controlling how the 2D render API renders lines + * + * This variable can be set to the following values: + * "0" - Use the default line drawing method (Bresenham's line algorithm as of SDL 2.0.20) + * "1" - Use the driver point API using Bresenham's line algorithm (correct, draws many points) + * "2" - Use the driver line API (occasionally misses line endpoints based on hardware driver quirks, was the default before 2.0.20) + * "3" - Use the driver geometry API (correct, draws thicker diagonal lines) + * + * This variable should be set when the renderer is created. + */} +SDL_HINT_RENDER_LINE_METHOD = 'SDL_RENDER_LINE_METHOD'; + +{/** + * \brief A variable controlling the scaling policy for SDL_RenderSetLogicalSize. + * + * This variable can be set to the following values: + * "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen + * "1" or "overscan" - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen + * + * By default letterbox is used + */} +SDL_HINT_RENDER_LOGICAL_SIZE_MODE = 'SDL_RENDER_LOGICAL_SIZE_MODE'; + +{/** + * \brief A variable controlling whether the OpenGL render driver uses shaders if they are available. + * + * This variable can be set to the following values: + * "0" - Disable shaders + * "1" - Enable shaders + * + * By default shaders are used if OpenGL supports them. + */} +SDL_HINT_RENDER_OPENGL_SHADERS = 'SDL_RENDER_OPENGL_SHADERS'; + +{/** + * \brief A variable controlling whether the Direct3D device is initialized for thread-safe operations. + * + * This variable can be set to the following values: + * "0" - Thread-safety is not enabled (faster) + * "1" - Thread-safety is enabled + * + * By default the Direct3D device is created with thread-safety disabled. + */} +SDL_HINT_RENDER_DIRECT3D_THREADSAFE = 'SDL_RENDER_DIRECT3D_THREADSAFE'; + +{/** + * \brief A variable controlling whether to enable Direct3D 11+'s Debug Layer. + * + * This variable does not have any effect on the Direct3D 9 based renderer. + * + * This variable can be set to the following values: + * "0" - Disable Debug Layer use + * "1" - Enable Debug Layer use + * + * By default, SDL does not use Direct3D Debug Layer. + */} +SDL_HINT_RENDER_DIRECT3D11_DEBUG = 'SDL_RENDER_DIRECT3D11_DEBUG'; + +{/** + * \brief A variable controlling the scaling quality + * + * This variable can be set to the following values: + * "0" or "nearest" - Nearest pixel sampling + * "1" or "linear" - Linear filtering (supported by OpenGL and Direct3D) + * "2" or "best" - Currently this is the same as "linear" + * + * By default nearest pixel sampling is used + */} +SDL_HINT_RENDER_SCALE_QUALITY = 'SDL_RENDER_SCALE_QUALITY'; + +{/** + * \brief A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing. + * + * This variable can be set to the following values: + * "0" - Disable vsync + * "1" - Enable vsync + * + * By default SDL does not sync screen surface updates with vertical refresh. + */} +SDL_HINT_RENDER_VSYNC = 'SDL_RENDER_VSYNC'; + +{** + * \brief A variable controlling if VSYNC is automatically disable if doesn't reach the enough FPS + * + * This variable can be set to the following values: + * "0" - It will be using VSYNC as defined in the main flag. Default + * "1" - If VSYNC was previously enabled, then it will disable VSYNC if doesn't reach enough speed + * + * By default SDL does not enable the automatic VSYNC + *} +SDL_HINT_PS2_DYNAMIC_VSYNC = 'SDL_PS2_DYNAMIC_VSYNC'; + +{/** + * \brief A variable controlling whether the screensaver is enabled. + * + * This variable can be set to the following values: + * "0" - Disable screensaver + * "1" - Enable screensaver + * + * By default SDL will disable the screensaver. + */} +SDL_HINT_VIDEO_ALLOW_SCREENSAVER = 'SDL_VIDEO_ALLOW_SCREENSAVER'; + +{/** + * \brief Tell the video driver that we only want a double buffer. + * + * By default, most lowlevel 2D APIs will use a triple buffer scheme that + * wastes no CPU time on waiting for vsync after issuing a flip, but + * introduces a frame of latency. On the other hand, using a double buffer + * scheme instead is recommended for cases where low latency is an important + * factor because we save a whole frame of latency. + * We do so by waiting for vsync immediately after issuing a flip, usually just + * after eglSwapBuffers call in the backend's *_SwapWindow function. + * + * Since it's driver-specific, it's only supported where possible and + * implemented. Currently supported the following drivers: + * + * - KMSDRM (kmsdrm) + * - Raspberry Pi (raspberrypi) + */} +SDL_HINT_VIDEO_DOUBLE_BUFFER = 'SDL_VIDEO_DOUBLE_BUFFER'; + +{/** + * \brief A variable controlling whether the EGL window is allowed to be + * composited as transparent, rather than opaque. + * + * Most window systems will always render windows opaque, even if the surface + * format has an alpha channel. This is not always true, however, so by default + * SDL will try to enforce opaque composition. To override this behavior, you + * can set this hint to "1". + */} +SDL_HINT_VIDEO_EGL_ALLOW_TRANSPARENCY = 'SDL_VIDEO_EGL_ALLOW_TRANSPARENCY'; + +{/** + * \brief A variable controlling whether the graphics context is externally managed. + * + * This variable can be set to the following values: + * "0" - SDL will manage graphics contexts that are attached to windows. + * "1" - Disable graphics context management on windows. + * + * By default SDL will manage OpenGL contexts in certain situations. For example, on Android the + * context will be automatically saved and restored when pausing the application. Additionally, some + * platforms will assume usage of OpenGL if Vulkan isn't used. Setting this to "1" will prevent this + * behavior, which is desireable when the application manages the graphics context, such as + * an externally managed OpenGL context or attaching a Vulkan surface to the window. + */} +SDL_HINT_VIDEO_EXTERNAL_CONTEXT = 'SDL_VIDEO_EXTERNAL_CONTEXT'; + +{/** + * \brief A variable controlling whether the libdecor Wayland backend is allowed to be used. + * + * This variable can be set to the following values: + * "0" - libdecor use is disabled. + * "1" - libdecor use is enabled (default). + * + * libdecor is used over xdg-shell when xdg-decoration protocol is unavailable. + */} +SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR = 'SDL_VIDEO_WAYLAND_ALLOW_LIBDECOR'; + +{** + * \brief A variable controlling whether the libdecor Wayland backend is preferred over native decrations. + * + * When this hint is set, libdecor will be used to provide window decorations, even if xdg-decoration is + * available. (Note that, by default, libdecor will use xdg-decoration itself if available). + * + * This variable can be set to the following values: + * "0" - libdecor is enabled only if server-side decorations are unavailable. + * "1" - libdecor is always enabled if available. + * + * libdecor is used over xdg-shell when xdg-decoration protocol is unavailable. + *} +SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR = 'SDL_VIDEO_WAYLAND_PREFER_LIBDECOR'; + +{** + * \brief A variable controlling whether video mode emulation is enabled under Wayland. + * + * When this hint is set, a standard set of emulated CVT video modes will be exposed for use by the application. + * If it is disabled, the only modes exposed will be the logical desktop size and, in the case of a scaled + * desktop, the native display resolution. + * + * This variable can be set to the following values: + * "0" - Video mode emulation is disabled. + * "1" - Video mode emulation is enabled. + * + * By default video mode emulation is enabled. + *} +SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION = 'SDL_VIDEO_WAYLAND_MODE_EMULATION'; + +{** + * \brief Enable or disable mouse pointer warp emulation, needed by some older games. + * + * When this hint is set, any SDL will emulate mouse warps using relative mouse mode. + * This is required for some older games (such as Source engine games), which warp the + * mouse to the centre of the screen rather than using relative mouse motion. Note that + * relative mouse mode may have different mouse acceleration behaviour than pointer warps. + * + * This variable can be set to the following values: + * "0" - All mouse warps fail, as mouse warping is not available under Wayland. + * "1" - Some mouse warps will be emulated by forcing relative mouse mode. + * + * If not set, this is automatically enabled unless an application uses + * relative mouse mode directly. + * + * This hint is available since SDL 2.26.0. + *} +SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP = 'SDL_VIDEO_WAYLAND_EMULATE_MOUSE_WARP'; + +{/** + * \brief Specify an "activity name" for screensaver inhibition. + * + * Some platforms, notably Linux desktops, list the applications which are + * inhibiting the screensaver or other power-saving features. + * + * This hint lets you specify the "activity name" sent to the OS when + * SDL_DisableScreenSaver() is used (or the screensaver is automatically + * disabled). The contents of this hint are used when the screensaver is + * disabled. You should use a string that describes what your program is doing + * (and, therefore, why the screensaver is disabled). For example, "Playing a + * game" or "Watching a video". + * + * Setting this to "" or leaving it unset will have SDL use a reasonable + * default: "Playing a game" or something similar. + * + * On targets where this is not supported, this hint does nothing. + */} +SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME = 'SDL_SCREENSAVER_INHIBIT_ACTIVITY_NAME'; + +{/** + * \brief A variable controlling whether X11 should use GLX or EGL by default + * + * This variable can be set to the following values: + * "0" - Use GLX + * "1" - Use EGL + * + * By default SDL will use GLX when both are present. + */} +SDL_HINT_VIDEO_X11_FORCE_EGL = 'SDL_VIDEO_X11_FORCE_EGL'; + +{/** + * \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used. + * + * This variable can be set to the following values: + * "0" - Disable _NET_WM_BYPASS_COMPOSITOR + * "1" - Enable _NET_WM_BYPASS_COMPOSITOR + * + * By default SDL will use _NET_WM_BYPASS_COMPOSITOR + * + */} +SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR = 'SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR'; + +{/** + * \brief A variable forcing the visual ID chosen for new X11 windows + * + */} +SDL_HINT_VIDEO_X11_WINDOW_VISUALID = 'SDL_VIDEO_X11_WINDOW_VISUALID'; + +{/** + * \brief A variable controlling whether the X11 VidMode extension should be used. + * + * This variable can be set to the following values: + * "0" - Disable XVidMode + * "1" - Enable XVidMode + * + * By default SDL will use XVidMode if it is available. + */} +SDL_HINT_VIDEO_X11_XVIDMODE = 'SDL_VIDEO_X11_XVIDMODE'; + +{/** + * \brief A variable controlling whether the X11 Xinerama extension should be used. + * + * This variable can be set to the following values: + * "0" - Disable Xinerama + * "1" - Enable Xinerama + * + * By default SDL will use Xinerama if it is available. + */} +SDL_HINT_VIDEO_X11_XINERAMA = 'SDL_VIDEO_X11_XINERAMA'; + +{/** + * \brief A variable controlling whether the X11 XRandR extension should be used. + * + * This variable can be set to the following values: + * "0" - Disable XRandR + * "1" - Enable XRandR + * + * By default SDL will not use XRandR because of window manager issues. + */} +SDL_HINT_VIDEO_X11_XRANDR = 'SDL_VIDEO_X11_XRANDR'; + +{/** + * \brief A variable controlling whether the X11 _NET_WM_PING protocol should be supported. + * + * This variable can be set to the following values: + * "0" - Disable _NET_WM_PING + * "1" - Enable _NET_WM_PING + * + * By default SDL will use _NET_WM_PING, but for applications that know they + * will not always be able to respond to ping requests in a timely manner they can + * turn it off to avoid the window manager thinking the app is hung. + * The hint is checked in CreateWindow. + */} +SDL_HINT_VIDEO_X11_NET_WM_PING = 'SDL_VIDEO_X11_NET_WM_PING'; + +{/** + * \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden + * + * This variable can be set to the following values: + * "0" - The window frame is not interactive when the cursor is hidden (no move, resize, etc) + * "1" - The window frame is interactive when the cursor is hidden + * + * By default SDL will allow interaction with the window frame when the cursor is hidden + */} +SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN = 'SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN'; + +{/** +* \brief A variable controlling whether the window is activated when the SDL_ShowWindow function is called +* +* This variable can be set to the following values: +* "0" - The window is activated when the SDL_ShowWindow function is called +* "1" - The window is not activated when the SDL_ShowWindow function is called +* +* By default SDL will activate the window when the SDL_ShowWindow function is called +*/} +SDL_HINT_WINDOW_NO_ACTIVATION_WHEN_SHOWN = 'SDL_WINDOW_NO_ACTIVATION_WHEN_SHOWN'; + +{/** + * \brief A variable controlling whether the windows message loop is processed by SDL + * + * This variable can be set to the following values: + * "0" - The window message loop is not run + * "1" - The window message loop is processed in SDL_PumpEvents() + * + * By default SDL will process the windows message loop + */} +SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP = 'SDL_WINDOWS_ENABLE_MESSAGELOOP'; + +{/** + * \brief Force SDL to use Critical Sections for mutexes on Windows. + * On Windows 7 and newer, Slim Reader/Writer Locks are available. + * They offer better performance, allocate no kernel ressources and + * use less memory. SDL will fall back to Critical Sections on older + * OS versions or if forced to by this hint. + * + * This variable can be set to the following values: + * "0" - Use SRW Locks when available. If not, fall back to Critical Sections. (default) + * "1" - Force the use of Critical Sections in all cases. + * + */} +SDL_HINT_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS = 'SDL_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS'; + +{/** + * \brief Force SDL to use Kernel Semaphores on Windows. + * Kernel Semaphores are inter-process and require a context + * switch on every interaction. On Windows 8 and newer, the + * WaitOnAddress API is available. Using that and atomics to + * implement semaphores increases performance. + * SDL will fall back to Kernel Objects on older OS versions + * or if forced to by this hint. + * + * This variable can be set to the following values: + * "0" - Use Atomics and WaitOnAddress API when available. If not, fall back to Kernel Objects. (default) + * "1" - Force the use of Kernel Objects in all cases. + * + */} +SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL = 'SDL_WINDOWS_FORCE_SEMAPHORE_KERNEL'; + +{/** + * \brief A variable to specify custom icon resource id from RC file on Windows platform + */} +SDL_HINT_WINDOWS_INTRESOURCE_ICON = 'SDL_WINDOWS_INTRESOURCE_ICON'; +SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL = 'SDL_WINDOWS_INTRESOURCE_ICON_SMALL'; + +{/** + * \brief Use the D3D9Ex API introduced in Windows Vista, instead of normal D3D9. + * Direct3D 9Ex contains changes to state management that can eliminate device + * loss errors during scenarios like Alt+Tab or UAC prompts. D3D9Ex may require + * some changes to your application to cope with the new behavior, so this + * is disabled by default. + * + * This hint must be set before initializing the video subsystem. + * + * For more information on Direct3D 9Ex, see: + * - https://docs.microsoft.com/en-us/windows/win32/direct3darticles/graphics-apis-in-windows-vista#direct3d-9ex + * - https://docs.microsoft.com/en-us/windows/win32/direct3darticles/direct3d-9ex-improvements + * + * This variable can be set to the following values: + * "0" - Use the original Direct3D 9 API (default) + * "1" - Use the Direct3D 9Ex API on Vista and later (and fall back if D3D9Ex is unavailable) + * + */} +SDL_HINT_WINDOWS_USE_D3D9EX = 'SDL_WINDOWS_USE_D3D9EX'; + +{** + * \brief Controls whether SDL will declare the process to be DPI aware. + * + * This hint must be set before initializing the video subsystem. + * + * The main purpose of declaring DPI awareness is to disable OS bitmap scaling of SDL windows on monitors with + * a DPI scale factor. + * + * This hint is equivalent to requesting DPI awareness via external means (e.g. calling SetProcessDpiAwarenessContext) + * and does not cause SDL to use a virtualized coordinate system, so it will generally give you 1 SDL coordinate = 1 pixel + * even on high-DPI displays. + * + * For more information, see: + * https://docs.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows + * + * This variable can be set to the following values: + * "" - Do not change the DPI awareness (default). + * "unaware" - Declare the process as DPI unaware. (Windows 8.1 and later). + * "system" - Request system DPI awareness. (Vista and later). + * "permonitor" - Request per-monitor DPI awareness. (Windows 8.1 and later). + * "permonitorv2" - Request per-monitor V2 DPI awareness. (Windows 10, version 1607 and later). + * The most visible difference from "permonitor" is that window title bar will be scaled + * to the visually correct size when dragging between monitors with different scale factors. + * This is the preferred DPI awareness level. + * + * If the requested DPI awareness is not available on the currently running OS, SDL will try to request the best + * available match. + *} +SDL_HINT_WINDOWS_DPI_AWARENESS = 'SDL_WINDOWS_DPI_AWARENESS'; + +{** + * \brief Uses DPI-scaled points as the SDL coordinate system on Windows. + * + * This changes the SDL coordinate system units to be DPI-scaled points, rather than pixels everywhere. + * This means windows will be appropriately sized, even when created on high-DPI displays with scaling. + * + * e.g. requesting a 640x480 window from SDL, on a display with 125% scaling in Windows display settings, + * will create a window with an 800x600 client area (in pixels). + * + * Setting this to "1" implicitly requests process DPI awareness (setting SDL_WINDOWS_DPI_AWARENESS is unnecessary), + * and forces SDL_WINDOW_ALLOW_HIGHDPI on all windows. + * + * This variable can be set to the following values: + * "0" - SDL coordinates equal Windows coordinates. No automatic window resizing when dragging + * between monitors with different scale factors (unless this is performed by + * Windows itself, which is the case when the process is DPI unaware). + * "1" - SDL coordinates are in DPI-scaled points. Automatically resize windows as needed on + * displays with non-100% scale factors. + *} +SDL_HINT_WINDOWS_DPI_SCALING = 'SDL_WINDOWS_DPI_SCALING'; + +{/** + * \brief A variable controlling whether grabbing input grabs the keyboard + * + * This variable can be set to the following values: + * "0" - Grab will affect only the mouse + * "1" - Grab will affect mouse and keyboard + * + * By default SDL will not grab the keyboard so system shortcuts still work. + */} +SDL_HINT_GRAB_KEYBOARD = 'SDL_GRAB_KEYBOARD'; + +{** + * \brief A variable containing a list of devices to ignore in SDL_hid_enumerate() + * + * For example, to ignore the Shanwan DS3 controller and any Valve controller, you might + * have the string "0x2563/0x0523,0x28de/0x0000". + * + * This hint is available since SDL 2.26.0. + *} +SDL_HINT_HIDAPI_IGNORE_DEVICES = 'SDL_HIDAPI_IGNORE_DEVICES'; + +{** + * \brief A variable controlling whether the mouse is captured while mouse buttons are pressed + * + * This variable can be set to the following values: + * "0" - The mouse is not captured while mouse buttons are pressed + * "1" - The mouse is captured while mouse buttons are pressed + * + * By default the mouse is captured while mouse buttons are pressed so if the mouse is dragged + * outside the window, the application continues to receive mouse events until the button is + * released. + *} +SDL_HINT_MOUSE_AUTO_CAPTURE = 'SDL_MOUSE_AUTO_CAPTURE'; + +{/** + * \brief A variable setting the double click radius, in pixels. + */} +SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS = 'SDL_MOUSE_DOUBLE_CLICK_RADIUS'; + +{/** + * \brief A variable setting the double click time, in milliseconds. + */} +SDL_HINT_MOUSE_DOUBLE_CLICK_TIME = 'SDL_MOUSE_DOUBLE_CLICK_TIME'; + +{/** + * \brief Allow mouse click events when clicking to focus an SDL window + * + * This variable can be set to the following values: + * "0" - Ignore mouse clicks that activate a window + * "1" - Generate events for mouse clicks that activate a window + * + * By default SDL will ignore mouse clicks that activate a window + */} +SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH = 'SDL_MOUSE_FOCUS_CLICKTHROUGH'; + +{/** + * \brief A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode + */} +SDL_HINT_MOUSE_NORMAL_SPEED_SCALE = 'SDL_MOUSE_NORMAL_SPEED_SCALE'; + +{** + * \brief A variable controlling whether relative mouse mode constrains the mouse to the center of the window + * + * This variable can be set to the following values: + * "0" - Relative mouse mode constrains the mouse to the window + * "1" - Relative mouse mode constrains the mouse to the center of the window + * + * Constraining to the center of the window works better for FPS games and when the + * application is running over RDP. Constraining to the whole window works better + * for 2D games and increases the chance that the mouse will be in the correct + * position when using high DPI mice. + * + * By default SDL will constrain the mouse to the center of the window + *} +SDL_HINT_MOUSE_RELATIVE_MODE_CENTER = 'SDL_MOUSE_RELATIVE_MODE_CENTER'; + +{/** + * \brief A variable controlling whether relative mouse mode is implemented using mouse warping + * + * This variable can be set to the following values: + * "0" - Relative mouse mode uses raw input + * "1" - Relative mouse mode uses mouse warping + * + * By default SDL will use raw input for relative mouse mode + */} +SDL_HINT_MOUSE_RELATIVE_MODE_WARP = 'SDL_MOUSE_RELATIVE_MODE_WARP'; + +{/** + * \brief A variable controlling whether relative mouse motion is affected by renderer scaling + * + * This variable can be set to the following values: + * "0" - Relative motion is unaffected by DPI or renderer's logical size + * "1" - Relative motion is scaled according to DPI scaling and logical size + * + * By default relative mouse deltas are affected by DPI and renderer scaling + */} +SDL_HINT_MOUSE_RELATIVE_SCALING = 'SDL_MOUSE_RELATIVE_SCALING'; + +{/** + * \brief A variable setting the scale for mouse motion, in floating point, when the mouse is in relative mode + */} +SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE = 'SDL_MOUSE_RELATIVE_SPEED_SCALE'; + +{** + * \brief A variable controlling whether the system mouse acceleration curve is used for relative mouse motion. + * + * This variable can be set to the following values: + * "0" - Relative mouse motion will be unscaled (the default) + * "1" - Relative mouse motion will be scaled using the system mouse acceleration curve. + * + * If SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE is set, that will override the system speed scale. + * + * This hint is available since SDL 2.26.0. + *} +SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE = 'SDL_MOUSE_RELATIVE_SYSTEM_SCALE'; + +{** + * \brief A variable controlling whether a motion event should be generated for mouse warping in relative mode. + * + * This variable can be set to the following values: + * "0" - Warping the mouse will not generate a motion event in relative mode + * "1" - Warping the mouse will generate a motion event in relative mode + * + * By default warping the mouse will not generate motion events in relative mode. This avoids the application having to filter out large relative motion due to warping. + *} +SDL_HINT_MOUSE_RELATIVE_WARP_MOTION = 'SDL_MOUSE_RELATIVE_WARP_MOTION'; + +{/** + * \brief A variable controlling whether mouse events should generate synthetic touch events + * + * This variable can be set to the following values: + * "0" - Mouse events will not generate touch events (default for desktop platforms) + * "1" - Mouse events will generate touch events (default for mobile platforms, such as Android and iOS) + */} +SDL_HINT_MOUSE_TOUCH_EVENTS = 'SDL_MOUSE_TOUCH_EVENTS'; + +{/** + * \brief Controls how the fact chunk affects the loading of a WAVE file. + * + * The fact chunk stores information about the number of samples of a WAVE + * file. The Standards Update from Microsoft notes that this value can be used + * to 'determine the length of the data in seconds'. This is especially useful + * for compressed formats (for which this is a mandatory chunk) if they produce + * multiple sample frames per block and truncating the block is not allowed. + * The fact chunk can exactly specify how many sample frames there should be + * in this case. + * + * Unfortunately, most application seem to ignore the fact chunk and so SDL + * ignores it by default as well. + * + * This variable can be set to the following values: + * + * "truncate" - Use the number of samples to truncate the wave data if + * the fact chunk is present and valid + * "strict" - Like "truncate", but raise an error if the fact chunk + * is invalid, not present for non-PCM formats, or if the + * data chunk doesn't have that many samples + * "ignorezero" - Like "truncate", but ignore fact chunk if the number of + * samples is zero + * "ignore" - Ignore fact chunk entirely (default) + */} +SDL_HINT_WAVE_FACT_CHUNK = 'SDL_WAVE_FACT_CHUNK'; + +{/** + * \brief Controls how the size of the RIFF chunk affects the loading of a WAVE file. + * + * The size of the RIFF chunk (which includes all the sub-chunks of the WAVE + * file) is not always reliable. In case the size is wrong, it's possible to + * just ignore it and step through the chunks until a fixed limit is reached. + * + * Note that files that have trailing data unrelated to the WAVE file or + * corrupt files may slow down the loading process without a reliable boundary. + * By default, SDL stops after 10000 chunks to prevent wasting time. Use the + * environment variable SDL_WAVE_CHUNK_LIMIT to adjust this value. + * + * This variable can be set to the following values: + * + * "force" - Always use the RIFF chunk size as a boundary for the chunk search + * "ignorezero" - Like "force", but a zero size searches up to 4 GiB (default) + * "ignore" - Ignore the RIFF chunk size and always search up to 4 GiB + * "maximum" - Search for chunks until the end of file (not recommended) + */} +SDL_HINT_WAVE_RIFF_CHUNK_SIZE = 'SDL_WAVE_RIFF_CHUNK_SIZE'; + +{/** + * \brief Controls how a truncated WAVE file is handled. + * + * A WAVE file is considered truncated if any of the chunks are incomplete or + * the data chunk size is not a multiple of the block size. By default, SDL + * decodes until the first incomplete block, as most applications seem to do. + * + * This variable can be set to the following values: + * + * "verystrict" - Raise an error if the file is truncated + * "strict" - Like "verystrict", but the size of the RIFF chunk is ignored + * "dropframe" - Decode until the first incomplete sample frame + * "dropblock" - Decode until the first incomplete block (default) + */} +SDL_HINT_WAVE_TRUNCATION = 'SDL_WAVE_TRUNCATION'; + +{/** + * \brief Minimize your SDL_Window if it loses key focus when in Fullscreen mode. Defaults to true. + * + */} +SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS = 'SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS'; + +{/** + * \brief A variable controlling whether the idle timer is disabled on iOS. + * + * When an iOS app does not receive touches for some time, the screen is + * dimmed automatically. For games where the accelerometer is the only input + * this is problematic. This functionality can be disabled by setting this + * hint. + * + * As of SDL 2.0.4, SDL_EnableScreenSaver() and SDL_DisableScreenSaver() + * accomplish the same thing on iOS. They should be preferred over this hint. + * + * This variable can be set to the following values: + * "0" - Enable idle timer + * "1" - Disable idle timer + */} +SDL_HINT_IDLE_TIMER_DISABLED = 'SDL_IOS_IDLE_TIMER_DISABLED'; + +{/** + * \brief A variable controlling what driver to use for OpenGL ES contexts. + * + * On some platforms, currently Windows and X11, OpenGL drivers may support + * creating contexts with an OpenGL ES profile. By default SDL uses these + * profiles, when available, otherwise it attempts to load an OpenGL ES + * library, e.g. that provided by the ANGLE project. This variable controls + * whether SDL follows this default behaviour or will always load an + * OpenGL ES library. + * + * Circumstances where this is useful include + * - Testing an app with a particular OpenGL ES implementation, e.g ANGLE, + * or emulator, e.g. those from ARM, Imagination or Qualcomm. + * - Resolving OpenGL ES function addresses at link time by linking with + * the OpenGL ES library instead of querying them at run time with + * SDL_GL_GetProcAddress(). + * + * Caution: for an application to work with the default behaviour across + * different OpenGL drivers it must query the OpenGL ES function + * addresses at run time using SDL_GL_GetProcAddress(). + * + * This variable is ignored on most platforms because OpenGL ES is native + * or not supported. + * + * This variable can be set to the following values: + * "0" - Use ES profile of OpenGL, if available. (Default when not set.) + * "1" - Load OpenGL ES library using the default library names. + * + */} +SDL_HINT_OPENGL_ES_DRIVER = 'SDL_OPENGL_ES_DRIVER'; + +{/** + * \brief A variable controlling which orientations are allowed on iOS. + * + * In some circumstances it is necessary to be able to explicitly control + * which UI orientations are allowed. + * + * This variable is a space delimited list of the following values: + * "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown" + */} +SDL_HINT_ORIENTATIONS = 'SDL_IOS_ORIENTATIONS'; + +{/** + * \brief A variable controlling the use of a sentinel event when polling the event queue + * + * This variable can be set to the following values: + * "0" - Disable poll sentinels + * "1" - Enable poll sentinels + * + * When polling for events, SDL_PumpEvents is used to gather new events from devices. + * If a device keeps producing new events between calls to SDL_PumpEvents, a poll loop will + * become stuck until the new events stop. + * This is most noticable when moving a high frequency mouse. + * + * By default, poll sentinels are enabled. + */} +SDL_HINT_POLL_SENTINEL = 'SDL_POLL_SENTINEL'; + +{/** + * \brief Override for SDL_GetPreferredLocales() + * + * If set, this will be favored over anything the OS might report for the + * user's preferred locales. Changing this hint at runtime will not generate + * a SDL_LOCALECHANGED event (but if you can change the hint, you can push + * your own event, if you want). + * + * The format of this hint is a comma-separated list of language and locale, + * combined with an underscore, as is a common format: "en_GB". Locale is + * optional: "en". So you might have a list like this: "en_GB,jp,es_PT" + */} +SDL_HINT_PREFERRED_LOCALES = 'SDL_PREFERRED_LOCALES'; + +{/** + * \brief A variable describing the content orientation on QtWayland-based platforms. + * + * On QtWayland platforms, windows are rotated client-side to allow for custom + * transitions. In order to correctly position overlays (e.g. volume bar) and + * gestures (e.g. events view, close/minimize gestures), the system needs to + * know in which orientation the application is currently drawing its contents. + * + * This does not cause the window to be rotated or resized, the application + * needs to take care of drawing the content in the right orientation (the + * framebuffer is always in portrait mode). + * + * This variable can be one of the following values: + * "primary" (default), "portrait", "landscape", "inverted-portrait", "inverted-landscape" + */} +SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION = 'SDL_QTWAYLAND_CONTENT_ORIENTATION'; + +{/** + * \brief Flags to set on QtWayland windows to integrate with the native window manager. + * + * On QtWayland platforms, this hint controls the flags to set on the windows. + * For example, on Sailfish OS "OverridesSystemGestures" disables swipe gestures. + * + * This variable is a space-separated list of the following values (empty = no flags): + * "OverridesSystemGestures", "StaysOnTop", "BypassWindowManager" + */} +SDL_HINT_QTWAYLAND_WINDOW_FLAGS = 'SDL_QTWAYLAND_WINDOW_FLAGS'; + +{** + * \brief Specify an application name. + * + * This hint lets you specify the application name sent to the OS when + * required. For example, this will often appear in volume control applets for + * audio streams, and in lists of applications which are inhibiting the + * screensaver. You should use a string that describes your program ("My Game + * 2: The Revenge") + * + * Setting this to "" or leaving it unset will have SDL use a reasonable + * default: probably the application's name or "SDL Application" if SDL + * doesn't have any better information. + * + * Note that, for audio streams, this can be overridden with + * SDL_HINT_AUDIO_DEVICE_APP_NAME. + * + * On targets where this is not supported, this hint does nothing. + *} +SDL_HINT_APP_NAME = 'SDL_APP_NAME'; + +{/** + * \brief A variable controlling whether controllers used with the Apple TV + * generate UI events. + * + * When UI events are generated by controller input, the app will be + * backgrounded when the Apple TV remote's menu button is pressed, and when the + * pause or B buttons on gamepads are pressed. + * + * More information about properly making use of controllers for the Apple TV + * can be found here: + * https://developer.apple.com/tvos/human-interface-guidelines/remote-and-controllers/ + * + * This variable can be set to the following values: + * "0" - Controller input does not generate UI events (the default). + * "1" - Controller input generates UI events. + */} +SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS = 'SDL_APPLE_TV_CONTROLLER_UI_EVENTS'; + +{/** + * \brief A variable controlling whether the Apple TV remote's joystick axes + * will automatically match the rotation of the remote. + * + * This variable can be set to the following values: + * "0" - Remote orientation does not affect joystick axes (the default). + * "1" - Joystick axes are based on the orientation of the remote. + */} +SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION = 'SDL_APPLE_TV_REMOTE_ALLOW_ROTATION'; + +{/** + * \brief A variable controlling whether the Android / iOS built-in + * accelerometer should be listed as a joystick device, rather than listing + * actual joysticks only. + * + * This variable can be set to the following values: + * "0" - List only real joysticks and accept input from them + * "1" - List real joysticks along with the accelerometer as if it were a 3 axis joystick (the default). + */} +SDL_HINT_ACCELEROMETER_AS_JOYSTICK = 'SDL_ACCELEROMETER_AS_JOYSTICK'; + +{/** + * \brief Specify the behavior of Alt+Tab while the keyboard is grabbed. + * + * By default, SDL emulates Alt+Tab functionality while the keyboard is grabbed + * and your window is full-screen. This prevents the user from getting stuck in + * your application if you've enabled keyboard grab. + * + * The variable can be set to the following values: + * "0" - SDL will not handle Alt+Tab. Your application is responsible + for handling Alt+Tab while the keyboard is grabbed. + * "1" - SDL will minimize your window when Alt+Tab is pressed (default) +*/} +SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED = 'SDL_ALLOW_ALT_TAB_WHILE_GRABBED'; + +{/** + * \brief A variable controlling the audio category on iOS and Mac OS X + * + * This variable can be set to the following values: + * + * "ambient" - Use the AVAudioSessionCategoryAmbient audio category, will be muted by the phone mute switch (default) + * "playback" - Use the AVAudioSessionCategoryPlayback category + * + * For more information, see Apple's documentation: + * https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategoriesandModes/AudioSessionCategoriesandModes.html + */} +SDL_HINT_AUDIO_CATEGORY = 'SDL_AUDIO_CATEGORY'; + +{/** + * \brief Specify an application name for an audio device. + * + * Some audio backends (such as PulseAudio) allow you to describe your audio + * stream. Among other things, this description might show up in a system + * control panel that lets the user adjust the volume on specific audio + * streams instead of using one giant master volume slider. + * + * This hints lets you transmit that information to the OS. The contents of + * this hint are used while opening an audio device. You should use a string + * that describes your program ("My Game 2: The Revenge") + * + * Setting this to "" or leaving it unset will have SDL use a reasonable + * default: this will be the name set with SDL_HINT_APP_NAME, if that hint is + * set. Otherwise, it'll probably the application's name or "SDL Application" + * if SDL doesn't have any better information. + * + * On targets where this is not supported, this hint does nothing. + *} +SDL_HINT_AUDIO_DEVICE_APP_NAME = 'SDL_AUDIO_DEVICE_APP_NAME'; + +{/** + * \brief Specify an application name for an audio device. + * + * Some audio backends (such as PulseAudio) allow you to describe your audio + * stream. Among other things, this description might show up in a system + * control panel that lets the user adjust the volume on specific audio + * streams instead of using one giant master volume slider. + * + * This hints lets you transmit that information to the OS. The contents of + * this hint are used while opening an audio device. You should use a string + * that describes your what your program is playing ("audio stream" is + * probably sufficient in many cases, but this could be useful for something + * like "team chat" if you have a headset playing VoIP audio separately). + * + * Setting this to "" or leaving it unset will have SDL use a reasonable + * default: "audio stream" or something similar. + * + * On targets where this is not supported, this hint does nothing. + */} +SDL_HINT_AUDIO_DEVICE_STREAM_NAME = 'SDL_AUDIO_DEVICE_STREAM_NAME'; + +{/** + * \brief Specify an application role for an audio device. + * + * Some audio backends (such as Pipewire) allow you to describe the role of + * your audio stream. Among other things, this description might show up in + * a system control panel or software for displaying and manipulating media + * playback/capture graphs. + * + * This hints lets you transmit that information to the OS. The contents of + * this hint are used while opening an audio device. You should use a string + * that describes your what your program is playing (Game, Music, Movie, + * etc...). + * + * Setting this to "" or leaving it unset will have SDL use a reasonable + * default: "Game" or something similar. + * + * On targets where this is not supported, this hint does nothing. + */} +SDL_HINT_AUDIO_DEVICE_STREAM_ROLE = 'SDL_AUDIO_DEVICE_STREAM_ROLE'; + +{/** + * \brief A variable that causes SDL to not ignore audio "monitors" + * + * This is currently only used for PulseAudio and ignored elsewhere. + * + * By default, SDL ignores audio devices that aren't associated with physical + * hardware. Changing this hint to "1" will expose anything SDL sees that + * appears to be an audio source or sink. This will add "devices" to the list + * that the user probably doesn't want or need, but it can be useful in + * scenarios where you want to hook up SDL to some sort of virtual device, + * etc. + * + * The default value is "0". This hint must be set before SDL_Init(). + * + * This hint is available since SDL 2.0.16. Before then, virtual devices are + * always ignored. + */} +SDL_HINT_AUDIO_INCLUDE_MONITORS = 'SDL_AUDIO_INCLUDE_MONITORS'; + +{/** + * \brief A variable controlling speed/quality tradeoff of audio resampling. + * + * If available, SDL can use libsamplerate ( http://www.mega-nerd.com/SRC/ ) + * to handle audio resampling. There are different resampling modes available + * that produce different levels of quality, using more CPU. + * + * If this hint isn't specified to a valid setting, or libsamplerate isn't + * available, SDL will use the default, internal resampling algorithm. + * + * Note that this is currently only applicable to resampling audio that is + * being written to a device for playback or audio being read from a device + * for capture. SDL_AudioCVT always uses the default resampler (although this + * might change for SDL 2.1). + * + * This hint is currently only checked at audio subsystem initialization. + * + * This variable can be set to the following values: + * + * "0" or "default" - Use SDL's internal resampling (Default when not set - low quality, fast) + * "1" or "fast" - Use fast, slightly higher quality resampling, if available + * "2" or "medium" - Use medium quality resampling, if available + * "3" or "best" - Use high quality resampling, if available + */} +SDL_HINT_AUDIO_RESAMPLING_MODE = 'SDL_AUDIO_RESAMPLING_MODE'; + +{** + * \brief A variable controlling whether SDL updates joystick state when getting input events + * + * This variable can be set to the following values: + * + * "0" - You'll call SDL_JoystickUpdate() manually + * "1" - SDL will automatically call SDL_JoystickUpdate() (default) + * + * This hint can be toggled on and off at runtime. + */} +SDL_HINT_AUTO_UPDATE_JOYSTICKS = 'SDL_AUTO_UPDATE_JOYSTICKS'; + +{/** + * \brief A variable controlling whether SDL updates sensor state when getting input events + * + * This variable can be set to the following values: + * + * "0" - You'll call SDL_SensorUpdate() manually + * "1" - SDL will automatically call SDL_SensorUpdate() (default) + * + * This hint can be toggled on and off at runtime. + */} +SDL_HINT_AUTO_UPDATE_SENSORS = 'SDL_AUTO_UPDATE_SENSORS'; + +{/** + * \brief Mark X11 windows as override-redirect. + * + * If set, this _might_ increase framerate at the expense of the desktop + * not working as expected. Override-redirect windows aren't noticed by the + * window manager at all. + * + * You should probably only use this for fullscreen windows, and you probably + * shouldn't even use it for that. But it's here if you want to try! + */} +SDL_HINT_X11_FORCE_OVERRIDE_REDIRECT = 'SDL_X11_FORCE_OVERRIDE_REDIRECT'; + +{** + * \brief A variable that forces X11 windows to create as a custom type. + * + * This is currently only used for X11 and ignored elsewhere. + * + * During SDL_CreateWindow, SDL uses the _NET_WM_WINDOW_TYPE X11 property + * to report to the window manager the type of window it wants to create. + * This might be set to various things if SDL_WINDOW_TOOLTIP or + * SDL_WINDOW_POPUP_MENU, etc, were specified. For "normal" windows that + * haven't set a specific type, this hint can be used to specify a custom + * type. For example, a dock window might set this to + * "_NET_WM_WINDOW_TYPE_DOCK". + * + * If not set or set to "", this hint is ignored. This hint must be set + * before the SDL_CreateWindow() call that it is intended to affect. + * + *} +SDL_HINT_X11_WINDOW_TYPE = 'SDL_X11_WINDOW_TYPE'; + +{/** + * \brief A variable that lets you disable the detection and use of Xinput gamepad devices + * + * The variable can be set to the following values: + * "0" - Disable XInput timer (only uses direct input) + * "1" - Enable XInput timer (the default) + */} +SDL_HINT_XINPUT_ENABLED = 'SDL_XINPUT_ENABLED'; + +{** + * \brief A variable that lets you disable the detection and use of DirectInput gamepad devices + * + * The variable can be set to the following values: + * "0" - Disable DirectInput detection (only uses XInput) + * "1" - Enable DirectInput detection (the default) + *} +SDL_HINT_DIRECTINPUT_ENABLED = 'SDL_DIRECTINPUT_ENABLED'; + +{** + * \brief A variable that causes SDL to use the old axis and button mapping for XInput devices. + * + * This hint is for backwards compatibility only and will be removed in SDL 2.1 + * + * The default value is "0". This hint must be set before SDL_Init() + *} +SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING = 'SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING'; + +{/** + * \brief A variable that lets you manually hint extra gamecontroller db entries + * + * The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h + * + * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) + * You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping() + */} +SDL_HINT_GAMECONTROLLERCONFIG = 'SDL_GAMECONTROLLERCONFIG'; + +{/** + * \brief A variable that lets you provide a file with extra gamecontroller db entries. + * + * The file should contain lines of gamecontroller config data, see SDL_gamecontroller.h + * + * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) + * You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping() + */} +SDL_HINT_GAMECONTROLLERCONFIG_FILE = 'SDL_GAMECONTROLLERCONFIG_FILE'; + +{/** + * \brief A variable that overrides the automatic controller type detection + * + * The variable should be comma separated entries, in the form: VID/PID=type + * + * The VID and PID should be hexadecimal with exactly 4 digits, e.g. 0x00fd + * + * The type should be one of: + * Xbox360 + * XboxOne + * PS3 + * PS4 + * PS5 + * SwitchPro + * + * This hint affects what driver is used, and must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) + */} +SDL_HINT_GAMECONTROLLERTYPE = 'SDL_GAMECONTROLLERTYPE'; + +{/** + * \brief A variable containing a list of devices to skip when scanning for game controllers. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */} +SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES = 'SDL_GAMECONTROLLER_IGNORE_DEVICES'; + +{/** + * \brief If set, all devices will be skipped when scanning for game controllers except for the ones listed in this variable. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */} +SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT = 'SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT'; + +{/** + * \brief If set, game controller face buttons report their values according to their labels instead of their positional layout. + * + * For example, on Nintendo Switch controllers, normally you'd get: + * + * (Y) + * (X) (B) + * (A) + * + * but if this hint is set, you'll get: + * + * (X) + * (Y) (A) + * (B) + * + * The variable can be set to the following values: + * "0" - Report the face buttons by position, as though they were on an Xbox controller. + * "1" - Report the face buttons by label instead of position + * + * The default value is "1". This hint may be set at any time. + */} +SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS = 'SDL_GAMECONTROLLER_USE_BUTTON_LABELS'; + +{/** + * \brief A variable controlling whether the home indicator bar on iPhone X + * should be hidden. + * + * This variable can be set to the following values: + * "0" - The indicator bar is not hidden (default for windowed applications) + * "1" - The indicator bar is hidden and is shown when the screen is touched (useful for movie playback applications) + * "2" - The indicator bar is dim and the first swipe makes it visible and the second swipe performs the "home" action (default for fullscreen applications) + */} +SDL_HINT_IOS_HIDE_HOME_INDICATOR = 'SDL_IOS_HIDE_HOME_INDICATOR'; + +{/** + * \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background. + * + * The variable can be set to the following values: + * "0" - Disable joystick & gamecontroller input events when the + * application is in the background. + * "1" - Enable joystick & gamecontroller input events when the + * application is in the backgroumd. + * + * The default value is "0". This hint may be set at any time. + */} +SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS = 'SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS'; + +{/** + * \brief A comma separated list of devices to open as joysticks + * + * This variable is currently only used by the Linux joystick driver. + *} +SDL_HINT_JOYSTICK_DEVICE = 'SDL_JOYSTICK_DEVICE'; + +{** + * \brief A variable controlling whether "low_frequency_rumble" and "high_frequency_rumble" is used to implement + * the GameCube controller's 3 rumble modes, Stop(0), Rumble(1), and StopHard(2) + * this is useful for applications that need full compatibility for things like ADSR envelopes. + * Stop is implemented by setting "low_frequency_rumble" to "0" and "high_frequency_rumble" ">0" + * Rumble is both at any arbitrary value, + * StopHard is implemented by setting both "low_frequency_rumble" and "high_frequency_rumble" to "0" + * + * This variable can be set to the following values: + * "0" - Normal rumble behavior is behavior is used (default) + * "1" - Proper GameCube controller rumble behavior is used + * + *} +SDL_HINT_JOYSTICK_GAMECUBE_RUMBLE_BRAKE = 'SDL_JOYSTICK_GAMECUBE_RUMBLE_BRAKE'; + +{/** + * \brief A variable controlling whether the HIDAPI joystick drivers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI drivers are not used + * "1" - HIDAPI drivers are used (the default) + * + * This variable is the default for all drivers, but can be overridden by the hints for specific drivers below. + */} +SDL_HINT_JOYSTICK_HIDAPI = 'SDL_JOYSTICK_HIDAPI'; + +{/** + * \brief A variable controlling whether the HIDAPI driver for Nintendo GameCube controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */} +SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE = 'SDL_JOYSTICK_HIDAPI_GAMECUBE'; + +{/** + * \brief A variable controlling whether Switch Joy-Cons should be treated the same as Switch Pro Controllers when using the HIDAPI driver. + * + * This variable can be set to the following values: + * "0" - basic Joy-Con support with no analog input (the default) + * "1" - Joy-Cons treated as half full Pro Controllers with analog inputs and sensors + * + * This does not combine Joy-Cons into a single controller. That's up to the user. + */} +SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS = 'SDL_JOYSTICK_HIDAPI_JOY_CONS'; + +{** + * \brief A variable controlling whether Nintendo Switch Joy-Con controllers will be combined into a single Pro-like controller when using the HIDAPI driver + * + * This variable can be set to the following values: + * "0" - Left and right Joy-Con controllers will not be combined and each will be a mini-gamepad + * "1" - Left and right Joy-Con controllers will be combined into a single controller (the default) + *} +SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS = 'SDL_JOYSTICK_HIDAPI_COMBINE_JOY_CONS'; + +{** + * \brief A variable controlling whether Nintendo Switch Joy-Con controllers will be in vertical mode when using the HIDAPI driver + * + * This variable can be set to the following values: + * "0" - Left and right Joy-Con controllers will not be in vertical mode (the default) + * "1" - Left and right Joy-Con controllers will be in vertical mode + * + * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER). + * + * This hint is available since SDL 2.26.0. + *} +SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS = 'SDL_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS'; + +{/** + * \brief A variable controlling whether the HIDAPI driver for Amazon Luna controllers connected via Bluetooth should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */} +SDL_HINT_JOYSTICK_HIDAPI_LUNA = 'SDL_JOYSTICK_HIDAPI_LUNA'; + +{** + * \brief A variable controlling whether the HIDAPI driver for Nintendo Online classic controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + *} +SDL_HINT_JOYSTICK_HIDAPI_NINTENDO_CLASSIC = 'SDL_JOYSTICK_HIDAPI_NINTENDO_CLASSIC'; + +{** + * \brief A variable controlling whether the HIDAPI driver for NVIDIA SHIELD controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + *} +SDL_HINT_JOYSTICK_HIDAPI_SHIELD = 'SDL_JOYSTICK_HIDAPI_SHIELD'; + +{** + * \brief A variable controlling whether the HIDAPI driver for PS3 controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI on macOS, and "0" on other platforms. + * + * It is not possible to use this driver on Windows, due to limitations in the default drivers + * installed. See https://github.com/ViGEm/DsHidMini for an alternative driver on Windows. + * + * This hint is available since SDL 2.26.0. + *} +SDL_HINT_JOYSTICK_HIDAPI_PS3 = 'SDL_JOYSTICK_HIDAPI_PS3'; + +{/** + * \brief A variable controlling whether the HIDAPI driver for PS4 controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */} +SDL_HINT_JOYSTICK_HIDAPI_PS4 = 'SDL_JOYSTICK_HIDAPI_PS4'; + +{/** + * \brief A variable controlling whether extended input reports should be used for PS4 controllers when using the HIDAPI driver. + * + * This variable can be set to the following values: + * "0" - extended reports are not enabled (the default) + * "1" - extended reports + * + * Extended input reports allow rumble on Bluetooth PS4 controllers, but + * break DirectInput handling for applications that don't use SDL. + * + * Once extended reports are enabled, they can not be disabled without + * power cycling the controller. + * + * For compatibility with applications written for versions of SDL prior + * to the introduction of PS5 controller support, this value will also + * control the state of extended reports on PS5 controllers when the + * SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE hint is not explicitly set. + */} +SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE = 'SDL_JOYSTICK_HIDAPI_PS4_RUMBLE'; + +{/** + * \brief A variable controlling whether the HIDAPI driver for PS5 controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */} +SDL_HINT_JOYSTICK_HIDAPI_PS5 = 'SDL_JOYSTICK_HIDAPI_PS5'; + +{/** + * \brief A variable controlling whether the player LEDs should be lit to indicate which player is associated with a PS5 controller. + * + * This variable can be set to the following values: + * "0" - player LEDs are not enabled + * "1" - player LEDs are enabled (the default) + */} +SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED = 'SDL_JOYSTICK_HIDAPI_PS5_PLAYER_LED'; + +{/** + * \brief A variable controlling whether extended input reports should be used for PS5 controllers when using the HIDAPI driver. + * + * This variable can be set to the following values: + * "0" - extended reports are not enabled (the default) + * "1" - extended reports + * + * Extended input reports allow rumble on Bluetooth PS5 controllers, but + * break DirectInput handling for applications that don't use SDL. + * + * Once extended reports are enabled, they can not be disabled without + * power cycling the controller. + * + * For compatibility with applications written for versions of SDL prior + * to the introduction of PS5 controller support, this value defaults to + * the value of SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE. + */} +SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE = 'SDL_JOYSTICK_HIDAPI_PS5_RUMBLE'; + +{/** + * \brief A variable controlling whether the HIDAPI driver for Google Stadia controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */} +SDL_HINT_JOYSTICK_HIDAPI_STADIA = 'SDL_JOYSTICK_HIDAPI_STADIA'; + +{/** + * \brief A variable controlling whether the HIDAPI driver for Steam Controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used for Steam Controllers, which requires Bluetooth access + * and may prompt the user for permission on iOS and Android. + * + * The default is "0" + */} +SDL_HINT_JOYSTICK_HIDAPI_STEAM = 'SDL_JOYSTICK_HIDAPI_STEAM'; + +{/** + * \brief A variable controlling whether the HIDAPI driver for Nintendo Switch controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */} +SDL_HINT_JOYSTICK_HIDAPI_SWITCH = 'SDL_JOYSTICK_HIDAPI_SWITCH'; + +{/** + * \brief A variable controlling whether the Home button LED should be turned on when a Nintendo Switch controller is opened + * + * This variable can be set to the following values: + * "0" - home button LED is turned off + * "1" - home button LED is turned on + * + * By default the Home button LED state is not changed. + */} +SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED = 'SDL_JOYSTICK_HIDAPI_SWITCH_HOME_LED'; + +{** + * \brief A variable controlling whether the Home button LED should be turned on when a Nintendo Switch Joy-Con controller is opened + * + * This variable can be set to the following values: + * "0" - home button LED is turned off + * "1" - home button LED is turned on + * + * By default the Home button LED state is not changed. This hint can also be set to a floating point value between 0.0 and 1.0 which controls the brightness of the Home button LED. + *} +SDL_HINT_JOYSTICK_HIDAPI_JOYCON_HOME_LED = 'SDL_JOYSTICK_HIDAPI_JOYCON_HOME_LED'; + +{** + * \brief A variable controlling whether the player LEDs should be lit to indicate which player is associated with a Nintendo Switch controller. + * + * This variable can be set to the following values: + * "0" - player LEDs are not enabled + * "1" - player LEDs are enabled (the default) + *} +SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED = 'SDL_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED'; + +{** + * \brief A variable controlling whether the HIDAPI driver for Nintendo Wii and Wii U controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * This driver doesn't work with the dolphinbar, so the default is SDL_FALSE for now. + * + * This hint is available since SDL 2.26.0. + *} +SDL_HINT_JOYSTICK_HIDAPI_WII = 'SDL_JOYSTICK_HIDAPI_WII'; + +{** + * \brief A variable controlling whether the player LEDs should be lit to indicate which player is associated with a Wii controller. + * + * This variable can be set to the following values: + * "0" - player LEDs are not enabled + * "1" - player LEDs are enabled (the default) + * + * This hiny is available since SDL 2.26.0. + *} +SDL_HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED = 'SDL_JOYSTICK_HIDAPI_WII_PLAYER_LED'; + +{/** + * \brief A variable controlling whether the HIDAPI driver for XBox controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is "0" on Windows, otherwise the value of SDL_HINT_JOYSTICK_HIDAPI + */} +SDL_HINT_JOYSTICK_HIDAPI_XBOX = 'SDL_JOYSTICK_HIDAPI_XBOX'; + +{** + * \brief A variable controlling whether the HIDAPI driver for XBox 360 controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI_XBOX. + * + * This hint is available since SDL 2.26.0. + *} +SDL_HINT_JOYSTICK_HIDAPI_XBOX_360 = 'SDL_JOYSTICK_HIDAPI_XBOX_360'; + +{** + * \brief A variable controlling whether the player LEDs should be lit to indicate which player is associated with an Xbox 360 controller. + * + * This variable can be set to the following values: + * "0" - player LEDs are not enabled + * "1" - player LEDs are enabled (the default) + * + * This hint is available since SDL 2.26.0. + *} +SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED = 'SDL_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED'; + +{** + * \brief A variable controlling whether the HIDAPI driver for XBox 360 wireless controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI_XBOX_360. + * + * This hint is available since SDL 2.26.0. + *} +SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS = 'SDL_JOYSTICK_HIDAPI_XBOX_360_WIRELESS'; + +{** + * \brief A variable controlling whether the HIDAPI driver for XBox One controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI_XBOX. + * + * This hint is available since SDL 2.26.0. + *} +SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE = 'SDL_JOYSTICK_HIDAPI_XBOX_ONE'; + +{** + * \brief A variable controlling whether the Home button LED should be turned on when an Xbox One controller is opened + * + * This variable can be set to the following values: + * "0" - home button LED is turned off + * "1" - home button LED is turned on + * + * By default the Home button LED state is not changed. This hint can also + * be set to a floating point value between 0.0 and 1.0 which controls + * the brightness of the Home button LED. The default brightness is 0.4. + * + * This hint is available since SDL 2.26.0. + *} +SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED = 'SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED'; + +{/** + * \brief A variable controlling whether the RAWINPUT joystick drivers should be used for better handling XInput-capable devices. + * + * This variable can be set to the following values: + * "0" - RAWINPUT drivers are not used + * "1" - RAWINPUT drivers are used (the default) + * + */} +SDL_HINT_JOYSTICK_RAWINPUT = 'SDL_JOYSTICK_RAWINPUT'; + +{/** + * \brief A variable controlling whether the RAWINPUT driver should pull correlated data from XInput. + * + * This variable can be set to the following values: + * "0" - RAWINPUT driver will only use data from raw input APIs + * "1" - RAWINPUT driver will also pull data from XInput, providing + * better trigger axes, guide button presses, and rumble support + * for Xbox controllers + * + * The default is "1". This hint applies to any joysticks opened after setting the hint. + */} +SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT = 'SDL_JOYSTICK_RAWINPUT_CORRELATE_XINPUT'; + +{** + * \brief A variable controlling whether the ROG Chakram mice should show up as joysticks + * + * This variable can be set to the following values: + * "0" - ROG Chakram mice do not show up as joysticks (the default) + * "1" - ROG Chakram mice show up as joysticks + *} +SDL_HINT_JOYSTICK_ROG_CHAKRAM = 'SDL_JOYSTICK_ROG_CHAKRAM'; + +{/** + * \brief A variable controlling whether a separate thread should be used + * for handling joystick detection and raw input messages on Windows + * + * This variable can be set to the following values: + * "0" - A separate thread is not used (the default) + * "1" - A separate thread is used for handling raw input messages + * + */} +SDL_HINT_JOYSTICK_THREAD = 'SDL_JOYSTICK_THREAD'; + +{/** + * \brief If set to 0 then never set the top most bit on a SDL Window, even if the video mode expects it. + * This is a debugging aid for developers and not expected to be used by end users. The default is "1" + * + * This variable can be set to the following values: + * "0" - don't allow topmost + * "1" - allow topmost + */} +SDL_HINT_ALLOW_TOPMOST = 'SDL_ALLOW_TOPMOST'; + +{/** + * \brief A variable that controls the timer resolution, in milliseconds. + * + * The higher resolution the timer, the more frequently the CPU services + * timer interrupts, and the more precise delays are, but this takes up + * power and CPU time. This hint is only used on Windows 7 and earlier. + * + * See this blog post for more information: + * http://randomascii.wordpress.com/2013/07/08/windows-timer-resolution-megawatts-wasted/ + * + * If this variable is set to "0", the system timer resolution is not set. + * + * The default value is "1". This hint may be set at any time. + */} +SDL_HINT_TIMER_RESOLUTION = 'SDL_TIMER_RESOLUTION'; + +{/** + * \brief Specifies whether SDL_THREAD_PRIORITY_TIME_CRITICAL should be treated as realtime. + * + * On some platforms, like Linux, a realtime priority thread may be subject to restrictions + * that require special handling by the application. This hint exists to let SDL know that + * the app is prepared to handle said restrictions. + * + * On Linux, SDL will apply the following configuration to any thread that becomes realtime: + * * The SCHED_RESET_ON_FORK bit will be set on the scheduling policy, + * * An RLIMIT_RTTIME budget will be configured to the rtkit specified limit. + * * Exceeding this limit will result in the kernel sending SIGKILL to the app, + * * Refer to the man pages for more information. + * + * This variable can be set to the following values: + * "0" - default platform specific behaviour + * "1" - Force SDL_THREAD_PRIORITY_TIME_CRITICAL to a realtime scheduling policy + */} +SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL = 'SDL_THREAD_FORCE_REALTIME_TIME_CRITICAL'; + +{/** +* \brief A string specifying additional information to use with SDL_SetThreadPriority. +* +* By default SDL_SetThreadPriority will make appropriate system changes in order to +* apply a thread priority. For example on systems using pthreads the scheduler policy +* is changed automatically to a policy that works well with a given priority. +* Code which has specific requirements can override SDL's default behavior with this hint. +* +* pthread hint values are "current", "other", "fifo" and "rr". +* Currently no other platform hint values are defined but may be in the future. +* +* \note On Linux, the kernel may send SIGKILL to realtime tasks which exceed the distro +* configured execution budget for rtkit. This budget can be queried through RLIMIT_RTTIME +* after calling SDL_SetThreadPriority(). +*/} +SDL_HINT_THREAD_PRIORITY_POLICY = 'SDL_THREAD_PRIORITY_POLICY'; + +{/** + * \brief A string specifying SDL's threads stack size in bytes or "0" for the backend's default size + * + * Use this hint in case you need to set SDL's threads stack size to other than the default. + * This is specially useful if you build SDL against a non glibc libc library (such as musl) which + * provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses). + * Support for this hint is currently available only in the pthread, Windows, and PSP backend. + */} +SDL_HINT_THREAD_STACK_SIZE = 'SDL_THREAD_STACK_SIZE'; + +{/** + * \brief A variable controlling whether touch events should generate synthetic mouse events + * + * This variable can be set to the following values: + * "0" - Touch events will not generate mouse events + * "1" - Touch events will generate mouse events + * + * By default SDL will generate mouse events for touch events + */} +SDL_HINT_TOUCH_MOUSE_EVENTS = 'SDL_TOUCH_MOUSE_EVENTS'; + +{** + * \brief A variable controlling which touchpad should generate synthetic mouse events + * + * This variable can be set to the following values: + * "0" - Only front touchpad should generate mouse events. Default + * "1" - Only back touchpad should generate mouse events. + * "2" - Both touchpads should generate mouse events. + * + * By default SDL will generate mouse events for all touch devices + *} +SDL_HINT_VITA_TOUCH_MOUSE_DEVICE = 'SDL_HINT_VITA_TOUCH_MOUSE_DEVICE'; + +{/** + * \brief A variable controlling whether the Android / tvOS remotes + * should be listed as joystick devices, instead of sending keyboard events. + * + * This variable can be set to the following values: + * "0" - Remotes send enter/escape/arrow key events + * "1" - Remotes are available as 2 axis, 2 button joysticks (the default). + */} +SDL_HINT_TV_REMOTE_AS_JOYSTICK = 'SDL_TV_REMOTE_AS_JOYSTICK'; + +{/** + * \brief If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and iOS) + */} +SDL_HINT_VIDEO_HIGHDPI_DISABLED = 'SDL_VIDEO_HIGHDPI_DISABLED'; + +{** + * \brief A variable controlling whether joysticks on Linux will always treat 'hat' axis inputs (ABS_HAT0X - ABS_HAT3Y) as 8-way digital hats without checking whether they may be analog. + * + * This variable can be set to the following values: + * "0" - Only map hat axis inputs to digital hat outputs if the input axes appear to actually be digital (the default) + * "1" - Always handle the input axes numbered ABS_HAT0X to ABS_HAT3Y as digital hats + *} +SDL_HINT_LINUX_DIGITAL_HATS = 'SDL_LINUX_DIGITAL_HATS'; + +{** + * \brief A variable controlling whether digital hats on Linux will apply deadzones to their underlying input axes or use unfiltered values. + * + * This variable can be set to the following values: + * "0" - Return digital hat values based on unfiltered input axis values + * "1" - Return digital hat values with deadzones on the input axes taken into account (the default) + *} +SDL_HINT_LINUX_HAT_DEADZONES = 'SDL_LINUX_HAT_DEADZONES'; + +{/** + * \brief A variable controlling whether to use the classic /dev/input/js* joystick interface or the newer /dev/input/event* joystick interface on Linux + * + * This variable can be set to the following values: + * "0" - Use /dev/input/event* + * "1" - Use /dev/input/js* + * + * By default the /dev/input/event* interfaces are used + */} +SDL_HINT_LINUX_JOYSTICK_CLASSIC = 'SDL_LINUX_JOYSTICK_CLASSIC'; + +{/** + * \brief A variable controlling whether joysticks on Linux adhere to their HID-defined deadzones or return unfiltered values. + * + * This variable can be set to the following values: + * "0" - Return unfiltered joystick axis values (the default) + * "1" - Return axis values with deadzones taken into account + */} +SDL_HINT_LINUX_JOYSTICK_DEADZONES = 'SDL_LINUX_JOYSTICK_DEADZONES'; + +{/** + * \brief A variable that determines whether ctrl+click should generate a right-click event on Mac + * + * If present, holding ctrl while left clicking will generate a right click + * event when on Mac. + */} +SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK = 'SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK'; + +{** + * \brief A variable controlling whether dispatching OpenGL context updates should block the dispatching thread until the main thread finishes processing + * + * This variable can be set to the following values: + * "0" - Dispatching OpenGL context updates will block the dispatching thread until the main thread finishes processing (default). + * "1" - Dispatching OpenGL context updates will allow the dispatching thread to continue execution. + * + * Generally you want the default, but if you have OpenGL code in a background thread on a Mac, and the main thread + * hangs because it's waiting for that background thread, but that background thread is also hanging because it's + * waiting for the main thread to do an update, this might fix your issue. + * + * This hint only applies to macOS. + * + * This hint is available since SDL 2.24.0. + *} +SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH = 'SDL_MAC_OPENGL_ASYNC_DISPATCH'; + +{/** + * \brief A variable specifying which shader compiler to preload when using the Chrome ANGLE binaries + * + * SDL has EGL and OpenGL ES2 support on Windows via the ANGLE project. It + * can use two different sets of binaries, those compiled by the user from source + * or those provided by the Chrome browser. In the later case, these binaries require + * that SDL loads a DLL providing the shader compiler. + * + * This variable can be set to the following values: + * "d3dcompiler_46.dll" - default, best for Vista or later. + * "d3dcompiler_43.dll" - for XP support. + * "none" - do not load any library, useful if you compiled ANGLE from source and included the compiler in your binaries. + * + */} +SDL_HINT_VIDEO_WIN_D3DCOMPILER = 'SDL_VIDEO_WIN_D3DCOMPILER'; + +{/** + * \brief A variable that is the address of another SDL_Window* (as a hex string formatted with "%p"). + * + * If this hint is set before SDL_CreateWindowFrom() and the SDL_Window* it is set to has + * SDL_WINDOW_OPENGL set (and running on WGL only, currently), then two things will occur on the newly + * created SDL_Window: + * + * 1. Its pixel format will be set to the same pixel format as this SDL_Window. This is + * needed for example when sharing an OpenGL context across multiple windows. + * + * 2. The flag SDL_WINDOW_OPENGL will be set on the new window so it can be used for + * OpenGL rendering. + * + * This variable can be set to the following values: + * The address (as a string "%p") of the SDL_Window* that new windows created with SDL_CreateWindowFrom() should + * share a pixel format with. + */} +SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT = 'SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT'; + +{** + * \brief When calling SDL_CreateWindowFrom(), make the window compatible with OpenGL. + * + * This variable can be set to the following values: + * "0" - Don't add any graphics flags to the SDL_WindowFlags + * "1" - Add SDL_WINDOW_OPENGL to the SDL_WindowFlags + * + * By default SDL will not make the foreign window compatible with OpenGL. + *} +SDL_HINT_VIDEO_FOREIGN_WINDOW_OPENGL = 'SDL_VIDEO_FOREIGN_WINDOW_OPENGL'; + +{** + * \brief When calling SDL_CreateWindowFrom(), make the window compatible with Vulkan. + * + * This variable can be set to the following values: + * "0" - Don't add any graphics flags to the SDL_WindowFlags + * "1" - Add SDL_WINDOW_VULKAN to the SDL_WindowFlags + * + * By default SDL will not make the foreign window compatible with Vulkan. + *} +SDL_HINT_VIDEO_FOREIGN_WINDOW_VULKAN = 'SDL_VIDEO_FOREIGN_WINDOW_VULKAN'; + +{/** + * \brief A URL to a WinRT app's privacy policy + * + * All network-enabled WinRT apps must make a privacy policy available to its + * users. On Windows 8, 8.1, and RT, Microsoft mandates that this policy be + * be available in the Windows Settings charm, as accessed from within the app. + * SDL provides code to add a URL-based link there, which can point to the app's + * privacy policy. + * + * To setup a URL to an app's privacy policy, set SDL_HINT_WINRT_PRIVACY_POLICY_URL + * before calling any SDL_Init() functions. The contents of the hint should + * be a valid URL. For example, "http://www.example.com". + * + * The default value is "", which will prevent SDL from adding a privacy policy + * link to the Settings charm. This hint should only be set during app init. + * + * The label text of an app's "Privacy Policy" link may be customized via another + * hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL. + * + * Please note that on Windows Phone, Microsoft does not provide standard UI + * for displaying a privacy policy link, and as such, SDL_HINT_WINRT_PRIVACY_POLICY_URL + * will not get used on that platform. Network-enabled phone apps should display + * their privacy policy through some other, in-app means. + */} +SDL_HINT_WINRT_PRIVACY_POLICY_URL = 'SDL_WINRT_PRIVACY_POLICY_URL'; + +{/** + * \brief Label text for a WinRT app's privacy policy link + * + * Network-enabled WinRT apps must include a privacy policy. On Windows 8, 8.1, and RT, + * Microsoft mandates that this policy be available via the Windows Settings charm. + * SDL provides code to add a link there, with its label text being set via the + * optional hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL. + * + * Please note that a privacy policy's contents are not set via this hint. A separate + * hint, SDL_HINT_WINRT_PRIVACY_POLICY_URL, is used to link to the actual text of the + * policy. + * + * The contents of this hint should be encoded as a UTF8 string. + * + * The default value is "Privacy Policy". This hint should only be set during app + * initialization, preferably before any calls to SDL_Init(). + * + * For additional information on linking to a privacy policy, see the documentation for + * SDL_HINT_WINRT_PRIVACY_POLICY_URL. + */} +SDL_HINT_WINRT_PRIVACY_POLICY_LABEL = 'SDL_WINRT_PRIVACY_POLICY_LABEL'; + +{/** + * \brief Allows back-button-press events on Windows Phone to be marked as handled + * + * Windows Phone devices typically feature a Back button. When pressed, + * the OS will emit back-button-press events, which apps are expected to + * handle in an appropriate manner. If apps do not explicitly mark these + * events as 'Handled', then the OS will invoke its default behavior for + * unhandled back-button-press events, which on Windows Phone 8 and 8.1 is to + * terminate the app (and attempt to switch to the previous app, or to the + * device's home screen). + * + * Setting the SDL_HINT_WINRT_HANDLE_BACK_BUTTON hint to "1" will cause SDL + * to mark back-button-press events as Handled, if and when one is sent to + * the app. + * + * Internally, Windows Phone sends back button events as parameters to + * special back-button-press callback functions. Apps that need to respond + * to back-button-press events are expected to register one or more + * callback functions for such, shortly after being launched (during the + * app's initialization phase). After the back button is pressed, the OS + * will invoke these callbacks. If the app's callback(s) do not explicitly + * mark the event as handled by the time they return, or if the app never + * registers one of these callback, the OS will consider the event + * un-handled, and it will apply its default back button behavior (terminate + * the app). + * + * SDL registers its own back-button-press callback with the Windows Phone + * OS. This callback will emit a pair of SDL key-press events (SDL_KEYDOWN + * and SDL_KEYUP), each with a scancode of SDL_SCANCODE_AC_BACK, after which + * it will check the contents of the hint, SDL_HINT_WINRT_HANDLE_BACK_BUTTON. + * If the hint's value is set to "1", the back button event's Handled + * property will get set to 'true'. If the hint's value is set to something + * else, or if it is unset, SDL will leave the event's Handled property + * alone. (By default, the OS sets this property to 'false', to note.) + * + * SDL apps can either set SDL_HINT_WINRT_HANDLE_BACK_BUTTON well before a + * back button is pressed, or can set it in direct-response to a back button + * being pressed. + * + * In order to get notified when a back button is pressed, SDL apps should + * register a callback function with SDL_AddEventWatch(), and have it listen + * for SDL_KEYDOWN events that have a scancode of SDL_SCANCODE_AC_BACK. + * (Alternatively, SDL_KEYUP events can be listened-for. Listening for + * either event type is suitable.) Any value of SDL_HINT_WINRT_HANDLE_BACK_BUTTON + * set by such a callback, will be applied to the OS' current + * back-button-press event. + * + * More details on back button behavior in Windows Phone apps can be found + * at the following page, on Microsoft's developer site: + * http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx + */} +SDL_HINT_WINRT_HANDLE_BACK_BUTTON = 'SDL_WINRT_HANDLE_BACK_BUTTON'; + +{/** + * \brief A variable that dictates policy for fullscreen Spaces on Mac OS X. + * + * This hint only applies to Mac OS X. + * + * The variable can be set to the following values: + * "0" - Disable Spaces support (FULLSCREEN_DESKTOP won't use them and + * SDL_WINDOW_RESIZABLE windows won't offer the "fullscreen" + * button on their titlebars). + * "1" - Enable Spaces support (FULLSCREEN_DESKTOP will use them and + * SDL_WINDOW_RESIZABLE windows will offer the "fullscreen" + * button on their titlebars). + * + * The default value is "1". Spaces are disabled regardless of this hint if + * the OS isn't at least Mac OS X Lion (10.7). This hint must be set before + * any windows are created. + */} +SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES = 'SDL_VIDEO_MAC_FULLSCREEN_SPACES'; + +{/** + * \brief When set don't force the SDL app to become a foreground process + * + * This hint only applies to Mac OS X. + * + */} +SDL_HINT_MAC_BACKGROUND_APP = 'SDL_MAC_BACKGROUND_APP'; + +{/** + * \brief Android APK expansion main file version. Should be a string number like "1", "2" etc. + * + * Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION. + * + * If both hints were set then SDL_RWFromFile() will look into expansion files + * after a given relative path was not found in the internal storage and assets. + * + * By default this hint is not set and the APK expansion files are not searched. + */} +SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION = 'SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION'; + +{/** + * \brief Android APK expansion patch file version. Should be a string number like "1", "2" etc. + * + * Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION. + * + * If both hints were set then SDL_RWFromFile() will look into expansion files + * after a given relative path was not found in the internal storage and assets. + * + * By default this hint is not set and the APK expansion files are not searched. + */} +SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION = 'SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION'; + +{/** + * \brief A variable to control whether the event loop will block itself when the app is paused. + * + * The variable can be set to the following values: + * "0" - Non blocking. + * "1" - Blocking. (default) + * + * The value should be set before SDL is initialized. + */} +SDL_HINT_ANDROID_BLOCK_ON_PAUSE = 'SDL_ANDROID_BLOCK_ON_PAUSE'; + +{/** + * \brief A variable to control whether SDL will pause audio in background + * (Requires SDL_ANDROID_BLOCK_ON_PAUSE as "Non blocking") + * + * The variable can be set to the following values: + * "0" - Non paused. + * "1" - Paused. (default) + * + * The value should be set before SDL is initialized. + */} +SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO = 'SDL_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO'; + +{/** + * \brief A variable to control whether we trap the Android back button to handle it manually. + * This is necessary for the right mouse button to work on some Android devices, or + * to be able to trap the back button for use in your code reliably. If set to true, + * the back button will show up as an SDL_KEYDOWN / SDL_KEYUP pair with a keycode of + * SDL_SCANCODE_AC_BACK. + * + * The variable can be set to the following values: + * "0" - Back button will be handled as usual for system. (default) + * "1" - Back button will be trapped, allowing you to handle the key press + * manually. (This will also let right mouse click work on systems + * where the right mouse button functions as back.) + * + * The value of this hint is used at runtime, so it can be changed at any time. + */} +SDL_HINT_ANDROID_TRAP_BACK_BUTTON = 'SDL_ANDROID_TRAP_BACK_BUTTON'; + +{/** + * \brief A variable to control whether certain IMEs should handle text editing internally instead of sending SDL_TEXTEDITING events. + * + * The variable can be set to the following values: + * "0" - SDL_TEXTEDITING events are sent, and it is the application's + * responsibility to render the text from these events and + * differentiate it somehow from committed text. (default) + * "1" - If supported by the IME then SDL_TEXTEDITING events are not sent, + * and text that is being composed will be rendered in its own UI. + */} +SDL_HINT_IME_INTERNAL_EDITING = 'SDL_IME_INTERNAL_EDITING'; + +{/** + * \brief A variable to control whether certain IMEs should show native UI components (such as the Candidate List) instead of suppressing them. + * + * The variable can be set to the following values: + * "0" - Native UI components are not display. (default) + * "1" - Native UI components are displayed. + */} +SDL_HINT_IME_SHOW_UI = 'SDL_IME_SHOW_UI'; + +{** + * \brief A variable to control if extended IME text support is enabled. + * If enabled then SDL_TextEditingExtEvent will be issued if the text would be truncated otherwise. + * Additionally SDL_TextInputEvent will be dispatched multiple times so that it is not truncated. + * + * The variable can be set to the following values: + * "0" - Legacy behavior. Text can be truncated, no heap allocations. (default) + * "1" - Modern behavior. + *} +SDL_HINT_IME_SUPPORT_EXTENDED_TEXT = 'SDL_IME_SUPPORT_EXTENDED_TEXT'; + +{/** + * \brief A variable to control whether mouse and touch events are to be treated together or separately + * + * The variable can be set to the following values: + * "0" - Mouse events will be handled as touch events, and touch will raise fake mouse + * events. This is the behaviour of SDL <= 2.0.3. (default) + * "1" - Mouse events will be handled separately from pure touch events. + * + * NOTE: This hint is no longer supported on SDL >= 2.0.10. + * Use SDL_HINT_MOUSE_TOUCH_EVENTS and SDL_HINT_TOUCH_MOUSE_EVENTS + * for generating synthetic touch/mouse events. + */} +SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH = 'SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH' + deprecated 'This hint is no longer supported on SDL >= 2.0.10. Use SDL_HINT_MOUSE_TOUCH_EVENTS and SDL_HINT_TOUCH_MOUSE_EVENTS instead.'; + +{/** + * \brief Disable giving back control to the browser automatically + * when running with asyncify + * + * With -s ASYNCIFY, SDL2 calls emscripten_sleep during operations + * such as refreshing the screen or polling events. + * + * This hint only applies to the emscripten platform + * + * The variable can be set to the following values: + * "0" - Disable emscripten_sleep calls (if you give back browser control manually or use asyncify for other purposes) + * "1" - Enable emscripten_sleep calls (the default) + */} +SDL_HINT_EMSCRIPTEN_ASYNCIFY = 'SDL_EMSCRIPTEN_ASYNCIFY'; + +{/** + * \brief override the binding element for keyboard inputs for Emscripten builds + * + * This hint only applies to the emscripten platform + * + * The variable can be one of + * "#window" - The javascript window object (this is the default) + * "#document" - The javascript document object + * "#screen" - the javascript window.screen object + * "#canvas" - the WebGL canvas element + * any other string without a leading # sign applies to the element on the page with that ID. + */} +SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT = 'SDL_EMSCRIPTEN_KEYBOARD_ELEMENT'; + +{/** + * \brief Tell SDL not to catch the SIGINT or SIGTERM signals. + * + * This hint only applies to Unix-like platforms. + * + * The variable can be set to the following values: + * "0" - SDL will install a SIGINT and SIGTERM handler, and when it + * catches a signal, convert it into an SDL_QUIT event. + * "1" - SDL will not install a signal handler at all. + */} +SDL_HINT_NO_SIGNAL_HANDLERS = 'SDL_NO_SIGNAL_HANDLERS'; + +{** + * \brief A variable that decides whether to send SDL_QUIT when closing the final window. + * + * By default, SDL sends an SDL_QUIT event when there is only one window + * and it receives an SDL_WINDOWEVENT_CLOSE event, under the assumption most + * apps would also take the loss of this window as a signal to terminate the + * program. + * + * However, it's not unreasonable in some cases to have the program continue + * to live on, perhaps to create new windows later. + * + * Changing this hint to "0" will cause SDL to not send an SDL_QUIT event + * when the final window is requesting to close. Note that in this case, + * there are still other legitimate reasons one might get an SDL_QUIT + * event: choosing "Quit" from the macOS menu bar, sending a SIGINT (ctrl-c) + * on Unix, etc. + * + * The default value is "1". This hint can be changed at any time. + * + * This hint is available since SDL 2.0.22. Before then, you always get + * an SDL_QUIT event when closing the final window. + *} +SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE = 'SDL_QUIT_ON_LAST_WINDOW_CLOSE'; + +{/** + * \brief Tell SDL not to generate window-close events for Alt+F4 on Windows. + * + * The variable can be set to the following values: + * "0" - SDL will generate a window-close event when it sees Alt+F4. + * "1" - SDL will only do normal key handling for Alt+F4. + */} +SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 = 'SDL_WINDOWS_NO_CLOSE_ON_ALT_F4'; + +{/** + * \brief Prevent SDL from using version 4 of the bitmap header when saving BMPs. + * + * The bitmap header version 4 is required for proper alpha channel support and + * SDL will use it when required. Should this not be desired, this hint can + * force the use of the 40 byte header version which is supported everywhere. + * + * The variable can be set to the following values: + * "0" - Surfaces with a colorkey or an alpha channel are saved to a + * 32-bit BMP file with an alpha mask. SDL will use the bitmap + * header version 4 and set the alpha mask accordingly. + * "1" - Surfaces with a colorkey or an alpha channel are saved to a + * 32-bit BMP file without an alpha mask. The alpha channel data + * will be in the file, but applications are going to ignore it. + * + * The default value is "0". + */} +SDL_HINT_BMP_SAVE_LEGACY_FORMAT = 'SDL_BMP_SAVE_LEGACY_FORMAT'; + +{/** + * \brief Tell SDL not to name threads on Windows. + * + * The variable can be set to the following values: + * "0" - SDL will raise the 0x406D1388 Exception to name threads. + * This is the default behavior of SDL <= 2.0.4. (default) + * "1" - SDL will not raise this exception, and threads will be unnamed. + * For .NET languages this is required when running under a debugger. + */} +SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING = 'SDL_WINDOWS_DISABLE_THREAD_NAMING'; + +{/** + * \brief A variable to control whether the return key on the soft keyboard + * should hide the soft keyboard on Android and iOS. + * + * The variable can be set to the following values: + * "0" - The return key will be handled as a key event. This is the behaviour of SDL <= 2.0.3. (default) + * "1" - The return key will hide the keyboard. + * + * The value of this hint is used at runtime, so it can be changed at any time. + */} +SDL_HINT_RETURN_KEY_HIDES_IME = 'SDL_RETURN_KEY_HIDES_IME'; + +{/** + * \brief Tell SDL which Dispmanx layer to use on a Raspberry PI + * + * Also known as Z-order. The variable can take a negative or positive value. + * The default is 10000. + */} +SDL_HINT_RPI_VIDEO_LAYER = 'SDL_RPI_VIDEO_LAYER'; + +{** + * \brief A variable that decides what audio backend to use. + * + * By default, SDL will try all available audio backends in a reasonable + * order until it finds one that can work, but this hint allows the app + * or user to force a specific target, such as "alsa" if, say, you are + * on PulseAudio but want to try talking to the lower level instead. + * + * This functionality has existed since SDL 2.0.0 (indeed, before that) + * but before 2.0.22 this was an environment variable only. In 2.0.22, + * it was upgraded to a full SDL hint, so you can set the environment + * variable as usual or programatically set the hint with SDL_SetHint, + * which won't propagate to child processes. + * + * The default value is unset, in which case SDL will try to figure out + * the best audio backend on your behalf. This hint needs to be set + * before SDL_Init() is called to be useful. + * + * This hint is available since SDL 2.0.22. Before then, you could set + * the environment variable to get the same effect. + *} +SDL_HINT_AUDIODRIVER = 'SDL_AUDIODRIVER'; + +{** + * \brief A variable that decides what video backend to use. + * + * By default, SDL will try all available video backends in a reasonable + * order until it finds one that can work, but this hint allows the app + * or user to force a specific target, such as "x11" if, say, you are + * on Wayland but want to try talking to the X server instead. + * + * This functionality has existed since SDL 2.0.0 (indeed, before that) + * but before 2.0.22 this was an environment variable only. In 2.0.22, + * it was upgraded to a full SDL hint, so you can set the environment + * variable as usual or programatically set the hint with SDL_SetHint, + * which won't propagate to child processes. + * + * The default value is unset, in which case SDL will try to figure out + * the best video backend on your behalf. This hint needs to be set + * before SDL_Init() is called to be useful. + * + * This hint is available since SDL 2.0.22. Before then, you could set + * the environment variable to get the same effect. + *} +SDL_HINT_VIDEODRIVER = 'SDL_VIDEODRIVER'; + +{** + * \brief A variable that decides what KMSDRM device to use. + * + * Internally, SDL might open something like "/dev/dri/cardNN" to + * access KMSDRM functionality, where "NN" is a device index number. + * + * SDL makes a guess at the best index to use (usually zero), but the + * app or user can set this hint to a number between 0 and 99 to + * force selection. + * + * This hint is available since SDL 2.24.0. + *} +SDL_HINT_KMSDRM_DEVICE_INDEX = 'SDL_KMSDRM_DEVICE_INDEX'; + +{** + * \brief A variable that treats trackpads as touch devices. + * + * On macOS (and possibly other platforms in the future), SDL will report + * touches on a trackpad as mouse input, which is generally what users + * expect from this device; however, these are often actually full + * multitouch-capable touch devices, so it might be preferable to some apps + * to treat them as such. + * + * Setting this hint to true will make the trackpad input report as a + * multitouch device instead of a mouse. The default is false. + * + * Note that most platforms don't support this hint. As of 2.24.0, it + * only supports MacBooks' trackpads on macOS. Others may follow later. + * + * This hint is checked during SDL_Init and can not be changed after. + * + * This hint is available since SDL 2.24.0. + *} +SDL_HINT_TRACKPAD_IS_TOUCH_ONLY = 'SDL_TRACKPAD_IS_TOUCH_ONLY'; + +{/** + * \brief An enumeration of hint priorities + */} +type + PPSDL_HintPriority = ^PSDL_HintPriority; + PSDL_HintPriority = ^TSDL_HintPriority; + TSDL_HintPriority = type Integer; + +const + SDL_HINT_DEFAULT = TSDL_HintPriority(0); + SDL_HINT_NORMAL = TSDL_HintPriority(1); + SDL_HINT_OVERRIDE = TSDL_HintPriority(2); + +{/** + * \brief Set a hint with a specific priority + * + * The priority controls the behavior when setting a hint that already + * has a value. Hints will replace existing hints of their priority and + * lower. Environment variables are considered to have override priority. + * + * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise + */} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetHintWithPriority_fun = function(const name: PAnsiChar; const value: PAnsiChar; priority: TSDL_HintPriority): TSDL_Bool; cdecl; +Var + SDL_SetHintWithPriority : TSDL_SetHintWithPriority_fun = Nil; +{$else} + +function SDL_SetHintWithPriority(const name: PAnsiChar; const value: PAnsiChar; priority: TSDL_HintPriority): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetHintWithPriority' {$ENDIF} {$ENDIF}; +{$endif} + +{/** + * \brief Set a hint with normal priority + * + * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise + */} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetHint_fun = function(const name: PAnsiChar; const value: PAnsiChar): TSDL_Bool; cdecl; +Var + SDL_SetHint : TSDL_SetHint_fun = Nil; +{$else} + +function SDL_SetHint(const name: PAnsiChar; const value: PAnsiChar): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetHint' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Reset a hint to the default value. + * + * This will reset a hint to the value of the environment variable, + * or NIL if the environment isn't set. Callbacks will be called normally + * with this change. + * + * \param name the hint to set + * \returns SDL_TRUE if the hint was set, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.24.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ResetHint_fun = function(const name: PAnsiChar): TSDL_Bool; cdecl; +Var + SDL_ResetHint : TSDL_ResetHint_fun = Nil; +{$else} + +function SDL_ResetHint(const name: PAnsiChar): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ResetHint' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Reset all hints to the default values. + * + * This will reset all hints to the value of the associated environment + * variable, or NIL if the environment isn't set. Callbacks will be called + * normally with this change. + * + * \since This function is available since SDL 2.26.0. + * + * \sa SDL_GetHint + * \sa SDL_SetHint + * \sa SDL_ResetHint + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ResetHints_proc = procedure(); cdecl; +Var + SDL_ResetHints : TSDL_ResetHints_proc = Nil; +{$else} + +procedure SDL_ResetHints(); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ResetHints' {$ENDIF} {$ENDIF}; +{$endif} + +{/** + * \brief Get a hint + * + * \return The string value of a hint variable. + */} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetHint_fun = function(const name: PAnsiChar): PAnsiChar; cdecl; +Var + SDL_GetHint : TSDL_GetHint_fun = Nil; +{$else} + +function SDL_GetHint(const name: PAnsiChar): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetHint' {$ENDIF} {$ENDIF}; +{$endif} + +{/** + * \brief Get a hint + * + * \return The boolean value of a hint variable. + */} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetHintBoolean_fun = function(const name: PAnsiChar; default_value: TSDL_Bool): TSDL_Bool; cdecl; +Var + SDL_GetHintBoolean : TSDL_GetHintBoolean_fun = Nil; +{$else} + +function SDL_GetHintBoolean(const name: PAnsiChar; default_value: TSDL_Bool): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetHintBoolean' {$ENDIF} {$ENDIF}; +{$endif} + +{/** + * \brief Add a function to watch a particular hint + * + * \param name The hint to watch + * \param callback The function to call when the hint value changes + * \param userdata A pointer to pass to the callback function + */} +type + PPSDL_HintCallback = ^PSDL_HintCallback; + PSDL_HintCallback = ^TSDL_HintCallback; + TSDL_HintCallback = procedure(userdata: Pointer; const name: PAnsiChar; const oldValue: PAnsiChar; const newValue: PAnsiChar); cdecl; + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AddHintCallback_proc = procedure(const name: PAnsiChar; callback: TSDL_HintCallback; userdata: Pointer); cdecl; +Var + SDL_AddHintCallback : TSDL_AddHintCallback_proc = Nil; +{$else} + +procedure SDL_AddHintCallback(const name: PAnsiChar; callback: TSDL_HintCallback; userdata: Pointer); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AddHintCallback' {$ENDIF} {$ENDIF}; +{$endif} + +{/** + * \brief Remove a function watching a particular hint + * + * \param name The hint being watched + * \param callback The function being called when the hint value changes + * \param userdata A pointer being passed to the callback function + */} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_DelHintCallback_proc = procedure(const name: PAnsiChar; callback: TSDL_HintCallback; userdata: Pointer); cdecl; +Var + SDL_DelHintCallback : TSDL_DelHintCallback_proc = Nil; +{$else} + +procedure SDL_DelHintCallback(const name: PAnsiChar; callback: TSDL_HintCallback; userdata: Pointer); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DelHintCallback' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Clear all hints. + * + * This function is automatically called during SDL_Quit(), and deletes all + * callbacks without calling them and frees all memory associated with hints. + * If you're calling this from application code you probably want to call + * SDL_ResetHints() instead. + * + * This function will be removed from the API the next time we rev the ABI. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_ResetHints + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ClearHints_proc = procedure(); cdecl; +Var + SDL_ClearHints : TSDL_ClearHints_proc = Nil; +{$else} + +procedure SDL_ClearHints(); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ClearHints' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdljoystick.inc b/units/sdljoystick.inc index 94cea724..1cd679dc 100644 --- a/units/sdljoystick.inc +++ b/units/sdljoystick.inc @@ -1,1541 +1,1541 @@ -{** - * \file SDL_joystick.h - * - * Include file for SDL joystick event handling - * - * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks(), with the exact joystick - * behind a device_index changing as joysticks are plugged and unplugged. - * - * The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted - * then it will get a new instance_id, instance_id's are monotonically increasing identifiers of a joystick plugged in. - * - * The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of - * the device (a X360 wired controller for example). This identifier is platform dependent. - * - * - *} - - {** - * \file SDL_joystick.h - * - * In order to use these functions, SDL_Init() must have been called - * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system - * for joysticks, and load appropriate drivers. - * - * If you would like to receive joystick updates while the application - * is in the background, you should set the following hint before calling - * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS - *} - -type - {* The joystick structure used to identify an SDL joystick *} - PPSDL_Joystick = ^PSDL_Joystick; - PSDL_Joystick = type Pointer; - - {* A structure that encodes the stable unique id for a joystick device *} - PPSDL_JoystickGUID = ^PSDL_JoystickGUID; - PSDL_JoystickGUID = ^TSDL_JoystickGUID; - TSDL_JoystickGUID = type TSDL_GUID; - - {** - * This is a unique ID for a joystick for the time it is connected to the system, - * and is never reused for the lifetime of the application. If the joystick is - * disconnected and reconnected, it will get a new ID. - * - * The ID value starts at 0 and increments from there. The value -1 is an invalid ID. - *} - PPSDL_JoystickID = ^PSDL_JoystickID; - PSDL_JoystickID = ^TSDL_JoystickID; - TSDL_JoystickID = type cint32; - -type - PPSDL_JoystickType = ^PSDL_JoystickType; - PSDL_JoystickType = ^TSDL_JoystickType; - TSDL_JoystickType = type Integer; - -const - SDL_JOYSTICK_TYPE_UNKNOWN = TSDL_JoystickType(0); - SDL_JOYSTICK_TYPE_GAMECONTROLLER = TSDL_JoystickType(1); - SDL_JOYSTICK_TYPE_WHEEL = TSDL_JoystickType(2); - SDL_JOYSTICK_TYPE_ARCADE_STICK = TSDL_JoystickType(3); - SDL_JOYSTICK_TYPE_FLIGHT_STICK = TSDL_JoystickType(4); - SDL_JOYSTICK_TYPE_DANCE_PAD = TSDL_JoystickType(5); - SDL_JOYSTICK_TYPE_GUITAR = TSDL_JoystickType(6); - SDL_JOYSTICK_TYPE_DRUM_KIT = TSDL_JoystickType(7); - SDL_JOYSTICK_TYPE_ARCADE_PAD = TSDL_JoystickType(8); - SDL_JOYSTICK_TYPE_THROTTLE = TSDL_JoystickType(9); - -type - PPSDL_JoystickPowerLevel = ^PSDL_JoystickPowerLevel; - PSDL_JoystickPowerLevel = ^TSDL_JoystickPowerLevel; - TSDL_JoystickPowerLevel = type Integer; - -const - SDL_JOYSTICK_POWER_UNKNOWN = TSDL_JoystickPowerLevel(-1); - SDL_JOYSTICK_POWER_EMPTY = TSDL_JoystickPowerLevel(0); {* <= 5% *} - SDL_JOYSTICK_POWER_LOW = TSDL_JoystickPowerLevel(1); {* <= 20% *} - SDL_JOYSTICK_POWER_MEDIUM = TSDL_JoystickPowerLevel(2); {* <= 70% *} - SDL_JOYSTICK_POWER_FULL = TSDL_JoystickPowerLevel(3); {* <= 100% *} - SDL_JOYSTICK_POWER_WIRED = TSDL_JoystickPowerLevel(4); - SDL_JOYSTICK_POWER_MAX = TSDL_JoystickPowerLevel(5); - - {* Set max recognized G-force from accelerometer - See src/joystick/uikit/SDL_sysjoystick.m for notes on why this is needed - *} -const - SDL_IPHONE_MAX_GFORCE = 5.0; - -{* Function prototypes *} - -{** - * Locking for multi-threaded access to the joystick API - * - * If you are using the joystick API or handling events from multiple threads - * you should use these locking functions to protect access to the joysticks. - * - * In particular, you are guaranteed that the joystick list won't change, so - * the API functions that take a joystick index will be valid, and joystick - * and game controller events will not be delivered. - * - * As of SDL 2.26.0, you can take the joystick lock around reinitializing the - * joystick subsystem, to prevent other threads from seeing joysticks in an - * uninitialized state. However, all open joysticks will be closed and SDL - * functions called with them will fail. - * - * \since This function is available since SDL 2.0.7. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LockJoysticks_proc = procedure(); cdecl; -Var - SDL_LockJoysticks : TSDL_LockJoysticks_proc = Nil; -{$else} - -procedure SDL_LockJoysticks(); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockJoysticks' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Unlocking for multi-threaded access to the joystick API - * - * If you are using the joystick API or handling events from multiple threads - * you should use these locking functions to protect access to the joysticks. - * - * In particular, you are guaranteed that the joystick list won't change, so - * the API functions that take a joystick index will be valid, and joystick - * and game controller events will not be delivered. - * - * \since This function is available since SDL 2.0.7. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_UnlockJoysticks_proc = procedure(); cdecl; -Var - SDL_UnlockJoysticks : TSDL_UnlockJoysticks_proc = Nil; -{$else} - -procedure SDL_UnlockJoysticks(); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnlockJoysticks' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Count the number of joysticks attached to the system. - * - * \returns the number of attached joysticks on success or a negative error - * code on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickName - * \sa SDL_JoystickPath - * \sa SDL_JoystickOpen - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_NumJoysticks_fun = function(): cint; cdecl; -Var - SDL_NumJoysticks : TSDL_NumJoysticks_fun = Nil; -{$else} - -function SDL_NumJoysticks(): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_NumJoysticks' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the implementation dependent name of a joystick. - * - * This can be called before any joysticks are opened. - * - * \param device_index the index of the joystick to query (the N'th joystick - * on the system) - * \returns the name of the selected joystick. If no name can be found, this - * function returns NULL; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickName - * \sa SDL_JoystickOpen - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickNameForIndex_fun = function(device_index: cint): PAnsiChar; cdecl; -Var - SDL_JoystickNameForIndex : TSDL_JoystickNameForIndex_fun = Nil; -{$else} - -function SDL_JoystickNameForIndex(device_index: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickNameForIndex' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the implementation dependent path of a joystick. - * - * This can be called before any joysticks are opened. - * - * \param device_index the index of the joystick to query (the N'th joystick - * on the system) - * \returns the path of the selected joystick. If no path can be found, this - * function returns NULL; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_JoystickPath - * \sa SDL_JoystickOpen - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickPathForIndex_fun = function(device_index: cint): PAnsiChar; cdecl; -Var - SDL_JoystickPathForIndex : TSDL_JoystickPathForIndex_fun = Nil; -{$else} - -function SDL_JoystickPathForIndex(device_index: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickPathForIndex' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the player index of a joystick, or -1 if it's not available This can be - * called before any joysticks are opened. - * - * \since This function is available since SDL 2.0.9. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickGetDevicePlayerIndex_fun = function(device_index: cint): cint; cdecl; -Var - SDL_JoystickGetDevicePlayerIndex : TSDL_JoystickGetDevicePlayerIndex_fun = Nil; -{$else} - -function SDL_JoystickGetDevicePlayerIndex(device_index: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDevicePlayerIndex' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Return the GUID for the joystick at this index - * This can be called before any joysticks are opened. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickGetDeviceGUID_fun = function(device_index: cint): TSDL_JoystickGUID; cdecl; -Var - SDL_JoystickGetDeviceGUID : TSDL_JoystickGetDeviceGUID_fun = Nil; -{$else} - -function SDL_JoystickGetDeviceGUID(device_index: cint): TSDL_JoystickGUID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceGUID' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the USB vendor ID of a joystick, if available. - * - * This can be called before any joysticks are opened. If the vendor ID isn't - * available this function returns 0. - * - * \param device_index the index of the joystick to query (the N'th joystick - * on the system - * \returns the USB vendor ID of the selected joystick. If called on an - * invalid index, this function returns zero - * - * \since This function is available since SDL 2.0.6. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickGetDeviceVendor_fun = function(device_index: cint): cuint16; cdecl; -Var - SDL_JoystickGetDeviceVendor : TSDL_JoystickGetDeviceVendor_fun = Nil; -{$else} - -function SDL_JoystickGetDeviceVendor(device_index: cint): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceVendor' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the USB product ID of a joystick, if available. - * - * This can be called before any joysticks are opened. If the product ID isn't - * available this function returns 0. - * - * \param device_index the index of the joystick to query (the N'th joystick - * on the system - * \returns the USB product ID of the selected joystick. If called on an - * invalid index, this function returns zero - * - * \since This function is available since SDL 2.0.6. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickGetDeviceProduct_fun = function(device_index: cint): cuint16; cdecl; -Var - SDL_JoystickGetDeviceProduct : TSDL_JoystickGetDeviceProduct_fun = Nil; -{$else} - -function SDL_JoystickGetDeviceProduct(device_index: cint): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceProduct' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the product version of a joystick, if available. - * - * This can be called before any joysticks are opened. If the product version - * isn't available this function returns 0. - * - * \param device_index the index of the joystick to query (the N'th joystick - * on the system - * \returns the product version of the selected joystick. If called on an - * invalid index, this function returns zero - * - * \since This function is available since SDL 2.0.6. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickGetDeviceProductVersion_fun = function(device_index: cint): cuint16; cdecl; -Var - SDL_JoystickGetDeviceProductVersion : TSDL_JoystickGetDeviceProductVersion_fun = Nil; -{$else} - -function SDL_JoystickGetDeviceProductVersion(device_index: cint): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceProductVersion' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the type of a joystick, if available. - * - * This can be called before any joysticks are opened. - * - * \param device_index the index of the joystick to query (the N'th joystick - * on the system - * \returns the SDL_JoystickType of the selected joystick. If called on an - * invalid index, this function returns `SDL_JOYSTICK_TYPE_UNKNOWN` - * - * \since This function is available since SDL 2.0.6. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickGetDeviceType_fun = function(device_index: cint): TSDL_JoystickType; cdecl; -Var - SDL_JoystickGetDeviceType : TSDL_JoystickGetDeviceType_fun = Nil; -{$else} - -function SDL_JoystickGetDeviceType(device_index: cint): TSDL_JoystickType; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceType' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the instance ID of a joystick. - * - * This can be called before any joysticks are opened. If the index is out of - * range, this function will return -1. - * - * \param device_index the index of the joystick to query (the N'th joystick - * on the system - * \returns the instance id of the selected joystick. If called on an invalid - * index, this function returns zero - * - * \since This function is available since SDL 2.0.6. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickGetDeviceInstanceID_fun = function(device_index: cint): TSDL_JoystickID; cdecl; -Var - SDL_JoystickGetDeviceInstanceID : TSDL_JoystickGetDeviceInstanceID_fun = Nil; -{$else} - -function SDL_JoystickGetDeviceInstanceID(device_index: cint): TSDL_JoystickID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceInstanceID' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Open a joystick for use. - * - * The `device_index` argument refers to the N'th joystick presently - * recognized by SDL on the system. It is **NOT** the same as the instance ID - * used to identify the joystick in future events. See - * SDL_JoystickInstanceID() for more details about instance IDs. - * - * The joystick subsystem must be initialized before a joystick can be opened - * for use. - * - * \param device_index the index of the joystick to query - * \returns a joystick identifier or NULL if an error occurred; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickClose - * \sa SDL_JoystickInstanceID - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickOpen_fun = function(device_index: cint): PSDL_Joystick; cdecl; - -Var - SDL_JoystickOpen : TSDL_JoystickOpen_fun = Nil; -{$else} - -function SDL_JoystickOpen(device_index: cint): PSDL_Joystick; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickOpen' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the SDL_Joystick associated with an instance id. - * - * \param instance_id the instance id to get the SDL_Joystick for - * \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError() - * for more information. - * - * \since This function is available since SDL 2.0.4. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickFromInstanceID_fun = function(instance_id: TSDL_JoystickID): PSDL_Joystick; cdecl; -Var - SDL_JoystickFromInstanceID : TSDL_JoystickFromInstanceID_fun = Nil; -{$else} - -function SDL_JoystickFromInstanceID(instance_id: TSDL_JoystickID): PSDL_Joystick; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickFromInstanceID' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the SDL_Joystick associated with a player index. - * - * \param player_index the player index to get the SDL_Joystick for - * \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError() - * for more information. - * - * \since This function is available since SDL 2.0.12. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickFromPlayerIndex_fun = function(player_index: cint): PSDL_Joystick; cdecl; -Var - SDL_JoystickFromPlayerIndex : TSDL_JoystickFromPlayerIndex_fun = Nil; -{$else} - -function SDL_JoystickFromPlayerIndex(player_index: cint): PSDL_Joystick; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickFromPlayerIndex' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Attach a new virtual joystick. - * - * \returns the joystick's device index, or -1 if an error occurred. - * - * \since This function is available since SDL 2.0.14. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickAttachVirtual_fun = function(type_: TSDL_JoystickType; naxes: cint; nbuttons: cint; nhats: cint): cint; cdecl; -Var - SDL_JoystickAttachVirtual : TSDL_JoystickAttachVirtual_fun = Nil; -{$else} - -function SDL_JoystickAttachVirtual(type_: TSDL_JoystickType; naxes: cint; nbuttons: cint; nhats: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickAttachVirtual' {$ENDIF} {$ENDIF}; -{$endif} - -type - {** - * The structure that defines an extended virtual joystick description - * - * The caller must zero the structure and then initialize the version with `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` before passing it to SDL_JoystickAttachVirtualEx() - * All other elements of this structure are optional and can be left 0. - * - * \sa SDL_JoystickAttachVirtualEx - *} - TUpdateProc = procedure(userdata: Pointer); cdecl; - TSetPlayerIndexProc = procedure(userdata: Pointer; player_index: cint); cdecl; - TRumbleFunc = function(userdata: Pointer; low_frequency_rumble: cuint16; high_frequency_rumble: cuint16): cint; cdecl; - TRumbleTriggersFunc = function(userdata: Pointer; left_rumble: cuint16; right_rumble: cuint16): cint; cdecl; - TSetLEDFunc = function(userdata: Pointer; red: cuint8; green: cuint8; blue: cuint8): cint; cdecl; - TSendEffectFunc = function(userdata: Pointer; const data: Pointer; size: cint): cint; cdecl; - - PPSDL_VirtualJoystickDesc = ^PSDL_VirtualJoystickDesc; - PSDL_VirtualJoystickDesc = ^TSDL_VirtualJoystickDesc; - TSDL_VirtualJoystickDesc = record - version: cuint16; {**< `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` *} - type_: cuint16; {**< `SDL_JoystickType` } - naxes: cuint16; {**< the number of axes on this joystick *} - nbuttons: cuint16; {**< the number of buttons on this joystick *} - nhats: cuint16; {**< the number of hats on this joystick *} - vendor_id: cuint16; {**< the USB vendor ID of this joystick *} - product_id: cuint16; {**< the USB product ID of this joystick *} - padding: cuint16; {**< unused *} - button_mask: cuint16; {**< A mask of which buttons are valid for this controller - e.g. (1 << SDL_CONTROLLER_BUTTON_A) *} - axis_mask: cuint32; {**< A mask of which axes are valid for this controller - e.g. (1 << SDL_CONTROLLER_AXIS_LEFTX) *} - name: PAnsiChar; {**< the name of the joystick *} - - userdata: Pointer; {**< User data pointer passed to callbacks *} - Update: TUpdateProc; {**< Called when the joystick state should be updated *} - SetPlayerIndex: TSetPlayerIndexProc; {**< Called when the player index is set *} - Rumble: TRumbleFunc; {**< Implements SDL_JoystickRumble() *} - RumbleTriggers: TRumbleTriggersFunc; {**< Implements SDL_JoystickRumbleTriggers() *} - SetLED: TSetLEDFunc; {**< Implements SDL_JoystickSetLED() *} - SendEffect: TSendEffectFunc; {**< Implements SDL_JoystickSendEffect() *} - end; - -{** - * \brief The current version of the SDL_VirtualJoystickDesc structure - *} -const - SDL_VIRTUAL_JOYSTICK_DESC_VERSION = 1; - -{/** - * Attach a new virtual joystick with extended properties. - * - * \returns the joystick's device index, or -1 if an error occurred. - * - * \since This function is available since SDL 2.24.0. - */} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickAttachVirtualEx_fun = function(const desc: PSDL_VirtualJoystickDesc): cint; cdecl; -Var - SDL_JoystickAttachVirtualEx : TSDL_JoystickAttachVirtualEx_fun = Nil; -{$else} - -function SDL_JoystickAttachVirtualEx(const desc: PSDL_VirtualJoystickDesc): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickAttachVirtualEx' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Detach a virtual joystick. - * - * \param device_index a value previously returned from - * SDL_JoystickAttachVirtual() - * \returns 0 on success, or -1 if an error occurred. - * - * \since This function is available since SDL 2.0.14. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickDetachVirtual_fun = function(device_index: cint): cint; cdecl; -Var - SDL_JoystickDetachVirtual : TSDL_JoystickDetachVirtual_fun = Nil; -{$else} - -function SDL_JoystickDetachVirtual(device_index: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickDetachVirtual' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Query whether or not the joystick at a given device index is virtual. - * - * \param device_index a joystick device index. - * \returns SDL_TRUE if the joystick is virtual, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.14. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickIsVirtual_fun = function(device_index: cint): TSDL_Bool; cdecl; -Var - SDL_JoystickIsVirtual : TSDL_JoystickIsVirtual_fun = Nil; -{$else} - -function SDL_JoystickIsVirtual(device_index: cint): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickIsVirtual' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Set values on an opened, virtual-joystick's axis. - * - * Please note that values set here will not be applied until the next call to - * SDL_JoystickUpdate, which can either be called directly, or can be called - * indirectly through various other SDL APIs, including, but not limited to - * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, - * SDL_WaitEvent. - * - * Note that when sending trigger axes, you should scale the value to the full - * range of Sint16. For example, a trigger at rest would have the value of - * `SDL_JOYSTICK_AXIS_MIN`. - * - * \param joystick the virtual joystick on which to set state. - * \param axis the specific axis on the virtual joystick to set. - * \param value the new value for the specified axis. - * \returns 0 on success, -1 on error. - * - * \since This function is available since SDL 2.0.14. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickSetVirtualAxis_fun = function(joystick: PSDL_Joystick; axis: cint; value: cint16): cint; cdecl; -Var - SDL_JoystickSetVirtualAxis : TSDL_JoystickSetVirtualAxis_fun = Nil; -{$else} - -function SDL_JoystickSetVirtualAxis(joystick: PSDL_Joystick; axis: cint; value: cint16): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSetVirtualAxis' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Set values on an opened, virtual-joystick's button. - * - * Please note that values set here will not be applied until the next call to - * SDL_JoystickUpdate, which can either be called directly, or can be called - * indirectly through various other SDL APIs, including, but not limited to - * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, - * SDL_WaitEvent. - * - * \param joystick the virtual joystick on which to set state. - * \param button the specific button on the virtual joystick to set. - * \param value the new value for the specified button. - * \returns 0 on success, -1 on error. - * - * \since This function is available since SDL 2.0.14. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickSetVirtualButton_fun = function(joystick: PSDL_Joystick; button: cint; value: cuint8): cint; cdecl; -Var - SDL_JoystickSetVirtualButton : TSDL_JoystickSetVirtualButton_fun = Nil; -{$else} - -function SDL_JoystickSetVirtualButton(joystick: PSDL_Joystick; button: cint; value: cuint8): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSetVirtualButton' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Set values on an opened, virtual-joystick's hat. - * - * Please note that values set here will not be applied until the next call to - * SDL_JoystickUpdate, which can either be called directly, or can be called - * indirectly through various other SDL APIs, including, but not limited to - * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, - * SDL_WaitEvent. - * - * \param joystick the virtual joystick on which to set state. - * \param hat the specific hat on the virtual joystick to set. - * \param value the new value for the specified hat. - * \returns 0 on success, -1 on error. - * - * \since This function is available since SDL 2.0.14. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickSetVirtualHat_fun = function(joystick: PSDL_Joystick; hat: cint; value: cuint8): cint; cdecl; -Var - SDL_JoystickSetVirtualHat : TSDL_JoystickSetVirtualHat_fun = Nil; -{$else} - -function SDL_JoystickSetVirtualHat(joystick: PSDL_Joystick; hat: cint; value: cuint8): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSetVirtualHat' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the implementation dependent name of a joystick. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \returns the name of the selected joystick. If no name can be found, this - * function returns NULL; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickNameForIndex - * \sa SDL_JoystickOpen - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickName_fun = function(joystick: PSDL_Joystick): PAnsiChar; cdecl; -Var - SDL_JoystickName : TSDL_JoystickName_fun = Nil; -{$else} - -function SDL_JoystickName(joystick: PSDL_Joystick): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickName' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the implementation dependent path of a joystick. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \returns the path of the selected joystick. If no path can be found, this - * function returns NULL; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_JoystickPathForIndex - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickPath_fun = function(joystick: PSDL_Joystick): PAnsiChar; cdecl; -Var - SDL_JoystickPath : TSDL_JoystickPath_fun = Nil; -{$else} - -function SDL_JoystickPath(joystick: PSDL_Joystick): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickPath' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the player index of an opened joystick. - * - * For XInput controllers this returns the XInput user index. Many joysticks - * will not be able to supply this information. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \returns the player index, or -1 if it's not available. - * - * \since This function is available since SDL 2.0.9. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickGetPlayerIndex_fun = function(joystick: PSDL_Joystick): cint; cdecl; -Var - SDL_JoystickGetPlayerIndex : TSDL_JoystickGetPlayerIndex_fun = Nil; -{$else} - -function SDL_JoystickGetPlayerIndex(joystick: PSDL_Joystick): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetPlayerIndex' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Set the player index of an opened joystick. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \param player_index Player index to assign to this joystick, or -1 to clear - * the player index and turn off player LEDs. - * - * \since This function is available since SDL 2.0.12. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickSetPlayerIndex_proc = procedure(joystick: PSDL_Joystick; player_index: cint); cdecl; -Var - SDL_JoystickSetPlayerIndex : TSDL_JoystickSetPlayerIndex_proc = Nil; -{$else} - -procedure SDL_JoystickSetPlayerIndex(joystick: PSDL_Joystick; player_index: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSetPlayerIndex' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the implementation-dependent GUID for the joystick. - * - * This function requires an open joystick. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \returns the GUID of the given joystick. If called on an invalid index, - * this function returns a zero GUID; call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickGetDeviceGUID - * \sa SDL_JoystickGetGUIDString - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickGetGUID_fun = function(joystick: PSDL_Joystick): TSDL_JoystickGUID; cdecl; -Var - SDL_JoystickGetGUID : TSDL_JoystickGetGUID_fun = Nil; -{$else} - -function SDL_JoystickGetGUID(joystick: PSDL_Joystick): TSDL_JoystickGUID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetGUID' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the USB vendor ID of an opened joystick, if available. - * - * If the vendor ID isn't available this function returns 0. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \returns the USB vendor ID of the selected joystick, or 0 if unavailable. - * - * \since This function is available since SDL 2.0.6. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickGetVendor_fun = function(joystick: PSDL_Joystick): cuint16; cdecl; -Var - SDL_JoystickGetVendor : TSDL_JoystickGetVendor_fun = Nil; -{$else} - -function SDL_JoystickGetVendor(joystick: PSDL_Joystick): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetVendor' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the USB product ID of an opened joystick, if available. - * - * If the product ID isn't available this function returns 0. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \returns the USB product ID of the selected joystick, or 0 if unavailable. - * - * \since This function is available since SDL 2.0.6. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickGetProduct_fun = function(joystick: PSDL_Joystick): cuint16; cdecl; -Var - SDL_JoystickGetProduct : TSDL_JoystickGetProduct_fun = Nil; -{$else} - -function SDL_JoystickGetProduct(joystick: PSDL_Joystick): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetProduct' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the product version of an opened joystick, if available. - * - * If the product version isn't available this function returns 0. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \returns the product version of the selected joystick, or 0 if unavailable. - * - * \since This function is available since SDL 2.0.6. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickGetProductVersion_fun = function(joystick: PSDL_Joystick): cuint16; cdecl; -Var - SDL_JoystickGetProductVersion : TSDL_JoystickGetProductVersion_fun = Nil; -{$else} - -function SDL_JoystickGetProductVersion(joystick: PSDL_Joystick): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetProductVersion' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the firmware version of an opened joystick, if available. - * - * If the firmware version isn't available this function returns 0. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \returns the firmware version of the selected joystick, or 0 if - * unavailable. - * - * \since This function is available since SDL 2.24.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickGetFirmwareVersion_fun = function(joystick: PSDL_Joystick): cuint16; cdecl; -Var - SDL_JoystickGetFirmwareVersion : TSDL_JoystickGetFirmwareVersion_fun = Nil; -{$else} - -function SDL_JoystickGetFirmwareVersion(joystick: PSDL_Joystick): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetFirmwareVersion' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the serial number of an opened joystick, if available. - * - * Returns the serial number of the joystick, or NULL if it is not available. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \returns the serial number of the selected joystick, or NULL if - * unavailable. - * - * \since This function is available since SDL 2.0.14. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickGetSerial_fun = function(joystick: PSDL_Joystick): PAnsiChar; cdecl; -Var - SDL_JoystickGetSerial : TSDL_JoystickGetSerial_fun = Nil; -{$else} - -function SDL_JoystickGetSerial(joystick: PSDL_Joystick): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetSerial' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the type of an opened joystick. - * - * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() - * \returns the SDL_JoystickType of the selected joystick. - * - * \since This function is available since SDL 2.0.6. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickGetType_fun = function(joystick: PSDL_Joystick): TSDL_JoystickType; cdecl; -Var - SDL_JoystickGetType : TSDL_JoystickGetType_fun = Nil; -{$else} - -function SDL_JoystickGetType(joystick: PSDL_Joystick): TSDL_JoystickType; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetType' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get an ASCII string representation for a given SDL_JoystickGUID. - * - * You should supply at least 33 bytes for pszGUID. - * - * \param guid the SDL_JoystickGUID you wish to convert to string - * \param pszGUID buffer in which to write the ASCII string - * \param cbGUID the size of pszGUID - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickGetDeviceGUID - * \sa SDL_JoystickGetGUID - * \sa SDL_JoystickGetGUIDFromString - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickGetGUIDString_proc = procedure(guid: TSDL_JoystickGUID; pszGUID: PAnsiChar; cbGUID: cint); cdecl; -Var - SDL_JoystickGetGUIDString : TSDL_JoystickGetGUIDString_proc = Nil; -{$else} - -procedure SDL_JoystickGetGUIDString(guid: TSDL_JoystickGUID; pszGUID: PAnsiChar; cbGUID: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetGUIDString' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Convert a GUID string into a SDL_JoystickGUID structure. - * - * Performs no error checking. If this function is given a string containing - * an invalid GUID, the function will silently succeed, but the GUID generated - * will not be useful. - * - * \param pchGUID string containing an ASCII representation of a GUID - * \returns a SDL_JoystickGUID structure. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickGetGUIDString - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickGetGUIDFromString_fun = function(const pchGUID: PAnsiChar): TSDL_JoystickGUID; cdecl; -Var - SDL_JoystickGetGUIDFromString : TSDL_JoystickGetGUIDFromString_fun = Nil; -{$else} - -function SDL_JoystickGetGUIDFromString(const pchGUID: PAnsiChar): TSDL_JoystickGUID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetGUIDFromString' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the device information encoded in a SDL_JoystickGUID structure - * - * \param guid the SDL_JoystickGUID you wish to get info about - * \param vendor A pointer filled in with the device VID, or 0 if not - * available - * \param product A pointer filled in with the device PID, or 0 if not - * available - * \param version A pointer filled in with the device version, or 0 if not - * available - * \param crc16 A pointer filled in with a CRC used to distinguish different - * products with the same VID/PID, or 0 if not available - * - * \since This function is available since SDL 2.26.0. - * - * \sa SDL_JoystickGetDeviceGUID - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetJoystickGUIDInfo_proc = procedure(guid: TSDL_JoystickGUID; vendor: pcuint16; product: pcuint16; version: pcuint16; crc16: pcuint16); cdecl; -Var - SDL_GetJoystickGUIDInfo : TSDL_GetJoystickGUIDInfo_proc = Nil; -{$else} - -procedure SDL_GetJoystickGUIDInfo(guid: TSDL_JoystickGUID; vendor: pcuint16; product: pcuint16; version: pcuint16; crc16: pcuint16); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetJoystickGUIDInfo' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the status of a specified joystick. - * - * \param joystick the joystick to query - * \returns SDL_TRUE if the joystick has been opened, SDL_FALSE if it has not; - * call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickClose - * \sa SDL_JoystickOpen - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickGetAttached_fun = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; -Var - SDL_JoystickGetAttached : TSDL_JoystickGetAttached_fun = Nil; -{$else} - -function SDL_JoystickGetAttached(joystick: PSDL_Joystick): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetAttached' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the instance ID of an opened joystick. - * - * \param joystick an SDL_Joystick structure containing joystick information - * \returns the instance ID of the specified joystick on success or a negative - * error code on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickOpen - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickInstanceID_fun = function(joystick: PSDL_Joystick): TSDL_JoystickID; cdecl; -Var - SDL_JoystickInstanceID : TSDL_JoystickInstanceID_fun = Nil; -{$else} - -function SDL_JoystickInstanceID(joystick: PSDL_Joystick): TSDL_JoystickID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickInstanceID' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the number of general axis controls on a joystick. - * - * Often, the directional pad on a game controller will either look like 4 - * separate buttons or a POV hat, and not axes, but all of this is up to the - * device and platform. - * - * \param joystick an SDL_Joystick structure containing joystick information - * \returns the number of axis controls/number of axes on success or a - * negative error code on failure; call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickGetAxis - * \sa SDL_JoystickOpen - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickNumAxes_fun = function(joystick: PSDL_Joystick): cint; cdecl; -Var - SDL_JoystickNumAxes : TSDL_JoystickNumAxes_fun = Nil; -{$else} - -function SDL_JoystickNumAxes(joystick: PSDL_Joystick): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickNumAxes' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the number of trackballs on a joystick. - * - * Joystick trackballs have only relative motion events associated with them - * and their state cannot be polled. - * - * Most joysticks do not have trackballs. - * - * \param joystick an SDL_Joystick structure containing joystick information - * \returns the number of trackballs on success or a negative error code on - * failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickGetBall - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickNumBalls_fun = function(joystick: PSDL_Joystick): cint; cdecl; -Var - SDL_JoystickNumBalls : TSDL_JoystickNumBalls_fun = Nil; -{$else} - -function SDL_JoystickNumBalls(joystick: PSDL_Joystick): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickNumBalls' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the number of POV hats on a joystick. - * - * \param joystick an SDL_Joystick structure containing joystick information - * \returns the number of POV hats on success or a negative error code on - * failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickGetHat - * \sa SDL_JoystickOpen - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickNumHats_fun = function(joystick: PSDL_Joystick): cint; cdecl; -Var - SDL_JoystickNumHats : TSDL_JoystickNumHats_fun = Nil; -{$else} - -function SDL_JoystickNumHats(joystick: PSDL_Joystick): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickNumHats' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the number of buttons on a joystick. - * - * \param joystick an SDL_Joystick structure containing joystick information - * \returns the number of buttons on success or a negative error code on - * failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickGetButton - * \sa SDL_JoystickOpen - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickNumButtons_fun = function(joystick: PSDL_Joystick): cint; cdecl; -Var - SDL_JoystickNumButtons : TSDL_JoystickNumButtons_fun = Nil; -{$else} - -function SDL_JoystickNumButtons(joystick: PSDL_Joystick): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickNumButtons' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Update the current state of the open joysticks. - * - * This is called automatically by the event loop if any joystick events are - * enabled. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickEventState - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickUpdate_proc = procedure(); cdecl; -Var - SDL_JoystickUpdate : TSDL_JoystickUpdate_proc = Nil; -{$else} - -procedure SDL_JoystickUpdate(); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickUpdate' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Enable/disable joystick event polling. - * - * If joystick events are disabled, you must call SDL_JoystickUpdate() - * yourself and manually check the state of the joystick when you want - * joystick information. - * - * It is recommended that you leave joystick event handling enabled. - * - * **WARNING**: Calling this function may delete all events currently in SDL's - * event queue. - * - * \param state can be one of `SDL_QUERY`, `SDL_IGNORE`, or `SDL_ENABLE` - * \returns 1 if enabled, 0 if disabled, or a negative error code on failure; - * call SDL_GetError() for more information. - * - * If `state` is `SDL_QUERY` then the current state is returned, - * otherwise the new processing state is returned. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GameControllerEventState - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickEventState_fun = function(state: cint): cint; cdecl; -Var - SDL_JoystickEventState : TSDL_JoystickEventState_fun = Nil; -{$else} - -function SDL_JoystickEventState(state: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickEventState' {$ENDIF} {$ENDIF}; -{$endif} - -const - SDL_JOYSTICK_AXIS_MAX = 32767; - SDL_JOYSTICK_AXIS_MIN = -32768; - -{** - * Get the current state of an axis control on a joystick. - * - * SDL makes no promises about what part of the joystick any given axis refers - * to. Your game should have some sort of configuration UI to let users - * specify what each axis should be bound to. Alternately, SDL's higher-level - * Game Controller API makes a great effort to apply order to this lower-level - * interface, so you know that a specific axis is the "left thumb stick," etc. - * - * The value returned by SDL_JoystickGetAxis() is a signed integer (-32768 to - * 32767) representing the current position of the axis. It may be necessary - * to impose certain tolerances on these values to account for jitter. - * - * \param joystick an SDL_Joystick structure containing joystick information - * \param axis the axis to query; the axis indices start at index 0 - * \returns a 16-bit signed integer representing the current position of the - * axis or 0 on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickNumAxes - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickGetAxis_fun = function(joystick: PSDL_Joystick; axis: cint): cint16; cdecl; -Var - SDL_JoystickGetAxis : TSDL_JoystickGetAxis_fun = Nil; -{$else} - -function SDL_JoystickGetAxis(joystick: PSDL_Joystick; axis: cint): cint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetAxis' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the initial state of an axis control on a joystick. - * - * The state is a value ranging from -32768 to 32767. - * - * The axis indices start at index 0. - * - * \param joystick an SDL_Joystick structure containing joystick information - * \param axis the axis to query; the axis indices start at index 0 - * \param state Upon return, the initial value is supplied here. - * \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not. - * - * \since This function is available since SDL 2.0.6. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickGetAxisInitialState_fun = function(joystick: PSDL_Joystick; axis: cint; state: pcint16): TSDL_Bool; cdecl; -Var - SDL_JoystickGetAxisInitialState : TSDL_JoystickGetAxisInitialState_fun = Nil; -{$else} - -function SDL_JoystickGetAxisInitialState(joystick: PSDL_Joystick; axis: cint; state: pcint16): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetAxisInitialState' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Hat positions - *} -const - SDL_HAT_CENTERED = $00; - SDL_HAT_UP = $01; - SDL_HAT_RIGHT = $02; - SDL_HAT_DOWN = $04; - SDL_HAT_LEFT = $08; - SDL_HAT_RIGHTUP = SDL_HAT_RIGHT or SDL_HAT_UP; - SDL_HAT_RIGHTDOWN = SDL_HAT_RIGHT or SDL_HAT_DOWN; - SDL_HAT_LEFTUP = SDL_HAT_LEFT or SDL_HAT_UP; - SDL_HAT_LEFTDOWN = SDL_HAT_LEFT or SDL_HAT_DOWN; - -{** - * Get the current state of a POV hat on a joystick. - * - * The returned value will be one of the following positions: - * - * - `SDL_HAT_CENTERED` - * - `SDL_HAT_UP` - * - `SDL_HAT_RIGHT` - * - `SDL_HAT_DOWN` - * - `SDL_HAT_LEFT` - * - `SDL_HAT_RIGHTUP` - * - `SDL_HAT_RIGHTDOWN` - * - `SDL_HAT_LEFTUP` - * - `SDL_HAT_LEFTDOWN` - * - * \param joystick an SDL_Joystick structure containing joystick information - * \param hat the hat index to get the state from; indices start at index 0 - * \returns the current hat position. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickNumHats - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickGetHat_fun = function(joystick: PSDL_Joystick; hat: cint): cuint8; cdecl; -Var - SDL_JoystickGetHat : TSDL_JoystickGetHat_fun = Nil; -{$else} - -function SDL_JoystickGetHat(joystick: PSDL_Joystick; hat: cint): cuint8; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetHat' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the ball axis change since the last poll. - * - * Trackballs can only return relative motion since the last call to - * SDL_JoystickGetBall(), these motion deltas are placed into `dx` and `dy`. - * - * Most joysticks do not have trackballs. - * - * \param joystick the SDL_Joystick to query - * \param ball the ball index to query; ball indices start at index 0 - * \param dx stores the difference in the x axis position since the last poll - * \param dy stores the difference in the y axis position since the last poll - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickNumBalls - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickGetBall_fun = function(joystick: PSDL_Joystick; ball: cint; dx: pcint; dy: pcint): cint; cdecl; -Var - SDL_JoystickGetBall : TSDL_JoystickGetBall_fun = Nil; -{$else} - -function SDL_JoystickGetBall(joystick: PSDL_Joystick; ball: cint; dx: pcint; dy: pcint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetBall' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the current state of a button on a joystick. - * - * \param joystick an SDL_Joystick structure containing joystick information - * \param button the button index to get the state from; indices start at - * index 0 - * \returns 1 if the specified button is pressed, 0 otherwise. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickNumButtons - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickGetButton_fun = function(joystick: PSDL_Joystick; button: cint): cuint8; cdecl; -Var - SDL_JoystickGetButton : TSDL_JoystickGetButton_fun = Nil; -{$else} - -function SDL_JoystickGetButton(joystick: PSDL_Joystick; button: cint): cuint8; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetButton' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Start a rumble effect. - * - * Each call to this function cancels any previous rumble effect, and calling - * it with 0 intensity stops any rumbling. - * - * \param joystick The joystick to vibrate - * \param low_frequency_rumble The intensity of the low frequency (left) - * rumble motor, from 0 to 0xFFFF - * \param high_frequency_rumble The intensity of the high frequency (right) - * rumble motor, from 0 to 0xFFFF - * \param duration_ms The duration of the rumble effect, in milliseconds - * \returns 0, or -1 if rumble isn't supported on this joystick - * - * \since This function is available since SDL 2.0.9. - * - * \sa SDL_JoystickHasRumble - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickRumble_fun = function(joystick: PSDL_Joystick; low_frequency_rumble: cuint16; high_frequency_rumble: cuint16; duration_ms: cuint32): cint; cdecl; -Var - SDL_JoystickRumble : TSDL_JoystickRumble_fun = Nil; -{$else} - -function SDL_JoystickRumble(joystick: PSDL_Joystick; low_frequency_rumble: cuint16; high_frequency_rumble: cuint16; duration_ms: cuint32): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickRumble' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Start a rumble effect in the joystick's triggers - * - * Each call to this function cancels any previous trigger rumble effect, and - * calling it with 0 intensity stops any rumbling. - * - * Note that this is rumbling of the _triggers_ and not the game controller as - * a whole. This is currently only supported on Xbox One controllers. If you - * want the (more common) whole-controller rumble, use SDL_JoystickRumble() - * instead. - * - * \param joystick The joystick to vibrate - * \param left_rumble The intensity of the left trigger rumble motor, from 0 - * to 0xFFFF - * \param right_rumble The intensity of the right trigger rumble motor, from 0 - * to 0xFFFF - * \param duration_ms The duration of the rumble effect, in milliseconds - * \returns 0, or -1 if trigger rumble isn't supported on this joystick - * - * \since This function is available since SDL 2.0.14. - * - * \sa SDL_JoystickHasRumbleTriggers - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickRumbleTriggers_fun = function(joystick: PSDL_Joystick; left_rumble: cuint16; right_rumble: cuint16; duration_ms: cuint32): cint; cdecl; -Var - SDL_JoystickRumbleTriggers : TSDL_JoystickRumbleTriggers_fun = Nil; -{$else} - -function SDL_JoystickRumbleTriggers(joystick: PSDL_Joystick; left_rumble: cuint16; right_rumble: cuint16; duration_ms: cuint32): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickRumbleTriggers' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Query whether a joystick has an LED. - * - * An example of a joystick LED is the light on the back of a PlayStation 4's - * DualShock 4 controller. - * - * \param joystick The joystick to query - * \return SDL_TRUE if the joystick has a modifiable LED, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.14. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickHasLED_fun = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; -Var - SDL_JoystickHasLED : TSDL_JoystickHasLED_fun = Nil; -{$else} - -function SDL_JoystickHasLED(joystick: PSDL_Joystick): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickHasLED' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Query whether a joystick has rumble support. - * - * \param joystick The joystick to query - * \return SDL_TRUE if the joystick has rumble, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.18. - * - * \sa SDL_JoystickRumble - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickHasRumble_fun = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; -Var - SDL_JoystickHasRumble : TSDL_JoystickHasRumble_fun = Nil; -{$else} - -function SDL_JoystickHasRumble(joystick: PSDL_Joystick): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickHasRumble' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Query whether a joystick has rumble support on triggers. - * - * \param joystick The joystick to query - * \return SDL_TRUE if the joystick has trigger rumble, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.18. - * - * \sa SDL_JoystickRumbleTriggers - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickHasRumbleTriggers_fun = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; -Var - SDL_JoystickHasRumbleTriggers : TSDL_JoystickHasRumbleTriggers_fun = Nil; -{$else} - -function SDL_JoystickHasRumbleTriggers(joystick: PSDL_Joystick): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickHasRumbleTriggers' {$ENDIF} {$ENDIF}; -{$endif} - - -{** - * Update a joystick's LED color. - * - * An example of a joystick LED is the light on the back of a PlayStation 4's - * DualShock 4 controller. - * - * \param joystick The joystick to update - * \param red The intensity of the red LED - * \param green The intensity of the green LED - * \param blue The intensity of the blue LED - * \returns 0 on success, -1 if this joystick does not have a modifiable LED - * - * \since This function is available since SDL 2.0.14. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickSetLED_fun = function(joystick: PSDL_Joystick; red: cuint8; green: cuint8; blue: cuint8): cint; cdecl; -Var - SDL_JoystickSetLED : TSDL_JoystickSetLED_fun = Nil; -{$else} - -function SDL_JoystickSetLED(joystick: PSDL_Joystick; red: cuint8; green: cuint8; blue: cuint8): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSetLED' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Send a joystick specific effect packet - * - * \param joystick The joystick to affect - * \param data The data to send to the joystick - * \param size The size of the data to send to the joystick - * \returns 0, or -1 if this joystick or driver doesn't support effect packets - * - * \since This function is available since SDL 2.0.16. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickSendEffect_fun = function(joystick: PSDL_Joystick; const data: Pointer; size: cint): cint; cdecl; -Var - SDL_JoystickSendEffect : TSDL_JoystickSendEffect_fun = Nil; -{$else} - -function SDL_JoystickSendEffect(joystick: PSDL_Joystick; const data: Pointer; size: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSendEffect' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Close a joystick previously opened with SDL_JoystickOpen(). - * - * \param joystick The joystick device to close - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_JoystickOpen - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickClose_proc = procedure(joystick: PSDL_Joystick); cdecl; -Var - SDL_JoystickClose : TSDL_JoystickClose_proc = Nil; -{$else} - -procedure SDL_JoystickClose(joystick: PSDL_Joystick); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickClose' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the battery level of a joystick as SDL_JoystickPowerLevel. - * - * \param joystick the SDL_Joystick to query - * \returns the current battery level as SDL_JoystickPowerLevel on success or - * `SDL_JOYSTICK_POWER_UNKNOWN` if it is unknown - * - * \since This function is available since SDL 2.0.4. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_JoystickCurrentPowerLevel_fun = function(joystick: PSDL_Joystick): TSDL_JoystickPowerLevel; cdecl; -Var - SDL_JoystickCurrentPowerLevel : TSDL_JoystickCurrentPowerLevel_fun = Nil; -{$else} - -function SDL_JoystickCurrentPowerLevel(joystick: PSDL_Joystick): TSDL_JoystickPowerLevel; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickCurrentPowerLevel' {$ENDIF} {$ENDIF}; -{$endif} +{** + * \file SDL_joystick.h + * + * Include file for SDL joystick event handling + * + * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks(), with the exact joystick + * behind a device_index changing as joysticks are plugged and unplugged. + * + * The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted + * then it will get a new instance_id, instance_id's are monotonically increasing identifiers of a joystick plugged in. + * + * The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of + * the device (a X360 wired controller for example). This identifier is platform dependent. + * + * + *} + + {** + * \file SDL_joystick.h + * + * In order to use these functions, SDL_Init() must have been called + * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system + * for joysticks, and load appropriate drivers. + * + * If you would like to receive joystick updates while the application + * is in the background, you should set the following hint before calling + * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS + *} + +type + {* The joystick structure used to identify an SDL joystick *} + PPSDL_Joystick = ^PSDL_Joystick; + PSDL_Joystick = type Pointer; + + {* A structure that encodes the stable unique id for a joystick device *} + PPSDL_JoystickGUID = ^PSDL_JoystickGUID; + PSDL_JoystickGUID = ^TSDL_JoystickGUID; + TSDL_JoystickGUID = type TSDL_GUID; + + {** + * This is a unique ID for a joystick for the time it is connected to the system, + * and is never reused for the lifetime of the application. If the joystick is + * disconnected and reconnected, it will get a new ID. + * + * The ID value starts at 0 and increments from there. The value -1 is an invalid ID. + *} + PPSDL_JoystickID = ^PSDL_JoystickID; + PSDL_JoystickID = ^TSDL_JoystickID; + TSDL_JoystickID = type cint32; + +type + PPSDL_JoystickType = ^PSDL_JoystickType; + PSDL_JoystickType = ^TSDL_JoystickType; + TSDL_JoystickType = type Integer; + +const + SDL_JOYSTICK_TYPE_UNKNOWN = TSDL_JoystickType(0); + SDL_JOYSTICK_TYPE_GAMECONTROLLER = TSDL_JoystickType(1); + SDL_JOYSTICK_TYPE_WHEEL = TSDL_JoystickType(2); + SDL_JOYSTICK_TYPE_ARCADE_STICK = TSDL_JoystickType(3); + SDL_JOYSTICK_TYPE_FLIGHT_STICK = TSDL_JoystickType(4); + SDL_JOYSTICK_TYPE_DANCE_PAD = TSDL_JoystickType(5); + SDL_JOYSTICK_TYPE_GUITAR = TSDL_JoystickType(6); + SDL_JOYSTICK_TYPE_DRUM_KIT = TSDL_JoystickType(7); + SDL_JOYSTICK_TYPE_ARCADE_PAD = TSDL_JoystickType(8); + SDL_JOYSTICK_TYPE_THROTTLE = TSDL_JoystickType(9); + +type + PPSDL_JoystickPowerLevel = ^PSDL_JoystickPowerLevel; + PSDL_JoystickPowerLevel = ^TSDL_JoystickPowerLevel; + TSDL_JoystickPowerLevel = type Integer; + +const + SDL_JOYSTICK_POWER_UNKNOWN = TSDL_JoystickPowerLevel(-1); + SDL_JOYSTICK_POWER_EMPTY = TSDL_JoystickPowerLevel(0); {* <= 5% *} + SDL_JOYSTICK_POWER_LOW = TSDL_JoystickPowerLevel(1); {* <= 20% *} + SDL_JOYSTICK_POWER_MEDIUM = TSDL_JoystickPowerLevel(2); {* <= 70% *} + SDL_JOYSTICK_POWER_FULL = TSDL_JoystickPowerLevel(3); {* <= 100% *} + SDL_JOYSTICK_POWER_WIRED = TSDL_JoystickPowerLevel(4); + SDL_JOYSTICK_POWER_MAX = TSDL_JoystickPowerLevel(5); + + {* Set max recognized G-force from accelerometer + See src/joystick/uikit/SDL_sysjoystick.m for notes on why this is needed + *} +const + SDL_IPHONE_MAX_GFORCE = 5.0; + +{* Function prototypes *} + +{** + * Locking for multi-threaded access to the joystick API + * + * If you are using the joystick API or handling events from multiple threads + * you should use these locking functions to protect access to the joysticks. + * + * In particular, you are guaranteed that the joystick list won't change, so + * the API functions that take a joystick index will be valid, and joystick + * and game controller events will not be delivered. + * + * As of SDL 2.26.0, you can take the joystick lock around reinitializing the + * joystick subsystem, to prevent other threads from seeing joysticks in an + * uninitialized state. However, all open joysticks will be closed and SDL + * functions called with them will fail. + * + * \since This function is available since SDL 2.0.7. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LockJoysticks_proc = procedure(); cdecl; +Var + SDL_LockJoysticks : TSDL_LockJoysticks_proc = Nil; +{$else} + +procedure SDL_LockJoysticks(); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockJoysticks' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Unlocking for multi-threaded access to the joystick API + * + * If you are using the joystick API or handling events from multiple threads + * you should use these locking functions to protect access to the joysticks. + * + * In particular, you are guaranteed that the joystick list won't change, so + * the API functions that take a joystick index will be valid, and joystick + * and game controller events will not be delivered. + * + * \since This function is available since SDL 2.0.7. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UnlockJoysticks_proc = procedure(); cdecl; +Var + SDL_UnlockJoysticks : TSDL_UnlockJoysticks_proc = Nil; +{$else} + +procedure SDL_UnlockJoysticks(); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnlockJoysticks' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Count the number of joysticks attached to the system. + * + * \returns the number of attached joysticks on success or a negative error + * code on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickName + * \sa SDL_JoystickPath + * \sa SDL_JoystickOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_NumJoysticks_fun = function(): cint; cdecl; +Var + SDL_NumJoysticks : TSDL_NumJoysticks_fun = Nil; +{$else} + +function SDL_NumJoysticks(): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_NumJoysticks' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the implementation dependent name of a joystick. + * + * This can be called before any joysticks are opened. + * + * \param device_index the index of the joystick to query (the N'th joystick + * on the system) + * \returns the name of the selected joystick. If no name can be found, this + * function returns NULL; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickName + * \sa SDL_JoystickOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickNameForIndex_fun = function(device_index: cint): PAnsiChar; cdecl; +Var + SDL_JoystickNameForIndex : TSDL_JoystickNameForIndex_fun = Nil; +{$else} + +function SDL_JoystickNameForIndex(device_index: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickNameForIndex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the implementation dependent path of a joystick. + * + * This can be called before any joysticks are opened. + * + * \param device_index the index of the joystick to query (the N'th joystick + * on the system) + * \returns the path of the selected joystick. If no path can be found, this + * function returns NULL; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_JoystickPath + * \sa SDL_JoystickOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickPathForIndex_fun = function(device_index: cint): PAnsiChar; cdecl; +Var + SDL_JoystickPathForIndex : TSDL_JoystickPathForIndex_fun = Nil; +{$else} + +function SDL_JoystickPathForIndex(device_index: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickPathForIndex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the player index of a joystick, or -1 if it's not available This can be + * called before any joysticks are opened. + * + * \since This function is available since SDL 2.0.9. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetDevicePlayerIndex_fun = function(device_index: cint): cint; cdecl; +Var + SDL_JoystickGetDevicePlayerIndex : TSDL_JoystickGetDevicePlayerIndex_fun = Nil; +{$else} + +function SDL_JoystickGetDevicePlayerIndex(device_index: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDevicePlayerIndex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Return the GUID for the joystick at this index + * This can be called before any joysticks are opened. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetDeviceGUID_fun = function(device_index: cint): TSDL_JoystickGUID; cdecl; +Var + SDL_JoystickGetDeviceGUID : TSDL_JoystickGetDeviceGUID_fun = Nil; +{$else} + +function SDL_JoystickGetDeviceGUID(device_index: cint): TSDL_JoystickGUID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceGUID' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the USB vendor ID of a joystick, if available. + * + * This can be called before any joysticks are opened. If the vendor ID isn't + * available this function returns 0. + * + * \param device_index the index of the joystick to query (the N'th joystick + * on the system + * \returns the USB vendor ID of the selected joystick. If called on an + * invalid index, this function returns zero + * + * \since This function is available since SDL 2.0.6. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetDeviceVendor_fun = function(device_index: cint): cuint16; cdecl; +Var + SDL_JoystickGetDeviceVendor : TSDL_JoystickGetDeviceVendor_fun = Nil; +{$else} + +function SDL_JoystickGetDeviceVendor(device_index: cint): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceVendor' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the USB product ID of a joystick, if available. + * + * This can be called before any joysticks are opened. If the product ID isn't + * available this function returns 0. + * + * \param device_index the index of the joystick to query (the N'th joystick + * on the system + * \returns the USB product ID of the selected joystick. If called on an + * invalid index, this function returns zero + * + * \since This function is available since SDL 2.0.6. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetDeviceProduct_fun = function(device_index: cint): cuint16; cdecl; +Var + SDL_JoystickGetDeviceProduct : TSDL_JoystickGetDeviceProduct_fun = Nil; +{$else} + +function SDL_JoystickGetDeviceProduct(device_index: cint): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceProduct' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the product version of a joystick, if available. + * + * This can be called before any joysticks are opened. If the product version + * isn't available this function returns 0. + * + * \param device_index the index of the joystick to query (the N'th joystick + * on the system + * \returns the product version of the selected joystick. If called on an + * invalid index, this function returns zero + * + * \since This function is available since SDL 2.0.6. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetDeviceProductVersion_fun = function(device_index: cint): cuint16; cdecl; +Var + SDL_JoystickGetDeviceProductVersion : TSDL_JoystickGetDeviceProductVersion_fun = Nil; +{$else} + +function SDL_JoystickGetDeviceProductVersion(device_index: cint): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceProductVersion' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the type of a joystick, if available. + * + * This can be called before any joysticks are opened. + * + * \param device_index the index of the joystick to query (the N'th joystick + * on the system + * \returns the SDL_JoystickType of the selected joystick. If called on an + * invalid index, this function returns `SDL_JOYSTICK_TYPE_UNKNOWN` + * + * \since This function is available since SDL 2.0.6. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetDeviceType_fun = function(device_index: cint): TSDL_JoystickType; cdecl; +Var + SDL_JoystickGetDeviceType : TSDL_JoystickGetDeviceType_fun = Nil; +{$else} + +function SDL_JoystickGetDeviceType(device_index: cint): TSDL_JoystickType; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceType' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the instance ID of a joystick. + * + * This can be called before any joysticks are opened. If the index is out of + * range, this function will return -1. + * + * \param device_index the index of the joystick to query (the N'th joystick + * on the system + * \returns the instance id of the selected joystick. If called on an invalid + * index, this function returns zero + * + * \since This function is available since SDL 2.0.6. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetDeviceInstanceID_fun = function(device_index: cint): TSDL_JoystickID; cdecl; +Var + SDL_JoystickGetDeviceInstanceID : TSDL_JoystickGetDeviceInstanceID_fun = Nil; +{$else} + +function SDL_JoystickGetDeviceInstanceID(device_index: cint): TSDL_JoystickID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetDeviceInstanceID' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Open a joystick for use. + * + * The `device_index` argument refers to the N'th joystick presently + * recognized by SDL on the system. It is **NOT** the same as the instance ID + * used to identify the joystick in future events. See + * SDL_JoystickInstanceID() for more details about instance IDs. + * + * The joystick subsystem must be initialized before a joystick can be opened + * for use. + * + * \param device_index the index of the joystick to query + * \returns a joystick identifier or NULL if an error occurred; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickClose + * \sa SDL_JoystickInstanceID + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickOpen_fun = function(device_index: cint): PSDL_Joystick; cdecl; + +Var + SDL_JoystickOpen : TSDL_JoystickOpen_fun = Nil; +{$else} + +function SDL_JoystickOpen(device_index: cint): PSDL_Joystick; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickOpen' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the SDL_Joystick associated with an instance id. + * + * \param instance_id the instance id to get the SDL_Joystick for + * \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError() + * for more information. + * + * \since This function is available since SDL 2.0.4. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickFromInstanceID_fun = function(instance_id: TSDL_JoystickID): PSDL_Joystick; cdecl; +Var + SDL_JoystickFromInstanceID : TSDL_JoystickFromInstanceID_fun = Nil; +{$else} + +function SDL_JoystickFromInstanceID(instance_id: TSDL_JoystickID): PSDL_Joystick; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickFromInstanceID' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the SDL_Joystick associated with a player index. + * + * \param player_index the player index to get the SDL_Joystick for + * \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError() + * for more information. + * + * \since This function is available since SDL 2.0.12. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickFromPlayerIndex_fun = function(player_index: cint): PSDL_Joystick; cdecl; +Var + SDL_JoystickFromPlayerIndex : TSDL_JoystickFromPlayerIndex_fun = Nil; +{$else} + +function SDL_JoystickFromPlayerIndex(player_index: cint): PSDL_Joystick; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickFromPlayerIndex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Attach a new virtual joystick. + * + * \returns the joystick's device index, or -1 if an error occurred. + * + * \since This function is available since SDL 2.0.14. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickAttachVirtual_fun = function(type_: TSDL_JoystickType; naxes: cint; nbuttons: cint; nhats: cint): cint; cdecl; +Var + SDL_JoystickAttachVirtual : TSDL_JoystickAttachVirtual_fun = Nil; +{$else} + +function SDL_JoystickAttachVirtual(type_: TSDL_JoystickType; naxes: cint; nbuttons: cint; nhats: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickAttachVirtual' {$ENDIF} {$ENDIF}; +{$endif} + +type + {** + * The structure that defines an extended virtual joystick description + * + * The caller must zero the structure and then initialize the version with `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` before passing it to SDL_JoystickAttachVirtualEx() + * All other elements of this structure are optional and can be left 0. + * + * \sa SDL_JoystickAttachVirtualEx + *} + TUpdateProc = procedure(userdata: Pointer); cdecl; + TSetPlayerIndexProc = procedure(userdata: Pointer; player_index: cint); cdecl; + TRumbleFunc = function(userdata: Pointer; low_frequency_rumble: cuint16; high_frequency_rumble: cuint16): cint; cdecl; + TRumbleTriggersFunc = function(userdata: Pointer; left_rumble: cuint16; right_rumble: cuint16): cint; cdecl; + TSetLEDFunc = function(userdata: Pointer; red: cuint8; green: cuint8; blue: cuint8): cint; cdecl; + TSendEffectFunc = function(userdata: Pointer; const data: Pointer; size: cint): cint; cdecl; + + PPSDL_VirtualJoystickDesc = ^PSDL_VirtualJoystickDesc; + PSDL_VirtualJoystickDesc = ^TSDL_VirtualJoystickDesc; + TSDL_VirtualJoystickDesc = record + version: cuint16; {**< `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` *} + type_: cuint16; {**< `SDL_JoystickType` } + naxes: cuint16; {**< the number of axes on this joystick *} + nbuttons: cuint16; {**< the number of buttons on this joystick *} + nhats: cuint16; {**< the number of hats on this joystick *} + vendor_id: cuint16; {**< the USB vendor ID of this joystick *} + product_id: cuint16; {**< the USB product ID of this joystick *} + padding: cuint16; {**< unused *} + button_mask: cuint16; {**< A mask of which buttons are valid for this controller + e.g. (1 << SDL_CONTROLLER_BUTTON_A) *} + axis_mask: cuint32; {**< A mask of which axes are valid for this controller + e.g. (1 << SDL_CONTROLLER_AXIS_LEFTX) *} + name: PAnsiChar; {**< the name of the joystick *} + + userdata: Pointer; {**< User data pointer passed to callbacks *} + Update: TUpdateProc; {**< Called when the joystick state should be updated *} + SetPlayerIndex: TSetPlayerIndexProc; {**< Called when the player index is set *} + Rumble: TRumbleFunc; {**< Implements SDL_JoystickRumble() *} + RumbleTriggers: TRumbleTriggersFunc; {**< Implements SDL_JoystickRumbleTriggers() *} + SetLED: TSetLEDFunc; {**< Implements SDL_JoystickSetLED() *} + SendEffect: TSendEffectFunc; {**< Implements SDL_JoystickSendEffect() *} + end; + +{** + * \brief The current version of the SDL_VirtualJoystickDesc structure + *} +const + SDL_VIRTUAL_JOYSTICK_DESC_VERSION = 1; + +{/** + * Attach a new virtual joystick with extended properties. + * + * \returns the joystick's device index, or -1 if an error occurred. + * + * \since This function is available since SDL 2.24.0. + */} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickAttachVirtualEx_fun = function(const desc: PSDL_VirtualJoystickDesc): cint; cdecl; +Var + SDL_JoystickAttachVirtualEx : TSDL_JoystickAttachVirtualEx_fun = Nil; +{$else} + +function SDL_JoystickAttachVirtualEx(const desc: PSDL_VirtualJoystickDesc): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickAttachVirtualEx' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Detach a virtual joystick. + * + * \param device_index a value previously returned from + * SDL_JoystickAttachVirtual() + * \returns 0 on success, or -1 if an error occurred. + * + * \since This function is available since SDL 2.0.14. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickDetachVirtual_fun = function(device_index: cint): cint; cdecl; +Var + SDL_JoystickDetachVirtual : TSDL_JoystickDetachVirtual_fun = Nil; +{$else} + +function SDL_JoystickDetachVirtual(device_index: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickDetachVirtual' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Query whether or not the joystick at a given device index is virtual. + * + * \param device_index a joystick device index. + * \returns SDL_TRUE if the joystick is virtual, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.14. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickIsVirtual_fun = function(device_index: cint): TSDL_Bool; cdecl; +Var + SDL_JoystickIsVirtual : TSDL_JoystickIsVirtual_fun = Nil; +{$else} + +function SDL_JoystickIsVirtual(device_index: cint): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickIsVirtual' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Set values on an opened, virtual-joystick's axis. + * + * Please note that values set here will not be applied until the next call to + * SDL_JoystickUpdate, which can either be called directly, or can be called + * indirectly through various other SDL APIs, including, but not limited to + * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, + * SDL_WaitEvent. + * + * Note that when sending trigger axes, you should scale the value to the full + * range of Sint16. For example, a trigger at rest would have the value of + * `SDL_JOYSTICK_AXIS_MIN`. + * + * \param joystick the virtual joystick on which to set state. + * \param axis the specific axis on the virtual joystick to set. + * \param value the new value for the specified axis. + * \returns 0 on success, -1 on error. + * + * \since This function is available since SDL 2.0.14. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickSetVirtualAxis_fun = function(joystick: PSDL_Joystick; axis: cint; value: cint16): cint; cdecl; +Var + SDL_JoystickSetVirtualAxis : TSDL_JoystickSetVirtualAxis_fun = Nil; +{$else} + +function SDL_JoystickSetVirtualAxis(joystick: PSDL_Joystick; axis: cint; value: cint16): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSetVirtualAxis' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Set values on an opened, virtual-joystick's button. + * + * Please note that values set here will not be applied until the next call to + * SDL_JoystickUpdate, which can either be called directly, or can be called + * indirectly through various other SDL APIs, including, but not limited to + * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, + * SDL_WaitEvent. + * + * \param joystick the virtual joystick on which to set state. + * \param button the specific button on the virtual joystick to set. + * \param value the new value for the specified button. + * \returns 0 on success, -1 on error. + * + * \since This function is available since SDL 2.0.14. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickSetVirtualButton_fun = function(joystick: PSDL_Joystick; button: cint; value: cuint8): cint; cdecl; +Var + SDL_JoystickSetVirtualButton : TSDL_JoystickSetVirtualButton_fun = Nil; +{$else} + +function SDL_JoystickSetVirtualButton(joystick: PSDL_Joystick; button: cint; value: cuint8): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSetVirtualButton' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Set values on an opened, virtual-joystick's hat. + * + * Please note that values set here will not be applied until the next call to + * SDL_JoystickUpdate, which can either be called directly, or can be called + * indirectly through various other SDL APIs, including, but not limited to + * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, + * SDL_WaitEvent. + * + * \param joystick the virtual joystick on which to set state. + * \param hat the specific hat on the virtual joystick to set. + * \param value the new value for the specified hat. + * \returns 0 on success, -1 on error. + * + * \since This function is available since SDL 2.0.14. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickSetVirtualHat_fun = function(joystick: PSDL_Joystick; hat: cint; value: cuint8): cint; cdecl; +Var + SDL_JoystickSetVirtualHat : TSDL_JoystickSetVirtualHat_fun = Nil; +{$else} + +function SDL_JoystickSetVirtualHat(joystick: PSDL_Joystick; hat: cint; value: cuint8): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSetVirtualHat' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the implementation dependent name of a joystick. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \returns the name of the selected joystick. If no name can be found, this + * function returns NULL; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickNameForIndex + * \sa SDL_JoystickOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickName_fun = function(joystick: PSDL_Joystick): PAnsiChar; cdecl; +Var + SDL_JoystickName : TSDL_JoystickName_fun = Nil; +{$else} + +function SDL_JoystickName(joystick: PSDL_Joystick): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickName' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the implementation dependent path of a joystick. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \returns the path of the selected joystick. If no path can be found, this + * function returns NULL; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_JoystickPathForIndex + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickPath_fun = function(joystick: PSDL_Joystick): PAnsiChar; cdecl; +Var + SDL_JoystickPath : TSDL_JoystickPath_fun = Nil; +{$else} + +function SDL_JoystickPath(joystick: PSDL_Joystick): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickPath' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the player index of an opened joystick. + * + * For XInput controllers this returns the XInput user index. Many joysticks + * will not be able to supply this information. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \returns the player index, or -1 if it's not available. + * + * \since This function is available since SDL 2.0.9. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetPlayerIndex_fun = function(joystick: PSDL_Joystick): cint; cdecl; +Var + SDL_JoystickGetPlayerIndex : TSDL_JoystickGetPlayerIndex_fun = Nil; +{$else} + +function SDL_JoystickGetPlayerIndex(joystick: PSDL_Joystick): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetPlayerIndex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Set the player index of an opened joystick. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \param player_index Player index to assign to this joystick, or -1 to clear + * the player index and turn off player LEDs. + * + * \since This function is available since SDL 2.0.12. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickSetPlayerIndex_proc = procedure(joystick: PSDL_Joystick; player_index: cint); cdecl; +Var + SDL_JoystickSetPlayerIndex : TSDL_JoystickSetPlayerIndex_proc = Nil; +{$else} + +procedure SDL_JoystickSetPlayerIndex(joystick: PSDL_Joystick; player_index: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSetPlayerIndex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the implementation-dependent GUID for the joystick. + * + * This function requires an open joystick. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \returns the GUID of the given joystick. If called on an invalid index, + * this function returns a zero GUID; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickGetDeviceGUID + * \sa SDL_JoystickGetGUIDString + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetGUID_fun = function(joystick: PSDL_Joystick): TSDL_JoystickGUID; cdecl; +Var + SDL_JoystickGetGUID : TSDL_JoystickGetGUID_fun = Nil; +{$else} + +function SDL_JoystickGetGUID(joystick: PSDL_Joystick): TSDL_JoystickGUID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetGUID' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the USB vendor ID of an opened joystick, if available. + * + * If the vendor ID isn't available this function returns 0. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \returns the USB vendor ID of the selected joystick, or 0 if unavailable. + * + * \since This function is available since SDL 2.0.6. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetVendor_fun = function(joystick: PSDL_Joystick): cuint16; cdecl; +Var + SDL_JoystickGetVendor : TSDL_JoystickGetVendor_fun = Nil; +{$else} + +function SDL_JoystickGetVendor(joystick: PSDL_Joystick): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetVendor' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the USB product ID of an opened joystick, if available. + * + * If the product ID isn't available this function returns 0. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \returns the USB product ID of the selected joystick, or 0 if unavailable. + * + * \since This function is available since SDL 2.0.6. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetProduct_fun = function(joystick: PSDL_Joystick): cuint16; cdecl; +Var + SDL_JoystickGetProduct : TSDL_JoystickGetProduct_fun = Nil; +{$else} + +function SDL_JoystickGetProduct(joystick: PSDL_Joystick): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetProduct' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the product version of an opened joystick, if available. + * + * If the product version isn't available this function returns 0. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \returns the product version of the selected joystick, or 0 if unavailable. + * + * \since This function is available since SDL 2.0.6. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetProductVersion_fun = function(joystick: PSDL_Joystick): cuint16; cdecl; +Var + SDL_JoystickGetProductVersion : TSDL_JoystickGetProductVersion_fun = Nil; +{$else} + +function SDL_JoystickGetProductVersion(joystick: PSDL_Joystick): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetProductVersion' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the firmware version of an opened joystick, if available. + * + * If the firmware version isn't available this function returns 0. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \returns the firmware version of the selected joystick, or 0 if + * unavailable. + * + * \since This function is available since SDL 2.24.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetFirmwareVersion_fun = function(joystick: PSDL_Joystick): cuint16; cdecl; +Var + SDL_JoystickGetFirmwareVersion : TSDL_JoystickGetFirmwareVersion_fun = Nil; +{$else} + +function SDL_JoystickGetFirmwareVersion(joystick: PSDL_Joystick): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetFirmwareVersion' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the serial number of an opened joystick, if available. + * + * Returns the serial number of the joystick, or NULL if it is not available. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \returns the serial number of the selected joystick, or NULL if + * unavailable. + * + * \since This function is available since SDL 2.0.14. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetSerial_fun = function(joystick: PSDL_Joystick): PAnsiChar; cdecl; +Var + SDL_JoystickGetSerial : TSDL_JoystickGetSerial_fun = Nil; +{$else} + +function SDL_JoystickGetSerial(joystick: PSDL_Joystick): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetSerial' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the type of an opened joystick. + * + * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() + * \returns the SDL_JoystickType of the selected joystick. + * + * \since This function is available since SDL 2.0.6. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetType_fun = function(joystick: PSDL_Joystick): TSDL_JoystickType; cdecl; +Var + SDL_JoystickGetType : TSDL_JoystickGetType_fun = Nil; +{$else} + +function SDL_JoystickGetType(joystick: PSDL_Joystick): TSDL_JoystickType; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetType' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get an ASCII string representation for a given SDL_JoystickGUID. + * + * You should supply at least 33 bytes for pszGUID. + * + * \param guid the SDL_JoystickGUID you wish to convert to string + * \param pszGUID buffer in which to write the ASCII string + * \param cbGUID the size of pszGUID + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickGetDeviceGUID + * \sa SDL_JoystickGetGUID + * \sa SDL_JoystickGetGUIDFromString + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetGUIDString_proc = procedure(guid: TSDL_JoystickGUID; pszGUID: PAnsiChar; cbGUID: cint); cdecl; +Var + SDL_JoystickGetGUIDString : TSDL_JoystickGetGUIDString_proc = Nil; +{$else} + +procedure SDL_JoystickGetGUIDString(guid: TSDL_JoystickGUID; pszGUID: PAnsiChar; cbGUID: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetGUIDString' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Convert a GUID string into a SDL_JoystickGUID structure. + * + * Performs no error checking. If this function is given a string containing + * an invalid GUID, the function will silently succeed, but the GUID generated + * will not be useful. + * + * \param pchGUID string containing an ASCII representation of a GUID + * \returns a SDL_JoystickGUID structure. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickGetGUIDString + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetGUIDFromString_fun = function(const pchGUID: PAnsiChar): TSDL_JoystickGUID; cdecl; +Var + SDL_JoystickGetGUIDFromString : TSDL_JoystickGetGUIDFromString_fun = Nil; +{$else} + +function SDL_JoystickGetGUIDFromString(const pchGUID: PAnsiChar): TSDL_JoystickGUID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetGUIDFromString' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the device information encoded in a SDL_JoystickGUID structure + * + * \param guid the SDL_JoystickGUID you wish to get info about + * \param vendor A pointer filled in with the device VID, or 0 if not + * available + * \param product A pointer filled in with the device PID, or 0 if not + * available + * \param version A pointer filled in with the device version, or 0 if not + * available + * \param crc16 A pointer filled in with a CRC used to distinguish different + * products with the same VID/PID, or 0 if not available + * + * \since This function is available since SDL 2.26.0. + * + * \sa SDL_JoystickGetDeviceGUID + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetJoystickGUIDInfo_proc = procedure(guid: TSDL_JoystickGUID; vendor: pcuint16; product: pcuint16; version: pcuint16; crc16: pcuint16); cdecl; +Var + SDL_GetJoystickGUIDInfo : TSDL_GetJoystickGUIDInfo_proc = Nil; +{$else} + +procedure SDL_GetJoystickGUIDInfo(guid: TSDL_JoystickGUID; vendor: pcuint16; product: pcuint16; version: pcuint16; crc16: pcuint16); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetJoystickGUIDInfo' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the status of a specified joystick. + * + * \param joystick the joystick to query + * \returns SDL_TRUE if the joystick has been opened, SDL_FALSE if it has not; + * call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickClose + * \sa SDL_JoystickOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetAttached_fun = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; +Var + SDL_JoystickGetAttached : TSDL_JoystickGetAttached_fun = Nil; +{$else} + +function SDL_JoystickGetAttached(joystick: PSDL_Joystick): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetAttached' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the instance ID of an opened joystick. + * + * \param joystick an SDL_Joystick structure containing joystick information + * \returns the instance ID of the specified joystick on success or a negative + * error code on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickInstanceID_fun = function(joystick: PSDL_Joystick): TSDL_JoystickID; cdecl; +Var + SDL_JoystickInstanceID : TSDL_JoystickInstanceID_fun = Nil; +{$else} + +function SDL_JoystickInstanceID(joystick: PSDL_Joystick): TSDL_JoystickID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickInstanceID' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the number of general axis controls on a joystick. + * + * Often, the directional pad on a game controller will either look like 4 + * separate buttons or a POV hat, and not axes, but all of this is up to the + * device and platform. + * + * \param joystick an SDL_Joystick structure containing joystick information + * \returns the number of axis controls/number of axes on success or a + * negative error code on failure; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickGetAxis + * \sa SDL_JoystickOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickNumAxes_fun = function(joystick: PSDL_Joystick): cint; cdecl; +Var + SDL_JoystickNumAxes : TSDL_JoystickNumAxes_fun = Nil; +{$else} + +function SDL_JoystickNumAxes(joystick: PSDL_Joystick): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickNumAxes' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the number of trackballs on a joystick. + * + * Joystick trackballs have only relative motion events associated with them + * and their state cannot be polled. + * + * Most joysticks do not have trackballs. + * + * \param joystick an SDL_Joystick structure containing joystick information + * \returns the number of trackballs on success or a negative error code on + * failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickGetBall + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickNumBalls_fun = function(joystick: PSDL_Joystick): cint; cdecl; +Var + SDL_JoystickNumBalls : TSDL_JoystickNumBalls_fun = Nil; +{$else} + +function SDL_JoystickNumBalls(joystick: PSDL_Joystick): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickNumBalls' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the number of POV hats on a joystick. + * + * \param joystick an SDL_Joystick structure containing joystick information + * \returns the number of POV hats on success or a negative error code on + * failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickGetHat + * \sa SDL_JoystickOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickNumHats_fun = function(joystick: PSDL_Joystick): cint; cdecl; +Var + SDL_JoystickNumHats : TSDL_JoystickNumHats_fun = Nil; +{$else} + +function SDL_JoystickNumHats(joystick: PSDL_Joystick): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickNumHats' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the number of buttons on a joystick. + * + * \param joystick an SDL_Joystick structure containing joystick information + * \returns the number of buttons on success or a negative error code on + * failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickGetButton + * \sa SDL_JoystickOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickNumButtons_fun = function(joystick: PSDL_Joystick): cint; cdecl; +Var + SDL_JoystickNumButtons : TSDL_JoystickNumButtons_fun = Nil; +{$else} + +function SDL_JoystickNumButtons(joystick: PSDL_Joystick): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickNumButtons' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Update the current state of the open joysticks. + * + * This is called automatically by the event loop if any joystick events are + * enabled. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickEventState + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickUpdate_proc = procedure(); cdecl; +Var + SDL_JoystickUpdate : TSDL_JoystickUpdate_proc = Nil; +{$else} + +procedure SDL_JoystickUpdate(); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickUpdate' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Enable/disable joystick event polling. + * + * If joystick events are disabled, you must call SDL_JoystickUpdate() + * yourself and manually check the state of the joystick when you want + * joystick information. + * + * It is recommended that you leave joystick event handling enabled. + * + * **WARNING**: Calling this function may delete all events currently in SDL's + * event queue. + * + * \param state can be one of `SDL_QUERY`, `SDL_IGNORE`, or `SDL_ENABLE` + * \returns 1 if enabled, 0 if disabled, or a negative error code on failure; + * call SDL_GetError() for more information. + * + * If `state` is `SDL_QUERY` then the current state is returned, + * otherwise the new processing state is returned. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GameControllerEventState + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickEventState_fun = function(state: cint): cint; cdecl; +Var + SDL_JoystickEventState : TSDL_JoystickEventState_fun = Nil; +{$else} + +function SDL_JoystickEventState(state: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickEventState' {$ENDIF} {$ENDIF}; +{$endif} + +const + SDL_JOYSTICK_AXIS_MAX = 32767; + SDL_JOYSTICK_AXIS_MIN = -32768; + +{** + * Get the current state of an axis control on a joystick. + * + * SDL makes no promises about what part of the joystick any given axis refers + * to. Your game should have some sort of configuration UI to let users + * specify what each axis should be bound to. Alternately, SDL's higher-level + * Game Controller API makes a great effort to apply order to this lower-level + * interface, so you know that a specific axis is the "left thumb stick," etc. + * + * The value returned by SDL_JoystickGetAxis() is a signed integer (-32768 to + * 32767) representing the current position of the axis. It may be necessary + * to impose certain tolerances on these values to account for jitter. + * + * \param joystick an SDL_Joystick structure containing joystick information + * \param axis the axis to query; the axis indices start at index 0 + * \returns a 16-bit signed integer representing the current position of the + * axis or 0 on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickNumAxes + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetAxis_fun = function(joystick: PSDL_Joystick; axis: cint): cint16; cdecl; +Var + SDL_JoystickGetAxis : TSDL_JoystickGetAxis_fun = Nil; +{$else} + +function SDL_JoystickGetAxis(joystick: PSDL_Joystick; axis: cint): cint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetAxis' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the initial state of an axis control on a joystick. + * + * The state is a value ranging from -32768 to 32767. + * + * The axis indices start at index 0. + * + * \param joystick an SDL_Joystick structure containing joystick information + * \param axis the axis to query; the axis indices start at index 0 + * \param state Upon return, the initial value is supplied here. + * \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not. + * + * \since This function is available since SDL 2.0.6. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetAxisInitialState_fun = function(joystick: PSDL_Joystick; axis: cint; state: pcint16): TSDL_Bool; cdecl; +Var + SDL_JoystickGetAxisInitialState : TSDL_JoystickGetAxisInitialState_fun = Nil; +{$else} + +function SDL_JoystickGetAxisInitialState(joystick: PSDL_Joystick; axis: cint; state: pcint16): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetAxisInitialState' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Hat positions + *} +const + SDL_HAT_CENTERED = $00; + SDL_HAT_UP = $01; + SDL_HAT_RIGHT = $02; + SDL_HAT_DOWN = $04; + SDL_HAT_LEFT = $08; + SDL_HAT_RIGHTUP = SDL_HAT_RIGHT or SDL_HAT_UP; + SDL_HAT_RIGHTDOWN = SDL_HAT_RIGHT or SDL_HAT_DOWN; + SDL_HAT_LEFTUP = SDL_HAT_LEFT or SDL_HAT_UP; + SDL_HAT_LEFTDOWN = SDL_HAT_LEFT or SDL_HAT_DOWN; + +{** + * Get the current state of a POV hat on a joystick. + * + * The returned value will be one of the following positions: + * + * - `SDL_HAT_CENTERED` + * - `SDL_HAT_UP` + * - `SDL_HAT_RIGHT` + * - `SDL_HAT_DOWN` + * - `SDL_HAT_LEFT` + * - `SDL_HAT_RIGHTUP` + * - `SDL_HAT_RIGHTDOWN` + * - `SDL_HAT_LEFTUP` + * - `SDL_HAT_LEFTDOWN` + * + * \param joystick an SDL_Joystick structure containing joystick information + * \param hat the hat index to get the state from; indices start at index 0 + * \returns the current hat position. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickNumHats + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetHat_fun = function(joystick: PSDL_Joystick; hat: cint): cuint8; cdecl; +Var + SDL_JoystickGetHat : TSDL_JoystickGetHat_fun = Nil; +{$else} + +function SDL_JoystickGetHat(joystick: PSDL_Joystick; hat: cint): cuint8; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetHat' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the ball axis change since the last poll. + * + * Trackballs can only return relative motion since the last call to + * SDL_JoystickGetBall(), these motion deltas are placed into `dx` and `dy`. + * + * Most joysticks do not have trackballs. + * + * \param joystick the SDL_Joystick to query + * \param ball the ball index to query; ball indices start at index 0 + * \param dx stores the difference in the x axis position since the last poll + * \param dy stores the difference in the y axis position since the last poll + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickNumBalls + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetBall_fun = function(joystick: PSDL_Joystick; ball: cint; dx: pcint; dy: pcint): cint; cdecl; +Var + SDL_JoystickGetBall : TSDL_JoystickGetBall_fun = Nil; +{$else} + +function SDL_JoystickGetBall(joystick: PSDL_Joystick; ball: cint; dx: pcint; dy: pcint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetBall' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the current state of a button on a joystick. + * + * \param joystick an SDL_Joystick structure containing joystick information + * \param button the button index to get the state from; indices start at + * index 0 + * \returns 1 if the specified button is pressed, 0 otherwise. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickNumButtons + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickGetButton_fun = function(joystick: PSDL_Joystick; button: cint): cuint8; cdecl; +Var + SDL_JoystickGetButton : TSDL_JoystickGetButton_fun = Nil; +{$else} + +function SDL_JoystickGetButton(joystick: PSDL_Joystick; button: cint): cuint8; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickGetButton' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Start a rumble effect. + * + * Each call to this function cancels any previous rumble effect, and calling + * it with 0 intensity stops any rumbling. + * + * \param joystick The joystick to vibrate + * \param low_frequency_rumble The intensity of the low frequency (left) + * rumble motor, from 0 to 0xFFFF + * \param high_frequency_rumble The intensity of the high frequency (right) + * rumble motor, from 0 to 0xFFFF + * \param duration_ms The duration of the rumble effect, in milliseconds + * \returns 0, or -1 if rumble isn't supported on this joystick + * + * \since This function is available since SDL 2.0.9. + * + * \sa SDL_JoystickHasRumble + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickRumble_fun = function(joystick: PSDL_Joystick; low_frequency_rumble: cuint16; high_frequency_rumble: cuint16; duration_ms: cuint32): cint; cdecl; +Var + SDL_JoystickRumble : TSDL_JoystickRumble_fun = Nil; +{$else} + +function SDL_JoystickRumble(joystick: PSDL_Joystick; low_frequency_rumble: cuint16; high_frequency_rumble: cuint16; duration_ms: cuint32): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickRumble' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Start a rumble effect in the joystick's triggers + * + * Each call to this function cancels any previous trigger rumble effect, and + * calling it with 0 intensity stops any rumbling. + * + * Note that this is rumbling of the _triggers_ and not the game controller as + * a whole. This is currently only supported on Xbox One controllers. If you + * want the (more common) whole-controller rumble, use SDL_JoystickRumble() + * instead. + * + * \param joystick The joystick to vibrate + * \param left_rumble The intensity of the left trigger rumble motor, from 0 + * to 0xFFFF + * \param right_rumble The intensity of the right trigger rumble motor, from 0 + * to 0xFFFF + * \param duration_ms The duration of the rumble effect, in milliseconds + * \returns 0, or -1 if trigger rumble isn't supported on this joystick + * + * \since This function is available since SDL 2.0.14. + * + * \sa SDL_JoystickHasRumbleTriggers + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickRumbleTriggers_fun = function(joystick: PSDL_Joystick; left_rumble: cuint16; right_rumble: cuint16; duration_ms: cuint32): cint; cdecl; +Var + SDL_JoystickRumbleTriggers : TSDL_JoystickRumbleTriggers_fun = Nil; +{$else} + +function SDL_JoystickRumbleTriggers(joystick: PSDL_Joystick; left_rumble: cuint16; right_rumble: cuint16; duration_ms: cuint32): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickRumbleTriggers' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Query whether a joystick has an LED. + * + * An example of a joystick LED is the light on the back of a PlayStation 4's + * DualShock 4 controller. + * + * \param joystick The joystick to query + * \return SDL_TRUE if the joystick has a modifiable LED, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.14. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickHasLED_fun = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; +Var + SDL_JoystickHasLED : TSDL_JoystickHasLED_fun = Nil; +{$else} + +function SDL_JoystickHasLED(joystick: PSDL_Joystick): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickHasLED' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Query whether a joystick has rumble support. + * + * \param joystick The joystick to query + * \return SDL_TRUE if the joystick has rumble, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.18. + * + * \sa SDL_JoystickRumble + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickHasRumble_fun = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; +Var + SDL_JoystickHasRumble : TSDL_JoystickHasRumble_fun = Nil; +{$else} + +function SDL_JoystickHasRumble(joystick: PSDL_Joystick): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickHasRumble' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Query whether a joystick has rumble support on triggers. + * + * \param joystick The joystick to query + * \return SDL_TRUE if the joystick has trigger rumble, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.18. + * + * \sa SDL_JoystickRumbleTriggers + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickHasRumbleTriggers_fun = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; +Var + SDL_JoystickHasRumbleTriggers : TSDL_JoystickHasRumbleTriggers_fun = Nil; +{$else} + +function SDL_JoystickHasRumbleTriggers(joystick: PSDL_Joystick): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickHasRumbleTriggers' {$ENDIF} {$ENDIF}; +{$endif} + + +{** + * Update a joystick's LED color. + * + * An example of a joystick LED is the light on the back of a PlayStation 4's + * DualShock 4 controller. + * + * \param joystick The joystick to update + * \param red The intensity of the red LED + * \param green The intensity of the green LED + * \param blue The intensity of the blue LED + * \returns 0 on success, -1 if this joystick does not have a modifiable LED + * + * \since This function is available since SDL 2.0.14. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickSetLED_fun = function(joystick: PSDL_Joystick; red: cuint8; green: cuint8; blue: cuint8): cint; cdecl; +Var + SDL_JoystickSetLED : TSDL_JoystickSetLED_fun = Nil; +{$else} + +function SDL_JoystickSetLED(joystick: PSDL_Joystick; red: cuint8; green: cuint8; blue: cuint8): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSetLED' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Send a joystick specific effect packet + * + * \param joystick The joystick to affect + * \param data The data to send to the joystick + * \param size The size of the data to send to the joystick + * \returns 0, or -1 if this joystick or driver doesn't support effect packets + * + * \since This function is available since SDL 2.0.16. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickSendEffect_fun = function(joystick: PSDL_Joystick; const data: Pointer; size: cint): cint; cdecl; +Var + SDL_JoystickSendEffect : TSDL_JoystickSendEffect_fun = Nil; +{$else} + +function SDL_JoystickSendEffect(joystick: PSDL_Joystick; const data: Pointer; size: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickSendEffect' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Close a joystick previously opened with SDL_JoystickOpen(). + * + * \param joystick The joystick device to close + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_JoystickOpen + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickClose_proc = procedure(joystick: PSDL_Joystick); cdecl; +Var + SDL_JoystickClose : TSDL_JoystickClose_proc = Nil; +{$else} + +procedure SDL_JoystickClose(joystick: PSDL_Joystick); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickClose' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the battery level of a joystick as SDL_JoystickPowerLevel. + * + * \param joystick the SDL_Joystick to query + * \returns the current battery level as SDL_JoystickPowerLevel on success or + * `SDL_JOYSTICK_POWER_UNKNOWN` if it is unknown + * + * \since This function is available since SDL 2.0.4. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_JoystickCurrentPowerLevel_fun = function(joystick: PSDL_Joystick): TSDL_JoystickPowerLevel; cdecl; +Var + SDL_JoystickCurrentPowerLevel : TSDL_JoystickCurrentPowerLevel_fun = Nil; +{$else} + +function SDL_JoystickCurrentPowerLevel(joystick: PSDL_Joystick): TSDL_JoystickPowerLevel; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickCurrentPowerLevel' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlkeyboard.inc b/units/sdlkeyboard.inc index 16123940..87b21dec 100644 --- a/units/sdlkeyboard.inc +++ b/units/sdlkeyboard.inc @@ -1,420 +1,420 @@ -//from "sdl_keyboard.h" - -{* - * \file SDL_keyboard.h - * - * Include file for SDL keyboard event handling - } - -type - { SDL2-for-Pascal: - - Is this type used/needed anywhere? - - It doesn't seem to be part of sdl_keyboard.h - - If not, should be commented out or deleted } - PPKeyStateArr = ^PKeyStateArr; - PKeyStateArr = ^TKeyStateArr; - TKeyStateArr = array[0..65000] of cuint8; - - {* - * \brief The SDL keysym structure, used in key events. - * - * \note If you are looking for translated character input, see the:: SDL_TEXTINPUT event. - } - PPSDL_Keysym = ^PSDL_Keysym; - PSDL_Keysym = ^TSDL_Keysym; - TSDL_Keysym = record - scancode: TSDL_ScanCode; // SDL physical key code - see SDL_Scancode for details - sym: TSDL_KeyCode; // SDL virtual key code - see SDL_Keycode for details - mod_: cuint16; // current key modifiers - unicode: cuint32; // (deprecated) use SDL_TextInputEvent instead - end; - -{ Function prototypes } - -{* - * Query the window which currently has keyboard focus. - * - * \returns the window with keyboard focus. - * - * \since This function is available since SDL 2.0.0. - } -function SDL_GetKeyboardFocus: PSDL_Window; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyboardFocus' {$ENDIF} {$ENDIF}; - -{* - * Get a snapshot of the current state of the keyboard. - * - * The pointer returned is a pointer to an internal SDL array. It will be - * valid for the whole lifetime of the application and should not be freed by - * the caller. - * - * A array element with a value of 1 means that the key is pressed and a value - * of 0 means that it is not. Indexes into this array are obtained by using - * SDL_Scancode values. - * - * Use SDL_PumpEvents() to update the state array. - * - * This function gives you the current state after all events have been - * processed, so if a key or button has been pressed and released before you - * process events, then the pressed state will never show up in the - * SDL_GetKeyboardState() calls. - * - * Note: This function doesn't take into account whether shift has been - * pressed or not. - * - * \param numkeys if non-nil, receives the length of the returned array - * \returns a pointer to an array of key states. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_PumpEvents - * \sa SDL_ResetKeyboard - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetKeyboardState_fun = function(numkeys: pcint): pcuint8; cdecl; -Var - SDL_GetKeyboardState : TSDL_GetKeyboardState_fun = Nil; -{$else} - -function SDL_GetKeyboardState(numkeys: pcint): pcuint8; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyboardState' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Clear the state of the keyboard - * - * This function will generate key up events for all pressed keys. - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_GetKeyboardState - } -procedure SDL_ResetKeyboard; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ResetKeyboard' {$ENDIF} {$ENDIF}; - -{* - * Get the current key modifier state for the keyboard. - * - * \returns an OR'd combination of the modifier keys for the keyboard. See - * SDL_Keymod for details. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetKeyboardState - * \sa SDL_SetModState - } -function SDL_GetModState: TSDL_Keymod; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetModState' {$ENDIF} {$ENDIF}; - -{* - * Set the current key modifier state for the keyboard. - * - * The inverse of SDL_GetModState(), SDL_SetModState() allows you to impose - * modifier key states on your application. Simply pass your desired modifier - * states into `modstate`. This value may be a bitwise, OR'd combination of - * SDL_Keymod values. - * - * This does not change the keyboard state, only the key modifier flags that - * SDL reports. - * - * \param modstate the desired SDL_Keymod for the keyboard - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetModState - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetModState_proc = procedure(modstate: TSDL_Keymod); cdecl; -Var - SDL_SetModState : TSDL_SetModState_proc = Nil; -{$else} - -procedure SDL_SetModState(modstate: TSDL_Keymod); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetModState' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Get the key code corresponding to the given scancode according to the - * current keyboard layout. - * - * See SDL_Keycode for details. - * - * \param scancode the desired SDL_Scancode to query - * \returns the SDL_Keycode that corresponds to the given SDL_Scancode. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetKeyName - * \sa SDL_GetScancodeFromKey - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetKeyFromScancode_fun = function(scancode: TSDL_Scancode): TSDL_Keycode; cdecl; -Var - SDL_GetKeyFromScancode : TSDL_GetKeyFromScancode_fun = Nil; -{$else} - -function SDL_GetKeyFromScancode(scancode: TSDL_Scancode): TSDL_Keycode; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyFromScancode' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Get the scancode corresponding to the given key code according to the - * current keyboard layout. - * - * See SDL_Scancode for details. - * - * \param key the desired SDL_Keycode to query - * \returns the SDL_Scancode that corresponds to the given SDL_Keycode. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetKeyFromScancode - * \sa SDL_GetScancodeName - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetScancodeFromKey_fun = function(key: TSDL_Keycode): TSDL_Scancode; cdecl; -Var - SDL_GetScancodeFromKey : TSDL_GetScancodeFromKey_fun = Nil; -{$else} - -function SDL_GetScancodeFromKey(key: TSDL_Keycode): TSDL_Scancode; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeFromKey' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Get a human-readable name for a scancode. - * - * See SDL_Scancode for details. - * - * **Warning**: The returned name is by design not stable across platforms, - * e.g. the name for `SDL_SCANCODE_LGUI` is "Left GUI" under Linux but "Left - * Windows" under Microsoft Windows, and some scancodes like - * `SDL_SCANCODE_NONUSBACKSLASH` don't have any name at all. There are even - * scancodes that share names, e.g. `SDL_SCANCODE_RETURN` and - * `SDL_SCANCODE_RETURN2` (both called "Return"). This function is therefore - * unsuitable for creating a stable cross-platform two-way mapping between - * strings and scancodes. - * - * \param scancode the desired SDL_Scancode to query - * \returns a pointer to the name for the scancode. If the scancode doesn't - * have a name this function returns an empty string (""). - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetScancodeFromKey - * \sa SDL_GetScancodeFromName - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetScancodeName_fun = function(scancode: TSDL_Scancode): PAnsiChar; cdecl; -Var - SDL_GetScancodeName : TSDL_GetScancodeName_fun = Nil; -{$else} - -function SDL_GetScancodeName(scancode: TSDL_Scancode): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeName' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Get a scancode from a human-readable name. - * - * \param name the human-readable scancode name - * \returns the SDL_Scancode, or `SDL_SCANCODE_UNKNOWN` if the name wasn't - * recognized; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetKeyFromName - * \sa SDL_GetScancodeFromKey - * \sa SDL_GetScancodeName - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetScancodeFromName_fun = function(name: PAnsiChar): TSDL_Scancode; cdecl; -Var - SDL_GetScancodeFromName : TSDL_GetScancodeFromName_fun = Nil; -{$else} - -function SDL_GetScancodeFromName(name: PAnsiChar): TSDL_Scancode; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeFromName' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Get a human-readable name for a key. - * - * See SDL_Scancode and SDL_Keycode for details. - * - * \param key the desired SDL_Keycode to query - * \returns a pointer to a UTF-8 string that stays valid at least until the - * next call to this function. If you need it around any longer, you - * must copy it. If the key doesn't have a name, this function - * returns an empty string (""). - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetKeyFromName - * \sa SDL_GetKeyFromScancode - * \sa SDL_GetScancodeFromKey - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetKeyName_fun = function(key: TSDL_Keycode): PAnsiChar; cdecl; -Var - SDL_GetKeyName : TSDL_GetKeyName_fun = Nil; -{$else} - -function SDL_GetKeyName(key: TSDL_Keycode): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyName' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Get a key code from a human-readable name. - * - * \param name the human-readable key name - * \returns key code, or `SDLK_UNKNOWN` if the name wasn't recognized; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetKeyFromScancode - * \sa SDL_GetKeyName - * \sa SDL_GetScancodeFromName - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetKeyFromName_fun = function(name: PAnsiChar): TSDL_Keycode; cdecl; -Var - SDL_GetKeyFromName : TSDL_GetKeyFromName_fun = Nil; -{$else} - -function SDL_GetKeyFromName(name: PAnsiChar): TSDL_Keycode; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyFromName' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Start accepting Unicode text input events. - * - * This function will start accepting Unicode text input events in the focused - * SDL window, and start emitting SDL_TextInputEvent (SDL_TEXTINPUT) and - * SDL_TextEditingEvent (SDL_TEXTEDITING) events. Please use this function in - * pair with SDL_StopTextInput(). - * - * On some platforms using this function activates the screen keyboard. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_SetTextInputRect - * \sa SDL_StopTextInput - } -procedure SDL_StartTextInput; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_StartTextInput' {$ENDIF} {$ENDIF}; - -{* - * Check whether or not Unicode text input events are enabled. - * - * \returns SDL_TRUE if text input events are enabled else SDL_FALSE. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_StartTextInput - } -function SDL_IsTextInputActive: TSDL_bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsTextInputActive' {$ENDIF} {$ENDIF}; - -{* - * Stop receiving any text input events. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_StartTextInput - } -procedure SDL_StopTextInput; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_StopTextInput' {$ENDIF} {$ENDIF}; - -{* - * Dismiss the composition window/IME without disabling the subsystem. - * - * \since This function is available since SDL 2.0.22. - * - * \sa SDL_StartTextInput - * \sa SDL_StopTextInput - } -procedure SDL_ClearComposition; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ClearComposition' {$ENDIF} {$ENDIF}; - -{* - * Returns if an IME Composite or Candidate window is currently shown. - * - * \since This function is available since SDL 2.0.22. - } -function SDL_IsTextInputShown: TSDL_bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsTextInputShown' {$ENDIF} {$ENDIF}; - -{* - * Set the rectangle used to type Unicode text inputs. - * - * To start text input in a given location, this function is intended to be - * called before SDL_StartTextInput, although some platforms support moving - * the rectangle even while text input (and a composition) is active. - * - * Note: If you want to use the system native IME window, try setting hint - * **SDL_HINT_IME_SHOW_UI** to **1**, otherwise this function won't give you - * any feedback. - * - * \param rect the SDL_Rect structure representing the rectangle to receive - * text (ignored if nil) - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_StartTextInput - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetTextInputRect_proc = procedure(rect: PSDL_Rect); cdecl; -Var - SDL_SetTextInputRect : TSDL_SetTextInputRect_proc = Nil; -{$else} - -procedure SDL_SetTextInputRect(rect: PSDL_Rect); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextInputRect' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Check whether the platform has screen keyboard support. - * - * \returns SDL_TRUE if the platform has some screen keyboard support or - * SDL_FALSE if not. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_StartTextInput - * \sa SDL_IsScreenKeyboardShown - } -function SDL_HasScreenKeyboardSupport: TSDL_bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasScreenKeyboardSupport' {$ENDIF} {$ENDIF}; - -{* - * Check whether the screen keyboard is shown for given window. - * - * \param window the window for which screen keyboard should be queried - * \returns SDL_TRUE if screen keyboard is shown or SDL_FALSE if not. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_HasScreenKeyboardSupport - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_IsScreenKeyboardShown_fun = function(window: PSDL_Window): TSDL_bool; cdecl; -Var - SDL_IsScreenKeyboardShown : TSDL_IsScreenKeyboardShown_fun = Nil; -{$else} - -function SDL_IsScreenKeyboardShown(window: PSDL_Window): TSDL_bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsScreenKeyboardShown' {$ENDIF} {$ENDIF}; -{$endif} - +//from "sdl_keyboard.h" + +{* + * \file SDL_keyboard.h + * + * Include file for SDL keyboard event handling + } + +type + { SDL2-for-Pascal: + - Is this type used/needed anywhere? + - It doesn't seem to be part of sdl_keyboard.h + - If not, should be commented out or deleted } + PPKeyStateArr = ^PKeyStateArr; + PKeyStateArr = ^TKeyStateArr; + TKeyStateArr = array[0..65000] of cuint8; + + {* + * \brief The SDL keysym structure, used in key events. + * + * \note If you are looking for translated character input, see the:: SDL_TEXTINPUT event. + } + PPSDL_Keysym = ^PSDL_Keysym; + PSDL_Keysym = ^TSDL_Keysym; + TSDL_Keysym = record + scancode: TSDL_ScanCode; // SDL physical key code - see SDL_Scancode for details + sym: TSDL_KeyCode; // SDL virtual key code - see SDL_Keycode for details + mod_: cuint16; // current key modifiers + unicode: cuint32; // (deprecated) use SDL_TextInputEvent instead + end; + +{ Function prototypes } + +{* + * Query the window which currently has keyboard focus. + * + * \returns the window with keyboard focus. + * + * \since This function is available since SDL 2.0.0. + } +function SDL_GetKeyboardFocus: PSDL_Window; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyboardFocus' {$ENDIF} {$ENDIF}; + +{* + * Get a snapshot of the current state of the keyboard. + * + * The pointer returned is a pointer to an internal SDL array. It will be + * valid for the whole lifetime of the application and should not be freed by + * the caller. + * + * A array element with a value of 1 means that the key is pressed and a value + * of 0 means that it is not. Indexes into this array are obtained by using + * SDL_Scancode values. + * + * Use SDL_PumpEvents() to update the state array. + * + * This function gives you the current state after all events have been + * processed, so if a key or button has been pressed and released before you + * process events, then the pressed state will never show up in the + * SDL_GetKeyboardState() calls. + * + * Note: This function doesn't take into account whether shift has been + * pressed or not. + * + * \param numkeys if non-nil, receives the length of the returned array + * \returns a pointer to an array of key states. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_PumpEvents + * \sa SDL_ResetKeyboard + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetKeyboardState_fun = function(numkeys: pcint): pcuint8; cdecl; +Var + SDL_GetKeyboardState : TSDL_GetKeyboardState_fun = Nil; +{$else} + +function SDL_GetKeyboardState(numkeys: pcint): pcuint8; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyboardState' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Clear the state of the keyboard + * + * This function will generate key up events for all pressed keys. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GetKeyboardState + } +procedure SDL_ResetKeyboard; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ResetKeyboard' {$ENDIF} {$ENDIF}; + +{* + * Get the current key modifier state for the keyboard. + * + * \returns an OR'd combination of the modifier keys for the keyboard. See + * SDL_Keymod for details. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetKeyboardState + * \sa SDL_SetModState + } +function SDL_GetModState: TSDL_Keymod; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetModState' {$ENDIF} {$ENDIF}; + +{* + * Set the current key modifier state for the keyboard. + * + * The inverse of SDL_GetModState(), SDL_SetModState() allows you to impose + * modifier key states on your application. Simply pass your desired modifier + * states into `modstate`. This value may be a bitwise, OR'd combination of + * SDL_Keymod values. + * + * This does not change the keyboard state, only the key modifier flags that + * SDL reports. + * + * \param modstate the desired SDL_Keymod for the keyboard + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetModState + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetModState_proc = procedure(modstate: TSDL_Keymod); cdecl; +Var + SDL_SetModState : TSDL_SetModState_proc = Nil; +{$else} + +procedure SDL_SetModState(modstate: TSDL_Keymod); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetModState' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get the key code corresponding to the given scancode according to the + * current keyboard layout. + * + * See SDL_Keycode for details. + * + * \param scancode the desired SDL_Scancode to query + * \returns the SDL_Keycode that corresponds to the given SDL_Scancode. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetKeyName + * \sa SDL_GetScancodeFromKey + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetKeyFromScancode_fun = function(scancode: TSDL_Scancode): TSDL_Keycode; cdecl; +Var + SDL_GetKeyFromScancode : TSDL_GetKeyFromScancode_fun = Nil; +{$else} + +function SDL_GetKeyFromScancode(scancode: TSDL_Scancode): TSDL_Keycode; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyFromScancode' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get the scancode corresponding to the given key code according to the + * current keyboard layout. + * + * See SDL_Scancode for details. + * + * \param key the desired SDL_Keycode to query + * \returns the SDL_Scancode that corresponds to the given SDL_Keycode. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetKeyFromScancode + * \sa SDL_GetScancodeName + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetScancodeFromKey_fun = function(key: TSDL_Keycode): TSDL_Scancode; cdecl; +Var + SDL_GetScancodeFromKey : TSDL_GetScancodeFromKey_fun = Nil; +{$else} + +function SDL_GetScancodeFromKey(key: TSDL_Keycode): TSDL_Scancode; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeFromKey' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get a human-readable name for a scancode. + * + * See SDL_Scancode for details. + * + * **Warning**: The returned name is by design not stable across platforms, + * e.g. the name for `SDL_SCANCODE_LGUI` is "Left GUI" under Linux but "Left + * Windows" under Microsoft Windows, and some scancodes like + * `SDL_SCANCODE_NONUSBACKSLASH` don't have any name at all. There are even + * scancodes that share names, e.g. `SDL_SCANCODE_RETURN` and + * `SDL_SCANCODE_RETURN2` (both called "Return"). This function is therefore + * unsuitable for creating a stable cross-platform two-way mapping between + * strings and scancodes. + * + * \param scancode the desired SDL_Scancode to query + * \returns a pointer to the name for the scancode. If the scancode doesn't + * have a name this function returns an empty string (""). + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetScancodeFromKey + * \sa SDL_GetScancodeFromName + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetScancodeName_fun = function(scancode: TSDL_Scancode): PAnsiChar; cdecl; +Var + SDL_GetScancodeName : TSDL_GetScancodeName_fun = Nil; +{$else} + +function SDL_GetScancodeName(scancode: TSDL_Scancode): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeName' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get a scancode from a human-readable name. + * + * \param name the human-readable scancode name + * \returns the SDL_Scancode, or `SDL_SCANCODE_UNKNOWN` if the name wasn't + * recognized; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetKeyFromName + * \sa SDL_GetScancodeFromKey + * \sa SDL_GetScancodeName + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetScancodeFromName_fun = function(name: PAnsiChar): TSDL_Scancode; cdecl; +Var + SDL_GetScancodeFromName : TSDL_GetScancodeFromName_fun = Nil; +{$else} + +function SDL_GetScancodeFromName(name: PAnsiChar): TSDL_Scancode; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeFromName' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get a human-readable name for a key. + * + * See SDL_Scancode and SDL_Keycode for details. + * + * \param key the desired SDL_Keycode to query + * \returns a pointer to a UTF-8 string that stays valid at least until the + * next call to this function. If you need it around any longer, you + * must copy it. If the key doesn't have a name, this function + * returns an empty string (""). + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetKeyFromName + * \sa SDL_GetKeyFromScancode + * \sa SDL_GetScancodeFromKey + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetKeyName_fun = function(key: TSDL_Keycode): PAnsiChar; cdecl; +Var + SDL_GetKeyName : TSDL_GetKeyName_fun = Nil; +{$else} + +function SDL_GetKeyName(key: TSDL_Keycode): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyName' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Get a key code from a human-readable name. + * + * \param name the human-readable key name + * \returns key code, or `SDLK_UNKNOWN` if the name wasn't recognized; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetKeyFromScancode + * \sa SDL_GetKeyName + * \sa SDL_GetScancodeFromName + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetKeyFromName_fun = function(name: PAnsiChar): TSDL_Keycode; cdecl; +Var + SDL_GetKeyFromName : TSDL_GetKeyFromName_fun = Nil; +{$else} + +function SDL_GetKeyFromName(name: PAnsiChar): TSDL_Keycode; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyFromName' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Start accepting Unicode text input events. + * + * This function will start accepting Unicode text input events in the focused + * SDL window, and start emitting SDL_TextInputEvent (SDL_TEXTINPUT) and + * SDL_TextEditingEvent (SDL_TEXTEDITING) events. Please use this function in + * pair with SDL_StopTextInput(). + * + * On some platforms using this function activates the screen keyboard. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_SetTextInputRect + * \sa SDL_StopTextInput + } +procedure SDL_StartTextInput; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_StartTextInput' {$ENDIF} {$ENDIF}; + +{* + * Check whether or not Unicode text input events are enabled. + * + * \returns SDL_TRUE if text input events are enabled else SDL_FALSE. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_StartTextInput + } +function SDL_IsTextInputActive: TSDL_bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsTextInputActive' {$ENDIF} {$ENDIF}; + +{* + * Stop receiving any text input events. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_StartTextInput + } +procedure SDL_StopTextInput; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_StopTextInput' {$ENDIF} {$ENDIF}; + +{* + * Dismiss the composition window/IME without disabling the subsystem. + * + * \since This function is available since SDL 2.0.22. + * + * \sa SDL_StartTextInput + * \sa SDL_StopTextInput + } +procedure SDL_ClearComposition; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ClearComposition' {$ENDIF} {$ENDIF}; + +{* + * Returns if an IME Composite or Candidate window is currently shown. + * + * \since This function is available since SDL 2.0.22. + } +function SDL_IsTextInputShown: TSDL_bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsTextInputShown' {$ENDIF} {$ENDIF}; + +{* + * Set the rectangle used to type Unicode text inputs. + * + * To start text input in a given location, this function is intended to be + * called before SDL_StartTextInput, although some platforms support moving + * the rectangle even while text input (and a composition) is active. + * + * Note: If you want to use the system native IME window, try setting hint + * **SDL_HINT_IME_SHOW_UI** to **1**, otherwise this function won't give you + * any feedback. + * + * \param rect the SDL_Rect structure representing the rectangle to receive + * text (ignored if nil) + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_StartTextInput + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetTextInputRect_proc = procedure(rect: PSDL_Rect); cdecl; +Var + SDL_SetTextInputRect : TSDL_SetTextInputRect_proc = Nil; +{$else} + +procedure SDL_SetTextInputRect(rect: PSDL_Rect); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextInputRect' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Check whether the platform has screen keyboard support. + * + * \returns SDL_TRUE if the platform has some screen keyboard support or + * SDL_FALSE if not. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_StartTextInput + * \sa SDL_IsScreenKeyboardShown + } +function SDL_HasScreenKeyboardSupport: TSDL_bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasScreenKeyboardSupport' {$ENDIF} {$ENDIF}; + +{* + * Check whether the screen keyboard is shown for given window. + * + * \param window the window for which screen keyboard should be queried + * \returns SDL_TRUE if screen keyboard is shown or SDL_FALSE if not. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_HasScreenKeyboardSupport + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_IsScreenKeyboardShown_fun = function(window: PSDL_Window): TSDL_bool; cdecl; +Var + SDL_IsScreenKeyboardShown : TSDL_IsScreenKeyboardShown_fun = Nil; +{$else} + +function SDL_IsScreenKeyboardShown(window: PSDL_Window): TSDL_bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsScreenKeyboardShown' {$ENDIF} {$ENDIF}; +{$endif} + diff --git a/units/sdlkeycode.inc b/units/sdlkeycode.inc index f29bf971..6f676373 100644 --- a/units/sdlkeycode.inc +++ b/units/sdlkeycode.inc @@ -1,320 +1,320 @@ -//from "sdl_keycode.h" - - {** - * The SDL virtual key representation. - * - * Values of this type are used to represent keyboard keys using the current - * layout of the keyboard. These values include Unicode values representing - * the unmodified character that would be generated by pressing the key, or - * an SDLK_* constant for those keys that do not generate characters. - * - * A special exception is the number keys at the top of the keyboard which - * always map to SDLK_0...SDLK_9, regardless of layout. - *} -type - PPSDL_KeyCode = ^PSDL_KeyCode; - PSDL_KeyCode = ^TSDL_KeyCode; - TSDL_KeyCode = type cint32; - -const - SDLK_SCANCODE_MASK = 1 shl 30; - //#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK) - //SDL2-for-Pascal: Not translated, see comment about this macro below. - - SDLK_UNKNOWN = TSDL_KeyCode(0); - - SDLK_RETURN = TSDL_KeyCode(#13); // C: '\r' - SDLK_ESCAPE = TSDL_KeyCode(#27); // C: '\x1B' - SDLK_BACKSPACE = TSDL_KeyCode(#8); // C: '\b' - SDLK_TAB = TSDL_KeyCode(#9); // C: '\t' - SDLK_SPACE = TSDL_KeyCode(' '); - SDLK_EXCLAIM = TSDL_KeyCode('!'); - SDLK_QUOTEDBL = TSDL_KeyCode('"'); - SDLK_HASH = TSDL_KeyCode('#'); - SDLK_PERCENT = TSDL_KeyCode('%'); - SDLK_DOLLAR = TSDL_KeyCode('$'); - SDLK_AMPERSAND = TSDL_KeyCode('&'); - SDLK_QUOTE = TSDL_KeyCode(''''); - SDLK_LEFTPAREN = TSDL_KeyCode('('); - SDLK_RIGHTPAREN = TSDL_KeyCode(')'); - SDLK_ASTERISK = TSDL_KeyCode('*'); - SDLK_PLUS = TSDL_KeyCode('+'); - SDLK_COMMA = TSDL_KeyCode(','); - SDLK_MINUS = TSDL_KeyCode('-'); - SDLK_PERIOD = TSDL_KeyCode('.'); - SDLK_SLASH = TSDL_KeyCode('/'); - SDLK_0 = TSDL_KeyCode('0'); - SDLK_1 = TSDL_KeyCode('1'); - SDLK_2 = TSDL_KeyCode('2'); - SDLK_3 = TSDL_KeyCode('3'); - SDLK_4 = TSDL_KeyCode('4'); - SDLK_5 = TSDL_KeyCode('5'); - SDLK_6 = TSDL_KeyCode('6'); - SDLK_7 = TSDL_KeyCode('7'); - SDLK_8 = TSDL_KeyCode('8'); - SDLK_9 = TSDL_KeyCode('9'); - SDLK_COLON = TSDL_KeyCode(':'); - SDLK_SEMICOLON = TSDL_KeyCode(';'); - SDLK_LESS = TSDL_KeyCode('<'); - SDLK_EQUALS = TSDL_KeyCode('='); - SDLK_GREATER = TSDL_KeyCode('>'); - SDLK_QUESTION = TSDL_KeyCode('?'); - SDLK_AT = TSDL_KeyCode('@'); - {* - Skip uppercase letters - *} - SDLK_LEFTBRACKET = TSDL_KeyCode('['); - SDLK_BACKSLASH = TSDL_KeyCode('\'); // C: '\\' - SDLK_RIGHTBRACKET = TSDL_KeyCode(']'); - SDLK_CARET = TSDL_KeyCode('^'); - SDLK_UNDERSCORE = TSDL_KeyCode('_'); - SDLK_BACKQUOTE = TSDL_KeyCode('`'); - SDLK_a = TSDL_KeyCode('a'); - SDLK_b = TSDL_KeyCode('b'); - SDLK_c = TSDL_KeyCode('c'); - SDLK_d = TSDL_KeyCode('d'); - SDLK_e = TSDL_KeyCode('e'); - SDLK_f = TSDL_KeyCode('f'); - SDLK_g = TSDL_KeyCode('g'); - SDLK_h = TSDL_KeyCode('h'); - SDLK_i = TSDL_KeyCode('i'); - SDLK_j = TSDL_KeyCode('j'); - SDLK_k = TSDL_KeyCode('k'); - SDLK_l = TSDL_KeyCode('l'); - SDLK_m = TSDL_KeyCode('m'); - SDLK_n = TSDL_KeyCode('n'); - SDLK_o = TSDL_KeyCode('o'); - SDLK_p = TSDL_KeyCode('p'); - SDLK_q = TSDL_KeyCode('q'); - SDLK_r = TSDL_KeyCode('r'); - SDLK_s = TSDL_KeyCode('s'); - SDLK_t = TSDL_KeyCode('t'); - SDLK_u = TSDL_KeyCode('u'); - SDLK_v = TSDL_KeyCode('v'); - SDLK_w = TSDL_KeyCode('w'); - SDLK_x = TSDL_KeyCode('x'); - SDLK_y = TSDL_KeyCode('y'); - SDLK_z = TSDL_KeyCode('z'); - - {SDL2-for-Pascal: In C the following scancodes are or'd by a macro: - SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK) - - We convert the scancodes directly by: - TSDL_KeyCode(X or SDLK_SCANCODE_MASK); } - - SDLK_CAPSLOCK = TSDL_KeyCode(SDL_SCANCODE_CAPSLOCK or SDLK_SCANCODE_MASK); - - SDLK_F1 = TSDL_KeyCode(SDL_SCANCODE_F1 or SDLK_SCANCODE_MASK); - SDLK_F2 = TSDL_KeyCode(SDL_SCANCODE_F2 or SDLK_SCANCODE_MASK); - SDLK_F3 = TSDL_KeyCode(SDL_SCANCODE_F3 or SDLK_SCANCODE_MASK); - SDLK_F4 = TSDL_KeyCode(SDL_SCANCODE_F4 or SDLK_SCANCODE_MASK); - SDLK_F5 = TSDL_KeyCode(SDL_SCANCODE_F5 or SDLK_SCANCODE_MASK); - SDLK_F6 = TSDL_KeyCode(SDL_SCANCODE_F6 or SDLK_SCANCODE_MASK); - SDLK_F7 = TSDL_KeyCode(SDL_SCANCODE_F7 or SDLK_SCANCODE_MASK); - SDLK_F8 = TSDL_KeyCode(SDL_SCANCODE_F8 or SDLK_SCANCODE_MASK); - SDLK_F9 = TSDL_KeyCode(SDL_SCANCODE_F9 or SDLK_SCANCODE_MASK); - SDLK_F10 = TSDL_KeyCode(SDL_SCANCODE_F10 or SDLK_SCANCODE_MASK); - SDLK_F11 = TSDL_KeyCode(SDL_SCANCODE_F11 or SDLK_SCANCODE_MASK); - SDLK_F12 = TSDL_KeyCode(SDL_SCANCODE_F12 or SDLK_SCANCODE_MASK); - - SDLK_PRINTSCREEN = TSDL_KeyCode(SDL_SCANCODE_PRINTSCREEN or SDLK_SCANCODE_MASK); - SDLK_SCROLLLOCK = TSDL_KeyCode(SDL_SCANCODE_SCROLLLOCK or SDLK_SCANCODE_MASK); - SDLK_PAUSE = TSDL_KeyCode(SDL_SCANCODE_PAUSE or SDLK_SCANCODE_MASK); - SDLK_INSERT = TSDL_KeyCode(SDL_SCANCODE_INSERT or SDLK_SCANCODE_MASK); - SDLK_HOME = TSDL_KeyCode(SDL_SCANCODE_HOME or SDLK_SCANCODE_MASK); - SDLK_PAGEUP = TSDL_KeyCode(SDL_SCANCODE_PAGEUP or SDLK_SCANCODE_MASK); - SDLK_DELETE = TSDL_KeyCode(#127); // C: '\x7F' - SDLK_END = TSDL_KeyCode(SDL_SCANCODE_END or SDLK_SCANCODE_MASK); - SDLK_PAGEDOWN = TSDL_KeyCode(SDL_SCANCODE_PAGEDOWN or SDLK_SCANCODE_MASK); - SDLK_RIGHT = TSDL_KeyCode(SDL_SCANCODE_RIGHT or SDLK_SCANCODE_MASK); - SDLK_LEFT = TSDL_KeyCode(SDL_SCANCODE_LEFT or SDLK_SCANCODE_MASK); - SDLK_DOWN = TSDL_KeyCode(SDL_SCANCODE_DOWN or SDLK_SCANCODE_MASK); - SDLK_UP = TSDL_KeyCode(SDL_SCANCODE_UP or SDLK_SCANCODE_MASK); - - SDLK_NUMLOCKCLEAR = TSDL_KeyCode(SDL_SCANCODE_NUMLOCKCLEAR or SDLK_SCANCODE_MASK); - SDLK_KP_DIVIDE = TSDL_KeyCode(SDL_SCANCODE_KP_DIVIDE or SDLK_SCANCODE_MASK); - SDLK_KP_MULTIPLY = TSDL_KeyCode(SDL_SCANCODE_KP_MULTIPLY or SDLK_SCANCODE_MASK); - SDLK_KP_MINUS = TSDL_KeyCode(SDL_SCANCODE_KP_MINUS or SDLK_SCANCODE_MASK); - SDLK_KP_PLUS = TSDL_KeyCode(SDL_SCANCODE_KP_PLUS or SDLK_SCANCODE_MASK); - SDLK_KP_ENTER = TSDL_KeyCode(SDL_SCANCODE_KP_ENTER or SDLK_SCANCODE_MASK); - SDLK_KP_1 = TSDL_KeyCode(SDL_SCANCODE_KP_1 or SDLK_SCANCODE_MASK); - SDLK_KP_2 = TSDL_KeyCode(SDL_SCANCODE_KP_2 or SDLK_SCANCODE_MASK); - SDLK_KP_3 = TSDL_KeyCode(SDL_SCANCODE_KP_3 or SDLK_SCANCODE_MASK); - SDLK_KP_4 = TSDL_KeyCode(SDL_SCANCODE_KP_4 or SDLK_SCANCODE_MASK); - SDLK_KP_5 = TSDL_KeyCode(SDL_SCANCODE_KP_5 or SDLK_SCANCODE_MASK); - SDLK_KP_6 = TSDL_KeyCode(SDL_SCANCODE_KP_6 or SDLK_SCANCODE_MASK); - SDLK_KP_7 = TSDL_KeyCode(SDL_SCANCODE_KP_7 or SDLK_SCANCODE_MASK); - SDLK_KP_8 = TSDL_KeyCode(SDL_SCANCODE_KP_8 or SDLK_SCANCODE_MASK); - SDLK_KP_9 = TSDL_KeyCode(SDL_SCANCODE_KP_9 or SDLK_SCANCODE_MASK); - SDLK_KP_0 = TSDL_KeyCode(SDL_SCANCODE_KP_0 or SDLK_SCANCODE_MASK); - SDLK_KP_PERIOD = TSDL_KeyCode(SDL_SCANCODE_KP_PERIOD or SDLK_SCANCODE_MASK); - - SDLK_APPLICATION = TSDL_KeyCode(SDL_SCANCODE_APPLICATION or SDLK_SCANCODE_MASK); - SDLK_POWER = TSDL_KeyCode(SDL_SCANCODE_POWER or SDLK_SCANCODE_MASK); - SDLK_KP_EQUALS = TSDL_KeyCode(SDL_SCANCODE_KP_EQUALS or SDLK_SCANCODE_MASK); - SDLK_F13 = TSDL_KeyCode(SDL_SCANCODE_F13 or SDLK_SCANCODE_MASK); - SDLK_F14 = TSDL_KeyCode(SDL_SCANCODE_F14 or SDLK_SCANCODE_MASK); - SDLK_F15 = TSDL_KeyCode(SDL_SCANCODE_F15 or SDLK_SCANCODE_MASK); - SDLK_F16 = TSDL_KeyCode(SDL_SCANCODE_F16 or SDLK_SCANCODE_MASK); - SDLK_F17 = TSDL_KeyCode(SDL_SCANCODE_F17 or SDLK_SCANCODE_MASK); - SDLK_F18 = TSDL_KeyCode(SDL_SCANCODE_F18 or SDLK_SCANCODE_MASK); - SDLK_F19 = TSDL_KeyCode(SDL_SCANCODE_F19 or SDLK_SCANCODE_MASK); - SDLK_F20 = TSDL_KeyCode(SDL_SCANCODE_F20 or SDLK_SCANCODE_MASK); - SDLK_F21 = TSDL_KeyCode(SDL_SCANCODE_F21 or SDLK_SCANCODE_MASK); - SDLK_F22 = TSDL_KeyCode(SDL_SCANCODE_F22 or SDLK_SCANCODE_MASK); - SDLK_F23 = TSDL_KeyCode(SDL_SCANCODE_F23 or SDLK_SCANCODE_MASK); - SDLK_F24 = TSDL_KeyCode(SDL_SCANCODE_F24 or SDLK_SCANCODE_MASK); - SDLK_EXECUTE = TSDL_KeyCode(SDL_SCANCODE_EXECUTE or SDLK_SCANCODE_MASK); - SDLK_HELP = TSDL_KeyCode(SDL_SCANCODE_HELP or SDLK_SCANCODE_MASK); - SDLK_MENU = TSDL_KeyCode(SDL_SCANCODE_MENU or SDLK_SCANCODE_MASK); - SDLK_SELECT = TSDL_KeyCode(SDL_SCANCODE_SELECT or SDLK_SCANCODE_MASK); - SDLK_STOP = TSDL_KeyCode(SDL_SCANCODE_STOP or SDLK_SCANCODE_MASK); - SDLK_AGAIN = TSDL_KeyCode(SDL_SCANCODE_AGAIN or SDLK_SCANCODE_MASK); - SDLK_UNDO = TSDL_KeyCode(SDL_SCANCODE_UNDO or SDLK_SCANCODE_MASK); - SDLK_CUT = TSDL_KeyCode(SDL_SCANCODE_CUT or SDLK_SCANCODE_MASK); - SDLK_COPY = TSDL_KeyCode(SDL_SCANCODE_COPY or SDLK_SCANCODE_MASK); - SDLK_PASTE = TSDL_KeyCode(SDL_SCANCODE_PASTE or SDLK_SCANCODE_MASK); - SDLK_FIND = TSDL_KeyCode(SDL_SCANCODE_FIND or SDLK_SCANCODE_MASK); - SDLK_MUTE = TSDL_KeyCode(SDL_SCANCODE_MUTE or SDLK_SCANCODE_MASK); - SDLK_VOLUMEUP = TSDL_KeyCode(SDL_SCANCODE_VOLUMEUP or SDLK_SCANCODE_MASK); - SDLK_VOLUMEDOWN = TSDL_KeyCode(SDL_SCANCODE_VOLUMEDOWN or SDLK_SCANCODE_MASK); - SDLK_KP_COMMA = TSDL_KeyCode(SDL_SCANCODE_KP_COMMA or SDLK_SCANCODE_MASK); - SDLK_KP_EQUALSAS400 = TSDL_KeyCode(SDL_SCANCODE_KP_EQUALSAS400 or SDLK_SCANCODE_MASK); - - SDLK_ALTERASE = TSDL_KeyCode(SDL_SCANCODE_ALTERASE or SDLK_SCANCODE_MASK); - SDLK_SYSREQ = TSDL_KeyCode(SDL_SCANCODE_SYSREQ or SDLK_SCANCODE_MASK); - SDLK_CANCEL = TSDL_KeyCode(SDL_SCANCODE_CANCEL or SDLK_SCANCODE_MASK); - SDLK_CLEAR = TSDL_KeyCode(SDL_SCANCODE_CLEAR or SDLK_SCANCODE_MASK); - SDLK_PRIOR = TSDL_KeyCode(SDL_SCANCODE_PRIOR or SDLK_SCANCODE_MASK); - SDLK_RETURN2 = TSDL_KeyCode(SDL_SCANCODE_RETURN2 or SDLK_SCANCODE_MASK); - SDLK_SEPARATOR = TSDL_KeyCode(SDL_SCANCODE_SEPARATOR or SDLK_SCANCODE_MASK); - SDLK_OUT = TSDL_KeyCode(SDL_SCANCODE_OUT or SDLK_SCANCODE_MASK); - SDLK_OPER = TSDL_KeyCode(SDL_SCANCODE_OPER or SDLK_SCANCODE_MASK); - SDLK_CLEARAGAIN = TSDL_KeyCode(SDL_SCANCODE_CLEARAGAIN or SDLK_SCANCODE_MASK); - SDLK_CRSEL = TSDL_KeyCode(SDL_SCANCODE_CRSEL or SDLK_SCANCODE_MASK); - SDLK_EXSEL = TSDL_KeyCode(SDL_SCANCODE_EXSEL or SDLK_SCANCODE_MASK); - - SDLK_KP_00 = TSDL_KeyCode(SDL_SCANCODE_KP_00 or SDLK_SCANCODE_MASK); - SDLK_KP_000 = TSDL_KeyCode(SDL_SCANCODE_KP_000 or SDLK_SCANCODE_MASK); - SDLK_THOUSANDSSEPARATOR = TSDL_KeyCode(SDL_SCANCODE_THOUSANDSSEPARATOR or SDLK_SCANCODE_MASK); - SDLK_DECIMALSEPARATOR = TSDL_KeyCode(SDL_SCANCODE_DECIMALSEPARATOR or SDLK_SCANCODE_MASK); - SDLK_CURRENCYUNIT = TSDL_KeyCode(SDL_SCANCODE_CURRENCYUNIT or SDLK_SCANCODE_MASK); - SDLK_CURRENCYSUBUNIT = TSDL_KeyCode(SDL_SCANCODE_CURRENCYSUBUNIT or SDLK_SCANCODE_MASK); - SDLK_KP_LEFTPAREN = TSDL_KeyCode(SDL_SCANCODE_KP_LEFTPAREN or SDLK_SCANCODE_MASK); - SDLK_KP_RIGHTPAREN = TSDL_KeyCode(SDL_SCANCODE_KP_RIGHTPAREN or SDLK_SCANCODE_MASK); - SDLK_KP_LEFTBRACE = TSDL_KeyCode(SDL_SCANCODE_KP_LEFTBRACE or SDLK_SCANCODE_MASK); - SDLK_KP_RIGHTBRACE = TSDL_KeyCode(SDL_SCANCODE_KP_RIGHTBRACE or SDLK_SCANCODE_MASK); - SDLK_KP_TAB = TSDL_KeyCode(SDL_SCANCODE_KP_TAB or SDLK_SCANCODE_MASK); - SDLK_KP_BACKSPACE = TSDL_KeyCode(SDL_SCANCODE_KP_BACKSPACE or SDLK_SCANCODE_MASK); - SDLK_KP_A = TSDL_KeyCode(SDL_SCANCODE_KP_A or SDLK_SCANCODE_MASK); - SDLK_KP_B = TSDL_KeyCode(SDL_SCANCODE_KP_B or SDLK_SCANCODE_MASK); - SDLK_KP_C = TSDL_KeyCode(SDL_SCANCODE_KP_C or SDLK_SCANCODE_MASK); - SDLK_KP_D = TSDL_KeyCode(SDL_SCANCODE_KP_D or SDLK_SCANCODE_MASK); - SDLK_KP_E = TSDL_KeyCode(SDL_SCANCODE_KP_E or SDLK_SCANCODE_MASK); - SDLK_KP_F = TSDL_KeyCode(SDL_SCANCODE_KP_F or SDLK_SCANCODE_MASK); - SDLK_KP_XOR = TSDL_KeyCode(SDL_SCANCODE_KP_XOR or SDLK_SCANCODE_MASK); - SDLK_KP_POWER = TSDL_KeyCode(SDL_SCANCODE_KP_POWER or SDLK_SCANCODE_MASK); - SDLK_KP_PERCENT = TSDL_KeyCode(SDL_SCANCODE_KP_PERCENT or SDLK_SCANCODE_MASK); - SDLK_KP_LESS = TSDL_KeyCode(SDL_SCANCODE_KP_LESS or SDLK_SCANCODE_MASK); - SDLK_KP_GREATER = TSDL_KeyCode(SDL_SCANCODE_KP_GREATER or SDLK_SCANCODE_MASK); - SDLK_KP_AMPERSAND = TSDL_KeyCode(SDL_SCANCODE_KP_AMPERSAND or SDLK_SCANCODE_MASK); - SDLK_KP_DBLAMPERSAND = TSDL_KeyCode(SDL_SCANCODE_KP_DBLAMPERSAND or SDLK_SCANCODE_MASK); - SDLK_KP_VERTICALBAR = TSDL_KeyCode(SDL_SCANCODE_KP_VERTICALBAR or SDLK_SCANCODE_MASK); - SDLK_KP_DBLVERTICALBAR = TSDL_KeyCode(SDL_SCANCODE_KP_DBLVERTICALBAR or SDLK_SCANCODE_MASK); - SDLK_KP_COLON = TSDL_KeyCode(SDL_SCANCODE_KP_COLON or SDLK_SCANCODE_MASK); - SDLK_KP_HASH = TSDL_KeyCode(SDL_SCANCODE_KP_HASH or SDLK_SCANCODE_MASK); - SDLK_KP_SPACE = TSDL_KeyCode(SDL_SCANCODE_KP_SPACE or SDLK_SCANCODE_MASK); - SDLK_KP_AT = TSDL_KeyCode(SDL_SCANCODE_KP_AT or SDLK_SCANCODE_MASK); - SDLK_KP_EXCLAM = TSDL_KeyCode(SDL_SCANCODE_KP_EXCLAM or SDLK_SCANCODE_MASK); - SDLK_KP_MEMSTORE = TSDL_KeyCode(SDL_SCANCODE_KP_MEMSTORE or SDLK_SCANCODE_MASK); - SDLK_KP_MEMRECALL = TSDL_KeyCode(SDL_SCANCODE_KP_MEMRECALL or SDLK_SCANCODE_MASK); - SDLK_KP_MEMCLEAR = TSDL_KeyCode(SDL_SCANCODE_KP_MEMCLEAR or SDLK_SCANCODE_MASK); - SDLK_KP_MEMADD = TSDL_KeyCode(SDL_SCANCODE_KP_MEMADD or SDLK_SCANCODE_MASK); - SDLK_KP_MEMSUBTRACT = TSDL_KeyCode(SDL_SCANCODE_KP_MEMSUBTRACT or SDLK_SCANCODE_MASK); - SDLK_KP_MEMMULTIPLY = TSDL_KeyCode(SDL_SCANCODE_KP_MEMMULTIPLY or SDLK_SCANCODE_MASK); - SDLK_KP_MEMDIVIDE = TSDL_KeyCode(SDL_SCANCODE_KP_MEMDIVIDE or SDLK_SCANCODE_MASK); - SDLK_KP_PLUSMINUS = TSDL_KeyCode(SDL_SCANCODE_KP_PLUSMINUS or SDLK_SCANCODE_MASK); - SDLK_KP_CLEAR = TSDL_KeyCode(SDL_SCANCODE_KP_CLEAR or SDLK_SCANCODE_MASK); - SDLK_KP_CLEARENTRY = TSDL_KeyCode(SDL_SCANCODE_KP_CLEARENTRY or SDLK_SCANCODE_MASK); - SDLK_KP_BINARY = TSDL_KeyCode(SDL_SCANCODE_KP_BINARY or SDLK_SCANCODE_MASK); - SDLK_KP_OCTAL = TSDL_KeyCode(SDL_SCANCODE_KP_OCTAL or SDLK_SCANCODE_MASK); - SDLK_KP_DECIMAL = TSDL_KeyCode(SDL_SCANCODE_KP_DECIMAL or SDLK_SCANCODE_MASK); - SDLK_KP_HEXADECIMAL = TSDL_KeyCode(SDL_SCANCODE_KP_HEXADECIMAL or SDLK_SCANCODE_MASK); - - SDLK_LCTRL = TSDL_KeyCode(SDL_SCANCODE_LCTRL or SDLK_SCANCODE_MASK); - SDLK_LSHIFT = TSDL_KeyCode(SDL_SCANCODE_LSHIFT or SDLK_SCANCODE_MASK); - SDLK_LALT = TSDL_KeyCode(SDL_SCANCODE_LALT or SDLK_SCANCODE_MASK); - SDLK_LGUI = TSDL_KeyCode(SDL_SCANCODE_LGUI or SDLK_SCANCODE_MASK); - SDLK_RCTRL = TSDL_KeyCode(SDL_SCANCODE_RCTRL or SDLK_SCANCODE_MASK); - SDLK_RSHIFT = TSDL_KeyCode(SDL_SCANCODE_RSHIFT or SDLK_SCANCODE_MASK); - SDLK_RALT = TSDL_KeyCode(SDL_SCANCODE_RALT or SDLK_SCANCODE_MASK); - SDLK_RGUI = TSDL_KeyCode(SDL_SCANCODE_RGUI or SDLK_SCANCODE_MASK); - - SDLK_MODE = TSDL_KeyCode(SDL_SCANCODE_MODE or SDLK_SCANCODE_MASK); - - SDLK_AUDIONEXT = TSDL_KeyCode(SDL_SCANCODE_AUDIONEXT or SDLK_SCANCODE_MASK); - SDLK_AUDIOPREV = TSDL_KeyCode(SDL_SCANCODE_AUDIOPREV or SDLK_SCANCODE_MASK); - SDLK_AUDIOSTOP = TSDL_KeyCode(SDL_SCANCODE_AUDIOSTOP or SDLK_SCANCODE_MASK); - SDLK_AUDIOPLAY = TSDL_KeyCode(SDL_SCANCODE_AUDIOPLAY or SDLK_SCANCODE_MASK); - SDLK_AUDIOMUTE = TSDL_KeyCode(SDL_SCANCODE_AUDIOMUTE or SDLK_SCANCODE_MASK); - SDLK_MEDIASELECT = TSDL_KeyCode(SDL_SCANCODE_MEDIASELECT or SDLK_SCANCODE_MASK); - SDLK_WWW = TSDL_KeyCode(SDL_SCANCODE_WWW or SDLK_SCANCODE_MASK); - SDLK_MAIL = TSDL_KeyCode(SDL_SCANCODE_MAIL or SDLK_SCANCODE_MASK); - SDLK_CALCULATOR = TSDL_KeyCode(SDL_SCANCODE_CALCULATOR or SDLK_SCANCODE_MASK); - SDLK_COMPUTER = TSDL_KeyCode(SDL_SCANCODE_COMPUTER or SDLK_SCANCODE_MASK); - SDLK_AC_SEARCH = TSDL_KeyCode(SDL_SCANCODE_AC_SEARCH or SDLK_SCANCODE_MASK); - SDLK_AC_HOME = TSDL_KeyCode(SDL_SCANCODE_AC_HOME or SDLK_SCANCODE_MASK); - SDLK_AC_BACK = TSDL_KeyCode(SDL_SCANCODE_AC_BACK or SDLK_SCANCODE_MASK); - SDLK_AC_FORWARD = TSDL_KeyCode(SDL_SCANCODE_AC_FORWARD or SDLK_SCANCODE_MASK); - SDLK_AC_STOP = TSDL_KeyCode(SDL_SCANCODE_AC_STOP or SDLK_SCANCODE_MASK); - SDLK_AC_REFRESH = TSDL_KeyCode(SDL_SCANCODE_AC_REFRESH or SDLK_SCANCODE_MASK); - SDLK_AC_BOOKMARKS = TSDL_KeyCode(SDL_SCANCODE_AC_BOOKMARKS or SDLK_SCANCODE_MASK); - - SDLK_BRIGHTNESSDOWN = TSDL_KeyCode(SDL_SCANCODE_BRIGHTNESSDOWN or SDLK_SCANCODE_MASK); - SDLK_BRIGHTNESSUP = TSDL_KeyCode(SDL_SCANCODE_BRIGHTNESSUP or SDLK_SCANCODE_MASK); - SDLK_DISPLAYSWITCH = TSDL_KeyCode(SDL_SCANCODE_DISPLAYSWITCH or SDLK_SCANCODE_MASK); - SDLK_KBDILLUMTOGGLE = TSDL_KeyCode(SDL_SCANCODE_KBDILLUMTOGGLE or SDLK_SCANCODE_MASK); - SDLK_KBDILLUMDOWN = TSDL_KeyCode(SDL_SCANCODE_KBDILLUMDOWN or SDLK_SCANCODE_MASK); - SDLK_KBDILLUMUP = TSDL_KeyCode(SDL_SCANCODE_KBDILLUMUP or SDLK_SCANCODE_MASK); - SDLK_EJECT = TSDL_KeyCode(SDL_SCANCODE_EJECT or SDLK_SCANCODE_MASK); - SDLK_SLEEP = TSDL_KeyCode(SDL_SCANCODE_SLEEP or SDLK_SCANCODE_MASK); - SDLK_APP1 = TSDL_KeyCode(SDL_SCANCODE_APP1 or SDLK_SCANCODE_MASK); - SDLK_APP2 = TSDL_KeyCode(SDL_SCANCODE_APP2 or SDLK_SCANCODE_MASK); - - SDLK_AUDIOREWIND = TSDL_KeyCode(SDL_SCANCODE_AUDIOREWIND or SDLK_SCANCODE_MASK); - SDLK_AUDIOFASTFORWARD = TSDL_KeyCode(SDL_SCANCODE_AUDIOFASTFORWARD or SDLK_SCANCODE_MASK); - - SDLK_SOFTLEFT = TSDL_KeyCode(SDL_SCANCODE_SOFTLEFT or SDLK_SCANCODE_MASK); - SDLK_SOFTRIGHT = TSDL_KeyCode(SDL_SCANCODE_SOFTRIGHT or SDLK_SCANCODE_MASK); - SDLK_CALL = TSDL_KeyCode(SDL_SCANCODE_CALL or SDLK_SCANCODE_MASK); - SDLK_ENDCALL = TSDL_KeyCode(SDL_SCANCODE_ENDCALL or SDLK_SCANCODE_MASK); - - {** - * Enumeration of valid key mods (possibly OR'd together). - *} -type - PPSDL_KeyMod = ^PSDL_KeyMod; - PSDL_KeyMod = ^TSDL_KeyMod; - TSDL_KeyMod = type cint; - -const - KMOD_NONE = TSDL_KeyMod($0000); - KMOD_LSHIFT = TSDL_KeyMod($0001); - KMOD_RSHIFT = TSDL_KeyMod($0002); - KMOD_LCTRL = TSDL_KeyMod($0040); - KMOD_RCTRL = TSDL_KeyMod($0080); - KMOD_LALT = TSDL_KeyMod($0100); - KMOD_RALT = TSDL_KeyMod($0200); - KMOD_LGUI = TSDL_KeyMod($0400); - KMOD_RGUI = TSDL_KeyMod($0800); - KMOD_NUM = TSDL_KeyMod($1000); - KMOD_CAPS = TSDL_KeyMod($2000); - KMOD_MODE = TSDL_KeyMod($4000); - KMOD_SCROLL = TSDL_KeyMod($8000); - - KMOD_CTRL = KMOD_LCTRL or KMOD_RCTRL; - KMOD_SHIFT = KMOD_LSHIFT or KMOD_RSHIFT; - KMOD_ALT = KMOD_LALT or KMOD_RALT; - KMOD_GUI = KMOD_LGUI or KMOD_RGUI; - - KMOD_RESERVED = KMOD_SCROLL; {* This is for source-level compatibility with SDL 2.0.0. *} +//from "sdl_keycode.h" + + {** + * The SDL virtual key representation. + * + * Values of this type are used to represent keyboard keys using the current + * layout of the keyboard. These values include Unicode values representing + * the unmodified character that would be generated by pressing the key, or + * an SDLK_* constant for those keys that do not generate characters. + * + * A special exception is the number keys at the top of the keyboard which + * always map to SDLK_0...SDLK_9, regardless of layout. + *} +type + PPSDL_KeyCode = ^PSDL_KeyCode; + PSDL_KeyCode = ^TSDL_KeyCode; + TSDL_KeyCode = type cint32; + +const + SDLK_SCANCODE_MASK = 1 shl 30; + //#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK) + //SDL2-for-Pascal: Not translated, see comment about this macro below. + + SDLK_UNKNOWN = TSDL_KeyCode(0); + + SDLK_RETURN = TSDL_KeyCode(#13); // C: '\r' + SDLK_ESCAPE = TSDL_KeyCode(#27); // C: '\x1B' + SDLK_BACKSPACE = TSDL_KeyCode(#8); // C: '\b' + SDLK_TAB = TSDL_KeyCode(#9); // C: '\t' + SDLK_SPACE = TSDL_KeyCode(' '); + SDLK_EXCLAIM = TSDL_KeyCode('!'); + SDLK_QUOTEDBL = TSDL_KeyCode('"'); + SDLK_HASH = TSDL_KeyCode('#'); + SDLK_PERCENT = TSDL_KeyCode('%'); + SDLK_DOLLAR = TSDL_KeyCode('$'); + SDLK_AMPERSAND = TSDL_KeyCode('&'); + SDLK_QUOTE = TSDL_KeyCode(''''); + SDLK_LEFTPAREN = TSDL_KeyCode('('); + SDLK_RIGHTPAREN = TSDL_KeyCode(')'); + SDLK_ASTERISK = TSDL_KeyCode('*'); + SDLK_PLUS = TSDL_KeyCode('+'); + SDLK_COMMA = TSDL_KeyCode(','); + SDLK_MINUS = TSDL_KeyCode('-'); + SDLK_PERIOD = TSDL_KeyCode('.'); + SDLK_SLASH = TSDL_KeyCode('/'); + SDLK_0 = TSDL_KeyCode('0'); + SDLK_1 = TSDL_KeyCode('1'); + SDLK_2 = TSDL_KeyCode('2'); + SDLK_3 = TSDL_KeyCode('3'); + SDLK_4 = TSDL_KeyCode('4'); + SDLK_5 = TSDL_KeyCode('5'); + SDLK_6 = TSDL_KeyCode('6'); + SDLK_7 = TSDL_KeyCode('7'); + SDLK_8 = TSDL_KeyCode('8'); + SDLK_9 = TSDL_KeyCode('9'); + SDLK_COLON = TSDL_KeyCode(':'); + SDLK_SEMICOLON = TSDL_KeyCode(';'); + SDLK_LESS = TSDL_KeyCode('<'); + SDLK_EQUALS = TSDL_KeyCode('='); + SDLK_GREATER = TSDL_KeyCode('>'); + SDLK_QUESTION = TSDL_KeyCode('?'); + SDLK_AT = TSDL_KeyCode('@'); + {* + Skip uppercase letters + *} + SDLK_LEFTBRACKET = TSDL_KeyCode('['); + SDLK_BACKSLASH = TSDL_KeyCode('\'); // C: '\\' + SDLK_RIGHTBRACKET = TSDL_KeyCode(']'); + SDLK_CARET = TSDL_KeyCode('^'); + SDLK_UNDERSCORE = TSDL_KeyCode('_'); + SDLK_BACKQUOTE = TSDL_KeyCode('`'); + SDLK_a = TSDL_KeyCode('a'); + SDLK_b = TSDL_KeyCode('b'); + SDLK_c = TSDL_KeyCode('c'); + SDLK_d = TSDL_KeyCode('d'); + SDLK_e = TSDL_KeyCode('e'); + SDLK_f = TSDL_KeyCode('f'); + SDLK_g = TSDL_KeyCode('g'); + SDLK_h = TSDL_KeyCode('h'); + SDLK_i = TSDL_KeyCode('i'); + SDLK_j = TSDL_KeyCode('j'); + SDLK_k = TSDL_KeyCode('k'); + SDLK_l = TSDL_KeyCode('l'); + SDLK_m = TSDL_KeyCode('m'); + SDLK_n = TSDL_KeyCode('n'); + SDLK_o = TSDL_KeyCode('o'); + SDLK_p = TSDL_KeyCode('p'); + SDLK_q = TSDL_KeyCode('q'); + SDLK_r = TSDL_KeyCode('r'); + SDLK_s = TSDL_KeyCode('s'); + SDLK_t = TSDL_KeyCode('t'); + SDLK_u = TSDL_KeyCode('u'); + SDLK_v = TSDL_KeyCode('v'); + SDLK_w = TSDL_KeyCode('w'); + SDLK_x = TSDL_KeyCode('x'); + SDLK_y = TSDL_KeyCode('y'); + SDLK_z = TSDL_KeyCode('z'); + + {SDL2-for-Pascal: In C the following scancodes are or'd by a macro: + SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK) + + We convert the scancodes directly by: + TSDL_KeyCode(X or SDLK_SCANCODE_MASK); } + + SDLK_CAPSLOCK = TSDL_KeyCode(SDL_SCANCODE_CAPSLOCK or SDLK_SCANCODE_MASK); + + SDLK_F1 = TSDL_KeyCode(SDL_SCANCODE_F1 or SDLK_SCANCODE_MASK); + SDLK_F2 = TSDL_KeyCode(SDL_SCANCODE_F2 or SDLK_SCANCODE_MASK); + SDLK_F3 = TSDL_KeyCode(SDL_SCANCODE_F3 or SDLK_SCANCODE_MASK); + SDLK_F4 = TSDL_KeyCode(SDL_SCANCODE_F4 or SDLK_SCANCODE_MASK); + SDLK_F5 = TSDL_KeyCode(SDL_SCANCODE_F5 or SDLK_SCANCODE_MASK); + SDLK_F6 = TSDL_KeyCode(SDL_SCANCODE_F6 or SDLK_SCANCODE_MASK); + SDLK_F7 = TSDL_KeyCode(SDL_SCANCODE_F7 or SDLK_SCANCODE_MASK); + SDLK_F8 = TSDL_KeyCode(SDL_SCANCODE_F8 or SDLK_SCANCODE_MASK); + SDLK_F9 = TSDL_KeyCode(SDL_SCANCODE_F9 or SDLK_SCANCODE_MASK); + SDLK_F10 = TSDL_KeyCode(SDL_SCANCODE_F10 or SDLK_SCANCODE_MASK); + SDLK_F11 = TSDL_KeyCode(SDL_SCANCODE_F11 or SDLK_SCANCODE_MASK); + SDLK_F12 = TSDL_KeyCode(SDL_SCANCODE_F12 or SDLK_SCANCODE_MASK); + + SDLK_PRINTSCREEN = TSDL_KeyCode(SDL_SCANCODE_PRINTSCREEN or SDLK_SCANCODE_MASK); + SDLK_SCROLLLOCK = TSDL_KeyCode(SDL_SCANCODE_SCROLLLOCK or SDLK_SCANCODE_MASK); + SDLK_PAUSE = TSDL_KeyCode(SDL_SCANCODE_PAUSE or SDLK_SCANCODE_MASK); + SDLK_INSERT = TSDL_KeyCode(SDL_SCANCODE_INSERT or SDLK_SCANCODE_MASK); + SDLK_HOME = TSDL_KeyCode(SDL_SCANCODE_HOME or SDLK_SCANCODE_MASK); + SDLK_PAGEUP = TSDL_KeyCode(SDL_SCANCODE_PAGEUP or SDLK_SCANCODE_MASK); + SDLK_DELETE = TSDL_KeyCode(#127); // C: '\x7F' + SDLK_END = TSDL_KeyCode(SDL_SCANCODE_END or SDLK_SCANCODE_MASK); + SDLK_PAGEDOWN = TSDL_KeyCode(SDL_SCANCODE_PAGEDOWN or SDLK_SCANCODE_MASK); + SDLK_RIGHT = TSDL_KeyCode(SDL_SCANCODE_RIGHT or SDLK_SCANCODE_MASK); + SDLK_LEFT = TSDL_KeyCode(SDL_SCANCODE_LEFT or SDLK_SCANCODE_MASK); + SDLK_DOWN = TSDL_KeyCode(SDL_SCANCODE_DOWN or SDLK_SCANCODE_MASK); + SDLK_UP = TSDL_KeyCode(SDL_SCANCODE_UP or SDLK_SCANCODE_MASK); + + SDLK_NUMLOCKCLEAR = TSDL_KeyCode(SDL_SCANCODE_NUMLOCKCLEAR or SDLK_SCANCODE_MASK); + SDLK_KP_DIVIDE = TSDL_KeyCode(SDL_SCANCODE_KP_DIVIDE or SDLK_SCANCODE_MASK); + SDLK_KP_MULTIPLY = TSDL_KeyCode(SDL_SCANCODE_KP_MULTIPLY or SDLK_SCANCODE_MASK); + SDLK_KP_MINUS = TSDL_KeyCode(SDL_SCANCODE_KP_MINUS or SDLK_SCANCODE_MASK); + SDLK_KP_PLUS = TSDL_KeyCode(SDL_SCANCODE_KP_PLUS or SDLK_SCANCODE_MASK); + SDLK_KP_ENTER = TSDL_KeyCode(SDL_SCANCODE_KP_ENTER or SDLK_SCANCODE_MASK); + SDLK_KP_1 = TSDL_KeyCode(SDL_SCANCODE_KP_1 or SDLK_SCANCODE_MASK); + SDLK_KP_2 = TSDL_KeyCode(SDL_SCANCODE_KP_2 or SDLK_SCANCODE_MASK); + SDLK_KP_3 = TSDL_KeyCode(SDL_SCANCODE_KP_3 or SDLK_SCANCODE_MASK); + SDLK_KP_4 = TSDL_KeyCode(SDL_SCANCODE_KP_4 or SDLK_SCANCODE_MASK); + SDLK_KP_5 = TSDL_KeyCode(SDL_SCANCODE_KP_5 or SDLK_SCANCODE_MASK); + SDLK_KP_6 = TSDL_KeyCode(SDL_SCANCODE_KP_6 or SDLK_SCANCODE_MASK); + SDLK_KP_7 = TSDL_KeyCode(SDL_SCANCODE_KP_7 or SDLK_SCANCODE_MASK); + SDLK_KP_8 = TSDL_KeyCode(SDL_SCANCODE_KP_8 or SDLK_SCANCODE_MASK); + SDLK_KP_9 = TSDL_KeyCode(SDL_SCANCODE_KP_9 or SDLK_SCANCODE_MASK); + SDLK_KP_0 = TSDL_KeyCode(SDL_SCANCODE_KP_0 or SDLK_SCANCODE_MASK); + SDLK_KP_PERIOD = TSDL_KeyCode(SDL_SCANCODE_KP_PERIOD or SDLK_SCANCODE_MASK); + + SDLK_APPLICATION = TSDL_KeyCode(SDL_SCANCODE_APPLICATION or SDLK_SCANCODE_MASK); + SDLK_POWER = TSDL_KeyCode(SDL_SCANCODE_POWER or SDLK_SCANCODE_MASK); + SDLK_KP_EQUALS = TSDL_KeyCode(SDL_SCANCODE_KP_EQUALS or SDLK_SCANCODE_MASK); + SDLK_F13 = TSDL_KeyCode(SDL_SCANCODE_F13 or SDLK_SCANCODE_MASK); + SDLK_F14 = TSDL_KeyCode(SDL_SCANCODE_F14 or SDLK_SCANCODE_MASK); + SDLK_F15 = TSDL_KeyCode(SDL_SCANCODE_F15 or SDLK_SCANCODE_MASK); + SDLK_F16 = TSDL_KeyCode(SDL_SCANCODE_F16 or SDLK_SCANCODE_MASK); + SDLK_F17 = TSDL_KeyCode(SDL_SCANCODE_F17 or SDLK_SCANCODE_MASK); + SDLK_F18 = TSDL_KeyCode(SDL_SCANCODE_F18 or SDLK_SCANCODE_MASK); + SDLK_F19 = TSDL_KeyCode(SDL_SCANCODE_F19 or SDLK_SCANCODE_MASK); + SDLK_F20 = TSDL_KeyCode(SDL_SCANCODE_F20 or SDLK_SCANCODE_MASK); + SDLK_F21 = TSDL_KeyCode(SDL_SCANCODE_F21 or SDLK_SCANCODE_MASK); + SDLK_F22 = TSDL_KeyCode(SDL_SCANCODE_F22 or SDLK_SCANCODE_MASK); + SDLK_F23 = TSDL_KeyCode(SDL_SCANCODE_F23 or SDLK_SCANCODE_MASK); + SDLK_F24 = TSDL_KeyCode(SDL_SCANCODE_F24 or SDLK_SCANCODE_MASK); + SDLK_EXECUTE = TSDL_KeyCode(SDL_SCANCODE_EXECUTE or SDLK_SCANCODE_MASK); + SDLK_HELP = TSDL_KeyCode(SDL_SCANCODE_HELP or SDLK_SCANCODE_MASK); + SDLK_MENU = TSDL_KeyCode(SDL_SCANCODE_MENU or SDLK_SCANCODE_MASK); + SDLK_SELECT = TSDL_KeyCode(SDL_SCANCODE_SELECT or SDLK_SCANCODE_MASK); + SDLK_STOP = TSDL_KeyCode(SDL_SCANCODE_STOP or SDLK_SCANCODE_MASK); + SDLK_AGAIN = TSDL_KeyCode(SDL_SCANCODE_AGAIN or SDLK_SCANCODE_MASK); + SDLK_UNDO = TSDL_KeyCode(SDL_SCANCODE_UNDO or SDLK_SCANCODE_MASK); + SDLK_CUT = TSDL_KeyCode(SDL_SCANCODE_CUT or SDLK_SCANCODE_MASK); + SDLK_COPY = TSDL_KeyCode(SDL_SCANCODE_COPY or SDLK_SCANCODE_MASK); + SDLK_PASTE = TSDL_KeyCode(SDL_SCANCODE_PASTE or SDLK_SCANCODE_MASK); + SDLK_FIND = TSDL_KeyCode(SDL_SCANCODE_FIND or SDLK_SCANCODE_MASK); + SDLK_MUTE = TSDL_KeyCode(SDL_SCANCODE_MUTE or SDLK_SCANCODE_MASK); + SDLK_VOLUMEUP = TSDL_KeyCode(SDL_SCANCODE_VOLUMEUP or SDLK_SCANCODE_MASK); + SDLK_VOLUMEDOWN = TSDL_KeyCode(SDL_SCANCODE_VOLUMEDOWN or SDLK_SCANCODE_MASK); + SDLK_KP_COMMA = TSDL_KeyCode(SDL_SCANCODE_KP_COMMA or SDLK_SCANCODE_MASK); + SDLK_KP_EQUALSAS400 = TSDL_KeyCode(SDL_SCANCODE_KP_EQUALSAS400 or SDLK_SCANCODE_MASK); + + SDLK_ALTERASE = TSDL_KeyCode(SDL_SCANCODE_ALTERASE or SDLK_SCANCODE_MASK); + SDLK_SYSREQ = TSDL_KeyCode(SDL_SCANCODE_SYSREQ or SDLK_SCANCODE_MASK); + SDLK_CANCEL = TSDL_KeyCode(SDL_SCANCODE_CANCEL or SDLK_SCANCODE_MASK); + SDLK_CLEAR = TSDL_KeyCode(SDL_SCANCODE_CLEAR or SDLK_SCANCODE_MASK); + SDLK_PRIOR = TSDL_KeyCode(SDL_SCANCODE_PRIOR or SDLK_SCANCODE_MASK); + SDLK_RETURN2 = TSDL_KeyCode(SDL_SCANCODE_RETURN2 or SDLK_SCANCODE_MASK); + SDLK_SEPARATOR = TSDL_KeyCode(SDL_SCANCODE_SEPARATOR or SDLK_SCANCODE_MASK); + SDLK_OUT = TSDL_KeyCode(SDL_SCANCODE_OUT or SDLK_SCANCODE_MASK); + SDLK_OPER = TSDL_KeyCode(SDL_SCANCODE_OPER or SDLK_SCANCODE_MASK); + SDLK_CLEARAGAIN = TSDL_KeyCode(SDL_SCANCODE_CLEARAGAIN or SDLK_SCANCODE_MASK); + SDLK_CRSEL = TSDL_KeyCode(SDL_SCANCODE_CRSEL or SDLK_SCANCODE_MASK); + SDLK_EXSEL = TSDL_KeyCode(SDL_SCANCODE_EXSEL or SDLK_SCANCODE_MASK); + + SDLK_KP_00 = TSDL_KeyCode(SDL_SCANCODE_KP_00 or SDLK_SCANCODE_MASK); + SDLK_KP_000 = TSDL_KeyCode(SDL_SCANCODE_KP_000 or SDLK_SCANCODE_MASK); + SDLK_THOUSANDSSEPARATOR = TSDL_KeyCode(SDL_SCANCODE_THOUSANDSSEPARATOR or SDLK_SCANCODE_MASK); + SDLK_DECIMALSEPARATOR = TSDL_KeyCode(SDL_SCANCODE_DECIMALSEPARATOR or SDLK_SCANCODE_MASK); + SDLK_CURRENCYUNIT = TSDL_KeyCode(SDL_SCANCODE_CURRENCYUNIT or SDLK_SCANCODE_MASK); + SDLK_CURRENCYSUBUNIT = TSDL_KeyCode(SDL_SCANCODE_CURRENCYSUBUNIT or SDLK_SCANCODE_MASK); + SDLK_KP_LEFTPAREN = TSDL_KeyCode(SDL_SCANCODE_KP_LEFTPAREN or SDLK_SCANCODE_MASK); + SDLK_KP_RIGHTPAREN = TSDL_KeyCode(SDL_SCANCODE_KP_RIGHTPAREN or SDLK_SCANCODE_MASK); + SDLK_KP_LEFTBRACE = TSDL_KeyCode(SDL_SCANCODE_KP_LEFTBRACE or SDLK_SCANCODE_MASK); + SDLK_KP_RIGHTBRACE = TSDL_KeyCode(SDL_SCANCODE_KP_RIGHTBRACE or SDLK_SCANCODE_MASK); + SDLK_KP_TAB = TSDL_KeyCode(SDL_SCANCODE_KP_TAB or SDLK_SCANCODE_MASK); + SDLK_KP_BACKSPACE = TSDL_KeyCode(SDL_SCANCODE_KP_BACKSPACE or SDLK_SCANCODE_MASK); + SDLK_KP_A = TSDL_KeyCode(SDL_SCANCODE_KP_A or SDLK_SCANCODE_MASK); + SDLK_KP_B = TSDL_KeyCode(SDL_SCANCODE_KP_B or SDLK_SCANCODE_MASK); + SDLK_KP_C = TSDL_KeyCode(SDL_SCANCODE_KP_C or SDLK_SCANCODE_MASK); + SDLK_KP_D = TSDL_KeyCode(SDL_SCANCODE_KP_D or SDLK_SCANCODE_MASK); + SDLK_KP_E = TSDL_KeyCode(SDL_SCANCODE_KP_E or SDLK_SCANCODE_MASK); + SDLK_KP_F = TSDL_KeyCode(SDL_SCANCODE_KP_F or SDLK_SCANCODE_MASK); + SDLK_KP_XOR = TSDL_KeyCode(SDL_SCANCODE_KP_XOR or SDLK_SCANCODE_MASK); + SDLK_KP_POWER = TSDL_KeyCode(SDL_SCANCODE_KP_POWER or SDLK_SCANCODE_MASK); + SDLK_KP_PERCENT = TSDL_KeyCode(SDL_SCANCODE_KP_PERCENT or SDLK_SCANCODE_MASK); + SDLK_KP_LESS = TSDL_KeyCode(SDL_SCANCODE_KP_LESS or SDLK_SCANCODE_MASK); + SDLK_KP_GREATER = TSDL_KeyCode(SDL_SCANCODE_KP_GREATER or SDLK_SCANCODE_MASK); + SDLK_KP_AMPERSAND = TSDL_KeyCode(SDL_SCANCODE_KP_AMPERSAND or SDLK_SCANCODE_MASK); + SDLK_KP_DBLAMPERSAND = TSDL_KeyCode(SDL_SCANCODE_KP_DBLAMPERSAND or SDLK_SCANCODE_MASK); + SDLK_KP_VERTICALBAR = TSDL_KeyCode(SDL_SCANCODE_KP_VERTICALBAR or SDLK_SCANCODE_MASK); + SDLK_KP_DBLVERTICALBAR = TSDL_KeyCode(SDL_SCANCODE_KP_DBLVERTICALBAR or SDLK_SCANCODE_MASK); + SDLK_KP_COLON = TSDL_KeyCode(SDL_SCANCODE_KP_COLON or SDLK_SCANCODE_MASK); + SDLK_KP_HASH = TSDL_KeyCode(SDL_SCANCODE_KP_HASH or SDLK_SCANCODE_MASK); + SDLK_KP_SPACE = TSDL_KeyCode(SDL_SCANCODE_KP_SPACE or SDLK_SCANCODE_MASK); + SDLK_KP_AT = TSDL_KeyCode(SDL_SCANCODE_KP_AT or SDLK_SCANCODE_MASK); + SDLK_KP_EXCLAM = TSDL_KeyCode(SDL_SCANCODE_KP_EXCLAM or SDLK_SCANCODE_MASK); + SDLK_KP_MEMSTORE = TSDL_KeyCode(SDL_SCANCODE_KP_MEMSTORE or SDLK_SCANCODE_MASK); + SDLK_KP_MEMRECALL = TSDL_KeyCode(SDL_SCANCODE_KP_MEMRECALL or SDLK_SCANCODE_MASK); + SDLK_KP_MEMCLEAR = TSDL_KeyCode(SDL_SCANCODE_KP_MEMCLEAR or SDLK_SCANCODE_MASK); + SDLK_KP_MEMADD = TSDL_KeyCode(SDL_SCANCODE_KP_MEMADD or SDLK_SCANCODE_MASK); + SDLK_KP_MEMSUBTRACT = TSDL_KeyCode(SDL_SCANCODE_KP_MEMSUBTRACT or SDLK_SCANCODE_MASK); + SDLK_KP_MEMMULTIPLY = TSDL_KeyCode(SDL_SCANCODE_KP_MEMMULTIPLY or SDLK_SCANCODE_MASK); + SDLK_KP_MEMDIVIDE = TSDL_KeyCode(SDL_SCANCODE_KP_MEMDIVIDE or SDLK_SCANCODE_MASK); + SDLK_KP_PLUSMINUS = TSDL_KeyCode(SDL_SCANCODE_KP_PLUSMINUS or SDLK_SCANCODE_MASK); + SDLK_KP_CLEAR = TSDL_KeyCode(SDL_SCANCODE_KP_CLEAR or SDLK_SCANCODE_MASK); + SDLK_KP_CLEARENTRY = TSDL_KeyCode(SDL_SCANCODE_KP_CLEARENTRY or SDLK_SCANCODE_MASK); + SDLK_KP_BINARY = TSDL_KeyCode(SDL_SCANCODE_KP_BINARY or SDLK_SCANCODE_MASK); + SDLK_KP_OCTAL = TSDL_KeyCode(SDL_SCANCODE_KP_OCTAL or SDLK_SCANCODE_MASK); + SDLK_KP_DECIMAL = TSDL_KeyCode(SDL_SCANCODE_KP_DECIMAL or SDLK_SCANCODE_MASK); + SDLK_KP_HEXADECIMAL = TSDL_KeyCode(SDL_SCANCODE_KP_HEXADECIMAL or SDLK_SCANCODE_MASK); + + SDLK_LCTRL = TSDL_KeyCode(SDL_SCANCODE_LCTRL or SDLK_SCANCODE_MASK); + SDLK_LSHIFT = TSDL_KeyCode(SDL_SCANCODE_LSHIFT or SDLK_SCANCODE_MASK); + SDLK_LALT = TSDL_KeyCode(SDL_SCANCODE_LALT or SDLK_SCANCODE_MASK); + SDLK_LGUI = TSDL_KeyCode(SDL_SCANCODE_LGUI or SDLK_SCANCODE_MASK); + SDLK_RCTRL = TSDL_KeyCode(SDL_SCANCODE_RCTRL or SDLK_SCANCODE_MASK); + SDLK_RSHIFT = TSDL_KeyCode(SDL_SCANCODE_RSHIFT or SDLK_SCANCODE_MASK); + SDLK_RALT = TSDL_KeyCode(SDL_SCANCODE_RALT or SDLK_SCANCODE_MASK); + SDLK_RGUI = TSDL_KeyCode(SDL_SCANCODE_RGUI or SDLK_SCANCODE_MASK); + + SDLK_MODE = TSDL_KeyCode(SDL_SCANCODE_MODE or SDLK_SCANCODE_MASK); + + SDLK_AUDIONEXT = TSDL_KeyCode(SDL_SCANCODE_AUDIONEXT or SDLK_SCANCODE_MASK); + SDLK_AUDIOPREV = TSDL_KeyCode(SDL_SCANCODE_AUDIOPREV or SDLK_SCANCODE_MASK); + SDLK_AUDIOSTOP = TSDL_KeyCode(SDL_SCANCODE_AUDIOSTOP or SDLK_SCANCODE_MASK); + SDLK_AUDIOPLAY = TSDL_KeyCode(SDL_SCANCODE_AUDIOPLAY or SDLK_SCANCODE_MASK); + SDLK_AUDIOMUTE = TSDL_KeyCode(SDL_SCANCODE_AUDIOMUTE or SDLK_SCANCODE_MASK); + SDLK_MEDIASELECT = TSDL_KeyCode(SDL_SCANCODE_MEDIASELECT or SDLK_SCANCODE_MASK); + SDLK_WWW = TSDL_KeyCode(SDL_SCANCODE_WWW or SDLK_SCANCODE_MASK); + SDLK_MAIL = TSDL_KeyCode(SDL_SCANCODE_MAIL or SDLK_SCANCODE_MASK); + SDLK_CALCULATOR = TSDL_KeyCode(SDL_SCANCODE_CALCULATOR or SDLK_SCANCODE_MASK); + SDLK_COMPUTER = TSDL_KeyCode(SDL_SCANCODE_COMPUTER or SDLK_SCANCODE_MASK); + SDLK_AC_SEARCH = TSDL_KeyCode(SDL_SCANCODE_AC_SEARCH or SDLK_SCANCODE_MASK); + SDLK_AC_HOME = TSDL_KeyCode(SDL_SCANCODE_AC_HOME or SDLK_SCANCODE_MASK); + SDLK_AC_BACK = TSDL_KeyCode(SDL_SCANCODE_AC_BACK or SDLK_SCANCODE_MASK); + SDLK_AC_FORWARD = TSDL_KeyCode(SDL_SCANCODE_AC_FORWARD or SDLK_SCANCODE_MASK); + SDLK_AC_STOP = TSDL_KeyCode(SDL_SCANCODE_AC_STOP or SDLK_SCANCODE_MASK); + SDLK_AC_REFRESH = TSDL_KeyCode(SDL_SCANCODE_AC_REFRESH or SDLK_SCANCODE_MASK); + SDLK_AC_BOOKMARKS = TSDL_KeyCode(SDL_SCANCODE_AC_BOOKMARKS or SDLK_SCANCODE_MASK); + + SDLK_BRIGHTNESSDOWN = TSDL_KeyCode(SDL_SCANCODE_BRIGHTNESSDOWN or SDLK_SCANCODE_MASK); + SDLK_BRIGHTNESSUP = TSDL_KeyCode(SDL_SCANCODE_BRIGHTNESSUP or SDLK_SCANCODE_MASK); + SDLK_DISPLAYSWITCH = TSDL_KeyCode(SDL_SCANCODE_DISPLAYSWITCH or SDLK_SCANCODE_MASK); + SDLK_KBDILLUMTOGGLE = TSDL_KeyCode(SDL_SCANCODE_KBDILLUMTOGGLE or SDLK_SCANCODE_MASK); + SDLK_KBDILLUMDOWN = TSDL_KeyCode(SDL_SCANCODE_KBDILLUMDOWN or SDLK_SCANCODE_MASK); + SDLK_KBDILLUMUP = TSDL_KeyCode(SDL_SCANCODE_KBDILLUMUP or SDLK_SCANCODE_MASK); + SDLK_EJECT = TSDL_KeyCode(SDL_SCANCODE_EJECT or SDLK_SCANCODE_MASK); + SDLK_SLEEP = TSDL_KeyCode(SDL_SCANCODE_SLEEP or SDLK_SCANCODE_MASK); + SDLK_APP1 = TSDL_KeyCode(SDL_SCANCODE_APP1 or SDLK_SCANCODE_MASK); + SDLK_APP2 = TSDL_KeyCode(SDL_SCANCODE_APP2 or SDLK_SCANCODE_MASK); + + SDLK_AUDIOREWIND = TSDL_KeyCode(SDL_SCANCODE_AUDIOREWIND or SDLK_SCANCODE_MASK); + SDLK_AUDIOFASTFORWARD = TSDL_KeyCode(SDL_SCANCODE_AUDIOFASTFORWARD or SDLK_SCANCODE_MASK); + + SDLK_SOFTLEFT = TSDL_KeyCode(SDL_SCANCODE_SOFTLEFT or SDLK_SCANCODE_MASK); + SDLK_SOFTRIGHT = TSDL_KeyCode(SDL_SCANCODE_SOFTRIGHT or SDLK_SCANCODE_MASK); + SDLK_CALL = TSDL_KeyCode(SDL_SCANCODE_CALL or SDLK_SCANCODE_MASK); + SDLK_ENDCALL = TSDL_KeyCode(SDL_SCANCODE_ENDCALL or SDLK_SCANCODE_MASK); + + {** + * Enumeration of valid key mods (possibly OR'd together). + *} +type + PPSDL_KeyMod = ^PSDL_KeyMod; + PSDL_KeyMod = ^TSDL_KeyMod; + TSDL_KeyMod = type cint; + +const + KMOD_NONE = TSDL_KeyMod($0000); + KMOD_LSHIFT = TSDL_KeyMod($0001); + KMOD_RSHIFT = TSDL_KeyMod($0002); + KMOD_LCTRL = TSDL_KeyMod($0040); + KMOD_RCTRL = TSDL_KeyMod($0080); + KMOD_LALT = TSDL_KeyMod($0100); + KMOD_RALT = TSDL_KeyMod($0200); + KMOD_LGUI = TSDL_KeyMod($0400); + KMOD_RGUI = TSDL_KeyMod($0800); + KMOD_NUM = TSDL_KeyMod($1000); + KMOD_CAPS = TSDL_KeyMod($2000); + KMOD_MODE = TSDL_KeyMod($4000); + KMOD_SCROLL = TSDL_KeyMod($8000); + + KMOD_CTRL = KMOD_LCTRL or KMOD_RCTRL; + KMOD_SHIFT = KMOD_LSHIFT or KMOD_RSHIFT; + KMOD_ALT = KMOD_LALT or KMOD_RALT; + KMOD_GUI = KMOD_LGUI or KMOD_RGUI; + + KMOD_RESERVED = KMOD_SCROLL; {* This is for source-level compatibility with SDL 2.0.0. *} diff --git a/units/sdlloadso.inc b/units/sdlloadso.inc index 8289ced0..5bd41f80 100644 --- a/units/sdlloadso.inc +++ b/units/sdlloadso.inc @@ -1,92 +1,92 @@ -//from sdl_loadso.h - -{* - * \file SDL_loadso.h - * - * System dependent library loading routines - * - * Some things to keep in mind: - * \li These functions only work on C function names. Other languages may - * have name mangling and intrinsic language support that varies from - * compiler to compiler. - * \li Make sure you declare your function pointers with the same calling - * convention as the actual library function. Your code will crash - * mysteriously if you do not do this. - * \li Avoid namespace collisions. If you load a symbol from the library, - * it is not defined whether or not it goes into the global symbol - * namespace for the application. If it does and it conflicts with - * symbols in your code or other shared libraries, you will not get - * the results you expect.:) - } - -{* - * Dynamically load a shared object. - * - * \param sofile a system-dependent name of the object file - * \returns an opaque pointer to the object handle or nil if there was an - * error; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_LoadFunction - * \sa SDL_UnloadObject - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LoadObject_fun = function(sofile: PAnsiChar): Pointer; cdecl; -Var - SDL_LoadObject : TSDL_LoadObject_fun = Nil; -{$else} - -function SDL_LoadObject(sofile: PAnsiChar): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadObject' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Look up the address of the named function in a shared object. - * - * This function pointer is no longer valid after calling SDL_UnloadObject(). - * - * This function can only look up C function names. Other languages may have - * name mangling and intrinsic language support that varies from compiler to - * compiler. - * - * Make sure you declare your function pointers with the same calling - * convention as the actual library function. Your code will crash - * mysteriously if you do not do this. - * - * If the requested function doesn't exist, nil is returned. - * - * \param handle a valid shared object handle returned by SDL_LoadObject() - * \param name the name of the function to look up - * \returns a pointer to the function or nil if there was an error; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_LoadObject - * \sa SDL_UnloadObject - } -function SDL_LoadFunction(handle: Pointer; name: PAnsiChar): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadFunction' {$ENDIF} {$ENDIF}; - -{* - * Unload a shared object from memory. - * - * \param handle a valid shared object handle returned by SDL_LoadObject() - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_LoadFunction - * \sa SDL_LoadObject - } -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_UnloadObject_proc = procedure(handle: Pointer); cdecl; -Var - SDL_UnloadObject : TSDL_UnloadObject_proc = Nil; -{$else} - -procedure SDL_UnloadObject(handle: Pointer); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnloadObject' {$ENDIF} {$ENDIF}; -{$endif} +//from sdl_loadso.h + +{* + * \file SDL_loadso.h + * + * System dependent library loading routines + * + * Some things to keep in mind: + * \li These functions only work on C function names. Other languages may + * have name mangling and intrinsic language support that varies from + * compiler to compiler. + * \li Make sure you declare your function pointers with the same calling + * convention as the actual library function. Your code will crash + * mysteriously if you do not do this. + * \li Avoid namespace collisions. If you load a symbol from the library, + * it is not defined whether or not it goes into the global symbol + * namespace for the application. If it does and it conflicts with + * symbols in your code or other shared libraries, you will not get + * the results you expect.:) + } + +{* + * Dynamically load a shared object. + * + * \param sofile a system-dependent name of the object file + * \returns an opaque pointer to the object handle or nil if there was an + * error; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_LoadFunction + * \sa SDL_UnloadObject + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LoadObject_fun = function(sofile: PAnsiChar): Pointer; cdecl; +Var + SDL_LoadObject : TSDL_LoadObject_fun = Nil; +{$else} + +function SDL_LoadObject(sofile: PAnsiChar): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadObject' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Look up the address of the named function in a shared object. + * + * This function pointer is no longer valid after calling SDL_UnloadObject(). + * + * This function can only look up C function names. Other languages may have + * name mangling and intrinsic language support that varies from compiler to + * compiler. + * + * Make sure you declare your function pointers with the same calling + * convention as the actual library function. Your code will crash + * mysteriously if you do not do this. + * + * If the requested function doesn't exist, nil is returned. + * + * \param handle a valid shared object handle returned by SDL_LoadObject() + * \param name the name of the function to look up + * \returns a pointer to the function or nil if there was an error; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_LoadObject + * \sa SDL_UnloadObject + } +function SDL_LoadFunction(handle: Pointer; name: PAnsiChar): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadFunction' {$ENDIF} {$ENDIF}; + +{* + * Unload a shared object from memory. + * + * \param handle a valid shared object handle returned by SDL_LoadObject() + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_LoadFunction + * \sa SDL_LoadObject + } +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UnloadObject_proc = procedure(handle: Pointer); cdecl; +Var + SDL_UnloadObject : TSDL_UnloadObject_proc = Nil; +{$else} + +procedure SDL_UnloadObject(handle: Pointer); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnloadObject' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdllocale.inc b/units/sdllocale.inc index 472bf3b8..9230152b 100644 --- a/units/sdllocale.inc +++ b/units/sdllocale.inc @@ -1,54 +1,54 @@ -// based on SDL_locale.h - -type - PPSDL_Locale = ^PSDL_Locale; - PSDL_Locale = ^TSDL_Locale; - TSDL_Locale = record - // A language name, like 'en' for English. - language: PAnsiChar; - // A country, like 'US' for America. Can be NIL. - country: PAnsiChar; - end; - -{** - * \brief Report the user's preferred locale. - * - * This returns an array of SDL_Locale structs, the final item zeroed out. - * When the caller is done with this array, it should call SDL_free() on - * the returned value; all the memory involved is allocated in a single - * block, so a single SDL_free() will suffice. - * - * Returned language strings are in the format xx, where 'xx' is an ISO-639 - * language specifier (such as 'en' for English, 'de' for German, etc). - * Country strings are in the format YY, where 'YY' is an ISO-3166 country - * code (such as "US" for the United States, 'CA' for Canada, etc). Country - * might be NULL if there's no specific guidance on them (so you might get - * ( 'en', 'US' ) for American English, but ( 'en', NIL ) means "English - * language, generically"). Language strings are never NIL, except to - * terminate the array. - * - * Please note that not all of these strings are 2 characters; some are - * three or more. - * - * The returned list of locales are in the order of the user's preference. - * For example, a German citizen that is fluent in US English and knows - * enough Japanese to navigate around Tokyo might have a list like: - * [ 'de', 'en_US', 'jp', NIL ]. Someone from England might prefer British - * English (where "color" is spelled "colour", etc), but will settle for - * anything like it: [ 'en_GB', 'en', NIL ]. - * - * This function returns NIL on error, including when the platform does not - * supply this information at all. - * - * This might be a "slow" call that has to query the operating system. It's - * best to ask for this once and save the results. However, this list can - * change, usually because the user has changed a system preference outside - * of your program; SDL will send an SDL_LOCALECHANGED event in this case, - * if possible, and you can call this function again to get an updated copy - * of preferred locales. - * - * \return array of locales, terminated with a locale with a NIL language - * field. Will return NIL on error. - *} -function SDL_GetPreferredLocales(): PSDL_Locale; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPreferredLocales' {$ENDIF} {$ENDIF}; +// based on SDL_locale.h + +type + PPSDL_Locale = ^PSDL_Locale; + PSDL_Locale = ^TSDL_Locale; + TSDL_Locale = record + // A language name, like 'en' for English. + language: PAnsiChar; + // A country, like 'US' for America. Can be NIL. + country: PAnsiChar; + end; + +{** + * \brief Report the user's preferred locale. + * + * This returns an array of SDL_Locale structs, the final item zeroed out. + * When the caller is done with this array, it should call SDL_free() on + * the returned value; all the memory involved is allocated in a single + * block, so a single SDL_free() will suffice. + * + * Returned language strings are in the format xx, where 'xx' is an ISO-639 + * language specifier (such as 'en' for English, 'de' for German, etc). + * Country strings are in the format YY, where 'YY' is an ISO-3166 country + * code (such as "US" for the United States, 'CA' for Canada, etc). Country + * might be NULL if there's no specific guidance on them (so you might get + * ( 'en', 'US' ) for American English, but ( 'en', NIL ) means "English + * language, generically"). Language strings are never NIL, except to + * terminate the array. + * + * Please note that not all of these strings are 2 characters; some are + * three or more. + * + * The returned list of locales are in the order of the user's preference. + * For example, a German citizen that is fluent in US English and knows + * enough Japanese to navigate around Tokyo might have a list like: + * [ 'de', 'en_US', 'jp', NIL ]. Someone from England might prefer British + * English (where "color" is spelled "colour", etc), but will settle for + * anything like it: [ 'en_GB', 'en', NIL ]. + * + * This function returns NIL on error, including when the platform does not + * supply this information at all. + * + * This might be a "slow" call that has to query the operating system. It's + * best to ask for this once and save the results. However, this list can + * change, usually because the user has changed a system preference outside + * of your program; SDL will send an SDL_LOCALECHANGED event in this case, + * if possible, and you can call this function again to get an updated copy + * of preferred locales. + * + * \return array of locales, terminated with a locale with a NIL language + * field. Will return NIL on error. + *} +function SDL_GetPreferredLocales(): PSDL_Locale; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPreferredLocales' {$ENDIF} {$ENDIF}; diff --git a/units/sdllog.inc b/units/sdllog.inc index 2da1f31e..353c2b3f 100644 --- a/units/sdllog.inc +++ b/units/sdllog.inc @@ -1,277 +1,277 @@ - -//since the array of const in delphi is not C compatible: -{$IFDEF FPC} - -{** - * \brief The maximum size of a log message - * - * Messages longer than the maximum size will be truncated - *} -const - SDL_MAX_LOG_MESSAGE = 4096; - -{** - * \brief The predefined log categories - * - * By default the application category is enabled at the INFO level, - * the assert category is enabled at the WARN level, test is enabled - * at the VERBOSE level and all other categories are enabled at the - * CRITICAL level. - *} -type - PPSDL_LogCategory = ^PSDL_LogCategory; - PSDL_LogCategory = ^TSDL_LogCategory; - TSDL_LogCategory = type cint; - -const - SDL_LOG_CATEGORY_APPLICATION = TSDL_LogCategory(0); - SDL_LOG_CATEGORY_ERROR = TSDL_LogCategory(1); - SDL_LOG_CATEGORY_ASSERT = TSDL_LogCategory(2); - SDL_LOG_CATEGORY_SYSTEM = TSDL_LogCategory(3); - SDL_LOG_CATEGORY_AUDIO = TSDL_LogCategory(4); - SDL_LOG_CATEGORY_VIDEO = TSDL_LogCategory(5); - SDL_LOG_CATEGORY_RENDER = TSDL_LogCategory(6); - SDL_LOG_CATEGORY_INPUT = TSDL_LogCategory(7); - SDL_LOG_CATEGORY_TEST = TSDL_LogCategory(8); - - {* Reserved for future SDL library use *} - SDL_LOG_CATEGORY_RESERVED1 = TSDL_LogCategory(9); - SDL_LOG_CATEGORY_RESERVED2 = TSDL_LogCategory(10); - SDL_LOG_CATEGORY_RESERVED3 = TSDL_LogCategory(11); - SDL_LOG_CATEGORY_RESERVED4 = TSDL_LogCategory(12); - SDL_LOG_CATEGORY_RESERVED5 = TSDL_LogCategory(13); - SDL_LOG_CATEGORY_RESERVED6 = TSDL_LogCategory(14); - SDL_LOG_CATEGORY_RESERVED7 = TSDL_LogCategory(15); - SDL_LOG_CATEGORY_RESERVED8 = TSDL_LogCategory(16); - SDL_LOG_CATEGORY_RESERVED9 = TSDL_LogCategory(17); - SDL_LOG_CATEGORY_RESERVED10 = TSDL_LogCategory(18); - - {* Beyond this point is reserved for application use *} - SDL_LOG_CATEGORY_CUSTOM = TSDL_LogCategory(19); - -{** - * \brief The predefined log priorities - *} -type - PPSDL_LogPriority = ^PSDL_LogPriority; - PSDL_LogPriority = ^TSDL_LogPriority; - TSDL_LogPriority = type cint32; -const - SDL_LOG_PRIORITY_VERBOSE = TSDL_LogPriority(1); - SDL_LOG_PRIORITY_DEBUG = TSDL_LogPriority(2); - SDL_LOG_PRIORITY_INFO = TSDL_LogPriority(3); - SDL_LOG_PRIORITY_WARN = TSDL_LogPriority(4); - SDL_LOG_PRIORITY_ERROR = TSDL_LogPriority(5); - SDL_LOG_PRIORITY_CRITICAL = TSDL_LogPriority(6); - SDL_NUM_LOG_PRIORITIES = TSDL_LogPriority(7); - -{** - * \brief Set the priority of all log categories - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LogSetAllPriority_proc = procedure(priority: TSDL_LogPriority); cdecl; -Var - SDL_LogSetAllPriority : TSDL_LogSetAllPriority_proc = Nil; -{$else} - -procedure SDL_LogSetAllPriority(priority: TSDL_LogPriority); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogSetAllPriority' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * \brief Set the priority of a particular log category - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LogSetPriority_proc = procedure(category: TSDL_LogCategory; priority: TSDL_LogPriority); cdecl; -Var - SDL_LogSetPriority : TSDL_LogSetPriority_proc = Nil; -{$else} - -procedure SDL_LogSetPriority(category: TSDL_LogCategory; priority: TSDL_LogPriority); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogSetPriority' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * \brief Get the priority of a particular log category - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LogGetPriority_fun = function(category: TSDL_LogCategory): TSDL_LogPriority; cdecl; -Var - SDL_LogGetPriority : TSDL_LogGetPriority_fun = Nil; -{$else} - -function SDL_LogGetPriority(category: TSDL_LogCategory): TSDL_LogPriority; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogGetPriority' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * \brief Reset all priorities to default. - * - * \note This is called in SDL_Quit(). - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LogResetPriorities_proc = procedure(); cdecl; -Var - SDL_LogResetPriorities : TSDL_LogResetPriorities_proc = Nil; -{$else} - -procedure SDL_LogResetPriorities(); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogResetPriorities' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_Log_proc = procedure(const fmt: PAnsiChar; pars: array of const); cdecl; -Var - SDL_Log : TSDL_Log_proc = Nil; -{$else} - -procedure SDL_Log(const fmt: PAnsiChar; pars: array of const); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Log' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LogVerbose_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; -Var - SDL_LogVerbose : TSDL_LogVerbose_proc = Nil; -{$else} - -procedure SDL_LogVerbose(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogVerbose' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * \brief Log a message with SDL_LOG_PRIORITY_DEBUG - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LogDebug_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; -Var - SDL_LogDebug : TSDL_LogDebug_proc = Nil; -{$else} - -procedure SDL_LogDebug(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogDebug' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * \brief Log a message with SDL_LOG_PRIORITY_INFO - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LogInfo_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; -Var - SDL_LogInfo : TSDL_LogInfo_proc = Nil; -{$else} - -procedure SDL_LogInfo(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogInfo' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * \brief Log a message with SDL_LOG_PRIORITY_WARN - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LogWarn_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; -Var - SDL_LogWarn : TSDL_LogWarn_proc = Nil; -{$else} - -procedure SDL_LogWarn(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogWarn' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * \brief Log a message with SDL_LOG_PRIORITY_ERROR - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LogError_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; -Var - SDL_LogError : TSDL_LogError_proc = Nil; -{$else} - -procedure SDL_LogError(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogError' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LogCritical_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; -Var - SDL_LogCritical : TSDL_LogCritical_proc = Nil; -{$else} - -procedure SDL_LogCritical(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogCritical' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * \brief Log a message with the specified category and priority. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LogMessage_proc = procedure(category: TSDL_LogCategory; priority: TSDL_LogPriority; const fmt: PAnsiChar; pars: array of const); cdecl; -Var - SDL_LogMessage : TSDL_LogMessage_proc = Nil; -{$else} - -procedure SDL_LogMessage(category: TSDL_LogCategory; priority: TSDL_LogPriority; const fmt: PAnsiChar; pars: array of const); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogMessage' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * \brief Log a message with the specified category and priority. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LogMessageV_proc = procedure(category: TSDL_LogCategory; priority: TSDL_LogPriority; const fmt: PAnsiChar; ap: array of const); cdecl; -Var - SDL_LogMessageV : TSDL_LogMessageV_proc = Nil; -{$else} - -procedure SDL_LogMessageV(category: TSDL_LogCategory; priority: TSDL_LogPriority; const fmt: PAnsiChar; ap: array of const); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogMessageV' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * \brief The prototype for the log output function - *} -type - PPSDL_LogOutputFunction = ^PSDL_LogOutputFunction; - PSDL_LogOutputFunction = ^TSDL_LogOutputFunction; - TSDL_LogOutputFunction = procedure( - userdata: Pointer; - category: TSDL_LogCategory; - priority: TSDL_LogPriority; - const msg: PAnsiChar); cdecl; - -{** - * \brief Get the current log output function. - *} -procedure SDL_LogGetOutputFunction(callback: PSDL_LogOutputFunction; userdata: PPointer); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogGetOutputFunction' {$ENDIF} {$ENDIF}; - -{** - * \brief This function allows you to replace the default log output - * function with one of your own. - *} -procedure SDL_LogSetOutputFunction(callback: TSDL_LogOutputFunction; userdata: Pointer); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogSetOutputFunction' {$ENDIF} {$ENDIF}; - -{$ENDIF} + +//since the array of const in delphi is not C compatible: +{$IFDEF FPC} + +{** + * \brief The maximum size of a log message + * + * Messages longer than the maximum size will be truncated + *} +const + SDL_MAX_LOG_MESSAGE = 4096; + +{** + * \brief The predefined log categories + * + * By default the application category is enabled at the INFO level, + * the assert category is enabled at the WARN level, test is enabled + * at the VERBOSE level and all other categories are enabled at the + * CRITICAL level. + *} +type + PPSDL_LogCategory = ^PSDL_LogCategory; + PSDL_LogCategory = ^TSDL_LogCategory; + TSDL_LogCategory = type cint; + +const + SDL_LOG_CATEGORY_APPLICATION = TSDL_LogCategory(0); + SDL_LOG_CATEGORY_ERROR = TSDL_LogCategory(1); + SDL_LOG_CATEGORY_ASSERT = TSDL_LogCategory(2); + SDL_LOG_CATEGORY_SYSTEM = TSDL_LogCategory(3); + SDL_LOG_CATEGORY_AUDIO = TSDL_LogCategory(4); + SDL_LOG_CATEGORY_VIDEO = TSDL_LogCategory(5); + SDL_LOG_CATEGORY_RENDER = TSDL_LogCategory(6); + SDL_LOG_CATEGORY_INPUT = TSDL_LogCategory(7); + SDL_LOG_CATEGORY_TEST = TSDL_LogCategory(8); + + {* Reserved for future SDL library use *} + SDL_LOG_CATEGORY_RESERVED1 = TSDL_LogCategory(9); + SDL_LOG_CATEGORY_RESERVED2 = TSDL_LogCategory(10); + SDL_LOG_CATEGORY_RESERVED3 = TSDL_LogCategory(11); + SDL_LOG_CATEGORY_RESERVED4 = TSDL_LogCategory(12); + SDL_LOG_CATEGORY_RESERVED5 = TSDL_LogCategory(13); + SDL_LOG_CATEGORY_RESERVED6 = TSDL_LogCategory(14); + SDL_LOG_CATEGORY_RESERVED7 = TSDL_LogCategory(15); + SDL_LOG_CATEGORY_RESERVED8 = TSDL_LogCategory(16); + SDL_LOG_CATEGORY_RESERVED9 = TSDL_LogCategory(17); + SDL_LOG_CATEGORY_RESERVED10 = TSDL_LogCategory(18); + + {* Beyond this point is reserved for application use *} + SDL_LOG_CATEGORY_CUSTOM = TSDL_LogCategory(19); + +{** + * \brief The predefined log priorities + *} +type + PPSDL_LogPriority = ^PSDL_LogPriority; + PSDL_LogPriority = ^TSDL_LogPriority; + TSDL_LogPriority = type cint32; +const + SDL_LOG_PRIORITY_VERBOSE = TSDL_LogPriority(1); + SDL_LOG_PRIORITY_DEBUG = TSDL_LogPriority(2); + SDL_LOG_PRIORITY_INFO = TSDL_LogPriority(3); + SDL_LOG_PRIORITY_WARN = TSDL_LogPriority(4); + SDL_LOG_PRIORITY_ERROR = TSDL_LogPriority(5); + SDL_LOG_PRIORITY_CRITICAL = TSDL_LogPriority(6); + SDL_NUM_LOG_PRIORITIES = TSDL_LogPriority(7); + +{** + * \brief Set the priority of all log categories + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogSetAllPriority_proc = procedure(priority: TSDL_LogPriority); cdecl; +Var + SDL_LogSetAllPriority : TSDL_LogSetAllPriority_proc = Nil; +{$else} + +procedure SDL_LogSetAllPriority(priority: TSDL_LogPriority); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogSetAllPriority' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Set the priority of a particular log category + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogSetPriority_proc = procedure(category: TSDL_LogCategory; priority: TSDL_LogPriority); cdecl; +Var + SDL_LogSetPriority : TSDL_LogSetPriority_proc = Nil; +{$else} + +procedure SDL_LogSetPriority(category: TSDL_LogCategory; priority: TSDL_LogPriority); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogSetPriority' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Get the priority of a particular log category + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogGetPriority_fun = function(category: TSDL_LogCategory): TSDL_LogPriority; cdecl; +Var + SDL_LogGetPriority : TSDL_LogGetPriority_fun = Nil; +{$else} + +function SDL_LogGetPriority(category: TSDL_LogCategory): TSDL_LogPriority; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogGetPriority' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Reset all priorities to default. + * + * \note This is called in SDL_Quit(). + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogResetPriorities_proc = procedure(); cdecl; +Var + SDL_LogResetPriorities : TSDL_LogResetPriorities_proc = Nil; +{$else} + +procedure SDL_LogResetPriorities(); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogResetPriorities' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_Log_proc = procedure(const fmt: PAnsiChar; pars: array of const); cdecl; +Var + SDL_Log : TSDL_Log_proc = Nil; +{$else} + +procedure SDL_Log(const fmt: PAnsiChar; pars: array of const); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Log' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogVerbose_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; +Var + SDL_LogVerbose : TSDL_LogVerbose_proc = Nil; +{$else} + +procedure SDL_LogVerbose(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogVerbose' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Log a message with SDL_LOG_PRIORITY_DEBUG + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogDebug_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; +Var + SDL_LogDebug : TSDL_LogDebug_proc = Nil; +{$else} + +procedure SDL_LogDebug(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogDebug' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Log a message with SDL_LOG_PRIORITY_INFO + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogInfo_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; +Var + SDL_LogInfo : TSDL_LogInfo_proc = Nil; +{$else} + +procedure SDL_LogInfo(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogInfo' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Log a message with SDL_LOG_PRIORITY_WARN + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogWarn_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; +Var + SDL_LogWarn : TSDL_LogWarn_proc = Nil; +{$else} + +procedure SDL_LogWarn(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogWarn' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Log a message with SDL_LOG_PRIORITY_ERROR + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogError_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; +Var + SDL_LogError : TSDL_LogError_proc = Nil; +{$else} + +procedure SDL_LogError(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogError' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogCritical_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; +Var + SDL_LogCritical : TSDL_LogCritical_proc = Nil; +{$else} + +procedure SDL_LogCritical(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogCritical' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Log a message with the specified category and priority. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogMessage_proc = procedure(category: TSDL_LogCategory; priority: TSDL_LogPriority; const fmt: PAnsiChar; pars: array of const); cdecl; +Var + SDL_LogMessage : TSDL_LogMessage_proc = Nil; +{$else} + +procedure SDL_LogMessage(category: TSDL_LogCategory; priority: TSDL_LogPriority; const fmt: PAnsiChar; pars: array of const); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogMessage' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Log a message with the specified category and priority. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LogMessageV_proc = procedure(category: TSDL_LogCategory; priority: TSDL_LogPriority; const fmt: PAnsiChar; ap: array of const); cdecl; +Var + SDL_LogMessageV : TSDL_LogMessageV_proc = Nil; +{$else} + +procedure SDL_LogMessageV(category: TSDL_LogCategory; priority: TSDL_LogPriority; const fmt: PAnsiChar; ap: array of const); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogMessageV' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief The prototype for the log output function + *} +type + PPSDL_LogOutputFunction = ^PSDL_LogOutputFunction; + PSDL_LogOutputFunction = ^TSDL_LogOutputFunction; + TSDL_LogOutputFunction = procedure( + userdata: Pointer; + category: TSDL_LogCategory; + priority: TSDL_LogPriority; + const msg: PAnsiChar); cdecl; + +{** + * \brief Get the current log output function. + *} +procedure SDL_LogGetOutputFunction(callback: PSDL_LogOutputFunction; userdata: PPointer); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogGetOutputFunction' {$ENDIF} {$ENDIF}; + +{** + * \brief This function allows you to replace the default log output + * function with one of your own. + *} +procedure SDL_LogSetOutputFunction(callback: TSDL_LogOutputFunction; userdata: Pointer); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogSetOutputFunction' {$ENDIF} {$ENDIF}; + +{$ENDIF} diff --git a/units/sdlmessagebox.inc b/units/sdlmessagebox.inc index 0e5f6949..238cda6a 100644 --- a/units/sdlmessagebox.inc +++ b/units/sdlmessagebox.inc @@ -1,140 +1,140 @@ -//from "sdl_messagebox.h" - -{** - * SDL_MessageBox flags. If supported will display warning icon, etc. - *} -type - PPSDL_MessageBoxFlags = ^PSDL_MessageBoxFlags; - PSDL_MessageBoxFlags = ^TSDL_MessageBoxFlags; - TSDL_MessageBoxFlags = type cuint32; - -const - SDL_MESSAGEBOX_ERROR = TSDL_MessageBoxFlags($00000010); {**< error dialog *} - SDL_MESSAGEBOX_WARNING = TSDL_MessageBoxFlags($00000020); {**< warning dialog *} - SDL_MESSAGEBOX_INFORMATION = TSDL_MessageBoxFlags($00000040); {**< informational dialog *} - SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = TSDL_MessageBoxFlags($00000080); {/**< buttons placed left to right */} - SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = TSDL_MessageBoxFlags($00000100); {/**< buttons placed right to left */} - -{** - * Flags for SDL_MessageBoxButtonData. - *} -type - PPSDL_MessageBoxButtonFlags = ^PSDL_MessageBoxButtonFlags; - PSDL_MessageBoxButtonFlags = ^TSDL_MessageBoxButtonFlags; - TSDL_MessageBoxButtonFlags = type cuint32; - -const - SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = TSDL_MessageBoxButtonFlags($00000001); {**< Marks the default button when return is hit *} - SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = TSDL_MessageBoxButtonFlags($00000002); {**< Marks the default button when escape is hit *} - - -{** - * Individual button data. - *} -type - PPSDL_MessageBoxButtonData = ^PSDL_MessageBoxButtonData; - PSDL_MessageBoxButtonData = ^TSDL_MessageBoxButtonData; - TSDL_MessageBoxButtonData = record - flags: TSDL_MessageBoxButtonFlags; {**< ::SDL_MessageBoxButtonFlags *} - buttonid: cint; {**< User defined button id (value returned via SDL_ShowMessageBox) *} - text: PAnsiChar; {**< The UTF-8 button text *} - end; - -{** - * RGB value used in a message box color scheme - *} -type - PPSDL_MessageBoxColor = ^PSDL_MessageBoxColor; - PSDL_MessageBoxColor = ^TSDL_MessageBoxColor; - TSDL_MessageBoxColor = record - r, g, b: cuint8; - end; - - PPSDL_MessageBoxColorType = ^PSDL_MessageBoxColorType; - PSDL_MessageBoxColorType = ^TSDL_MessageBoxColorType; - TSDL_MessageBoxColorType = type Word; - -const - SDL_MESSAGEBOX_COLOR_BACKGROUND = TSDL_MessageBoxColorType(0); - SDL_MESSAGEBOX_COLOR_TEXT = TSDL_MessageBoxColorType(1); - SDL_MESSAGEBOX_COLOR_BUTTON_BORDER = TSDL_MessageBoxColorType(2); - SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND = TSDL_MessageBoxColorType(3); - SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED = TSDL_MessageBoxColorType(4); - SDL_MESSAGEBOX_COLOR_MAX = TSDL_MessageBoxColorType(5); - - {** - * A set of colors to use for message box dialogs - *} -type - PPSDL_MessageBoxColorScheme = ^PSDL_MessageBoxColorScheme; - PSDL_MessageBoxColorScheme = ^TSDL_MessageBoxColorScheme; - TSDL_MessageBoxColorScheme = record - colors: array[0..SDL_MESSAGEBOX_COLOR_MAX-1] of TSDL_MessageBoxColor; - end; - - {** - * MessageBox structure containing title, text, window, etc. - *} -type - PPSDL_MessageBoxData = ^PSDL_MessageBoxData; - PSDL_MessageBoxData = ^TSDL_MessageBoxData; - TSDL_MessageBoxData = record - flags: TSDL_MessageBoxFlags; {**< SDL_MessageBoxFlags *} - window: PSDL_Window; {**< Parent window, can be NULL *} - title: PAnsiChar; {**< UTF-8 title *} - _message: PAnsiChar; {**< UTF-8 message text *} - - numbuttons: cint; - buttons: PSDL_MessageBoxButtonData; - - colorScheme: PSDL_MessageBoxColorScheme; {**< SDL_MessageBoxColorScheme, can be NULL to use system settings *} - end; - -{** - * Create a modal message box. - * - * messageboxdata The SDL_MessageBoxData structure with title, text, etc. - * buttonid The pointer to which user id of hit button should be copied. - * - * -1 on error, otherwise 0 and buttonid contains user id of button - * hit or -1 if dialog was closed. - * - * This function should be called on the thread that created the parent - * window, or on the main thread if the messagebox has no parent. It will - * block execution of that thread until the user clicks a button or - * closes the messagebox. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_ShowMessageBox_fun = function(messageboxdata: PSDL_MessageBoxData; buttonid: pcint): cint; cdecl; -Var - SDL_ShowMessageBox : TSDL_ShowMessageBox_fun = Nil; -{$else} - -function SDL_ShowMessageBox(messageboxdata: PSDL_MessageBoxData; buttonid: pcint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ShowMessageBox' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Create a simple modal message box - * - * flags SDL_MessageBoxFlags - * title UTF-8 title text - * message UTF-8 message text - * window The parent window, or NULL for no parent - * - * 0 on success, -1 on error - * - * SDL_ShowMessageBox - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_ShowSimpleMessageBox_fun = function(flags: TSDL_MessageBoxFlags; title: PAnsiChar; _message: PAnsiChar; window: PSDL_Window): cint; cdecl; -Var - SDL_ShowSimpleMessageBox : TSDL_ShowSimpleMessageBox_fun = Nil; -{$else} - -function SDL_ShowSimpleMessageBox(flags: TSDL_MessageBoxFlags; title: PAnsiChar; _message: PAnsiChar; window: PSDL_Window): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ShowSimpleMessageBox' {$ENDIF} {$ENDIF}; -{$endif} - +//from "sdl_messagebox.h" + +{** + * SDL_MessageBox flags. If supported will display warning icon, etc. + *} +type + PPSDL_MessageBoxFlags = ^PSDL_MessageBoxFlags; + PSDL_MessageBoxFlags = ^TSDL_MessageBoxFlags; + TSDL_MessageBoxFlags = type cuint32; + +const + SDL_MESSAGEBOX_ERROR = TSDL_MessageBoxFlags($00000010); {**< error dialog *} + SDL_MESSAGEBOX_WARNING = TSDL_MessageBoxFlags($00000020); {**< warning dialog *} + SDL_MESSAGEBOX_INFORMATION = TSDL_MessageBoxFlags($00000040); {**< informational dialog *} + SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = TSDL_MessageBoxFlags($00000080); {/**< buttons placed left to right */} + SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = TSDL_MessageBoxFlags($00000100); {/**< buttons placed right to left */} + +{** + * Flags for SDL_MessageBoxButtonData. + *} +type + PPSDL_MessageBoxButtonFlags = ^PSDL_MessageBoxButtonFlags; + PSDL_MessageBoxButtonFlags = ^TSDL_MessageBoxButtonFlags; + TSDL_MessageBoxButtonFlags = type cuint32; + +const + SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = TSDL_MessageBoxButtonFlags($00000001); {**< Marks the default button when return is hit *} + SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = TSDL_MessageBoxButtonFlags($00000002); {**< Marks the default button when escape is hit *} + + +{** + * Individual button data. + *} +type + PPSDL_MessageBoxButtonData = ^PSDL_MessageBoxButtonData; + PSDL_MessageBoxButtonData = ^TSDL_MessageBoxButtonData; + TSDL_MessageBoxButtonData = record + flags: TSDL_MessageBoxButtonFlags; {**< ::SDL_MessageBoxButtonFlags *} + buttonid: cint; {**< User defined button id (value returned via SDL_ShowMessageBox) *} + text: PAnsiChar; {**< The UTF-8 button text *} + end; + +{** + * RGB value used in a message box color scheme + *} +type + PPSDL_MessageBoxColor = ^PSDL_MessageBoxColor; + PSDL_MessageBoxColor = ^TSDL_MessageBoxColor; + TSDL_MessageBoxColor = record + r, g, b: cuint8; + end; + + PPSDL_MessageBoxColorType = ^PSDL_MessageBoxColorType; + PSDL_MessageBoxColorType = ^TSDL_MessageBoxColorType; + TSDL_MessageBoxColorType = type Word; + +const + SDL_MESSAGEBOX_COLOR_BACKGROUND = TSDL_MessageBoxColorType(0); + SDL_MESSAGEBOX_COLOR_TEXT = TSDL_MessageBoxColorType(1); + SDL_MESSAGEBOX_COLOR_BUTTON_BORDER = TSDL_MessageBoxColorType(2); + SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND = TSDL_MessageBoxColorType(3); + SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED = TSDL_MessageBoxColorType(4); + SDL_MESSAGEBOX_COLOR_MAX = TSDL_MessageBoxColorType(5); + + {** + * A set of colors to use for message box dialogs + *} +type + PPSDL_MessageBoxColorScheme = ^PSDL_MessageBoxColorScheme; + PSDL_MessageBoxColorScheme = ^TSDL_MessageBoxColorScheme; + TSDL_MessageBoxColorScheme = record + colors: array[0..SDL_MESSAGEBOX_COLOR_MAX-1] of TSDL_MessageBoxColor; + end; + + {** + * MessageBox structure containing title, text, window, etc. + *} +type + PPSDL_MessageBoxData = ^PSDL_MessageBoxData; + PSDL_MessageBoxData = ^TSDL_MessageBoxData; + TSDL_MessageBoxData = record + flags: TSDL_MessageBoxFlags; {**< SDL_MessageBoxFlags *} + window: PSDL_Window; {**< Parent window, can be NULL *} + title: PAnsiChar; {**< UTF-8 title *} + _message: PAnsiChar; {**< UTF-8 message text *} + + numbuttons: cint; + buttons: PSDL_MessageBoxButtonData; + + colorScheme: PSDL_MessageBoxColorScheme; {**< SDL_MessageBoxColorScheme, can be NULL to use system settings *} + end; + +{** + * Create a modal message box. + * + * messageboxdata The SDL_MessageBoxData structure with title, text, etc. + * buttonid The pointer to which user id of hit button should be copied. + * + * -1 on error, otherwise 0 and buttonid contains user id of button + * hit or -1 if dialog was closed. + * + * This function should be called on the thread that created the parent + * window, or on the main thread if the messagebox has no parent. It will + * block execution of that thread until the user clicks a button or + * closes the messagebox. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ShowMessageBox_fun = function(messageboxdata: PSDL_MessageBoxData; buttonid: pcint): cint; cdecl; +Var + SDL_ShowMessageBox : TSDL_ShowMessageBox_fun = Nil; +{$else} + +function SDL_ShowMessageBox(messageboxdata: PSDL_MessageBoxData; buttonid: pcint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ShowMessageBox' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Create a simple modal message box + * + * flags SDL_MessageBoxFlags + * title UTF-8 title text + * message UTF-8 message text + * window The parent window, or NULL for no parent + * + * 0 on success, -1 on error + * + * SDL_ShowMessageBox + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ShowSimpleMessageBox_fun = function(flags: TSDL_MessageBoxFlags; title: PAnsiChar; _message: PAnsiChar; window: PSDL_Window): cint; cdecl; +Var + SDL_ShowSimpleMessageBox : TSDL_ShowSimpleMessageBox_fun = Nil; +{$else} + +function SDL_ShowSimpleMessageBox(flags: TSDL_MessageBoxFlags; title: PAnsiChar; _message: PAnsiChar; window: PSDL_Window): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ShowSimpleMessageBox' {$ENDIF} {$ENDIF}; +{$endif} + diff --git a/units/sdlmisc.inc b/units/sdlmisc.inc index 6ccc47ae..a975c072 100644 --- a/units/sdlmisc.inc +++ b/units/sdlmisc.inc @@ -1,29 +1,29 @@ -// based on SDL_misc.h - -{** - * \brief Open an URL / URI in the browser or other - * - * Open a URL in a separate, system-provided application. How this works will - * vary wildly depending on the platform. This will likely launch what - * makes sense to handle a specific URL's protocol (a web browser for http://, - * etc), but it might also be able to launch file managers for directories - * and other things. - * - * What happens when you open a URL varies wildly as well: your game window - * may lose focus (and may or may not lose focus if your game was fullscreen - * or grabbing input at the time). On mobile devices, your app will likely - * move to the background or your process might be paused. Any given platform - * may or may not handle a given URL. - * - * If this is unimplemented (or simply unavailable) for a platform, this will - * fail with an error. A successful result does not mean the URL loaded, just - * that we launched something to handle it (or at least believe we did). - * - * All this to say: this function can be useful, but you should definitely - * test it on every platform you target. - * - * \param url A valid URL to open. - * \return 0 on success, or -1 on error. - *} -function SDL_OpenURL(const url: PAnsiChar): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_OpenURL' {$ENDIF} {$ENDIF}; +// based on SDL_misc.h + +{** + * \brief Open an URL / URI in the browser or other + * + * Open a URL in a separate, system-provided application. How this works will + * vary wildly depending on the platform. This will likely launch what + * makes sense to handle a specific URL's protocol (a web browser for http://, + * etc), but it might also be able to launch file managers for directories + * and other things. + * + * What happens when you open a URL varies wildly as well: your game window + * may lose focus (and may or may not lose focus if your game was fullscreen + * or grabbing input at the time). On mobile devices, your app will likely + * move to the background or your process might be paused. Any given platform + * may or may not handle a given URL. + * + * If this is unimplemented (or simply unavailable) for a platform, this will + * fail with an error. A successful result does not mean the URL loaded, just + * that we launched something to handle it (or at least believe we did). + * + * All this to say: this function can be useful, but you should definitely + * test it on every platform you target. + * + * \param url A valid URL to open. + * \return 0 on success, or -1 on error. + *} +function SDL_OpenURL(const url: PAnsiChar): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_OpenURL' {$ENDIF} {$ENDIF}; diff --git a/units/sdlmouse.inc b/units/sdlmouse.inc index d4fc4fde..c4ed4507 100644 --- a/units/sdlmouse.inc +++ b/units/sdlmouse.inc @@ -1,555 +1,555 @@ -//from "sdl_mouse.h" - -type - PPSDL_Cursor = ^PSDL_Cursor; - PSDL_Cursor = type Pointer; {**< Implementation dependent *} - -{** -* Cursor types for SDL_CreateSystemCursor. -*} -type - PPSDL_SystemCursor = ^PSDL_SystemCursor; - PSDL_SystemCursor = ^TSDL_SystemCursor; - TSDL_SystemCursor = type Integer; - -const - SDL_SYSTEM_CURSOR_ARROW = TSDL_SystemCursor(0); // Arrow - SDL_SYSTEM_CURSOR_IBEAM = TSDL_SystemCursor(1); // I-beam - SDL_SYSTEM_CURSOR_WAIT = TSDL_SystemCursor(2); // Wait - SDL_SYSTEM_CURSOR_CROSSHAIR = TSDL_SystemCursor(3); // Crosshair - SDL_SYSTEM_CURSOR_WAITARROW = TSDL_SystemCursor(4); // Small wait cursor (or Wait if not available) - SDL_SYSTEM_CURSOR_SIZENWSE = TSDL_SystemCursor(5); // Double arrow pointing northwest and southeast - SDL_SYSTEM_CURSOR_SIZENESW = TSDL_SystemCursor(6); // Double arrow pointing northeast and southwest - SDL_SYSTEM_CURSOR_SIZEWE = TSDL_SystemCursor(7); // Double arrow pointing west and east - SDL_SYSTEM_CURSOR_SIZENS = TSDL_SystemCursor(8); // Double arrow pointing north and south - SDL_SYSTEM_CURSOR_SIZEALL = TSDL_SystemCursor(9); // Four pointed arrow pointing north, south, east, and west - SDL_SYSTEM_CURSOR_NO = TSDL_SystemCursor(10); // Slashed circle or crossbones - SDL_SYSTEM_CURSOR_HAND = TSDL_SystemCursor(11); // Hand - SDL_NUM_SYSTEM_CURSORS = TSDL_SystemCursor(12); - -type - PPSDL_MouseWheelDirection = ^PSDL_MouseWheelDirection; - PSDL_MouseWheelDirection = ^TSDL_MouseWheelDirection; - TSDL_MouseWheelDirection = type Integer; - -const - SDL_MOUSEWHEEL_NORMAL = TSDL_MouseWheelDirection(0); {**< The scroll direction is normal *} - SDL_MOUSEWHEEL_FLIPPED = TSDL_MouseWheelDirection(1); {**< The scroll direction is flipped / natural *} - - {* Function prototypes *} - - {** - * Get the window which currently has mouse focus. - * - * \returns the window with mouse focus. - * - * \since This function is available since SDL 2.0.0. - *} -function SDL_GetMouseFocus: PSDL_Window; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetMouseFocus' {$ENDIF}{$ENDIF}; - - {** - * Retrieve the current state of the mouse. - * - * The current button state is returned as a button bitmask, which can be - * tested using the `SDL_BUTTON(X)` macros (where `X` is generally 1 for the - * left, 2 for middle, 3 for the right button), and `x` and `y` are set to the - * mouse cursor position relative to the focus window. You can pass NULL for - * either `x` or `y`. - * - * \param x the x coordinate of the mouse cursor position relative to the - * focus window - * \param y the y coordinate of the mouse cursor position relative to the - * focus window - * \returns a 32-bit button bitmask of the current button state. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetGlobalMouseState - * \sa SDL_GetRelativeMouseState - * \sa SDL_PumpEvents - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetMouseState_fun = function(x: pcint; y: pcint): cuint32; cdecl; -Var - SDL_GetMouseState : TSDL_GetMouseState_fun = Nil; -{$else} - -function SDL_GetMouseState(x: pcint; y: pcint): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetMouseState' {$ENDIF}{$ENDIF}; -{$endif} - - - {** - * Get the current state of the mouse in relation to the desktop. - * - * This works similarly to SDL_GetMouseState(), but the coordinates will be - * reported relative to the top-left of the desktop. This can be useful if you - * need to track the mouse outside of a specific window and SDL_CaptureMouse() - * doesn't fit your needs. For example, it could be useful if you need to - * track the mouse while dragging a window, where coordinates relative to a - * window might not be in sync at all times. - * - * Note: SDL_GetMouseState() returns the mouse position as SDL understands it - * from the last pump of the event queue. This function, however, queries the - * OS for the current mouse position, and as such, might be a slightly less - * efficient function. Unless you know what you're doing and have a good - * reason to use this function, you probably want SDL_GetMouseState() instead. - * - * \param x filled in with the current X coord relative to the desktop; can be - * NULL - * \param y filled in with the current Y coord relative to the desktop; can be - * NULL - * \returns the current button state as a bitmask which can be tested using - * the SDL_BUTTON(X) macros. - * - * \since This function is available since SDL 2.0.4. - * - * \sa SDL_CaptureMouse - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetGlobalMouseState_fun = function(x, y: pcint32): cuint32; cdecl; -Var - SDL_GetGlobalMouseState : TSDL_GetGlobalMouseState_fun = Nil; -{$else} - -function SDL_GetGlobalMouseState(x, y: pcint32): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetGlobalMouseState' {$ENDIF}{$ENDIF}; -{$endif} - - {** - * Retrieve the relative state of the mouse. - * - * The current button state is returned as a button bitmask, which can be - * tested using the `SDL_BUTTON(X)` macros (where `X` is generally 1 for the - * left, 2 for middle, 3 for the right button), and `x` and `y` are set to the - * mouse deltas since the last call to SDL_GetRelativeMouseState() or since - * event initialization. You can pass NULL for either `x` or `y`. - * - * \param x a pointer filled with the last recorded x coordinate of the mouse - * \param y a pointer filled with the last recorded y coordinate of the mouse - * \returns a 32-bit button bitmask of the relative button state. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetMouseState - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetRelativeMouseState_fun = function(x: pcint; y: pcint): cuint32; cdecl; -Var - SDL_GetRelativeMouseState : TSDL_GetRelativeMouseState_fun = Nil; -{$else} - -function SDL_GetRelativeMouseState(x: pcint; y: pcint): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRelativeMouseState' {$ENDIF}{$ENDIF}; -{$endif} - - {** - * Move the mouse cursor to the given position within the window. - * - * This function generates a mouse motion event if relative mode is not - * enabled. If relative mode is enabled, you can force mouse events for the - * warp by setting the SDL_HINT_MOUSE_RELATIVE_WARP_MOTION hint. - * - * Note that this function will appear to succeed, but not actually move the - * mouse when used over Microsoft Remote Desktop. - * - * \param window the window to move the mouse into, or NULL for the current - * mouse focus - * \param x the x coordinate within the window - * \param y the y coordinate within the window - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_WarpMouseGlobal - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_WarpMouseInWindow_proc = procedure(window: PSDL_Window; x: cint; y: cint); cdecl; -Var - SDL_WarpMouseInWindow : TSDL_WarpMouseInWindow_proc = Nil; -{$else} - -procedure SDL_WarpMouseInWindow(window: PSDL_Window; x: cint; y: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WarpMouseInWindow' {$ENDIF}{$ENDIF}; -{$endif} - - {** - * Move the mouse to the given position in global screen space. - * - * This function generates a mouse motion event. - * - * A failure of this function usually means that it is unsupported by a - * platform. - * - * Note that this function will appear to succeed, but not actually move the - * mouse when used over Microsoft Remote Desktop. - * - * \param x the x coordinate - * \param y the y coordinate - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.4. - * - * \sa SDL_WarpMouseInWindow - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_WarpMouseGlobal_fun = function(x, y: cint): cint; cdecl; -Var - SDL_WarpMouseGlobal : TSDL_WarpMouseGlobal_fun = Nil; -{$else} - -function SDL_WarpMouseGlobal(x, y: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WarpMouseGlobal' {$ENDIF}{$ENDIF}; -{$endif} - - {** - * Set relative mouse mode. - * - * While the mouse is in relative mode, the cursor is hidden, and the driver - * will try to report continuous motion in the current window. Only relative - * motion events will be delivered, the mouse position will not change. - * - * Note that this function will not be able to provide continuous relative - * motion when used over Microsoft Remote Desktop, instead motion is limited - * to the bounds of the screen. - * - * This function will flush any pending mouse motion. - * - * \param enabled SDL_TRUE to enable relative mode, SDL_FALSE to disable. - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * If relative mode is not supported, this returns -1. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetRelativeMouseMode - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetRelativeMouseMode_fun = function(enabled: TSDL_Bool): cint; cdecl; -Var - SDL_SetRelativeMouseMode : TSDL_SetRelativeMouseMode_fun = Nil; -{$else} - -function SDL_SetRelativeMouseMode(enabled: TSDL_Bool): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRelativeMouseMode' {$ENDIF}{$ENDIF}; -{$endif} - - {** - * Capture the mouse and to track input outside an SDL window. - * - * Capturing enables your app to obtain mouse events globally, instead of just - * within your window. Not all video targets support this function. When - * capturing is enabled, the current window will get all mouse events, but - * unlike relative mode, no change is made to the cursor and it is not - * restrained to your window. - * - * This function may also deny mouse input to other windows--both those in - * your application and others on the system--so you should use this function - * sparingly, and in small bursts. For example, you might want to track the - * mouse while the user is dragging something, until the user releases a mouse - * button. It is not recommended that you capture the mouse for long periods - * of time, such as the entire time your app is running. For that, you should - * probably use SDL_SetRelativeMouseMode() or SDL_SetWindowGrab(), depending - * on your goals. - * - * While captured, mouse events still report coordinates relative to the - * current (foreground) window, but those coordinates may be outside the - * bounds of the window (including negative values). Capturing is only allowed - * for the foreground window. If the window loses focus while capturing, the - * capture will be disabled automatically. - * - * While capturing is enabled, the current window will have the - * `SDL_WINDOW_MOUSE_CAPTURE` flag set. - * - * Please note that as of SDL 2.0.22, SDL will attempt to "auto capture" the - * mouse while the user is pressing a button; this is to try and make mouse - * behavior more consistent between platforms, and deal with the common case - * of a user dragging the mouse outside of the window. This means that if you - * are calling SDL_CaptureMouse() only to deal with this situation, you no - * longer have to (although it is safe to do so). If this causes problems for - * your app, you can disable auto capture by setting the - * `SDL_HINT_MOUSE_AUTO_CAPTURE` hint to zero. - * - * \param enabled SDL_TRUE to enable capturing, SDL_FALSE to disable. - * \returns 0 on success or -1 if not supported; call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.4. - * - * \sa SDL_GetGlobalMouseState - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_CaptureMouse_fun = function(enabled: TSDL_Bool): cint; cdecl; -Var - SDL_CaptureMouse : TSDL_CaptureMouse_fun = Nil; -{$else} - - function SDL_CaptureMouse(enabled: TSDL_Bool): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CaptureMouse' {$ENDIF}{$ENDIF}; -{$endif} - - {** - * Query whether relative mouse mode is enabled. - * - * \returns SDL_TRUE if relative mode is enabled or SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_SetRelativeMouseMode - *} -function SDL_GetRelativeMouseMode: TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRelativeMouseMode' {$ENDIF}{$ENDIF}; - - {** - * Create a cursor using the specified bitmap data and mask (in MSB format). - * - * `mask` has to be in MSB (Most Significant Bit) format. - * - * The cursor width (`w`) must be a multiple of 8 bits. - * - * The cursor is created in black and white according to the following: - * - * - data=0, mask=1: white - * - data=1, mask=1: black - * - data=0, mask=0: transparent - * - data=1, mask=0: inverted color if possible, black if not. - * - * Cursors created with this function must be freed with SDL_FreeCursor(). - * - * If you want to have a color cursor, or create your cursor from an - * SDL_Surface, you should use SDL_CreateColorCursor(). Alternately, you can - * hide the cursor and draw your own as part of your game's rendering, but it - * will be bound to the framerate. - * - * Also, since SDL 2.0.0, SDL_CreateSystemCursor() is available, which - * provides twelve readily available system cursors to pick from. - * - * \param data the color value for each pixel of the cursor - * \param mask the mask value for each pixel of the cursor - * \param w the width of the cursor - * \param h the height of the cursor - * \param hot_x the X-axis location of the upper left corner of the cursor - * relative to the actual mouse position - * \param hot_y the Y-axis location of the upper left corner of the cursor - * relative to the actual mouse position - * \returns a new cursor with the specified parameters on success or NULL on - * failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_FreeCursor - * \sa SDL_SetCursor - * \sa SDL_ShowCursor - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_CreateCursor_fun = function( - const data: pcuint8; - const mask: pcuint8; - w: cint; h: cint; - hot_x: cint; hot_y: cint): PSDL_Cursor; cdecl; -Var - SDL_CreateCursor : TSDL_CreateCursor_fun = Nil; -{$else} - -function SDL_CreateCursor( - const data: pcuint8; - const mask: pcuint8; - w: cint; h: cint; - hot_x: cint; hot_y: cint): PSDL_Cursor; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateCursor' {$ENDIF}{$ENDIF}; -{$endif} - - {** - * Create a color cursor. - * - * \param surface an SDL_Surface structure representing the cursor image - * \param hot_x the x position of the cursor hot spot - * \param hot_y the y position of the cursor hot spot - * \returns the new cursor on success or NULL on failure; call SDL_GetError() - * for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_CreateCursor - * \sa SDL_FreeCursor - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_CreateColorCursor_fun = function( - surface: PSDL_Surface; - hot_x: cint; - hot_y: cint): PSDL_Cursor; cdecl; -Var - SDL_CreateColorCursor : TSDL_CreateColorCursor_fun = Nil; -{$else} - -function SDL_CreateColorCursor( - surface: PSDL_Surface; - hot_x: cint; - hot_y: cint): PSDL_Cursor; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateColorCursor' {$ENDIF}{$ENDIF}; -{$endif} - - {** - * Create a system cursor. - * - * \param id an SDL_SystemCursor enum value - * \returns a cursor on success or NULL on failure; call SDL_GetError() for - * more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_FreeCursor - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_CreateSystemCursor_fun = function(id: TSDL_SystemCursor): PSDL_Cursor; cdecl; -Var - SDL_CreateSystemCursor : TSDL_CreateSystemCursor_fun = Nil; -{$else} - -function SDL_CreateSystemCursor(id: TSDL_SystemCursor): PSDL_Cursor; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateSystemCursor' {$ENDIF}{$ENDIF}; -{$endif} - - {** - * Set the active cursor. - * - * This function sets the currently active cursor to the specified one. If the - * cursor is currently visible, the change will be immediately represented on - * the display. SDL_SetCursor(NULL) can be used to force cursor redraw, if - * this is desired for any reason. - * - * \param cursor a cursor to make active - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_CreateCursor - * \sa SDL_GetCursor - * \sa SDL_ShowCursor - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetCursor_proc = procedure(cursor: PSDL_Cursor); cdecl; -Var - SDL_SetCursor : TSDL_SetCursor_proc = Nil; -{$else} - -procedure SDL_SetCursor(cursor: PSDL_Cursor); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetCursor' {$ENDIF}{$ENDIF}; -{$endif} - - {** - * Get the active cursor. - * - * This function returns a pointer to the current cursor which is owned by the - * library. It is not necessary to free the cursor with SDL_FreeCursor(). - * - * \returns the active cursor or NULL if there is no mouse. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_SetCursor - *} -function SDL_GetCursor: PSDL_Cursor; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCursor' {$ENDIF}{$ENDIF}; - - {** - * Get the default cursor. - * - * \returns the default cursor on success or NULL on failure. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_CreateSystemCursor - *} -function SDL_GetDefaultCursor: PSDL_Cursor; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDefaultCursor' {$ENDIF}{$ENDIF}; - - {** - * Free a previously-created cursor. - * - * Use this function to free cursor resources created with SDL_CreateCursor(), - * SDL_CreateColorCursor() or SDL_CreateSystemCursor(). - * - * \param cursor the cursor to free - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_CreateColorCursor - * \sa SDL_CreateCursor - * \sa SDL_CreateSystemCursor - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_FreeCursor_proc = procedure(cursor: PSDL_Cursor); cdecl; -Var - SDL_FreeCursor : TSDL_FreeCursor_proc = Nil; -{$else} - -procedure SDL_FreeCursor(cursor: PSDL_Cursor); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeCursor' {$ENDIF}{$ENDIF}; -{$endif} - - {** - * Toggle whether or not the cursor is shown. - * - * The cursor starts off displayed but can be turned off. Passing `SDL_ENABLE` - * displays the cursor and passing `SDL_DISABLE` hides it. - * - * The current state of the mouse cursor can be queried by passing - * `SDL_QUERY`; either `SDL_DISABLE` or `SDL_ENABLE` will be returned. - * - * \param toggle `SDL_ENABLE` to show the cursor, `SDL_DISABLE` to hide it, - * `SDL_QUERY` to query the current state without changing it. - * \returns `SDL_ENABLE` if the cursor is shown, or `SDL_DISABLE` if the - * cursor is hidden, or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_CreateCursor - * \sa SDL_SetCursor - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_ShowCursor_fun = function(toggle: cint): cint; cdecl; -Var - SDL_ShowCursor : TSDL_ShowCursor_fun = Nil; -{$else} - -function SDL_ShowCursor(toggle: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ShowCursor' {$ENDIF}{$ENDIF}; -{$endif} - -{** - * Used as a mask when testing buttons in buttonstate. - * - Button 1: Left mouse button - * - Button 2: Middle mouse button - * - Button 3: Right mouse button - *} -function SDL_Button(X: cint): cint; {$IFNDEF DELPHI} inline; {$ELSE} {$IFDEF DELPHI10UP} inline; {$ENDIF} {$ENDIF} -const - SDL_BUTTON_LEFT = 1; - SDL_BUTTON_MIDDLE = 2; - SDL_BUTTON_RIGHT = 3; - SDL_BUTTON_X1 = 4; - SDL_BUTTON_X2 = 5; - { Pascal Conv.: For better performance instead of using the - SDL_Button(X) macro, the following defines are - implemented directly. } - SDL_BUTTON_LMASK = 1 shl ((SDL_BUTTON_LEFT) - 1); - SDL_BUTTON_MMASK = 1 shl ((SDL_BUTTON_MIDDLE) - 1); - SDL_BUTTON_RMASK = 1 shl ((SDL_BUTTON_RIGHT) - 1); - SDL_BUTTON_X1MASK = 1 shl ((SDL_BUTTON_X1) - 1); - SDL_BUTTON_X2MASK = 1 shl ((SDL_BUTTON_X2) - 1); +//from "sdl_mouse.h" + +type + PPSDL_Cursor = ^PSDL_Cursor; + PSDL_Cursor = type Pointer; {**< Implementation dependent *} + +{** +* Cursor types for SDL_CreateSystemCursor. +*} +type + PPSDL_SystemCursor = ^PSDL_SystemCursor; + PSDL_SystemCursor = ^TSDL_SystemCursor; + TSDL_SystemCursor = type Integer; + +const + SDL_SYSTEM_CURSOR_ARROW = TSDL_SystemCursor(0); // Arrow + SDL_SYSTEM_CURSOR_IBEAM = TSDL_SystemCursor(1); // I-beam + SDL_SYSTEM_CURSOR_WAIT = TSDL_SystemCursor(2); // Wait + SDL_SYSTEM_CURSOR_CROSSHAIR = TSDL_SystemCursor(3); // Crosshair + SDL_SYSTEM_CURSOR_WAITARROW = TSDL_SystemCursor(4); // Small wait cursor (or Wait if not available) + SDL_SYSTEM_CURSOR_SIZENWSE = TSDL_SystemCursor(5); // Double arrow pointing northwest and southeast + SDL_SYSTEM_CURSOR_SIZENESW = TSDL_SystemCursor(6); // Double arrow pointing northeast and southwest + SDL_SYSTEM_CURSOR_SIZEWE = TSDL_SystemCursor(7); // Double arrow pointing west and east + SDL_SYSTEM_CURSOR_SIZENS = TSDL_SystemCursor(8); // Double arrow pointing north and south + SDL_SYSTEM_CURSOR_SIZEALL = TSDL_SystemCursor(9); // Four pointed arrow pointing north, south, east, and west + SDL_SYSTEM_CURSOR_NO = TSDL_SystemCursor(10); // Slashed circle or crossbones + SDL_SYSTEM_CURSOR_HAND = TSDL_SystemCursor(11); // Hand + SDL_NUM_SYSTEM_CURSORS = TSDL_SystemCursor(12); + +type + PPSDL_MouseWheelDirection = ^PSDL_MouseWheelDirection; + PSDL_MouseWheelDirection = ^TSDL_MouseWheelDirection; + TSDL_MouseWheelDirection = type Integer; + +const + SDL_MOUSEWHEEL_NORMAL = TSDL_MouseWheelDirection(0); {**< The scroll direction is normal *} + SDL_MOUSEWHEEL_FLIPPED = TSDL_MouseWheelDirection(1); {**< The scroll direction is flipped / natural *} + + {* Function prototypes *} + + {** + * Get the window which currently has mouse focus. + * + * \returns the window with mouse focus. + * + * \since This function is available since SDL 2.0.0. + *} +function SDL_GetMouseFocus: PSDL_Window; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetMouseFocus' {$ENDIF}{$ENDIF}; + + {** + * Retrieve the current state of the mouse. + * + * The current button state is returned as a button bitmask, which can be + * tested using the `SDL_BUTTON(X)` macros (where `X` is generally 1 for the + * left, 2 for middle, 3 for the right button), and `x` and `y` are set to the + * mouse cursor position relative to the focus window. You can pass NULL for + * either `x` or `y`. + * + * \param x the x coordinate of the mouse cursor position relative to the + * focus window + * \param y the y coordinate of the mouse cursor position relative to the + * focus window + * \returns a 32-bit button bitmask of the current button state. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetGlobalMouseState + * \sa SDL_GetRelativeMouseState + * \sa SDL_PumpEvents + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetMouseState_fun = function(x: pcint; y: pcint): cuint32; cdecl; +Var + SDL_GetMouseState : TSDL_GetMouseState_fun = Nil; +{$else} + +function SDL_GetMouseState(x: pcint; y: pcint): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetMouseState' {$ENDIF}{$ENDIF}; +{$endif} + + + {** + * Get the current state of the mouse in relation to the desktop. + * + * This works similarly to SDL_GetMouseState(), but the coordinates will be + * reported relative to the top-left of the desktop. This can be useful if you + * need to track the mouse outside of a specific window and SDL_CaptureMouse() + * doesn't fit your needs. For example, it could be useful if you need to + * track the mouse while dragging a window, where coordinates relative to a + * window might not be in sync at all times. + * + * Note: SDL_GetMouseState() returns the mouse position as SDL understands it + * from the last pump of the event queue. This function, however, queries the + * OS for the current mouse position, and as such, might be a slightly less + * efficient function. Unless you know what you're doing and have a good + * reason to use this function, you probably want SDL_GetMouseState() instead. + * + * \param x filled in with the current X coord relative to the desktop; can be + * NULL + * \param y filled in with the current Y coord relative to the desktop; can be + * NULL + * \returns the current button state as a bitmask which can be tested using + * the SDL_BUTTON(X) macros. + * + * \since This function is available since SDL 2.0.4. + * + * \sa SDL_CaptureMouse + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetGlobalMouseState_fun = function(x, y: pcint32): cuint32; cdecl; +Var + SDL_GetGlobalMouseState : TSDL_GetGlobalMouseState_fun = Nil; +{$else} + +function SDL_GetGlobalMouseState(x, y: pcint32): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetGlobalMouseState' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Retrieve the relative state of the mouse. + * + * The current button state is returned as a button bitmask, which can be + * tested using the `SDL_BUTTON(X)` macros (where `X` is generally 1 for the + * left, 2 for middle, 3 for the right button), and `x` and `y` are set to the + * mouse deltas since the last call to SDL_GetRelativeMouseState() or since + * event initialization. You can pass NULL for either `x` or `y`. + * + * \param x a pointer filled with the last recorded x coordinate of the mouse + * \param y a pointer filled with the last recorded y coordinate of the mouse + * \returns a 32-bit button bitmask of the relative button state. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetMouseState + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetRelativeMouseState_fun = function(x: pcint; y: pcint): cuint32; cdecl; +Var + SDL_GetRelativeMouseState : TSDL_GetRelativeMouseState_fun = Nil; +{$else} + +function SDL_GetRelativeMouseState(x: pcint; y: pcint): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRelativeMouseState' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Move the mouse cursor to the given position within the window. + * + * This function generates a mouse motion event if relative mode is not + * enabled. If relative mode is enabled, you can force mouse events for the + * warp by setting the SDL_HINT_MOUSE_RELATIVE_WARP_MOTION hint. + * + * Note that this function will appear to succeed, but not actually move the + * mouse when used over Microsoft Remote Desktop. + * + * \param window the window to move the mouse into, or NULL for the current + * mouse focus + * \param x the x coordinate within the window + * \param y the y coordinate within the window + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_WarpMouseGlobal + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WarpMouseInWindow_proc = procedure(window: PSDL_Window; x: cint; y: cint); cdecl; +Var + SDL_WarpMouseInWindow : TSDL_WarpMouseInWindow_proc = Nil; +{$else} + +procedure SDL_WarpMouseInWindow(window: PSDL_Window; x: cint; y: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WarpMouseInWindow' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Move the mouse to the given position in global screen space. + * + * This function generates a mouse motion event. + * + * A failure of this function usually means that it is unsupported by a + * platform. + * + * Note that this function will appear to succeed, but not actually move the + * mouse when used over Microsoft Remote Desktop. + * + * \param x the x coordinate + * \param y the y coordinate + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.4. + * + * \sa SDL_WarpMouseInWindow + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WarpMouseGlobal_fun = function(x, y: cint): cint; cdecl; +Var + SDL_WarpMouseGlobal : TSDL_WarpMouseGlobal_fun = Nil; +{$else} + +function SDL_WarpMouseGlobal(x, y: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WarpMouseGlobal' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Set relative mouse mode. + * + * While the mouse is in relative mode, the cursor is hidden, and the driver + * will try to report continuous motion in the current window. Only relative + * motion events will be delivered, the mouse position will not change. + * + * Note that this function will not be able to provide continuous relative + * motion when used over Microsoft Remote Desktop, instead motion is limited + * to the bounds of the screen. + * + * This function will flush any pending mouse motion. + * + * \param enabled SDL_TRUE to enable relative mode, SDL_FALSE to disable. + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * If relative mode is not supported, this returns -1. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetRelativeMouseMode + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetRelativeMouseMode_fun = function(enabled: TSDL_Bool): cint; cdecl; +Var + SDL_SetRelativeMouseMode : TSDL_SetRelativeMouseMode_fun = Nil; +{$else} + +function SDL_SetRelativeMouseMode(enabled: TSDL_Bool): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRelativeMouseMode' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Capture the mouse and to track input outside an SDL window. + * + * Capturing enables your app to obtain mouse events globally, instead of just + * within your window. Not all video targets support this function. When + * capturing is enabled, the current window will get all mouse events, but + * unlike relative mode, no change is made to the cursor and it is not + * restrained to your window. + * + * This function may also deny mouse input to other windows--both those in + * your application and others on the system--so you should use this function + * sparingly, and in small bursts. For example, you might want to track the + * mouse while the user is dragging something, until the user releases a mouse + * button. It is not recommended that you capture the mouse for long periods + * of time, such as the entire time your app is running. For that, you should + * probably use SDL_SetRelativeMouseMode() or SDL_SetWindowGrab(), depending + * on your goals. + * + * While captured, mouse events still report coordinates relative to the + * current (foreground) window, but those coordinates may be outside the + * bounds of the window (including negative values). Capturing is only allowed + * for the foreground window. If the window loses focus while capturing, the + * capture will be disabled automatically. + * + * While capturing is enabled, the current window will have the + * `SDL_WINDOW_MOUSE_CAPTURE` flag set. + * + * Please note that as of SDL 2.0.22, SDL will attempt to "auto capture" the + * mouse while the user is pressing a button; this is to try and make mouse + * behavior more consistent between platforms, and deal with the common case + * of a user dragging the mouse outside of the window. This means that if you + * are calling SDL_CaptureMouse() only to deal with this situation, you no + * longer have to (although it is safe to do so). If this causes problems for + * your app, you can disable auto capture by setting the + * `SDL_HINT_MOUSE_AUTO_CAPTURE` hint to zero. + * + * \param enabled SDL_TRUE to enable capturing, SDL_FALSE to disable. + * \returns 0 on success or -1 if not supported; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.4. + * + * \sa SDL_GetGlobalMouseState + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CaptureMouse_fun = function(enabled: TSDL_Bool): cint; cdecl; +Var + SDL_CaptureMouse : TSDL_CaptureMouse_fun = Nil; +{$else} + + function SDL_CaptureMouse(enabled: TSDL_Bool): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CaptureMouse' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Query whether relative mouse mode is enabled. + * + * \returns SDL_TRUE if relative mode is enabled or SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_SetRelativeMouseMode + *} +function SDL_GetRelativeMouseMode: TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRelativeMouseMode' {$ENDIF}{$ENDIF}; + + {** + * Create a cursor using the specified bitmap data and mask (in MSB format). + * + * `mask` has to be in MSB (Most Significant Bit) format. + * + * The cursor width (`w`) must be a multiple of 8 bits. + * + * The cursor is created in black and white according to the following: + * + * - data=0, mask=1: white + * - data=1, mask=1: black + * - data=0, mask=0: transparent + * - data=1, mask=0: inverted color if possible, black if not. + * + * Cursors created with this function must be freed with SDL_FreeCursor(). + * + * If you want to have a color cursor, or create your cursor from an + * SDL_Surface, you should use SDL_CreateColorCursor(). Alternately, you can + * hide the cursor and draw your own as part of your game's rendering, but it + * will be bound to the framerate. + * + * Also, since SDL 2.0.0, SDL_CreateSystemCursor() is available, which + * provides twelve readily available system cursors to pick from. + * + * \param data the color value for each pixel of the cursor + * \param mask the mask value for each pixel of the cursor + * \param w the width of the cursor + * \param h the height of the cursor + * \param hot_x the X-axis location of the upper left corner of the cursor + * relative to the actual mouse position + * \param hot_y the Y-axis location of the upper left corner of the cursor + * relative to the actual mouse position + * \returns a new cursor with the specified parameters on success or NULL on + * failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_FreeCursor + * \sa SDL_SetCursor + * \sa SDL_ShowCursor + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateCursor_fun = function( + const data: pcuint8; + const mask: pcuint8; + w: cint; h: cint; + hot_x: cint; hot_y: cint): PSDL_Cursor; cdecl; +Var + SDL_CreateCursor : TSDL_CreateCursor_fun = Nil; +{$else} + +function SDL_CreateCursor( + const data: pcuint8; + const mask: pcuint8; + w: cint; h: cint; + hot_x: cint; hot_y: cint): PSDL_Cursor; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateCursor' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Create a color cursor. + * + * \param surface an SDL_Surface structure representing the cursor image + * \param hot_x the x position of the cursor hot spot + * \param hot_y the y position of the cursor hot spot + * \returns the new cursor on success or NULL on failure; call SDL_GetError() + * for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_CreateCursor + * \sa SDL_FreeCursor + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateColorCursor_fun = function( + surface: PSDL_Surface; + hot_x: cint; + hot_y: cint): PSDL_Cursor; cdecl; +Var + SDL_CreateColorCursor : TSDL_CreateColorCursor_fun = Nil; +{$else} + +function SDL_CreateColorCursor( + surface: PSDL_Surface; + hot_x: cint; + hot_y: cint): PSDL_Cursor; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateColorCursor' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Create a system cursor. + * + * \param id an SDL_SystemCursor enum value + * \returns a cursor on success or NULL on failure; call SDL_GetError() for + * more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_FreeCursor + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateSystemCursor_fun = function(id: TSDL_SystemCursor): PSDL_Cursor; cdecl; +Var + SDL_CreateSystemCursor : TSDL_CreateSystemCursor_fun = Nil; +{$else} + +function SDL_CreateSystemCursor(id: TSDL_SystemCursor): PSDL_Cursor; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateSystemCursor' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Set the active cursor. + * + * This function sets the currently active cursor to the specified one. If the + * cursor is currently visible, the change will be immediately represented on + * the display. SDL_SetCursor(NULL) can be used to force cursor redraw, if + * this is desired for any reason. + * + * \param cursor a cursor to make active + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_CreateCursor + * \sa SDL_GetCursor + * \sa SDL_ShowCursor + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetCursor_proc = procedure(cursor: PSDL_Cursor); cdecl; +Var + SDL_SetCursor : TSDL_SetCursor_proc = Nil; +{$else} + +procedure SDL_SetCursor(cursor: PSDL_Cursor); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetCursor' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Get the active cursor. + * + * This function returns a pointer to the current cursor which is owned by the + * library. It is not necessary to free the cursor with SDL_FreeCursor(). + * + * \returns the active cursor or NULL if there is no mouse. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_SetCursor + *} +function SDL_GetCursor: PSDL_Cursor; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCursor' {$ENDIF}{$ENDIF}; + + {** + * Get the default cursor. + * + * \returns the default cursor on success or NULL on failure. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_CreateSystemCursor + *} +function SDL_GetDefaultCursor: PSDL_Cursor; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDefaultCursor' {$ENDIF}{$ENDIF}; + + {** + * Free a previously-created cursor. + * + * Use this function to free cursor resources created with SDL_CreateCursor(), + * SDL_CreateColorCursor() or SDL_CreateSystemCursor(). + * + * \param cursor the cursor to free + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_CreateColorCursor + * \sa SDL_CreateCursor + * \sa SDL_CreateSystemCursor + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_FreeCursor_proc = procedure(cursor: PSDL_Cursor); cdecl; +Var + SDL_FreeCursor : TSDL_FreeCursor_proc = Nil; +{$else} + +procedure SDL_FreeCursor(cursor: PSDL_Cursor); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeCursor' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Toggle whether or not the cursor is shown. + * + * The cursor starts off displayed but can be turned off. Passing `SDL_ENABLE` + * displays the cursor and passing `SDL_DISABLE` hides it. + * + * The current state of the mouse cursor can be queried by passing + * `SDL_QUERY`; either `SDL_DISABLE` or `SDL_ENABLE` will be returned. + * + * \param toggle `SDL_ENABLE` to show the cursor, `SDL_DISABLE` to hide it, + * `SDL_QUERY` to query the current state without changing it. + * \returns `SDL_ENABLE` if the cursor is shown, or `SDL_DISABLE` if the + * cursor is hidden, or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_CreateCursor + * \sa SDL_SetCursor + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ShowCursor_fun = function(toggle: cint): cint; cdecl; +Var + SDL_ShowCursor : TSDL_ShowCursor_fun = Nil; +{$else} + +function SDL_ShowCursor(toggle: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ShowCursor' {$ENDIF}{$ENDIF}; +{$endif} + +{** + * Used as a mask when testing buttons in buttonstate. + * - Button 1: Left mouse button + * - Button 2: Middle mouse button + * - Button 3: Right mouse button + *} +function SDL_Button(X: cint): cint; {$IFNDEF DELPHI} inline; {$ELSE} {$IFDEF DELPHI10UP} inline; {$ENDIF} {$ENDIF} +const + SDL_BUTTON_LEFT = 1; + SDL_BUTTON_MIDDLE = 2; + SDL_BUTTON_RIGHT = 3; + SDL_BUTTON_X1 = 4; + SDL_BUTTON_X2 = 5; + { Pascal Conv.: For better performance instead of using the + SDL_Button(X) macro, the following defines are + implemented directly. } + SDL_BUTTON_LMASK = 1 shl ((SDL_BUTTON_LEFT) - 1); + SDL_BUTTON_MMASK = 1 shl ((SDL_BUTTON_MIDDLE) - 1); + SDL_BUTTON_RMASK = 1 shl ((SDL_BUTTON_RIGHT) - 1); + SDL_BUTTON_X1MASK = 1 shl ((SDL_BUTTON_X1) - 1); + SDL_BUTTON_X2MASK = 1 shl ((SDL_BUTTON_X2) - 1); diff --git a/units/sdlmutex.inc b/units/sdlmutex.inc index aca623b8..a0e95757 100644 --- a/units/sdlmutex.inc +++ b/units/sdlmutex.inc @@ -1,489 +1,489 @@ -// based on "sdl_mutex.h" - -const - {** - * Synchronization functions which can time out return this value - * if they time out. - *} - SDL_MUTEX_TIMEDOUT = 1; - - {** - * This is the timeout value which corresponds to never time out. - *} - SDL_MUTEX_MAXWAIT = Not cuint32(0); - - { -- Mutex functions -- } -type - { The SDL mutex structure, defined in SDL_sysmutex.c } - PPSDL_Mutex = ^PSDL_Mutex; - PSDL_Mutex = Type Pointer; - -{** - * Create a new mutex. - * - * All newly-created mutexes begin in the _unlocked_ state. - * - * Calls to SDL_LockMutex() will not return while the mutex is locked by - * another thread. See SDL_TryLockMutex() to attempt to lock without blocking. - * - * SDL mutexes are reentrant. - * - * \returns the initialized and unlocked mutex or NIL on failure; - * call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *} -function SDL_CreateMutex: PSDL_Mutex; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateMutex' {$ENDIF} {$ENDIF}; - -{** - * Lock the mutex. - * - * This will block until the mutex is available, which is to say it is in the - * unlocked state and the OS has chosen the caller as the next thread to lock - * it. Of all threads waiting to lock the mutex, only one may do so at a time. - * - * It is legal for the owning thread to lock an already-locked mutex. It must - * unlock it the same number of times before it is actually made available for - * other threads in the system (this is known as a "recursive mutex"). - * - * \param mutex the mutex to lock - * \return 0, or -1 on error. - * - * \since This function is available since SDL 2.0.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LockMutex_fun = function(mutex: PSDL_Mutex): cint; cdecl; -Var - SDL_LockMutex : TSDL_LockMutex_fun = Nil; -{$else} - -function SDL_LockMutex(mutex: PSDL_Mutex): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockMutex' {$ENDIF} {$ENDIF}; -{$endif} - -{ SDL2-for-Pascal: SDL_mutexP macro ignored; no benefit for the Pascal units } -//C: #define SDL_mutexP(m) SDL_UnlockMutex(m) - -{** - * Try to lock a mutex without blocking. - * - * This works just like SDL_LockMutex(), but if the mutex is not available, - * this function returns SDL_MUTEX_TIMEDOUT immediately. - * - * This technique is useful if you need exclusive access to a resource but - * don't want to wait for it, and will return to it to try again later. - * - * \param mutex the mutex to try to lock - * \returns 0, SDL_MUTEX_TIMEDOUT, or -1 on error; call SDL_GetError() for - * more information. - * - * \since This function is available since SDL 2.0.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_TryLockMutex_fun = function(mutex: PSDL_Mutex): cint; cdecl; -Var - SDL_TryLockMutex : TSDL_TryLockMutex_fun = Nil; -{$else} - -function SDL_TryLockMutex(mutex: PSDL_Mutex): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TryLockMutex' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Unlock the mutex. - * - * It is legal for the owning thread to lock an already-locked mutex. It must - * unlock it the same number of times before it is actually made available for - * other threads in the system (this is known as a "recursive mutex"). - * - * It is an error to unlock a mutex that has not been locked by the current - * thread, and doing so results in undefined behavior. - * - * It is also an error to unlock a mutex that isn't locked at all. - * - * \param mutex the mutex to unlock. - * \returns 0, or -1 on error. - * - * \since This function is available since SDL 2.0.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_UnlockMutex_fun = function(mutex: PSDL_Mutex): cint; cdecl; -Var - SDL_UnlockMutex : TSDL_UnlockMutex_fun = Nil; -{$else} - -function SDL_UnlockMutex(mutex: PSDL_Mutex): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnlockMutex' {$ENDIF} {$ENDIF}; -{$endif} - -{ SDL2-for-Pascal: SDL_mutexV macro ignored; no benefit for the Pascal units } -//C: #define SDL_mutexV(m) SDL_UnlockMutex(m) - -{** - * Destroy a mutex created with SDL_CreateMutex(). - * - * This function must be called on any mutex that is no longer needed. Failure - * to destroy a mutex will result in a system memory or resource leak. While - * it is safe to destroy a mutex that is _unlocked_, it is not safe to attempt - * to destroy a locked mutex, and may result in undefined behavior depending - * on the platform. - * - * \param mutex the mutex to destroy - * - * \since This function is available since SDL 2.0.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_DestroyMutex_proc = procedure(mutex: PSDL_Mutex); cdecl; -Var - SDL_DestroyMutex : TSDL_DestroyMutex_proc = Nil; -{$else} - -procedure SDL_DestroyMutex(mutex: PSDL_Mutex); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyMutex' {$ENDIF} {$ENDIF}; -{$endif} - - { -- Semaphore functions -- } -type - { The SDL semaphore structure, defined in SDL_sem.c } - PPSDL_Sem = ^PSDL_Sem; - PSDL_Sem = Type Pointer; - -{** - * Create a semaphore. - * - * This function creates a new semaphore and initializes it with the provided - * initial value. Each wait operation on the semaphore will atomically - * decrement the semaphore value and potentially block if the semaphore value - * is 0. Each post operation will atomically increment the semaphore value and - * wake waiting threads and allow them to retry the wait operation. - * - * \param initial_value the starting value of the semaphore - * \returns a new semaphore or NIL on failure; call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_CreateSemaphore_fun = function(initial_value: cuint32): PSDL_sem; cdecl; -Var - SDL_CreateSemaphore : TSDL_CreateSemaphore_fun = Nil; -{$else} - -function SDL_CreateSemaphore(initial_value: cuint32): PSDL_sem; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateSemaphore' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Destroy a semaphore. - * - * It is not safe to destroy a semaphore if there are threads currently - * waiting on it. - * - * \param sem the semaphore to destroy - * - * \since This function is available since SDL 2.0.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_DestroySemaphore_proc = procedure(sem: PSDL_Sem); cdecl; -Var - SDL_DestroySemaphore : TSDL_DestroySemaphore_proc = Nil; -{$else} - -procedure SDL_DestroySemaphore(sem: PSDL_Sem); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroySemaphore' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Wait until a semaphore has a positive value and then decrements it. - * - * This function suspends the calling thread until either the semaphore - * pointed to by `sem` has a positive value or the call is interrupted by a - * signal or error. If the call is successful it will atomically decrement the - * semaphore value. - * - * This function is the equivalent of calling SDL_SemWaitTimeout() with a time - * length of SDL_MUTEX_MAXWAIT. - * - * \param sem the semaphore wait on - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SemWait_fun = function(sem: PSDL_Sem): cint; cdecl; -Var - SDL_SemWait : TSDL_SemWait_fun = Nil; -{$else} - -function SDL_SemWait(sem: PSDL_Sem): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SemWait' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * See if a semaphore has a positive value and decrement it if it does. - * - * This function checks to see if the semaphore pointed to by `sem` has a - * positive value and atomically decrements the semaphore value if it does. If - * the semaphore doesn't have a positive value, the function immediately - * returns SDL_MUTEX_TIMEDOUT. - * - * \param sem the semaphore to wait on - * \returns 0 if the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait would - * block, or a negative error code on failure; call SDL_GetError() - * for more information. - * - * \since This function is available since SDL 2.0.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SemTryWait_fun = function(sem: PSDL_Sem): cint; cdecl; -Var - SDL_SemTryWait : TSDL_SemTryWait_fun = Nil; -{$else} - -function SDL_SemTryWait(sem: PSDL_Sem): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SemTryWait' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Wait until a semaphore has a positive value and then decrements it. - * - * This function suspends the calling thread until either the semaphore - * pointed to by `sem` has a positive value, the call is interrupted by a - * signal or error, or the specified time has elapsed. If the call is - * successful it will atomically decrement the semaphore value. - * - * \param sem the semaphore to wait on - * \param ms the length of the timeout, in milliseconds - * \returns 0 if the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not - * succeed in the allotted time, or a negative error code on failure; - * call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SemWaitTimeout_fun = function(sem: PSDL_Sem; ms: cuint32): cint; cdecl; -Var - SDL_SemWaitTimeout : TSDL_SemWaitTimeout_fun = Nil; -{$else} - -function SDL_SemWaitTimeout(sem: PSDL_Sem; ms: cuint32): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SemWaitTimeout' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Atomically increment a semaphore's value and wake waiting threads. - * - * \param sem the semaphore to increment - * \returns 0 on success or a negative error code on failure; - * call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SemPost_fun = function(sem: PSDL_Sem): cint; cdecl; -Var - SDL_SemPost : TSDL_SemPost_fun = Nil; -{$else} - -function SDL_SemPost(sem: PSDL_Sem): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SemPost' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the current value of a semaphore. - * - * \param sem the semaphore to query - * \returns the current value of the semaphore. - * - * \since This function is available since SDL 2.0.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SemValue_fun = function(sem: PSDL_Sem): cuint32; cdecl; -Var - SDL_SemValue : TSDL_SemValue_fun = Nil; -{$else} - -function SDL_SemValue(sem: PSDL_Sem): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SemValue' {$ENDIF} {$ENDIF}; -{$endif} - - { -- Condition variable functions -- } -type - { The SDL condition variable structure, defined in SDL_cond.c } - PPSDL_Cond = ^PSDL_Cond; - - {** - * The condition variable type. - * - * Typical use of condition variables: - * - * Thread A: - * SDL_LockMutex(lock); - * while ( not condition ) - * begin - * SDL_CondWait(cond, lock); - * end; - * SDL_UnlockMutex(lock); - * - * Thread B: - * SDL_LockMutex(lock); - * ... - * condition := true; - * ... - * SDL_CondSignal(cond); - * SDL_UnlockMutex(lock); - * - * There is some discussion whether to signal the condition variable - * with the mutex locked or not. There is some potential performance - * benefit to unlocking first on some platforms, but there are some - * potential race conditions depending on how your code is structured. - * - * In general it's safer to signal the condition variable while the - * mutex is locked. - *} - PSDL_Cond = Type Pointer; - -{** - * Create a condition variable. - * - * \returns a new condition variable or NIL on failure; call SDL_GetError() - * for more information. - * - * \since This function is available since SDL 2.0.0. - *} -function SDL_CreateCond: PSDL_Cond; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateCond' {$ENDIF} {$ENDIF}; - -{** - * Destroy a condition variable. - * - * \param cond the condition variable to destroy - * - * \since This function is available since SDL 2.0.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_DestroyCond_proc = procedure(cond: PSDL_Cond); cdecl; -Var - SDL_DestroyCond : TSDL_DestroyCond_proc = Nil; -{$else} - -procedure SDL_DestroyCond(cond: PSDL_Cond); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyCond' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Restart one of the threads that are waiting on the condition variable. - * - * \param cond the condition variable to signal - * \returns 0 on success or a negative error code on failure; - * call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_CondSignal_fun = function(cond: PSDL_Cond): cint; cdecl; -Var - SDL_CondSignal : TSDL_CondSignal_fun = Nil; -{$else} - -function SDL_CondSignal(cond: PSDL_Cond): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CondSignal' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Restart all threads that are waiting on the condition variable. - * - * \param cond the condition variable to signal - * \returns 0 on success or a negative error code on failure; - * call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_CondBroadcast_fun = function(cond: PSDL_Cond): cint; cdecl; -Var - SDL_CondBroadcast : TSDL_CondBroadcast_fun = Nil; -{$else} - -function SDL_CondBroadcast(cond: PSDL_Cond): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CondBroadcast' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Wait until a condition variable is signaled. - * - * This function unlocks the specified `mutex` and waits for another thread to - * call SDL_CondSignal() or SDL_CondBroadcast() on the condition variable - * `cond`. Once the condition variable is signaled, the mutex is re-locked and - * the function returns. - * - * The mutex must be locked before calling this function. - * - * This function is the equivalent of calling SDL_CondWaitTimeout() with a - * time length of SDL_MUTEX_MAXWAIT. - * - * \param cond the condition variable to wait on - * \param mutex the mutex used to coordinate thread access - * \returns 0 when it is signaled or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_CondWait_fun = function(cond: PSDL_Cond; mutex: PSDL_Mutex): cint; cdecl; -Var - SDL_CondWait : TSDL_CondWait_fun = Nil; -{$else} - -function SDL_CondWait(cond: PSDL_Cond; mutex: PSDL_Mutex): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CondWait' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Wait until a condition variable is signaled or a certain time has passed. - * - * This function unlocks the specified `mutex` and waits for another thread to - * call SDL_CondSignal() or SDL_CondBroadcast() on the condition variable - * `cond`, or for the specified time to elapse. Once the condition variable is - * signaled or the time elapsed, the mutex is re-locked and the function - * returns. - * - * The mutex must be locked before calling this function. - * - * \param cond the condition variable to wait on - * \param mutex the mutex used to coordinate thread access - * \param ms the maximum time to wait, in milliseconds, or SDL_MUTEX_MAXWAIT - * to wait indefinitely - * \returns 0 if the condition variable is signaled, SDL_MUTEX_TIMEDOUT if - * the condition is not signaled in the allotted time, or a negative - * error code on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_CondWaitTimeout_fun = function(cond: PSDL_Cond; mutex: PSDL_Mutex; ms: cuint32): cint; cdecl; -Var - SDL_CondWaitTimeout : TSDL_CondWaitTimeout_fun = Nil; -{$else} - -function SDL_CondWaitTimeout(cond: PSDL_Cond; mutex: PSDL_Mutex; ms: cuint32): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CondWaitTimeout' {$ENDIF} {$ENDIF}; -{$endif} +// based on "sdl_mutex.h" + +const + {** + * Synchronization functions which can time out return this value + * if they time out. + *} + SDL_MUTEX_TIMEDOUT = 1; + + {** + * This is the timeout value which corresponds to never time out. + *} + SDL_MUTEX_MAXWAIT = Not cuint32(0); + + { -- Mutex functions -- } +type + { The SDL mutex structure, defined in SDL_sysmutex.c } + PPSDL_Mutex = ^PSDL_Mutex; + PSDL_Mutex = Type Pointer; + +{** + * Create a new mutex. + * + * All newly-created mutexes begin in the _unlocked_ state. + * + * Calls to SDL_LockMutex() will not return while the mutex is locked by + * another thread. See SDL_TryLockMutex() to attempt to lock without blocking. + * + * SDL mutexes are reentrant. + * + * \returns the initialized and unlocked mutex or NIL on failure; + * call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *} +function SDL_CreateMutex: PSDL_Mutex; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateMutex' {$ENDIF} {$ENDIF}; + +{** + * Lock the mutex. + * + * This will block until the mutex is available, which is to say it is in the + * unlocked state and the OS has chosen the caller as the next thread to lock + * it. Of all threads waiting to lock the mutex, only one may do so at a time. + * + * It is legal for the owning thread to lock an already-locked mutex. It must + * unlock it the same number of times before it is actually made available for + * other threads in the system (this is known as a "recursive mutex"). + * + * \param mutex the mutex to lock + * \return 0, or -1 on error. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LockMutex_fun = function(mutex: PSDL_Mutex): cint; cdecl; +Var + SDL_LockMutex : TSDL_LockMutex_fun = Nil; +{$else} + +function SDL_LockMutex(mutex: PSDL_Mutex): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockMutex' {$ENDIF} {$ENDIF}; +{$endif} + +{ SDL2-for-Pascal: SDL_mutexP macro ignored; no benefit for the Pascal units } +//C: #define SDL_mutexP(m) SDL_UnlockMutex(m) + +{** + * Try to lock a mutex without blocking. + * + * This works just like SDL_LockMutex(), but if the mutex is not available, + * this function returns SDL_MUTEX_TIMEDOUT immediately. + * + * This technique is useful if you need exclusive access to a resource but + * don't want to wait for it, and will return to it to try again later. + * + * \param mutex the mutex to try to lock + * \returns 0, SDL_MUTEX_TIMEDOUT, or -1 on error; call SDL_GetError() for + * more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_TryLockMutex_fun = function(mutex: PSDL_Mutex): cint; cdecl; +Var + SDL_TryLockMutex : TSDL_TryLockMutex_fun = Nil; +{$else} + +function SDL_TryLockMutex(mutex: PSDL_Mutex): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TryLockMutex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Unlock the mutex. + * + * It is legal for the owning thread to lock an already-locked mutex. It must + * unlock it the same number of times before it is actually made available for + * other threads in the system (this is known as a "recursive mutex"). + * + * It is an error to unlock a mutex that has not been locked by the current + * thread, and doing so results in undefined behavior. + * + * It is also an error to unlock a mutex that isn't locked at all. + * + * \param mutex the mutex to unlock. + * \returns 0, or -1 on error. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UnlockMutex_fun = function(mutex: PSDL_Mutex): cint; cdecl; +Var + SDL_UnlockMutex : TSDL_UnlockMutex_fun = Nil; +{$else} + +function SDL_UnlockMutex(mutex: PSDL_Mutex): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnlockMutex' {$ENDIF} {$ENDIF}; +{$endif} + +{ SDL2-for-Pascal: SDL_mutexV macro ignored; no benefit for the Pascal units } +//C: #define SDL_mutexV(m) SDL_UnlockMutex(m) + +{** + * Destroy a mutex created with SDL_CreateMutex(). + * + * This function must be called on any mutex that is no longer needed. Failure + * to destroy a mutex will result in a system memory or resource leak. While + * it is safe to destroy a mutex that is _unlocked_, it is not safe to attempt + * to destroy a locked mutex, and may result in undefined behavior depending + * on the platform. + * + * \param mutex the mutex to destroy + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_DestroyMutex_proc = procedure(mutex: PSDL_Mutex); cdecl; +Var + SDL_DestroyMutex : TSDL_DestroyMutex_proc = Nil; +{$else} + +procedure SDL_DestroyMutex(mutex: PSDL_Mutex); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyMutex' {$ENDIF} {$ENDIF}; +{$endif} + + { -- Semaphore functions -- } +type + { The SDL semaphore structure, defined in SDL_sem.c } + PPSDL_Sem = ^PSDL_Sem; + PSDL_Sem = Type Pointer; + +{** + * Create a semaphore. + * + * This function creates a new semaphore and initializes it with the provided + * initial value. Each wait operation on the semaphore will atomically + * decrement the semaphore value and potentially block if the semaphore value + * is 0. Each post operation will atomically increment the semaphore value and + * wake waiting threads and allow them to retry the wait operation. + * + * \param initial_value the starting value of the semaphore + * \returns a new semaphore or NIL on failure; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateSemaphore_fun = function(initial_value: cuint32): PSDL_sem; cdecl; +Var + SDL_CreateSemaphore : TSDL_CreateSemaphore_fun = Nil; +{$else} + +function SDL_CreateSemaphore(initial_value: cuint32): PSDL_sem; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateSemaphore' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Destroy a semaphore. + * + * It is not safe to destroy a semaphore if there are threads currently + * waiting on it. + * + * \param sem the semaphore to destroy + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_DestroySemaphore_proc = procedure(sem: PSDL_Sem); cdecl; +Var + SDL_DestroySemaphore : TSDL_DestroySemaphore_proc = Nil; +{$else} + +procedure SDL_DestroySemaphore(sem: PSDL_Sem); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroySemaphore' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Wait until a semaphore has a positive value and then decrements it. + * + * This function suspends the calling thread until either the semaphore + * pointed to by `sem` has a positive value or the call is interrupted by a + * signal or error. If the call is successful it will atomically decrement the + * semaphore value. + * + * This function is the equivalent of calling SDL_SemWaitTimeout() with a time + * length of SDL_MUTEX_MAXWAIT. + * + * \param sem the semaphore wait on + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SemWait_fun = function(sem: PSDL_Sem): cint; cdecl; +Var + SDL_SemWait : TSDL_SemWait_fun = Nil; +{$else} + +function SDL_SemWait(sem: PSDL_Sem): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SemWait' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * See if a semaphore has a positive value and decrement it if it does. + * + * This function checks to see if the semaphore pointed to by `sem` has a + * positive value and atomically decrements the semaphore value if it does. If + * the semaphore doesn't have a positive value, the function immediately + * returns SDL_MUTEX_TIMEDOUT. + * + * \param sem the semaphore to wait on + * \returns 0 if the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait would + * block, or a negative error code on failure; call SDL_GetError() + * for more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SemTryWait_fun = function(sem: PSDL_Sem): cint; cdecl; +Var + SDL_SemTryWait : TSDL_SemTryWait_fun = Nil; +{$else} + +function SDL_SemTryWait(sem: PSDL_Sem): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SemTryWait' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Wait until a semaphore has a positive value and then decrements it. + * + * This function suspends the calling thread until either the semaphore + * pointed to by `sem` has a positive value, the call is interrupted by a + * signal or error, or the specified time has elapsed. If the call is + * successful it will atomically decrement the semaphore value. + * + * \param sem the semaphore to wait on + * \param ms the length of the timeout, in milliseconds + * \returns 0 if the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not + * succeed in the allotted time, or a negative error code on failure; + * call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SemWaitTimeout_fun = function(sem: PSDL_Sem; ms: cuint32): cint; cdecl; +Var + SDL_SemWaitTimeout : TSDL_SemWaitTimeout_fun = Nil; +{$else} + +function SDL_SemWaitTimeout(sem: PSDL_Sem; ms: cuint32): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SemWaitTimeout' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Atomically increment a semaphore's value and wake waiting threads. + * + * \param sem the semaphore to increment + * \returns 0 on success or a negative error code on failure; + * call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SemPost_fun = function(sem: PSDL_Sem): cint; cdecl; +Var + SDL_SemPost : TSDL_SemPost_fun = Nil; +{$else} + +function SDL_SemPost(sem: PSDL_Sem): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SemPost' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the current value of a semaphore. + * + * \param sem the semaphore to query + * \returns the current value of the semaphore. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SemValue_fun = function(sem: PSDL_Sem): cuint32; cdecl; +Var + SDL_SemValue : TSDL_SemValue_fun = Nil; +{$else} + +function SDL_SemValue(sem: PSDL_Sem): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SemValue' {$ENDIF} {$ENDIF}; +{$endif} + + { -- Condition variable functions -- } +type + { The SDL condition variable structure, defined in SDL_cond.c } + PPSDL_Cond = ^PSDL_Cond; + + {** + * The condition variable type. + * + * Typical use of condition variables: + * + * Thread A: + * SDL_LockMutex(lock); + * while ( not condition ) + * begin + * SDL_CondWait(cond, lock); + * end; + * SDL_UnlockMutex(lock); + * + * Thread B: + * SDL_LockMutex(lock); + * ... + * condition := true; + * ... + * SDL_CondSignal(cond); + * SDL_UnlockMutex(lock); + * + * There is some discussion whether to signal the condition variable + * with the mutex locked or not. There is some potential performance + * benefit to unlocking first on some platforms, but there are some + * potential race conditions depending on how your code is structured. + * + * In general it's safer to signal the condition variable while the + * mutex is locked. + *} + PSDL_Cond = Type Pointer; + +{** + * Create a condition variable. + * + * \returns a new condition variable or NIL on failure; call SDL_GetError() + * for more information. + * + * \since This function is available since SDL 2.0.0. + *} +function SDL_CreateCond: PSDL_Cond; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateCond' {$ENDIF} {$ENDIF}; + +{** + * Destroy a condition variable. + * + * \param cond the condition variable to destroy + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_DestroyCond_proc = procedure(cond: PSDL_Cond); cdecl; +Var + SDL_DestroyCond : TSDL_DestroyCond_proc = Nil; +{$else} + +procedure SDL_DestroyCond(cond: PSDL_Cond); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyCond' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Restart one of the threads that are waiting on the condition variable. + * + * \param cond the condition variable to signal + * \returns 0 on success or a negative error code on failure; + * call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CondSignal_fun = function(cond: PSDL_Cond): cint; cdecl; +Var + SDL_CondSignal : TSDL_CondSignal_fun = Nil; +{$else} + +function SDL_CondSignal(cond: PSDL_Cond): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CondSignal' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Restart all threads that are waiting on the condition variable. + * + * \param cond the condition variable to signal + * \returns 0 on success or a negative error code on failure; + * call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CondBroadcast_fun = function(cond: PSDL_Cond): cint; cdecl; +Var + SDL_CondBroadcast : TSDL_CondBroadcast_fun = Nil; +{$else} + +function SDL_CondBroadcast(cond: PSDL_Cond): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CondBroadcast' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Wait until a condition variable is signaled. + * + * This function unlocks the specified `mutex` and waits for another thread to + * call SDL_CondSignal() or SDL_CondBroadcast() on the condition variable + * `cond`. Once the condition variable is signaled, the mutex is re-locked and + * the function returns. + * + * The mutex must be locked before calling this function. + * + * This function is the equivalent of calling SDL_CondWaitTimeout() with a + * time length of SDL_MUTEX_MAXWAIT. + * + * \param cond the condition variable to wait on + * \param mutex the mutex used to coordinate thread access + * \returns 0 when it is signaled or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CondWait_fun = function(cond: PSDL_Cond; mutex: PSDL_Mutex): cint; cdecl; +Var + SDL_CondWait : TSDL_CondWait_fun = Nil; +{$else} + +function SDL_CondWait(cond: PSDL_Cond; mutex: PSDL_Mutex): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CondWait' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Wait until a condition variable is signaled or a certain time has passed. + * + * This function unlocks the specified `mutex` and waits for another thread to + * call SDL_CondSignal() or SDL_CondBroadcast() on the condition variable + * `cond`, or for the specified time to elapse. Once the condition variable is + * signaled or the time elapsed, the mutex is re-locked and the function + * returns. + * + * The mutex must be locked before calling this function. + * + * \param cond the condition variable to wait on + * \param mutex the mutex used to coordinate thread access + * \param ms the maximum time to wait, in milliseconds, or SDL_MUTEX_MAXWAIT + * to wait indefinitely + * \returns 0 if the condition variable is signaled, SDL_MUTEX_TIMEDOUT if + * the condition is not signaled in the allotted time, or a negative + * error code on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CondWaitTimeout_fun = function(cond: PSDL_Cond; mutex: PSDL_Mutex; ms: cuint32): cint; cdecl; +Var + SDL_CondWaitTimeout : TSDL_CondWaitTimeout_fun = Nil; +{$else} + +function SDL_CondWaitTimeout(cond: PSDL_Cond; mutex: PSDL_Mutex; ms: cuint32): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CondWaitTimeout' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlpixels.inc b/units/sdlpixels.inc index 02e5783f..8f79d0d9 100644 --- a/units/sdlpixels.inc +++ b/units/sdlpixels.inc @@ -1,919 +1,919 @@ -// based on "sdl_pixels.h" (2.0.14, WIP) - -{** - * \file SDL_pixels.h - * - * Header for the enumerated pixel format definitions. - *} - -{** - * Transparency definitions - * - * These define alpha as the opacity of a surface. - *} - -const - SDL_ALPHA_OPAQUE = 255; - SDL_ALPHA_TRANSPARENT = 0; - -{** Pixel type. *} -type - PPSDL_PixelType = ^PSDL_PixelType; - PSDL_PixelType = ^TSDL_PixelType; - TSDL_PixelType = type cuint; - -const - SDL_PIXELTYPE_UNKNOWN = TSDL_PixelType(0); - SDL_PIXELTYPE_INDEX1 = TSDL_PixelType(1); - SDL_PIXELTYPE_INDEX4 = TSDL_PixelType(2); - SDL_PIXELTYPE_INDEX8 = TSDL_PixelType(3); - SDL_PIXELTYPE_PACKED8 = TSDL_PixelType(4); - SDL_PIXELTYPE_PACKED16 = TSDL_PixelType(5); - SDL_PIXELTYPE_PACKED32 = TSDL_PixelType(6); - SDL_PIXELTYPE_ARRAYU8 = TSDL_PixelType(7); - SDL_PIXELTYPE_ARRAYU16 = TSDL_PixelType(8); - SDL_PIXELTYPE_ARRAYU32 = TSDL_PixelType(9); - SDL_PIXELTYPE_ARRAYF16 = TSDL_PixelType(10); - SDL_PIXELTYPE_ARRAYF32 = TSDL_PixelType(11); - -{** Bitmap pixel order, high bit -> low bit. *} -type - PPSDL_BitmapOrder = ^PSDL_BitmapOrder; - PSDL_BitmapOrder = ^TSDL_BitmapOrder; - TSDL_BitmapOrder = type cuint32; - -const - SDL_BITMAPORDER_NONE = TSDL_BitmapOrder(0); - SDL_BITMAPORDER_4321 = TSDL_BitmapOrder(1); - SDL_BITMAPORDER_1234 = TSDL_BitmapOrder(2); - -{** Packed component order, high bit -> low bit. *} -type - PPSDL_PackOrder = ^PSDL_PackOrder; - PSDL_PackOrder = ^TSDL_PackOrder; - TSDL_PackOrder = type cuint32; - -const - SDL_PACKEDORDER_NONE = TSDL_PackOrder(0); - SDL_PACKEDORDER_XRGB = TSDL_PackOrder(1); - SDL_PACKEDORDER_RGBX = TSDL_PackOrder(2); - SDL_PACKEDORDER_ARGB = TSDL_PackOrder(3); - SDL_PACKEDORDER_RGBA = TSDL_PackOrder(4); - SDL_PACKEDORDER_XBGR = TSDL_PackOrder(5); - SDL_PACKEDORDER_BGRX = TSDL_PackOrder(6); - SDL_PACKEDORDER_ABGR = TSDL_PackOrder(7); - SDL_PACKEDORDER_BGRA = TSDL_PackOrder(8); - -{** Array component order, low byte -> high byte. *} -type - PPSDL_ArrayOrder = ^PSDL_ArrayOrder; - PSDL_ArrayOrder = ^TSDL_ArrayOrder; - TSDL_ArrayOrder = type cuint32; - -const - SDL_ARRAYORDER_NONE = TSDL_ArrayOrder(0); - SDL_ARRAYORDER_RGB = TSDL_ArrayOrder(1); - SDL_ARRAYORDER_RGBA = TSDL_ArrayOrder(2); - SDL_ARRAYORDER_ARGB = TSDL_ArrayOrder(3); - SDL_ARRAYORDER_BGR = TSDL_ArrayOrder(4); - SDL_ARRAYORDER_BGRA = TSDL_ArrayOrder(5); - SDL_ARRAYORDER_ABGR = TSDL_ArrayOrder(6); - -{** Packed component layout. *} -type - PPSDL_PackedLayout = ^PSDL_PackedLayout; - PSDL_PackedLayout = ^TSDL_PackedLayout; - TSDL_PackedLayout = type cuint32; - -const - SDL_PACKEDLAYOUT_NONE = TSDL_PackedLayout(0); - SDL_PACKEDLAYOUT_332 = TSDL_PackedLayout(1); - SDL_PACKEDLAYOUT_4444 = TSDL_PackedLayout(2); - SDL_PACKEDLAYOUT_1555 = TSDL_PackedLayout(3); - SDL_PACKEDLAYOUT_5551 = TSDL_PackedLayout(4); - SDL_PACKEDLAYOUT_565 = TSDL_PackedLayout(5); - SDL_PACKEDLAYOUT_8888 = TSDL_PackedLayout(6); - SDL_PACKEDLAYOUT_2101010 = TSDL_PackedLayout(7); - SDL_PACKEDLAYOUT_1010102 = TSDL_PackedLayout(8); - -{ -SDL2-for-Pascal: The SDL_DEFINE_PIXELFOURCC macro is replaced - by another macro, the SDL_FOURCC macro (in SDL_stdinc.h). - - The original C SDL_FOURCC macro: - #define SDL_FOURCC(A, B, C, D) \ - ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \ - (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \ - (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \ - (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24)) - - In Pascal it is cleaner to implement this directly as a - constant instead of a function. So we do, e. g.: - - SDL_PIXELFORMAT_YV12 = (cuint32('Y') ) or - (cuint32('V') shl 8) or - (cuint32('1') shl 16) or - (cuint32('2') shl 24); - - In the future it may be desirable to have a Pascal function. - The prototype could look like this: - function SDL_DEFINE_PIXELFOURCC(A,B,C,D: Variant): Variant; -} - -{ -SDL2-for-Pascal: The SDL_DEFINE_PIXELFORMAT macro returns the underlying - pixel format based on five arguments. - - The original C macro: - #define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \ - ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \ - ((bits) << 8) | ((bytes) << 0)) - - This C implementation could be replaced by a Pascal function, - but from a performance stand point this will be slower. - Therefore we decided to keep it as it has been implemented - before by the original binding authors and translate - every pixel format constant by the very same expression: - - SDL_PIXELFORMAT_[...] = (1 shl 28) or - (SDL_PIXELTYPE_[...] shl 24) or - (SDL_BITMAPORDER_[...] shl 20) or - ([...] shl 16) or - ([...] shl 8) or - ([...] shl 0); - - In the future it may be desirable to have a Pascal function. - The prototype could look like this: - function SDL_DEFINE_PIXELFORMAT(type, order, layour, bit, bytes: cuint32): Result; -} - -function SDL_PIXELFLAG(X: cuint32): cuint32; -function SDL_PIXELTYPE(X: cuint32): cuint32; -function SDL_PIXELORDER(X: cuint32): cuint32; -function SDL_PIXELLAYOUT(X: cuint32): cuint32; -function SDL_BITSPERPIXEL(X: cuint32): cuint32; - -{ -SDL2-for-Pascal: Is it worth translating these macros as they seem to be used - by SDL2 internally only? - -#define SDL_BYTESPERPIXEL(X) \ - (SDL_ISPIXELFORMAT_FOURCC(X) ? \ - ((((X) == SDL_PIXELFORMAT_YUY2) || \ - ((X) == SDL_PIXELFORMAT_UYVY) || \ - ((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF)) - -#define SDL_ISPIXELFORMAT_INDEXED(format) \ - (!SDL_ISPIXELFORMAT_FOURCC(format) && \ - ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \ - (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \ - (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8))) - -#define SDL_ISPIXELFORMAT_PACKED(format) \ - (!SDL_ISPIXELFORMAT_FOURCC(format) && \ - ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED8) || \ - (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED16) || \ - (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32))) - -#define SDL_ISPIXELFORMAT_ARRAY(format) \ - (!SDL_ISPIXELFORMAT_FOURCC(format) && \ - ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU8) || \ - (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU16) || \ - (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU32) || \ - (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \ - (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32))) - -#define SDL_ISPIXELFORMAT_ALPHA(format) \ - ((SDL_ISPIXELFORMAT_PACKED(format) && \ - ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \ - (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \ - (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \ - (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))) || \ - (SDL_ISPIXELFORMAT_ARRAY(format) && \ - ((SDL_PIXELORDER(format) == SDL_ARRAYORDER_ARGB) || \ - (SDL_PIXELORDER(format) == SDL_ARRAYORDER_RGBA) || \ - (SDL_PIXELORDER(format) == SDL_ARRAYORDER_ABGR) || \ - (SDL_PIXELORDER(format) == SDL_ARRAYORDER_BGRA)))) -} - -{* The flag is set to 1 because 0x1? is not in the printable ASCII range *} -function SDL_ISPIXELFORMAT_FOURCC(format: Variant): Boolean; - -{* Note: If you modify this list, update SDL_GetPixelFormatName() *} -const - SDL_PIXELFORMAT_UNKNOWN = 0; - SDL_PIXELFORMAT_INDEX1LSB = (1 shl 28) or - (SDL_PIXELTYPE_INDEX1 shl 24) or - (SDL_BITMAPORDER_4321 shl 20) or - (0 shl 16) or - (1 shl 8) or - (0 shl 0); - - SDL_PIXELFORMAT_INDEX1MSB = (1 shl 28) or - (SDL_PIXELTYPE_INDEX1 shl 24) or - (SDL_BITMAPORDER_1234 shl 20) or - (0 shl 16) or - (1 shl 8) or - (0 shl 0); - - SDL_PIXELFORMAT_INDEX4LSB = (1 shl 28) or - (SDL_PIXELTYPE_INDEX4 shl 24) or - (SDL_BITMAPORDER_4321 shl 20) or - (0 shl 16) or - (4 shl 8) or - (0 shl 0); - - SDL_PIXELFORMAT_INDEX4MSB = (1 shl 28) or - (SDL_PIXELTYPE_INDEX4 shl 24) or - (SDL_BITMAPORDER_1234 shl 20) or - (0 shl 16) or - (4 shl 8) or - (0 shl 0); - - SDL_PIXELFORMAT_INDEX8 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED8 shl 24) or - (0 shl 20) or - (0 shl 16) or - (8 shl 8) or - (1 shl 0); - - SDL_PIXELFORMAT_RGB332 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED8 shl 24) or - (SDL_PACKEDORDER_XRGB shl 20) or - (SDL_PACKEDLAYOUT_332 shl 16) or - (8 shl 8) or - (1 shl 0); - - SDL_PIXELFORMAT_RGB444 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_XRGB shl 20) or - (SDL_PACKEDLAYOUT_4444 shl 16) or - (12 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_RGB555 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_XRGB shl 20) or - (SDL_PACKEDLAYOUT_1555 shl 16) or - (15 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_BGR555 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_XBGR shl 20) or - (SDL_PACKEDLAYOUT_1555 shl 16) or - (15 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_ARGB4444 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_ARGB shl 20) or - (SDL_PACKEDLAYOUT_4444 shl 16) or - (16 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_RGBA4444 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_RGBA shl 20) or - (SDL_PACKEDLAYOUT_4444 shl 16) or - (16 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_ABGR4444 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_ABGR shl 20) or - (SDL_PACKEDLAYOUT_4444 shl 16) or - (16 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_BGRA4444 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_BGRA shl 20) or - (SDL_PACKEDLAYOUT_4444 shl 16) or - (16 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_ARGB1555 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_ARGB shl 20) or - (SDL_PACKEDLAYOUT_1555 shl 16) or - (16 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_RGBA5551 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_RGBA shl 20) or - (SDL_PACKEDLAYOUT_5551 shl 16) or - (16 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_ABGR1555 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_ABGR shl 20) or - (SDL_PACKEDLAYOUT_1555 shl 16) or - (16 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_BGRA5551 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_BGRA shl 20) or - (SDL_PACKEDLAYOUT_5551 shl 16) or - (16 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_RGB565 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_XRGB shl 20) or - (SDL_PACKEDLAYOUT_565 shl 16) or - (16 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_BGR565 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED16 shl 24) or - (SDL_PACKEDORDER_XBGR shl 20) or - (SDL_PACKEDLAYOUT_1555 shl 16) or - (16 shl 8) or - (2 shl 0); - - SDL_PIXELFORMAT_RGB24 = (1 shl 28) or - (SDL_PIXELTYPE_ARRAYU8 shl 24) or - (SDL_ARRAYORDER_RGB shl 20) or - (0 shl 16) or - (24 shl 8) or - (3 shl 0); - - SDL_PIXELFORMAT_BGR24 = (1 shl 28) or - (SDL_PIXELTYPE_ARRAYU8 shl 24) or - (SDL_ARRAYORDER_BGR shl 20) or - (0 shl 16) or - (24 shl 8) or - (3 shl 0); - - SDL_PIXELFORMAT_RGB888 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED32 shl 24) or - (SDL_PACKEDORDER_XRGB shl 20) or - (SDL_PACKEDLAYOUT_8888 shl 16) or - (24 shl 8) or - (4 shl 0); - - SDL_PIXELFORMAT_RGBX8888 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED32 shl 24) or - (SDL_PACKEDORDER_RGBX shl 20) or - (SDL_PACKEDLAYOUT_8888 shl 16) or - (24 shl 8) or - (4 shl 0); - - SDL_PIXELFORMAT_BGR888 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED32 shl 24) or - (SDL_PACKEDORDER_XBGR shl 20) or - (SDL_PACKEDLAYOUT_8888 shl 16) or - (24 shl 8) or - (4 shl 0); - - SDL_PIXELFORMAT_BGRX8888 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED32 shl 24) or - (SDL_PACKEDORDER_BGRX shl 20) or - (SDL_PACKEDLAYOUT_8888 shl 16) or - (24 shl 8) or - (4 shl 0); - - SDL_PIXELFORMAT_ARGB8888 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED32 shl 24) or - (SDL_PACKEDORDER_ARGB shl 20) or - (SDL_PACKEDLAYOUT_8888 shl 16) or - (32 shl 8) or - (4 shl 0); - - SDL_PIXELFORMAT_RGBA8888 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED32 shl 24) or - (SDL_PACKEDORDER_RGBA shl 20) or - (SDL_PACKEDLAYOUT_8888 shl 16) or - (32 shl 8) or - (4 shl 0); - - SDL_PIXELFORMAT_ABGR8888 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED32 shl 24) or - (SDL_PACKEDORDER_ABGR shl 20) or - (SDL_PACKEDLAYOUT_8888 shl 16) or - (32 shl 8) or - (4 shl 0); - - SDL_PIXELFORMAT_BGRA8888 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED32 shl 24) or - (SDL_PACKEDORDER_RGBX shl 20) or - (SDL_PACKEDLAYOUT_8888 shl 16) or - (32 shl 8) or - (4 shl 0); - - SDL_PIXELFORMAT_ARGB2101010 = (1 shl 28) or - (SDL_PIXELTYPE_PACKED32 shl 24) or - (SDL_PACKEDORDER_ARGB shl 20) or - (SDL_PACKEDLAYOUT_2101010 shl 16)or - (32 shl 8) or - (4 shl 0); - - (* Aliases for RGBA byte arrays of color data, for the current platform *) - {$IFDEF FPC} - {$IF DEFINED(ENDIAN_LITTLE)} - SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888; - SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888; - SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888; - SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888; - {$ELSEIF DEFINED(ENDIAN_BIG)} - SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_RGBA8888; - SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_ARGB8888; - SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_BGRA8888; - SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_ABGR8888; - {$ELSE} - {$FATAL Cannot determine endianness.} - {$IFEND} - {$ENDIF} - - {**< Planar mode: Y + V + U (3 planes) *} - SDL_PIXELFORMAT_YV12 = (cuint32('Y') ) or - (cuint32('V') shl 8) or - (cuint32('1') shl 16) or - (cuint32('2') shl 24); - {**< Planar mode: Y + U + V (3 planes) *} - SDL_PIXELFORMAT_IYUV = (cuint32('I') ) or - (cuint32('Y') shl 8) or - (cuint32('U') shl 16) or - (cuint32('V') shl 24); - {**< Packed mode: Y0+U0+Y1+V0 (1 plane) *} - SDL_PIXELFORMAT_YUY2 = (cuint32('Y') ) or - (cuint32('U') shl 8) or - (cuint32('Y') shl 16) or - (cuint32('2') shl 24); - {**< Packed mode: U0+Y0+V0+Y1 (1 plane) *} - SDL_PIXELFORMAT_UYVY = (cuint32('U') ) or - (cuint32('Y') shl 8) or - (cuint32('V') shl 16) or - (cuint32('Y') shl 24); - {**< Packed mode: Y0+V0+Y1+U0 (1 plane) *} - SDL_PIXELFORMAT_YVYU = (cuint32('Y') ) or - (cuint32('V') shl 8) or - (cuint32('Y') shl 16) or - (cuint32('U') shl 24); - {**< Planar mode: Y + U/V interleaved (2 planes) *} - SDL_PIXELFORMAT_NV12 = (cuint32('N') ) or - (cuint32('V') shl 8) or - (cuint32('1') shl 16) or - (cuint32('2') shl 24); - {**< Planar mode: Y + V/U interleaved (2 planes) *} - SDL_PIXELFORMAT_NV21 = (cuint32('N') ) or - (cuint32('V') shl 8) or - (cuint32('2') shl 16) or - (cuint32('1') shl 24); - {**< Android video texture format *} - SDL_PIXELFORMAT_EXTERMAL_OES - = (cuint32('O') ) or - (cuint32('E') shl 8) or - (cuint32('S') shl 16) or - (cuint32(' ') shl 24); - -type - - {** - * The bits of this structure can be directly reinterpreted as an integer-packed - * color which uses the SDL_PIXELFORMAT_RGBA32 format (SDL_PIXELFORMAT_ABGR8888 - * on little-endian systems and SDL_PIXELFORMAT_RGBA8888 on big-endian systems). - *} - PPSDL_Color = ^PSDL_Color; - PSDL_Color = ^TSDL_Color; - TSDL_Color = record - r: cuint8; - g: cuint8; - b: cuint8; - a: cuint8; - end; - - PPSDL_Colour = ^PSDL_Colour; - PSDL_Colour = ^TSDL_Colour; - TSDL_Colour = TSDL_Color; - - PPSDL_Palette = ^PSDL_Palette; - PSDL_Palette = ^TSDL_Palette; - TSDL_Palette = record - ncolors: cint; - colors: PSDL_Color; - version: cuint32; - refcount: cint; - end; - - {** - * Everything in the pixel format structure is read-only. - *} - PPSDL_PixelFormat = ^PSDL_PixelFormat; - PSDL_PixelFormat = ^TSDL_PixelFormat; - TSDL_PixelFormat = record - format: cuint32; - palette: PSDL_Palette; - BitsPerPixel: cuint8; - BytesPerPixel: cuint8; - padding: array[0..1] of cuint8; - Rmask: cuint32; - Gmask: cuint32; - Bmask: cuint32; - Amask: cuint32; - Rloss: cuint8; - Gloss: cuint8; - Bloss: cuint8; - Aloss: cuint8; - Rshift: cuint8; - Gshift: cuint8; - Bshift: cuint8; - Ashift: cuint8; - refcount: cint; - next: PSDL_PixelFormat; - end; - -{** - * Get the human readable name of a pixel format. - * - * \param format the pixel format to query - * \returns the human readable name of the specified pixel format or - * `SDL_PIXELFORMAT_UNKNOWN` if the format isn't recognized. - * - * \since This function is available since SDL 2.0.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetPixelFormatName_fun = function(format: cuint32): PAnsiChar; cdecl; -Var - SDL_GetPixelFormatName : TSDL_GetPixelFormatName_fun = Nil; -{$else} - -function SDL_GetPixelFormatName(format: cuint32): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPixelFormatName' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Convert one of the enumerated pixel formats to a bpp value and RGBA masks. - * - * \param format one of the SDL_PixelFormatEnum values - * \param bpp a bits per pixel value; usually 15, 16, or 32 - * \param Rmask a pointer filled in with the red mask for the format - * \param Gmask a pointer filled in with the green mask for the format - * \param Bmask a pointer filled in with the blue mask for the format - * \param Amask a pointer filled in with the alpha mask for the format - * \returns SDL_TRUE on success or SDL_FALSE if the conversion wasn't - * possible; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_MasksToPixelFormatEnum - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_PixelFormatEnumToMasks_fun = function(format: cuint32; bpp: pcint; - Rmask: pcuint32; Gmask: pcuint32; Bmask: pcuint32; Amask: pcuint32): TSDL_Bool; cdecl; -Var - SDL_PixelFormatEnumToMasks : TSDL_PixelFormatEnumToMasks_fun = Nil; -{$else} - -function SDL_PixelFormatEnumToMasks(format: cuint32; bpp: pcint; - Rmask: pcuint32; Gmask: pcuint32; Bmask: pcuint32; Amask: pcuint32): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PixelFormatEnumToMasks' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Convert a bpp value and RGBA masks to an enumerated pixel format. - * - * This will return `SDL_PIXELFORMAT_UNKNOWN` if the conversion wasn't - * possible. - * - * \param bpp a bits per pixel value; usually 15, 16, or 32 - * \param Rmask the red mask for the format - * \param Gmask the green mask for the format - * \param Bmask the blue mask for the format - * \param Amask the alpha mask for the format - * \returns one of the SDL_PixelFormatEnum values - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_PixelFormatEnumToMasks - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_MasksToPixelFormatEnum_fun = function(bpp: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): cuint32; cdecl; -Var - SDL_MasksToPixelFormatEnum : TSDL_MasksToPixelFormatEnum_fun = Nil; -{$else} - -function SDL_MasksToPixelFormatEnum(bpp: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MasksToPixelFormatEnum' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Create an SDL_PixelFormat structure corresponding to a pixel format. - * - * Returned structure may come from a shared global cache (i.e. not newly - * allocated), and hence should not be modified, especially the palette. Weird - * errors such as `Blit combination not supported` may occur. - * - * \param pixel_format one of the SDL_PixelFormatEnum values - * \returns the new SDL_PixelFormat structure or NULL on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_FreeFormat - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_AllocFormat_fun = function(pixel_format: cuint32): PSDL_PixelFormat; cdecl; -Var - SDL_AllocFormat : TSDL_AllocFormat_fun = Nil; -{$else} - -function SDL_AllocFormat(pixel_format: cuint32): PSDL_PixelFormat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AllocFormat' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Free an SDL_PixelFormat structure allocated by SDL_AllocFormat(). - * - * \param format the SDL_PixelFormat structure to free - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AllocFormat - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_FreeFormat_proc = procedure(format: PSDL_PixelFormat); cdecl; -Var - SDL_FreeFormat : TSDL_FreeFormat_proc = Nil; -{$else} - -procedure SDL_FreeFormat(format: PSDL_PixelFormat); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeFormat' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Create a palette structure with the specified number of color entries. - * - * The palette entries are initialized to white. - * - * \param ncolors represents the number of color entries in the color palette - * \returns a new SDL_Palette structure on success or NULL on failure (e.g. if - * there wasn't enough memory); call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_FreePalette - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_AllocPalette_fun = function(ncolors: cint): PSDL_Palette; cdecl; -Var - SDL_AllocPalette : TSDL_AllocPalette_fun = Nil; -{$else} - -function SDL_AllocPalette(ncolors: cint): PSDL_Palette; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AllocPalette' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Set the palette for a pixel format structure. - * - * \param format the SDL_PixelFormat structure that will use the palette - * \param palette the SDL_Palette structure that will be used - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AllocPalette - * \sa SDL_FreePalette - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetPixelFormatPalette_fun = function(format: PSDL_PixelFormat; palette: PSDL_Palette): cint; cdecl; -Var - SDL_SetPixelFormatPalette : TSDL_SetPixelFormatPalette_fun = Nil; -{$else} - -function SDL_SetPixelFormatPalette(format: PSDL_PixelFormat; palette: PSDL_Palette): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetPixelFormatPalette' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Set a range of colors in a palette. - * - * \param palette the SDL_Palette structure to modify - * \param colors an array of SDL_Color structures to copy into the palette - * \param firstcolor the index of the first palette entry to modify - * \param ncolors the number of entries to modify - * \returns 0 on success or a negative error code if not all of the colors - * could be set; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AllocPalette - * \sa SDL_CreateRGBSurface - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetPaletteColors_fun = function(palette: PSDL_Palette; const colors: PSDL_Color; firstcolor: cint; ncolors: cint): cint; cdecl; -Var - SDL_SetPaletteColors : TSDL_SetPaletteColors_fun = Nil; -{$else} - -function SDL_SetPaletteColors(palette: PSDL_Palette; const colors: PSDL_Color; firstcolor: cint; ncolors: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetPaletteColors' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Free a palette created with SDL_AllocPalette(). - * - * \param palette the SDL_Palette structure to be freed - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AllocPalette - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_FreePalette_proc = procedure(palette: PSDL_Palette); cdecl; -Var - SDL_FreePalette : TSDL_FreePalette_proc = Nil; -{$else} - -procedure SDL_FreePalette(palette: PSDL_Palette); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreePalette' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Map an RGB triple to an opaque pixel value for a given pixel format. - * - * This function maps the RGB color value to the specified pixel format and - * returns the pixel value best approximating the given RGB color value for - * the given pixel format. - * - * If the format has a palette (8-bit) the index of the closest matching color - * in the palette will be returned. - * - * If the specified pixel format has an alpha component it will be returned as - * all 1 bits (fully opaque). - * - * If the pixel format bpp (color depth) is less than 32-bpp then the unused - * upper bits of the return value can safely be ignored (e.g., with a 16-bpp - * format the return value can be assigned to a Uint16, and similarly a Uint8 - * for an 8-bpp format). - * - * \param format an SDL_PixelFormat structure describing the pixel format - * \param r the red component of the pixel in the range 0-255 - * \param g the green component of the pixel in the range 0-255 - * \param b the blue component of the pixel in the range 0-255 - * \returns a pixel value - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetRGB - * \sa SDL_GetRGBA - * \sa SDL_MapRGBA - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_MapRGB_fun = function(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cuint8): cuint32; cdecl; -Var - SDL_MapRGB : TSDL_MapRGB_fun = Nil; -{$else} - -function SDL_MapRGB(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cuint8): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MapRGB' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Map an RGBA quadruple to a pixel value for a given pixel format. - * - * This function maps the RGBA color value to the specified pixel format and - * returns the pixel value best approximating the given RGBA color value for - * the given pixel format. - * - * If the specified pixel format has no alpha component the alpha value will - * be ignored (as it will be in formats with a palette). - * - * If the format has a palette (8-bit) the index of the closest matching color - * in the palette will be returned. - * - * If the pixel format bpp (color depth) is less than 32-bpp then the unused - * upper bits of the return value can safely be ignored (e.g., with a 16-bpp - * format the return value can be assigned to a Uint16, and similarly a Uint8 - * for an 8-bpp format). - * - * \param format an SDL_PixelFormat structure describing the format of the - * pixel - * \param r the red component of the pixel in the range 0-255 - * \param g the green component of the pixel in the range 0-255 - * \param b the blue component of the pixel in the range 0-255 - * \param a the alpha component of the pixel in the range 0-255 - * \returns a pixel value - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetRGB - * \sa SDL_GetRGBA - * \sa SDL_MapRGB - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_MapRGBA_fun = function(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cuint8; a: cuint8): cuint32; cdecl; -Var - SDL_MapRGBA : TSDL_MapRGBA_fun = Nil; -{$else} - -function SDL_MapRGBA(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cuint8; a: cuint8): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MapRGBA' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get RGB values from a pixel in the specified format. - * - * This function uses the entire 8-bit [0..255] range when converting color - * components from pixel formats with less than 8-bits per RGB component - * (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, - * 0xff, 0xff] not [0xf8, 0xfc, 0xf8]). - * - * \param pixel a pixel value - * \param format an SDL_PixelFormat structure describing the format of the - * pixel - * \param r a pointer filled in with the red component - * \param g a pointer filled in with the green component - * \param b a pointer filled in with the blue component - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetRGBA - * \sa SDL_MapRGB - * \sa SDL_MapRGBA - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetRGB_proc = procedure(pixel: cuint32; const format: PSDL_PixelFormat; r: pcuint8; g: pcuint8; b: pcuint8); cdecl; -Var - SDL_GetRGB : TSDL_GetRGB_proc = Nil; -{$else} - -procedure SDL_GetRGB(pixel: cuint32; const format: PSDL_PixelFormat; r: pcuint8; g: pcuint8; b: pcuint8); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRGB' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get RGBA values from a pixel in the specified format. - * - * This function uses the entire 8-bit [0..255] range when converting color - * components from pixel formats with less than 8-bits per RGB component - * (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, - * 0xff, 0xff] not [0xf8, 0xfc, 0xf8]). - * - * If the surface has no alpha component, the alpha will be returned as 0xff - * (100% opaque). - * - * \param pixel a pixel value - * \param format an SDL_PixelFormat structure describing the format of the - * pixel - * \param r a pointer filled in with the red component - * \param g a pointer filled in with the green component - * \param b a pointer filled in with the blue component - * \param a a pointer filled in with the alpha component - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetRGB - * \sa SDL_MapRGB - * \sa SDL_MapRGBA - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetRGBA_proc = procedure(pixel: cuint32; const format: PSDL_PixelFormat; r: pcuint8; g: pcuint8; b: pcuint8; a: pcuint8); cdecl; -Var - SDL_GetRGBA : TSDL_GetRGBA_proc = Nil; -{$else} - -procedure SDL_GetRGBA(pixel: cuint32; const format: PSDL_PixelFormat; r: pcuint8; g: pcuint8; b: pcuint8; a: pcuint8); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRGBA' {$ENDIF} {$ENDIF}; -{$endif} - -{/** - * Calculate a 256 entry gamma ramp for a gamma value. - * - * \param gamma a gamma value where 0.0 is black and 1.0 is identity - * \param ramp an array of 256 values filled in with the gamma ramp - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_SetWindowGammaRamp - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_CalculateGammaRamp_proc = procedure(gamma: cfloat; ramp: pcuint16); cdecl; -Var - SDL_CalculateGammaRamp : TSDL_CalculateGammaRamp_proc = Nil; -{$else} - -procedure SDL_CalculateGammaRamp(gamma: cfloat; ramp: pcuint16); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CalculateGammaRamp' {$ENDIF} {$ENDIF}; -{$endif} +// based on "sdl_pixels.h" (2.0.14, WIP) + +{** + * \file SDL_pixels.h + * + * Header for the enumerated pixel format definitions. + *} + +{** + * Transparency definitions + * + * These define alpha as the opacity of a surface. + *} + +const + SDL_ALPHA_OPAQUE = 255; + SDL_ALPHA_TRANSPARENT = 0; + +{** Pixel type. *} +type + PPSDL_PixelType = ^PSDL_PixelType; + PSDL_PixelType = ^TSDL_PixelType; + TSDL_PixelType = type cuint; + +const + SDL_PIXELTYPE_UNKNOWN = TSDL_PixelType(0); + SDL_PIXELTYPE_INDEX1 = TSDL_PixelType(1); + SDL_PIXELTYPE_INDEX4 = TSDL_PixelType(2); + SDL_PIXELTYPE_INDEX8 = TSDL_PixelType(3); + SDL_PIXELTYPE_PACKED8 = TSDL_PixelType(4); + SDL_PIXELTYPE_PACKED16 = TSDL_PixelType(5); + SDL_PIXELTYPE_PACKED32 = TSDL_PixelType(6); + SDL_PIXELTYPE_ARRAYU8 = TSDL_PixelType(7); + SDL_PIXELTYPE_ARRAYU16 = TSDL_PixelType(8); + SDL_PIXELTYPE_ARRAYU32 = TSDL_PixelType(9); + SDL_PIXELTYPE_ARRAYF16 = TSDL_PixelType(10); + SDL_PIXELTYPE_ARRAYF32 = TSDL_PixelType(11); + +{** Bitmap pixel order, high bit -> low bit. *} +type + PPSDL_BitmapOrder = ^PSDL_BitmapOrder; + PSDL_BitmapOrder = ^TSDL_BitmapOrder; + TSDL_BitmapOrder = type cuint32; + +const + SDL_BITMAPORDER_NONE = TSDL_BitmapOrder(0); + SDL_BITMAPORDER_4321 = TSDL_BitmapOrder(1); + SDL_BITMAPORDER_1234 = TSDL_BitmapOrder(2); + +{** Packed component order, high bit -> low bit. *} +type + PPSDL_PackOrder = ^PSDL_PackOrder; + PSDL_PackOrder = ^TSDL_PackOrder; + TSDL_PackOrder = type cuint32; + +const + SDL_PACKEDORDER_NONE = TSDL_PackOrder(0); + SDL_PACKEDORDER_XRGB = TSDL_PackOrder(1); + SDL_PACKEDORDER_RGBX = TSDL_PackOrder(2); + SDL_PACKEDORDER_ARGB = TSDL_PackOrder(3); + SDL_PACKEDORDER_RGBA = TSDL_PackOrder(4); + SDL_PACKEDORDER_XBGR = TSDL_PackOrder(5); + SDL_PACKEDORDER_BGRX = TSDL_PackOrder(6); + SDL_PACKEDORDER_ABGR = TSDL_PackOrder(7); + SDL_PACKEDORDER_BGRA = TSDL_PackOrder(8); + +{** Array component order, low byte -> high byte. *} +type + PPSDL_ArrayOrder = ^PSDL_ArrayOrder; + PSDL_ArrayOrder = ^TSDL_ArrayOrder; + TSDL_ArrayOrder = type cuint32; + +const + SDL_ARRAYORDER_NONE = TSDL_ArrayOrder(0); + SDL_ARRAYORDER_RGB = TSDL_ArrayOrder(1); + SDL_ARRAYORDER_RGBA = TSDL_ArrayOrder(2); + SDL_ARRAYORDER_ARGB = TSDL_ArrayOrder(3); + SDL_ARRAYORDER_BGR = TSDL_ArrayOrder(4); + SDL_ARRAYORDER_BGRA = TSDL_ArrayOrder(5); + SDL_ARRAYORDER_ABGR = TSDL_ArrayOrder(6); + +{** Packed component layout. *} +type + PPSDL_PackedLayout = ^PSDL_PackedLayout; + PSDL_PackedLayout = ^TSDL_PackedLayout; + TSDL_PackedLayout = type cuint32; + +const + SDL_PACKEDLAYOUT_NONE = TSDL_PackedLayout(0); + SDL_PACKEDLAYOUT_332 = TSDL_PackedLayout(1); + SDL_PACKEDLAYOUT_4444 = TSDL_PackedLayout(2); + SDL_PACKEDLAYOUT_1555 = TSDL_PackedLayout(3); + SDL_PACKEDLAYOUT_5551 = TSDL_PackedLayout(4); + SDL_PACKEDLAYOUT_565 = TSDL_PackedLayout(5); + SDL_PACKEDLAYOUT_8888 = TSDL_PackedLayout(6); + SDL_PACKEDLAYOUT_2101010 = TSDL_PackedLayout(7); + SDL_PACKEDLAYOUT_1010102 = TSDL_PackedLayout(8); + +{ +SDL2-for-Pascal: The SDL_DEFINE_PIXELFOURCC macro is replaced + by another macro, the SDL_FOURCC macro (in SDL_stdinc.h). + + The original C SDL_FOURCC macro: + #define SDL_FOURCC(A, B, C, D) \ + ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \ + (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \ + (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \ + (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24)) + + In Pascal it is cleaner to implement this directly as a + constant instead of a function. So we do, e. g.: + + SDL_PIXELFORMAT_YV12 = (cuint32('Y') ) or + (cuint32('V') shl 8) or + (cuint32('1') shl 16) or + (cuint32('2') shl 24); + + In the future it may be desirable to have a Pascal function. + The prototype could look like this: + function SDL_DEFINE_PIXELFOURCC(A,B,C,D: Variant): Variant; +} + +{ +SDL2-for-Pascal: The SDL_DEFINE_PIXELFORMAT macro returns the underlying + pixel format based on five arguments. + + The original C macro: + #define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \ + ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \ + ((bits) << 8) | ((bytes) << 0)) + + This C implementation could be replaced by a Pascal function, + but from a performance stand point this will be slower. + Therefore we decided to keep it as it has been implemented + before by the original binding authors and translate + every pixel format constant by the very same expression: + + SDL_PIXELFORMAT_[...] = (1 shl 28) or + (SDL_PIXELTYPE_[...] shl 24) or + (SDL_BITMAPORDER_[...] shl 20) or + ([...] shl 16) or + ([...] shl 8) or + ([...] shl 0); + + In the future it may be desirable to have a Pascal function. + The prototype could look like this: + function SDL_DEFINE_PIXELFORMAT(type, order, layour, bit, bytes: cuint32): Result; +} + +function SDL_PIXELFLAG(X: cuint32): cuint32; +function SDL_PIXELTYPE(X: cuint32): cuint32; +function SDL_PIXELORDER(X: cuint32): cuint32; +function SDL_PIXELLAYOUT(X: cuint32): cuint32; +function SDL_BITSPERPIXEL(X: cuint32): cuint32; + +{ +SDL2-for-Pascal: Is it worth translating these macros as they seem to be used + by SDL2 internally only? + +#define SDL_BYTESPERPIXEL(X) \ + (SDL_ISPIXELFORMAT_FOURCC(X) ? \ + ((((X) == SDL_PIXELFORMAT_YUY2) || \ + ((X) == SDL_PIXELFORMAT_UYVY) || \ + ((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF)) + +#define SDL_ISPIXELFORMAT_INDEXED(format) \ + (!SDL_ISPIXELFORMAT_FOURCC(format) && \ + ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8))) + +#define SDL_ISPIXELFORMAT_PACKED(format) \ + (!SDL_ISPIXELFORMAT_FOURCC(format) && \ + ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED8) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED16) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32))) + +#define SDL_ISPIXELFORMAT_ARRAY(format) \ + (!SDL_ISPIXELFORMAT_FOURCC(format) && \ + ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU8) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU16) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU32) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32))) + +#define SDL_ISPIXELFORMAT_ALPHA(format) \ + ((SDL_ISPIXELFORMAT_PACKED(format) && \ + ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \ + (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \ + (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \ + (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))) || \ + (SDL_ISPIXELFORMAT_ARRAY(format) && \ + ((SDL_PIXELORDER(format) == SDL_ARRAYORDER_ARGB) || \ + (SDL_PIXELORDER(format) == SDL_ARRAYORDER_RGBA) || \ + (SDL_PIXELORDER(format) == SDL_ARRAYORDER_ABGR) || \ + (SDL_PIXELORDER(format) == SDL_ARRAYORDER_BGRA)))) +} + +{* The flag is set to 1 because 0x1? is not in the printable ASCII range *} +function SDL_ISPIXELFORMAT_FOURCC(format: Variant): Boolean; + +{* Note: If you modify this list, update SDL_GetPixelFormatName() *} +const + SDL_PIXELFORMAT_UNKNOWN = 0; + SDL_PIXELFORMAT_INDEX1LSB = (1 shl 28) or + (SDL_PIXELTYPE_INDEX1 shl 24) or + (SDL_BITMAPORDER_4321 shl 20) or + (0 shl 16) or + (1 shl 8) or + (0 shl 0); + + SDL_PIXELFORMAT_INDEX1MSB = (1 shl 28) or + (SDL_PIXELTYPE_INDEX1 shl 24) or + (SDL_BITMAPORDER_1234 shl 20) or + (0 shl 16) or + (1 shl 8) or + (0 shl 0); + + SDL_PIXELFORMAT_INDEX4LSB = (1 shl 28) or + (SDL_PIXELTYPE_INDEX4 shl 24) or + (SDL_BITMAPORDER_4321 shl 20) or + (0 shl 16) or + (4 shl 8) or + (0 shl 0); + + SDL_PIXELFORMAT_INDEX4MSB = (1 shl 28) or + (SDL_PIXELTYPE_INDEX4 shl 24) or + (SDL_BITMAPORDER_1234 shl 20) or + (0 shl 16) or + (4 shl 8) or + (0 shl 0); + + SDL_PIXELFORMAT_INDEX8 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED8 shl 24) or + (0 shl 20) or + (0 shl 16) or + (8 shl 8) or + (1 shl 0); + + SDL_PIXELFORMAT_RGB332 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED8 shl 24) or + (SDL_PACKEDORDER_XRGB shl 20) or + (SDL_PACKEDLAYOUT_332 shl 16) or + (8 shl 8) or + (1 shl 0); + + SDL_PIXELFORMAT_RGB444 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_XRGB shl 20) or + (SDL_PACKEDLAYOUT_4444 shl 16) or + (12 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_RGB555 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_XRGB shl 20) or + (SDL_PACKEDLAYOUT_1555 shl 16) or + (15 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_BGR555 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_XBGR shl 20) or + (SDL_PACKEDLAYOUT_1555 shl 16) or + (15 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_ARGB4444 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_ARGB shl 20) or + (SDL_PACKEDLAYOUT_4444 shl 16) or + (16 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_RGBA4444 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_RGBA shl 20) or + (SDL_PACKEDLAYOUT_4444 shl 16) or + (16 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_ABGR4444 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_ABGR shl 20) or + (SDL_PACKEDLAYOUT_4444 shl 16) or + (16 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_BGRA4444 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_BGRA shl 20) or + (SDL_PACKEDLAYOUT_4444 shl 16) or + (16 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_ARGB1555 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_ARGB shl 20) or + (SDL_PACKEDLAYOUT_1555 shl 16) or + (16 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_RGBA5551 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_RGBA shl 20) or + (SDL_PACKEDLAYOUT_5551 shl 16) or + (16 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_ABGR1555 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_ABGR shl 20) or + (SDL_PACKEDLAYOUT_1555 shl 16) or + (16 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_BGRA5551 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_BGRA shl 20) or + (SDL_PACKEDLAYOUT_5551 shl 16) or + (16 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_RGB565 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_XRGB shl 20) or + (SDL_PACKEDLAYOUT_565 shl 16) or + (16 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_BGR565 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED16 shl 24) or + (SDL_PACKEDORDER_XBGR shl 20) or + (SDL_PACKEDLAYOUT_1555 shl 16) or + (16 shl 8) or + (2 shl 0); + + SDL_PIXELFORMAT_RGB24 = (1 shl 28) or + (SDL_PIXELTYPE_ARRAYU8 shl 24) or + (SDL_ARRAYORDER_RGB shl 20) or + (0 shl 16) or + (24 shl 8) or + (3 shl 0); + + SDL_PIXELFORMAT_BGR24 = (1 shl 28) or + (SDL_PIXELTYPE_ARRAYU8 shl 24) or + (SDL_ARRAYORDER_BGR shl 20) or + (0 shl 16) or + (24 shl 8) or + (3 shl 0); + + SDL_PIXELFORMAT_RGB888 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED32 shl 24) or + (SDL_PACKEDORDER_XRGB shl 20) or + (SDL_PACKEDLAYOUT_8888 shl 16) or + (24 shl 8) or + (4 shl 0); + + SDL_PIXELFORMAT_RGBX8888 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED32 shl 24) or + (SDL_PACKEDORDER_RGBX shl 20) or + (SDL_PACKEDLAYOUT_8888 shl 16) or + (24 shl 8) or + (4 shl 0); + + SDL_PIXELFORMAT_BGR888 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED32 shl 24) or + (SDL_PACKEDORDER_XBGR shl 20) or + (SDL_PACKEDLAYOUT_8888 shl 16) or + (24 shl 8) or + (4 shl 0); + + SDL_PIXELFORMAT_BGRX8888 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED32 shl 24) or + (SDL_PACKEDORDER_BGRX shl 20) or + (SDL_PACKEDLAYOUT_8888 shl 16) or + (24 shl 8) or + (4 shl 0); + + SDL_PIXELFORMAT_ARGB8888 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED32 shl 24) or + (SDL_PACKEDORDER_ARGB shl 20) or + (SDL_PACKEDLAYOUT_8888 shl 16) or + (32 shl 8) or + (4 shl 0); + + SDL_PIXELFORMAT_RGBA8888 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED32 shl 24) or + (SDL_PACKEDORDER_RGBA shl 20) or + (SDL_PACKEDLAYOUT_8888 shl 16) or + (32 shl 8) or + (4 shl 0); + + SDL_PIXELFORMAT_ABGR8888 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED32 shl 24) or + (SDL_PACKEDORDER_ABGR shl 20) or + (SDL_PACKEDLAYOUT_8888 shl 16) or + (32 shl 8) or + (4 shl 0); + + SDL_PIXELFORMAT_BGRA8888 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED32 shl 24) or + (SDL_PACKEDORDER_RGBX shl 20) or + (SDL_PACKEDLAYOUT_8888 shl 16) or + (32 shl 8) or + (4 shl 0); + + SDL_PIXELFORMAT_ARGB2101010 = (1 shl 28) or + (SDL_PIXELTYPE_PACKED32 shl 24) or + (SDL_PACKEDORDER_ARGB shl 20) or + (SDL_PACKEDLAYOUT_2101010 shl 16)or + (32 shl 8) or + (4 shl 0); + + (* Aliases for RGBA byte arrays of color data, for the current platform *) + {$IFDEF FPC} + {$IF DEFINED(ENDIAN_LITTLE)} + SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888; + SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888; + SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888; + SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888; + {$ELSEIF DEFINED(ENDIAN_BIG)} + SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_RGBA8888; + SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_ARGB8888; + SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_BGRA8888; + SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_ABGR8888; + {$ELSE} + {$FATAL Cannot determine endianness.} + {$IFEND} + {$ENDIF} + + {**< Planar mode: Y + V + U (3 planes) *} + SDL_PIXELFORMAT_YV12 = (cuint32('Y') ) or + (cuint32('V') shl 8) or + (cuint32('1') shl 16) or + (cuint32('2') shl 24); + {**< Planar mode: Y + U + V (3 planes) *} + SDL_PIXELFORMAT_IYUV = (cuint32('I') ) or + (cuint32('Y') shl 8) or + (cuint32('U') shl 16) or + (cuint32('V') shl 24); + {**< Packed mode: Y0+U0+Y1+V0 (1 plane) *} + SDL_PIXELFORMAT_YUY2 = (cuint32('Y') ) or + (cuint32('U') shl 8) or + (cuint32('Y') shl 16) or + (cuint32('2') shl 24); + {**< Packed mode: U0+Y0+V0+Y1 (1 plane) *} + SDL_PIXELFORMAT_UYVY = (cuint32('U') ) or + (cuint32('Y') shl 8) or + (cuint32('V') shl 16) or + (cuint32('Y') shl 24); + {**< Packed mode: Y0+V0+Y1+U0 (1 plane) *} + SDL_PIXELFORMAT_YVYU = (cuint32('Y') ) or + (cuint32('V') shl 8) or + (cuint32('Y') shl 16) or + (cuint32('U') shl 24); + {**< Planar mode: Y + U/V interleaved (2 planes) *} + SDL_PIXELFORMAT_NV12 = (cuint32('N') ) or + (cuint32('V') shl 8) or + (cuint32('1') shl 16) or + (cuint32('2') shl 24); + {**< Planar mode: Y + V/U interleaved (2 planes) *} + SDL_PIXELFORMAT_NV21 = (cuint32('N') ) or + (cuint32('V') shl 8) or + (cuint32('2') shl 16) or + (cuint32('1') shl 24); + {**< Android video texture format *} + SDL_PIXELFORMAT_EXTERMAL_OES + = (cuint32('O') ) or + (cuint32('E') shl 8) or + (cuint32('S') shl 16) or + (cuint32(' ') shl 24); + +type + + {** + * The bits of this structure can be directly reinterpreted as an integer-packed + * color which uses the SDL_PIXELFORMAT_RGBA32 format (SDL_PIXELFORMAT_ABGR8888 + * on little-endian systems and SDL_PIXELFORMAT_RGBA8888 on big-endian systems). + *} + PPSDL_Color = ^PSDL_Color; + PSDL_Color = ^TSDL_Color; + TSDL_Color = record + r: cuint8; + g: cuint8; + b: cuint8; + a: cuint8; + end; + + PPSDL_Colour = ^PSDL_Colour; + PSDL_Colour = ^TSDL_Colour; + TSDL_Colour = TSDL_Color; + + PPSDL_Palette = ^PSDL_Palette; + PSDL_Palette = ^TSDL_Palette; + TSDL_Palette = record + ncolors: cint; + colors: PSDL_Color; + version: cuint32; + refcount: cint; + end; + + {** + * Everything in the pixel format structure is read-only. + *} + PPSDL_PixelFormat = ^PSDL_PixelFormat; + PSDL_PixelFormat = ^TSDL_PixelFormat; + TSDL_PixelFormat = record + format: cuint32; + palette: PSDL_Palette; + BitsPerPixel: cuint8; + BytesPerPixel: cuint8; + padding: array[0..1] of cuint8; + Rmask: cuint32; + Gmask: cuint32; + Bmask: cuint32; + Amask: cuint32; + Rloss: cuint8; + Gloss: cuint8; + Bloss: cuint8; + Aloss: cuint8; + Rshift: cuint8; + Gshift: cuint8; + Bshift: cuint8; + Ashift: cuint8; + refcount: cint; + next: PSDL_PixelFormat; + end; + +{** + * Get the human readable name of a pixel format. + * + * \param format the pixel format to query + * \returns the human readable name of the specified pixel format or + * `SDL_PIXELFORMAT_UNKNOWN` if the format isn't recognized. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetPixelFormatName_fun = function(format: cuint32): PAnsiChar; cdecl; +Var + SDL_GetPixelFormatName : TSDL_GetPixelFormatName_fun = Nil; +{$else} + +function SDL_GetPixelFormatName(format: cuint32): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPixelFormatName' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Convert one of the enumerated pixel formats to a bpp value and RGBA masks. + * + * \param format one of the SDL_PixelFormatEnum values + * \param bpp a bits per pixel value; usually 15, 16, or 32 + * \param Rmask a pointer filled in with the red mask for the format + * \param Gmask a pointer filled in with the green mask for the format + * \param Bmask a pointer filled in with the blue mask for the format + * \param Amask a pointer filled in with the alpha mask for the format + * \returns SDL_TRUE on success or SDL_FALSE if the conversion wasn't + * possible; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_MasksToPixelFormatEnum + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_PixelFormatEnumToMasks_fun = function(format: cuint32; bpp: pcint; + Rmask: pcuint32; Gmask: pcuint32; Bmask: pcuint32; Amask: pcuint32): TSDL_Bool; cdecl; +Var + SDL_PixelFormatEnumToMasks : TSDL_PixelFormatEnumToMasks_fun = Nil; +{$else} + +function SDL_PixelFormatEnumToMasks(format: cuint32; bpp: pcint; + Rmask: pcuint32; Gmask: pcuint32; Bmask: pcuint32; Amask: pcuint32): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PixelFormatEnumToMasks' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Convert a bpp value and RGBA masks to an enumerated pixel format. + * + * This will return `SDL_PIXELFORMAT_UNKNOWN` if the conversion wasn't + * possible. + * + * \param bpp a bits per pixel value; usually 15, 16, or 32 + * \param Rmask the red mask for the format + * \param Gmask the green mask for the format + * \param Bmask the blue mask for the format + * \param Amask the alpha mask for the format + * \returns one of the SDL_PixelFormatEnum values + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_PixelFormatEnumToMasks + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_MasksToPixelFormatEnum_fun = function(bpp: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): cuint32; cdecl; +Var + SDL_MasksToPixelFormatEnum : TSDL_MasksToPixelFormatEnum_fun = Nil; +{$else} + +function SDL_MasksToPixelFormatEnum(bpp: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MasksToPixelFormatEnum' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Create an SDL_PixelFormat structure corresponding to a pixel format. + * + * Returned structure may come from a shared global cache (i.e. not newly + * allocated), and hence should not be modified, especially the palette. Weird + * errors such as `Blit combination not supported` may occur. + * + * \param pixel_format one of the SDL_PixelFormatEnum values + * \returns the new SDL_PixelFormat structure or NULL on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_FreeFormat + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AllocFormat_fun = function(pixel_format: cuint32): PSDL_PixelFormat; cdecl; +Var + SDL_AllocFormat : TSDL_AllocFormat_fun = Nil; +{$else} + +function SDL_AllocFormat(pixel_format: cuint32): PSDL_PixelFormat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AllocFormat' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Free an SDL_PixelFormat structure allocated by SDL_AllocFormat(). + * + * \param format the SDL_PixelFormat structure to free + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AllocFormat + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_FreeFormat_proc = procedure(format: PSDL_PixelFormat); cdecl; +Var + SDL_FreeFormat : TSDL_FreeFormat_proc = Nil; +{$else} + +procedure SDL_FreeFormat(format: PSDL_PixelFormat); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeFormat' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Create a palette structure with the specified number of color entries. + * + * The palette entries are initialized to white. + * + * \param ncolors represents the number of color entries in the color palette + * \returns a new SDL_Palette structure on success or NULL on failure (e.g. if + * there wasn't enough memory); call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_FreePalette + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AllocPalette_fun = function(ncolors: cint): PSDL_Palette; cdecl; +Var + SDL_AllocPalette : TSDL_AllocPalette_fun = Nil; +{$else} + +function SDL_AllocPalette(ncolors: cint): PSDL_Palette; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AllocPalette' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Set the palette for a pixel format structure. + * + * \param format the SDL_PixelFormat structure that will use the palette + * \param palette the SDL_Palette structure that will be used + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AllocPalette + * \sa SDL_FreePalette + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetPixelFormatPalette_fun = function(format: PSDL_PixelFormat; palette: PSDL_Palette): cint; cdecl; +Var + SDL_SetPixelFormatPalette : TSDL_SetPixelFormatPalette_fun = Nil; +{$else} + +function SDL_SetPixelFormatPalette(format: PSDL_PixelFormat; palette: PSDL_Palette): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetPixelFormatPalette' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Set a range of colors in a palette. + * + * \param palette the SDL_Palette structure to modify + * \param colors an array of SDL_Color structures to copy into the palette + * \param firstcolor the index of the first palette entry to modify + * \param ncolors the number of entries to modify + * \returns 0 on success or a negative error code if not all of the colors + * could be set; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AllocPalette + * \sa SDL_CreateRGBSurface + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetPaletteColors_fun = function(palette: PSDL_Palette; const colors: PSDL_Color; firstcolor: cint; ncolors: cint): cint; cdecl; +Var + SDL_SetPaletteColors : TSDL_SetPaletteColors_fun = Nil; +{$else} + +function SDL_SetPaletteColors(palette: PSDL_Palette; const colors: PSDL_Color; firstcolor: cint; ncolors: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetPaletteColors' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Free a palette created with SDL_AllocPalette(). + * + * \param palette the SDL_Palette structure to be freed + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AllocPalette + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_FreePalette_proc = procedure(palette: PSDL_Palette); cdecl; +Var + SDL_FreePalette : TSDL_FreePalette_proc = Nil; +{$else} + +procedure SDL_FreePalette(palette: PSDL_Palette); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreePalette' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Map an RGB triple to an opaque pixel value for a given pixel format. + * + * This function maps the RGB color value to the specified pixel format and + * returns the pixel value best approximating the given RGB color value for + * the given pixel format. + * + * If the format has a palette (8-bit) the index of the closest matching color + * in the palette will be returned. + * + * If the specified pixel format has an alpha component it will be returned as + * all 1 bits (fully opaque). + * + * If the pixel format bpp (color depth) is less than 32-bpp then the unused + * upper bits of the return value can safely be ignored (e.g., with a 16-bpp + * format the return value can be assigned to a Uint16, and similarly a Uint8 + * for an 8-bpp format). + * + * \param format an SDL_PixelFormat structure describing the pixel format + * \param r the red component of the pixel in the range 0-255 + * \param g the green component of the pixel in the range 0-255 + * \param b the blue component of the pixel in the range 0-255 + * \returns a pixel value + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetRGB + * \sa SDL_GetRGBA + * \sa SDL_MapRGBA + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_MapRGB_fun = function(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cuint8): cuint32; cdecl; +Var + SDL_MapRGB : TSDL_MapRGB_fun = Nil; +{$else} + +function SDL_MapRGB(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cuint8): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MapRGB' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Map an RGBA quadruple to a pixel value for a given pixel format. + * + * This function maps the RGBA color value to the specified pixel format and + * returns the pixel value best approximating the given RGBA color value for + * the given pixel format. + * + * If the specified pixel format has no alpha component the alpha value will + * be ignored (as it will be in formats with a palette). + * + * If the format has a palette (8-bit) the index of the closest matching color + * in the palette will be returned. + * + * If the pixel format bpp (color depth) is less than 32-bpp then the unused + * upper bits of the return value can safely be ignored (e.g., with a 16-bpp + * format the return value can be assigned to a Uint16, and similarly a Uint8 + * for an 8-bpp format). + * + * \param format an SDL_PixelFormat structure describing the format of the + * pixel + * \param r the red component of the pixel in the range 0-255 + * \param g the green component of the pixel in the range 0-255 + * \param b the blue component of the pixel in the range 0-255 + * \param a the alpha component of the pixel in the range 0-255 + * \returns a pixel value + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetRGB + * \sa SDL_GetRGBA + * \sa SDL_MapRGB + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_MapRGBA_fun = function(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cuint8; a: cuint8): cuint32; cdecl; +Var + SDL_MapRGBA : TSDL_MapRGBA_fun = Nil; +{$else} + +function SDL_MapRGBA(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cuint8; a: cuint8): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MapRGBA' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get RGB values from a pixel in the specified format. + * + * This function uses the entire 8-bit [0..255] range when converting color + * components from pixel formats with less than 8-bits per RGB component + * (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, + * 0xff, 0xff] not [0xf8, 0xfc, 0xf8]). + * + * \param pixel a pixel value + * \param format an SDL_PixelFormat structure describing the format of the + * pixel + * \param r a pointer filled in with the red component + * \param g a pointer filled in with the green component + * \param b a pointer filled in with the blue component + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetRGBA + * \sa SDL_MapRGB + * \sa SDL_MapRGBA + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetRGB_proc = procedure(pixel: cuint32; const format: PSDL_PixelFormat; r: pcuint8; g: pcuint8; b: pcuint8); cdecl; +Var + SDL_GetRGB : TSDL_GetRGB_proc = Nil; +{$else} + +procedure SDL_GetRGB(pixel: cuint32; const format: PSDL_PixelFormat; r: pcuint8; g: pcuint8; b: pcuint8); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRGB' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get RGBA values from a pixel in the specified format. + * + * This function uses the entire 8-bit [0..255] range when converting color + * components from pixel formats with less than 8-bits per RGB component + * (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, + * 0xff, 0xff] not [0xf8, 0xfc, 0xf8]). + * + * If the surface has no alpha component, the alpha will be returned as 0xff + * (100% opaque). + * + * \param pixel a pixel value + * \param format an SDL_PixelFormat structure describing the format of the + * pixel + * \param r a pointer filled in with the red component + * \param g a pointer filled in with the green component + * \param b a pointer filled in with the blue component + * \param a a pointer filled in with the alpha component + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetRGB + * \sa SDL_MapRGB + * \sa SDL_MapRGBA + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetRGBA_proc = procedure(pixel: cuint32; const format: PSDL_PixelFormat; r: pcuint8; g: pcuint8; b: pcuint8; a: pcuint8); cdecl; +Var + SDL_GetRGBA : TSDL_GetRGBA_proc = Nil; +{$else} + +procedure SDL_GetRGBA(pixel: cuint32; const format: PSDL_PixelFormat; r: pcuint8; g: pcuint8; b: pcuint8; a: pcuint8); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRGBA' {$ENDIF} {$ENDIF}; +{$endif} + +{/** + * Calculate a 256 entry gamma ramp for a gamma value. + * + * \param gamma a gamma value where 0.0 is black and 1.0 is identity + * \param ramp an array of 256 values filled in with the gamma ramp + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_SetWindowGammaRamp + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CalculateGammaRamp_proc = procedure(gamma: cfloat; ramp: pcuint16); cdecl; +Var + SDL_CalculateGammaRamp : TSDL_CalculateGammaRamp_proc = Nil; +{$else} + +procedure SDL_CalculateGammaRamp(gamma: cfloat; ramp: pcuint16); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CalculateGammaRamp' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlplatform.inc b/units/sdlplatform.inc index e54b9c1d..0b5eb625 100644 --- a/units/sdlplatform.inc +++ b/units/sdlplatform.inc @@ -1,13 +1,13 @@ -// based on "sdl_platform.h" (2.0.14) - -{** - * \file SDL_platform.h - * - * Try to get a standard set of platform defines. - *} - -{** - * Gets the name of the platform. - *} -function SDL_GetPlatform: PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPlatform' {$ENDIF} {$ENDIF}; +// based on "sdl_platform.h" (2.0.14) + +{** + * \file SDL_platform.h + * + * Try to get a standard set of platform defines. + *} + +{** + * Gets the name of the platform. + *} +function SDL_GetPlatform: PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPlatform' {$ENDIF} {$ENDIF}; diff --git a/units/sdlpower.inc b/units/sdlpower.inc index c1c6e102..59910ebf 100644 --- a/units/sdlpower.inc +++ b/units/sdlpower.inc @@ -1,43 +1,43 @@ -// based on "sdl_power.h" (2.0.14) - -{** - * \file SDL_power.h - * - * Header for the SDL power management routines. - *} - - {** - * The basic state for the system's power supply. - *} -type - PPSDL_PowerState = ^PSDL_PowerState; - PSDL_PowerState = ^TSDL_PowerState; - TSDL_PowerState = (SDL_POWERSTATE_UNKNOWN, {**< cannot determine power status *} - SDL_POWERSTATE_ON_BATTERY, {**< Not plugged in, running on the battery *} - SDL_POWERSTATE_NO_BATTERY, {**< Plugged in, no battery available *} - SDL_POWERSTATE_CHARGING, {**< Plugged in, charging battery *} - SDL_POWERSTATE_CHARGED); {**< Plugged in, battery charged *} - - {** - * \brief Get the current power supply details. - * - * \param secs Seconds of battery life left. You can pass a NULL here if - * you don't care. Will return -1 if we can't determine a - * value, or we're not running on a battery. - * - * \param pct Percentage of battery life left, between 0 and 100. You can - * pass a NULL here if you don't care. Will return -1 if we - * can't determine a value, or we're not running on a battery. - * - * \return The state of the battery (if any). - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetPowerInfo_fun = function(secs: pcint; pct: pcint): TSDL_PowerState; cdecl; -Var - SDL_GetPowerInfo : TSDL_GetPowerInfo_fun = Nil; -{$else} - -function SDL_GetPowerInfo(secs: pcint; pct: pcint): TSDL_PowerState; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPowerInfo' {$ENDIF} {$ENDIF}; -{$endif} +// based on "sdl_power.h" (2.0.14) + +{** + * \file SDL_power.h + * + * Header for the SDL power management routines. + *} + + {** + * The basic state for the system's power supply. + *} +type + PPSDL_PowerState = ^PSDL_PowerState; + PSDL_PowerState = ^TSDL_PowerState; + TSDL_PowerState = (SDL_POWERSTATE_UNKNOWN, {**< cannot determine power status *} + SDL_POWERSTATE_ON_BATTERY, {**< Not plugged in, running on the battery *} + SDL_POWERSTATE_NO_BATTERY, {**< Plugged in, no battery available *} + SDL_POWERSTATE_CHARGING, {**< Plugged in, charging battery *} + SDL_POWERSTATE_CHARGED); {**< Plugged in, battery charged *} + + {** + * \brief Get the current power supply details. + * + * \param secs Seconds of battery life left. You can pass a NULL here if + * you don't care. Will return -1 if we can't determine a + * value, or we're not running on a battery. + * + * \param pct Percentage of battery life left, between 0 and 100. You can + * pass a NULL here if you don't care. Will return -1 if we + * can't determine a value, or we're not running on a battery. + * + * \return The state of the battery (if any). + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetPowerInfo_fun = function(secs: pcint; pct: pcint): TSDL_PowerState; cdecl; +Var + SDL_GetPowerInfo : TSDL_GetPowerInfo_fun = Nil; +{$else} + +function SDL_GetPowerInfo(secs: pcint; pct: pcint): TSDL_PowerState; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPowerInfo' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlrect.inc b/units/sdlrect.inc index 69b0e095..5e4deaaa 100644 --- a/units/sdlrect.inc +++ b/units/sdlrect.inc @@ -1,308 +1,308 @@ -// based on "sdl_rect.h" (2.24.0) - -{** - * \file SDL_rect.h - * - * Header file for SDL_rect definition and management functions. - *} - -type - {** - * \brief The structure that defines a point (integer) - * - * \sa SDL_EnclosePoints - * \sa SDL_PointInRect - *} - PPSDL_Point = ^PSDL_Point; - PSDL_Point = ^TSDL_Point; - TSDL_Point = record - x: cint; - y: cint; - end; - - {** - * \brief The structure that defines a point (floating point) - * - * \sa SDL_EnclosePoints - * \sa SDL_PointInRect - *} - PPSDL_FPoint = ^PSDL_FPoint; - PSDL_FPoint = ^TSDL_FPoint; - TSDL_FPoint = record - x: cfloat; - y: cfloat; - end; - - {** - * \brief A rectangle, with the origin at the upper left (integer). - * - * \sa SDL_RectEmpty - * \sa SDL_RectEquals - * \sa SDL_HasIntersection - * \sa SDL_IntersectRect - * \sa SDL_UnionRect - * \sa SDL_EnclosePoints - *} - PPSDL_Rect = ^PSDL_Rect; - PSDL_Rect = ^TSDL_Rect; - TSDL_Rect = record - x,y: cint; - w,h: cint; - end; - - {** - * A rectangle, with the origin at the upper left. (floating point) - *} - PPSDL_FRect = ^PSDL_FRect; - PSDL_FRect = ^TSDL_FRect; - TSDL_FRect = record - x,y: cfloat; - w,h: cfloat; - end; - -{** - * Returns true if point resides inside a rectangle. - *} -function SDL_PointInRect(const p: PSDL_Point; const r: PSDL_Rect): Boolean; Inline; - -{** - * Returns true if the rectangle has no area. - *} -function SDL_RectEmpty(const r: PSDL_Rect): Boolean; inline; - -{** - * Returns true if the two rectangles are equal. - *} -function SDL_RectEquals(const a, b: PSDL_Rect): Boolean; inline; - -{** - * Determine whether two rectangles intersect. - * - * SDL_TRUE if there is an intersection, SDL_FALSE otherwise. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HasIntersection_fun = function(const a, b: PSDL_Rect): TSDL_Bool; cdecl; -Var - SDL_HasIntersection : TSDL_HasIntersection_fun = Nil; -{$else} - -function SDL_HasIntersection(const a, b: PSDL_Rect): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasIntersection' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Calculate the intersection of two rectangles. - * - * SDL_TRUE if there is an intersection, SDL_FALSE otherwise. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_IntersectRect_fun = function(const A, B: PSDL_Rect; result: PSDL_Rect): TSDL_Bool; cdecl; -Var - SDL_IntersectRect : TSDL_IntersectRect_fun = Nil; -{$else} - -function SDL_IntersectRect(const A, B: PSDL_Rect; result: PSDL_Rect): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IntersectRect' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Calculate the union of two rectangles. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_UnionRect_proc = procedure(const A, B: PSDL_Rect; result: PSDL_Rect); cdecl; -Var - SDL_UnionRect : TSDL_UnionRect_proc = Nil; -{$else} - -procedure SDL_UnionRect(const A, B: PSDL_Rect; result: PSDL_Rect); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnionRect' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Calculate a minimal rectangle enclosing a set of points - * - * SDL_TRUE if any points were within the clipping rect - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_EnclosePoints_fun = function(const points: PSDL_Point; count: cint; const clip: PSDL_Rect; result: PSDL_Rect): TSDL_Bool; cdecl; -Var - SDL_EnclosePoints : TSDL_EnclosePoints_fun = Nil; -{$else} - -function SDL_EnclosePoints(const points: PSDL_Point; count: cint; const clip: PSDL_Rect; result: PSDL_Rect): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EnclosePoints' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Calculate the intersection of a rectangle and line segment. - * - * SDL_TRUE if there is an intersection, SDL_FALSE otherwise. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_IntersectRectAndLine_fun = function(const rect: PSDL_Rect; X1, Y1, X2, Y2: pcint): TSDL_Bool; cdecl; -Var - SDL_IntersectRectAndLine : TSDL_IntersectRectAndLine_fun = Nil; -{$else} - -function SDL_IntersectRectAndLine(const rect: PSDL_Rect; X1, Y1, X2, Y2: pcint): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IntersectRectAndLine' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Returns true if point resides inside a rectangle. - *} -function SDL_PointInFRect(const p: PSDL_FPoint; const r: PSDL_FRect): Boolean; Inline; - -{** - * Returns true if the rectangle has no area. - *} -function SDL_FRectEmpty(const r: PSDL_FRect): Boolean; inline; - -{** - * Returns true if the two rectangles are equal, within some given epsilon. - * - * \since This function is available since SDL 2.0.22. - *} -function SDL_FRectEqualsEpsilon(const a, b: PSDL_FRect; const epsilon: cfloat): Boolean; Inline; - -{** - * Returns true if the two rectangles are equal, using a default epsilon. - * - * \since This function is available since SDL 2.0.22. - *} -function SDL_FRectEquals(const a, b: PSDL_FRect): Boolean; Inline; - -{** - * Determine whether two rectangles intersect with float precision. - * - * If either pointer is NIL the function will return SDL_FALSE. - * - * \param A an SDL_FRect structure representing the first rectangle - * \param B an SDL_FRect structure representing the second rectangle - * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.22. - * - * \sa SDL_IntersectRect - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HasIntersectionF_fun = function(const a, b: PSDL_FRect): TSDL_Bool; cdecl; -Var - SDL_HasIntersectionF : TSDL_HasIntersectionF_fun = Nil; -{$else} - -function SDL_HasIntersectionF(const a, b: PSDL_FRect): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasIntersectionF' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Calculate the intersection of two rectangles with float precision. - * - * If `result` is NIL then this function will return SDL_FALSE. - * - * \param A an SDL_FRect structure representing the first rectangle - * \param B an SDL_FRect structure representing the second rectangle - * \param result an SDL_FRect structure filled in with the intersection of - * rectangles `A` and `B` - * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.22. - * - * \sa SDL_HasIntersectionF - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_IntersectFRect_fun = function(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; -Var - SDL_IntersectFRect : TSDL_IntersectFRect_fun = Nil; -{$else} - -function SDL_IntersectFRect(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IntersectFRect' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Calculate the union of two rectangles with float precision. - * - * \param A an SDL_FRect structure representing the first rectangle - * \param B an SDL_FRect structure representing the second rectangle - * \param result an SDL_FRect structure filled in with the union of rectangles - * `A` and `B` - * - * \since This function is available since SDL 2.0.22. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_UnionFRect_fun = function(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; -Var - SDL_UnionFRect : TSDL_UnionFRect_fun = Nil; -{$else} - -function SDL_UnionFRect(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnionFRect' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Calculate a minimal rectangle enclosing a set of points with float - * precision. - * - * If `clip` is not NIL then only points inside of the clipping rectangle - * are considered. - * - * \param points an array of SDL_FPoint structures representing points to be - * enclosed - * \param count the number of structures in the `points` array - * \param clip an SDL_FRect used for clipping or NIL to enclose all points - * \param result an SDL_FRect structure filled in with the minimal enclosing - * rectangle - * \returns SDL_TRUE if any points were enclosed or SDL_FALSE if all the - * points were outside of the clipping rectangle. - * - * \since This function is available since SDL 2.0.22. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_EncloseFPoints_fun = function(const points: PSDL_FPoint; count: cint; const clip: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; -Var - SDL_EncloseFPoints : TSDL_EncloseFPoints_fun = Nil; -{$else} - -function SDL_EncloseFPoints(const points: PSDL_FPoint; count: cint; const clip: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EncloseFPoints' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Calculate the intersection of a rectangle and line segment with float - * precision. - * - * This function is used to clip a line segment to a rectangle. A line segment - * contained entirely within the rectangle or that does not intersect will - * remain unchanged. A line segment that crosses the rectangle at either or - * both ends will be clipped to the boundary of the rectangle and the new - * coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary. - * - * \param rect an SDL_FRect structure representing the rectangle to intersect - * \param X1 a pointer to the starting X-coordinate of the line - * \param Y1 a pointer to the starting Y-coordinate of the line - * \param X2 a pointer to the ending X-coordinate of the line - * \param Y2 a pointer to the ending Y-coordinate of the line - * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.22. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_IntersectFRectAndLine_fun = function(const rect: PSDL_FRect; X1, Y1, X2, Y2: pcfloat): TSDL_Bool; cdecl; -Var - SDL_IntersectFRectAndLine : TSDL_IntersectFRectAndLine_fun = Nil; -{$else} - -function SDL_IntersectFRectAndLine(const rect: PSDL_FRect; X1, Y1, X2, Y2: pcfloat): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IntersectFRectAndLine' {$ENDIF} {$ENDIF}; -{$endif} +// based on "sdl_rect.h" (2.24.0) + +{** + * \file SDL_rect.h + * + * Header file for SDL_rect definition and management functions. + *} + +type + {** + * \brief The structure that defines a point (integer) + * + * \sa SDL_EnclosePoints + * \sa SDL_PointInRect + *} + PPSDL_Point = ^PSDL_Point; + PSDL_Point = ^TSDL_Point; + TSDL_Point = record + x: cint; + y: cint; + end; + + {** + * \brief The structure that defines a point (floating point) + * + * \sa SDL_EnclosePoints + * \sa SDL_PointInRect + *} + PPSDL_FPoint = ^PSDL_FPoint; + PSDL_FPoint = ^TSDL_FPoint; + TSDL_FPoint = record + x: cfloat; + y: cfloat; + end; + + {** + * \brief A rectangle, with the origin at the upper left (integer). + * + * \sa SDL_RectEmpty + * \sa SDL_RectEquals + * \sa SDL_HasIntersection + * \sa SDL_IntersectRect + * \sa SDL_UnionRect + * \sa SDL_EnclosePoints + *} + PPSDL_Rect = ^PSDL_Rect; + PSDL_Rect = ^TSDL_Rect; + TSDL_Rect = record + x,y: cint; + w,h: cint; + end; + + {** + * A rectangle, with the origin at the upper left. (floating point) + *} + PPSDL_FRect = ^PSDL_FRect; + PSDL_FRect = ^TSDL_FRect; + TSDL_FRect = record + x,y: cfloat; + w,h: cfloat; + end; + +{** + * Returns true if point resides inside a rectangle. + *} +function SDL_PointInRect(const p: PSDL_Point; const r: PSDL_Rect): Boolean; Inline; + +{** + * Returns true if the rectangle has no area. + *} +function SDL_RectEmpty(const r: PSDL_Rect): Boolean; inline; + +{** + * Returns true if the two rectangles are equal. + *} +function SDL_RectEquals(const a, b: PSDL_Rect): Boolean; inline; + +{** + * Determine whether two rectangles intersect. + * + * SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HasIntersection_fun = function(const a, b: PSDL_Rect): TSDL_Bool; cdecl; +Var + SDL_HasIntersection : TSDL_HasIntersection_fun = Nil; +{$else} + +function SDL_HasIntersection(const a, b: PSDL_Rect): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasIntersection' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Calculate the intersection of two rectangles. + * + * SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_IntersectRect_fun = function(const A, B: PSDL_Rect; result: PSDL_Rect): TSDL_Bool; cdecl; +Var + SDL_IntersectRect : TSDL_IntersectRect_fun = Nil; +{$else} + +function SDL_IntersectRect(const A, B: PSDL_Rect; result: PSDL_Rect): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IntersectRect' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Calculate the union of two rectangles. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UnionRect_proc = procedure(const A, B: PSDL_Rect; result: PSDL_Rect); cdecl; +Var + SDL_UnionRect : TSDL_UnionRect_proc = Nil; +{$else} + +procedure SDL_UnionRect(const A, B: PSDL_Rect; result: PSDL_Rect); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnionRect' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Calculate a minimal rectangle enclosing a set of points + * + * SDL_TRUE if any points were within the clipping rect + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_EnclosePoints_fun = function(const points: PSDL_Point; count: cint; const clip: PSDL_Rect; result: PSDL_Rect): TSDL_Bool; cdecl; +Var + SDL_EnclosePoints : TSDL_EnclosePoints_fun = Nil; +{$else} + +function SDL_EnclosePoints(const points: PSDL_Point; count: cint; const clip: PSDL_Rect; result: PSDL_Rect): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EnclosePoints' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Calculate the intersection of a rectangle and line segment. + * + * SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_IntersectRectAndLine_fun = function(const rect: PSDL_Rect; X1, Y1, X2, Y2: pcint): TSDL_Bool; cdecl; +Var + SDL_IntersectRectAndLine : TSDL_IntersectRectAndLine_fun = Nil; +{$else} + +function SDL_IntersectRectAndLine(const rect: PSDL_Rect; X1, Y1, X2, Y2: pcint): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IntersectRectAndLine' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Returns true if point resides inside a rectangle. + *} +function SDL_PointInFRect(const p: PSDL_FPoint; const r: PSDL_FRect): Boolean; Inline; + +{** + * Returns true if the rectangle has no area. + *} +function SDL_FRectEmpty(const r: PSDL_FRect): Boolean; inline; + +{** + * Returns true if the two rectangles are equal, within some given epsilon. + * + * \since This function is available since SDL 2.0.22. + *} +function SDL_FRectEqualsEpsilon(const a, b: PSDL_FRect; const epsilon: cfloat): Boolean; Inline; + +{** + * Returns true if the two rectangles are equal, using a default epsilon. + * + * \since This function is available since SDL 2.0.22. + *} +function SDL_FRectEquals(const a, b: PSDL_FRect): Boolean; Inline; + +{** + * Determine whether two rectangles intersect with float precision. + * + * If either pointer is NIL the function will return SDL_FALSE. + * + * \param A an SDL_FRect structure representing the first rectangle + * \param B an SDL_FRect structure representing the second rectangle + * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.22. + * + * \sa SDL_IntersectRect + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HasIntersectionF_fun = function(const a, b: PSDL_FRect): TSDL_Bool; cdecl; +Var + SDL_HasIntersectionF : TSDL_HasIntersectionF_fun = Nil; +{$else} + +function SDL_HasIntersectionF(const a, b: PSDL_FRect): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasIntersectionF' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Calculate the intersection of two rectangles with float precision. + * + * If `result` is NIL then this function will return SDL_FALSE. + * + * \param A an SDL_FRect structure representing the first rectangle + * \param B an SDL_FRect structure representing the second rectangle + * \param result an SDL_FRect structure filled in with the intersection of + * rectangles `A` and `B` + * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.22. + * + * \sa SDL_HasIntersectionF + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_IntersectFRect_fun = function(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; +Var + SDL_IntersectFRect : TSDL_IntersectFRect_fun = Nil; +{$else} + +function SDL_IntersectFRect(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IntersectFRect' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Calculate the union of two rectangles with float precision. + * + * \param A an SDL_FRect structure representing the first rectangle + * \param B an SDL_FRect structure representing the second rectangle + * \param result an SDL_FRect structure filled in with the union of rectangles + * `A` and `B` + * + * \since This function is available since SDL 2.0.22. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UnionFRect_fun = function(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; +Var + SDL_UnionFRect : TSDL_UnionFRect_fun = Nil; +{$else} + +function SDL_UnionFRect(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnionFRect' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Calculate a minimal rectangle enclosing a set of points with float + * precision. + * + * If `clip` is not NIL then only points inside of the clipping rectangle + * are considered. + * + * \param points an array of SDL_FPoint structures representing points to be + * enclosed + * \param count the number of structures in the `points` array + * \param clip an SDL_FRect used for clipping or NIL to enclose all points + * \param result an SDL_FRect structure filled in with the minimal enclosing + * rectangle + * \returns SDL_TRUE if any points were enclosed or SDL_FALSE if all the + * points were outside of the clipping rectangle. + * + * \since This function is available since SDL 2.0.22. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_EncloseFPoints_fun = function(const points: PSDL_FPoint; count: cint; const clip: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; +Var + SDL_EncloseFPoints : TSDL_EncloseFPoints_fun = Nil; +{$else} + +function SDL_EncloseFPoints(const points: PSDL_FPoint; count: cint; const clip: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EncloseFPoints' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Calculate the intersection of a rectangle and line segment with float + * precision. + * + * This function is used to clip a line segment to a rectangle. A line segment + * contained entirely within the rectangle or that does not intersect will + * remain unchanged. A line segment that crosses the rectangle at either or + * both ends will be clipped to the boundary of the rectangle and the new + * coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary. + * + * \param rect an SDL_FRect structure representing the rectangle to intersect + * \param X1 a pointer to the starting X-coordinate of the line + * \param Y1 a pointer to the starting Y-coordinate of the line + * \param X2 a pointer to the ending X-coordinate of the line + * \param Y2 a pointer to the ending Y-coordinate of the line + * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.22. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_IntersectFRectAndLine_fun = function(const rect: PSDL_FRect; X1, Y1, X2, Y2: pcfloat): TSDL_Bool; cdecl; +Var + SDL_IntersectFRectAndLine : TSDL_IntersectFRectAndLine_fun = Nil; +{$else} + +function SDL_IntersectFRectAndLine(const rect: PSDL_FRect; X1, Y1, X2, Y2: pcfloat): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IntersectFRectAndLine' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlrenderer.inc b/units/sdlrenderer.inc index 09e6ef37..7e962120 100644 --- a/units/sdlrenderer.inc +++ b/units/sdlrenderer.inc @@ -1,1222 +1,1222 @@ -//from "sdl_renderer.h" - - {** - * Flags used when creating a rendering context - *} -const - SDL_RENDERER_SOFTWARE = $00000001; {**< The renderer is a software fallback *} - SDL_RENDERER_ACCELERATED = $00000002; {**< The renderer uses hardware - acceleration *} - SDL_RENDERER_PRESENTVSYNC = $00000004; {**< Present is synchronized - with the refresh rate *} - SDL_RENDERER_TARGETTEXTURE = $00000008; {**< The renderer supports - rendering to texture *} - -type - PPSDL_RendererFlags = ^PSDL_RendererFlags; - PSDL_RendererFlags = ^TSDL_RendererFlags; - TSDL_RendererFlags = Word; - - {** - * Information on the capabilities of a render driver or context. - *} - PPSDL_RendererInfo = ^PSDL_RendererInfo; - PSDL_RendererInfo = ^TSDL_RendererInfo; - TSDL_RendererInfo = record - name: PAnsiChar; {**< The name of the renderer *} - flags: cuint32; {**< Supported ::SDL_RendererFlags *} - num_texture_formats: cuint32; {**< The number of available texture formats *} - texture_formats: array[0..15] of cuint32; {**< The available texture formats *} - max_texture_width: cint32; {**< The maximimum texture width *} - max_texture_height: cint32; {**< The maximimum texture height *} - end; - - PPSDL_Vertex = ^PSDL_Vertex; - PSDL_Vertex = ^TSDL_Vertex; - TSDL_Vertex = record - position: TSDL_FPoint; - color: TSDL_Color; - tex_coord: TSDL_FPoint; - end; - -{** - * The scaling mode for a texture. - *} - PPSDL_ScaleMode = ^PSDL_ScaleMode; - PSDL_ScaleMode = ^TSDL_ScaleMode; - TSDL_ScaleMode = type cint; - -const - SDL_ScaleModeNearest = TSDL_ScaleMode(0); {**< nearest pixel sampling *} - SDL_ScaleModeLinear = TSDL_ScaleMode(1); {**< linear filtering *} - SDL_ScaleModeBest = TSDL_ScaleMode(2); {**< anisotropic filtering *} - - {** - * The access pattern allowed for a texture. - *} -type - PPSDL_TextureAccess = ^PSDL_TextureAccess; - PSDL_TextureAccess = ^TSDL_TextureAccess; - TSDL_TextureAccess = type cint; - -const - SDL_TEXTUREACCESS_STATIC = 0; {**< Changes rarely, not lockable *} - SDL_TEXTUREACCESS_STREAMING = 1; {**< Changes frequently, lockable *} - SDL_TEXTUREACCESS_TARGET = 2; {**< Texture can be used as a render target *} - -type - {** - * The texture channel modulation used in SDL_RenderCopy(). - *} - PPSDL_TextureModulate = ^PSDL_TextureModulate; - PSDL_TextureModulate = ^TSDL_TextureModulate; - TSDL_TextureModulate = type cint; - -const - SDL_TEXTUREMODULATE_NONE = TSDL_TextureModulate(0); {**< No modulation *} - SDL_TEXTUREMODULATE_COLOR = TSDL_TextureModulate(1); {**< srcC = srcC * color *} - SDL_TEXTUREMODULATE_ALPHA = TSDL_TextureModulate(2); {**< srcA = srcA * alpha *} - -type - {** - * Flip constants for SDL_RenderCopyEx - *} - PPSDL_RenderFlip = ^PSDL_RenderFlip; - PSDL_RenderFlip = ^TSDL_RenderFlip; - TSDL_RenderFlip = type cint; - -const - SDL_FLIP_NONE = TSDL_RenderFlip($0); {**< Do not flip *} - SDL_FLIP_HORIZONTAL = TSDL_RenderFlip($1); {**< flip horizontally *} - SDL_FLIP_VERTICAL = TSDL_RenderFlip($2); {**< flip vertically *} - -type - {** - * A structure representing rendering state - *} - - PPSDL_Renderer = ^PSDL_Renderer; - PSDL_Renderer = type Pointer; - - {** - * An efficient driver-specific representation of pixel data - *} - PPSDL_Texture = ^PSDL_Texture; - PSDL_Texture = type Pointer; - - {* Function prototypes *} - - {** - * Get the number of 2D rendering drivers available for the current - * display. - * - * A render driver is a set of code that handles rendering and texture - * management on a particular display. Normally there is only one, but - * some drivers may have several available with different capabilities. - * - * SDL_GetRenderDriverInfo() - * SDL_CreateRenderer() - *} -function SDL_GetNumRenderDrivers: cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumRenderDrivers' {$ENDIF} {$ENDIF}; - - {** - * Get information about a specific 2D rendering driver for the current - * display. - * - * index The index of the driver to query information about. - * info A pointer to an SDL_RendererInfo struct to be filled with - * information on the rendering driver. - * - * 0 on success, -1 if the index was out of range. - * - * SDL_CreateRenderer() - *} -function SDL_GetRenderDriverInfo(index: cint32; info: PSDL_RendererInfo): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderDriverInfo' {$ENDIF} {$ENDIF}; - - {** - * Create a window and default renderer - * - * width The width of the window - * height The height of the window - * window_flags The flags used to create the window - * window A pointer filled with the window, or NULL on error - * renderer A pointer filled with the renderer, or NULL on error - * - * 0 on success, or -1 on error - *} -function SDL_CreateWindowAndRenderer(width: cint32; height: cint32; window_flags: cuint32; window: PPSDL_Window; renderer: PPSDL_Renderer): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateWindowAndRenderer' {$ENDIF} {$ENDIF}; - - {** - * Create a 2D rendering context for a window. - * - * window The window where rendering is displayed. - * index The index of the rendering driver to initialize, or -1 to - * initialize the first one supporting the requested flags. - * flags ::SDL_RendererFlags. - * - * A valid rendering context or NULL if there was an error. - * - * SDL_CreateSoftwareRenderer() - * SDL_GetRendererInfo() - * SDL_DestroyRenderer() - *} -function SDL_CreateRenderer(window: PSDL_Window; index: cint32; flags: cuint32): PSDL_Renderer cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRenderer' {$ENDIF} {$ENDIF}; - - {** - * Create a 2D software rendering context for a surface. - * - * surface The surface where rendering is done. - * - * A valid rendering context or NULL if there was an error. - * - * SDL_CreateRenderer() - * SDL_DestroyRenderer() - *} -function SDL_CreateSoftwareRenderer(surface: PSDL_Surface): PSDL_Renderer cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateSoftwareRenderer' {$ENDIF} {$ENDIF}; - - {** - * Get the renderer associated with a window. - *} -function SDL_GetRenderer(window: PSDL_Window): PSDL_Renderer cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderer' {$ENDIF} {$ENDIF}; - -{** - * Get the window associated with a renderer. - *} -function SDL_RenderGetWindow(renderer: PSDL_Renderer): PSDL_Window; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetWindow' {$ENDIF} {$ENDIF}; - - {** - * Get information about a rendering context. - *} -function SDL_GetRendererInfo(renderer: PSDL_Renderer; info: PSDL_RendererInfo): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRendererInfo' {$ENDIF} {$ENDIF}; - - {** - * Get the output size of a rendering context. - *} -function SDL_GetRendererOutputSize(renderer: PSDL_Renderer; w: pcint; h: pcint): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRendererOutputSize' {$ENDIF} {$ENDIF}; - - {** - * Create a texture for a rendering context. - * - * renderer The renderer. - * format The format of the texture. - * access One of the enumerated values in ::SDL_TextureAccess. - * w The width of the texture in pixels. - * h The height of the texture in pixels. - * - * The created texture is returned, or 0 if no rendering context was - * active, the format was unsupported, or the width or height were out - * of range. - * - * SDL_QueryTexture() - * SDL_UpdateTexture() - * SDL_DestroyTexture() - *} -function SDL_CreateTexture(renderer: PSDL_Renderer; format: cuint32; access: cint32; w: cint32; h: cint32): PSDL_Texture cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateTexture' {$ENDIF} {$ENDIF}; - - {** - * Create a texture from an existing surface. - * - * renderer The renderer. - * surface The surface containing pixel data used to fill the texture. - * - * The created texture is returned, or 0 on error. - * - * The surface is not modified or freed by this function. - * - * SDL_QueryTexture() - * SDL_DestroyTexture() - *} -function SDL_CreateTextureFromSurface(renderer: PSDL_Renderer; surface: PSDL_Surface): PSDL_Texture cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateTextureFromSurface' {$ENDIF} {$ENDIF}; - - {** - * Query the attributes of a texture - * - * texture A texture to be queried. - * format A pointer filled in with the raw format of the texture. The - * actual format may differ, but pixel transfers will use this - * format. - * access A pointer filled in with the actual access to the texture. - * w A pointer filled in with the width of the texture in pixels. - * h A pointer filled in with the height of the texture in pixels. - * - * 0 on success, or -1 if the texture is not valid. - *} -function SDL_QueryTexture(texture: PSDL_Texture; format: pcuint32; access: pcint; w: pcint; h: pcint): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_QueryTexture' {$ENDIF} {$ENDIF}; - - {** - * Set an additional color value used in render copy operations. - * - * texture The texture to update. - * r The red color value multiplied into copy operations. - * g The green color value multiplied into copy operations. - * b The blue color value multiplied into copy operations. - * - * 0 on success, or -1 if the texture is not valid or color modulation - * is not supported. - * - * SDL_GetTextureColorMod() - *} -function SDL_SetTextureColorMod(texture: PSDL_Texture; r: cuint8; g: cuint8; b: cuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureColorMod' {$ENDIF} {$ENDIF}; - - {** - * Get the additional color value used in render copy operations. - * - * texture The texture to query. - * r A pointer filled in with the current red color value. - * g A pointer filled in with the current green color value. - * b A pointer filled in with the current blue color value. - * - * 0 on success, or -1 if the texture is not valid. - * - * SDL_SetTextureColorMod() - *} -function SDL_GetTextureColorMod(texture: PSDL_Texture; r: pcuint8; g: pcuint8; b: pcuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureColorMod' {$ENDIF} {$ENDIF}; - - {** - * Set an additional alpha value used in render copy operations. - * - * texture The texture to update. - * alpha The alpha value multiplied into copy operations. - * - * 0 on success, or -1 if the texture is not valid or alpha modulation - * is not supported. - * - * SDL_GetTextureAlphaMod() - *} -function SDL_SetTextureAlphaMod(texture: PSDL_Texture; alpha: cuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureAlphaMod' {$ENDIF} {$ENDIF}; - - {** - * Get the additional alpha value used in render copy operations. - * - * texture The texture to query. - * alpha A pointer filled in with the current alpha value. - * - * 0 on success, or -1 if the texture is not valid. - * - * SDL_SetTextureAlphaMod() - *} -function SDL_GetTextureAlphaMod(texture: PSDL_Texture; alpha: pcuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureAlphaMod' {$ENDIF} {$ENDIF}; - - {** - * Set the blend mode used for texture copy operations. - * - * texture The texture to update. - * blendMode ::SDL_BlendMode to use for texture blending. - * - * 0 on success, or -1 if the texture is not valid or the blend mode is - * not supported. - * - * If the blend mode is not supported, the closest supported mode is - * chosen. - * - * SDL_GetTextureBlendMode() - *} -function SDL_SetTextureBlendMode(texture: PSDL_Texture; blendMode: TSDL_BlendMode): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureBlendMode' {$ENDIF} {$ENDIF}; - - {** - * Get the blend mode used for texture copy operations. - * - * texture The texture to query. - * blendMode A pointer filled in with the current blend mode. - * - * 0 on success, or -1 if the texture is not valid. - * - * SDL_SetTextureBlendMode() - *} -function SDL_GetTextureBlendMode(texture: PSDL_Texture; blendMode: PSDL_BlendMode): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureBlendMode' {$ENDIF} {$ENDIF}; - -{** - * Set the scale mode used for texture scale operations. - * If the scale mode is not supported, the closest supported mode is chosen. - *} -function SDL_SetTextureScaleMode(texture: PSDL_Texture; scaleMode: TSDL_ScaleMode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureScaleMode' {$ENDIF} {$ENDIF}; - -{** - * Get the scale mode used for texture scale operations. - *} -function SDL_GetTextureScaleMode(texture: PSDL_Texture; scaleMode: PSDL_ScaleMode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureScaleMode' {$ENDIF} {$ENDIF}; - -{** - * Associate a user-specified pointer with a texture. - *} -function SDL_SetTextureUserData(texture: PSDL_Texture; userdata: Pointer): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureUserData' {$ENDIF} {$ENDIF}; - -{** - * Get the user-specified pointer associated with a texture. - *} -function SDL_GetTextureUserData(texture: PSDL_Texture): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureUserData' {$ENDIF} {$ENDIF}; - - {** - * Update the given texture rectangle with new pixel data. - * - * texture The texture to update - * rect A pointer to the rectangle of pixels to update, or NULL to - * update the entire texture. - * pixels The raw pixel data. - * pitch The number of bytes between rows of pixel data. - * - * 0 on success, or -1 if the texture is not valid. - * - * This is a fairly slow function. - *} -function SDL_UpdateTexture(texture: PSDL_Texture; rect: PSDL_Rect; pixels: Pointer; pitch: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateTexture' {$ENDIF} {$ENDIF}; - - {** - * Lock a portion of the texture for write-only pixel access. - * - * texture The texture to lock for access, which was created with - * SDL_TEXTUREACCESS_STREAMING. - * rect A pointer to the rectangle to lock for access. If the rect - * is NULL, the entire texture will be locked. - * pixels This is filled in with a pointer to the locked pixels, - * appropriately offset by the locked area. - * pitch This is filled in with the pitch of the locked pixels. - * - * 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING. - * - * SDL_UnlockTexture() - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LockTexture_fun = function(texture: PSDL_Texture; const rect: PSDL_Rect; pixels: PPointer; pitch: pcint): cint; cdecl; -Var - SDL_LockTexture : TSDL_LockTexture_fun = Nil; -{$else} - -function SDL_LockTexture(texture: PSDL_Texture; const rect: PSDL_Rect; pixels: PPointer; pitch: pcint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockTexture' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * \brief Lock a portion of the texture for write-only pixel access. - * Expose it as a SDL surface. - * - * \param texture The texture to lock for access, which was created with - * ::SDL_TEXTUREACCESS_STREAMING. - * \param rect A pointer to the rectangle to lock for access. If the rect - * is NULL, the entire texture will be locked. - * \param surface This is filled in with a SDL surface representing the locked area - * Surface is freed internally after calling SDL_UnlockTexture or SDL_DestroyTexture. - * - * \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING. - * - * \sa SDL_UnlockTexture() - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LockTextureToSurface_fun = function(texture: PSDL_Texture; const rect: PSDL_Rect; surface: PPSDL_Surface): cint; cdecl; -Var - SDL_LockTextureToSurface : TSDL_LockTextureToSurface_fun = Nil; -{$else} - -function SDL_LockTextureToSurface(texture: PSDL_Texture; const rect: PSDL_Rect; surface: PPSDL_Surface): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockTextureToSurface' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Unlock a texture, uploading the changes to video memory, if needed. - * - * SDL_LockTexture() - *} -procedure SDL_UnlockTexture(texture: PSDL_Texture) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockTexture' {$ENDIF} {$ENDIF}; - - {** - * Determines whether a window supports the use of render targets - * - * renderer The renderer that will be checked - * - * SDL_TRUE if supported, SDL_FALSE if not. - *} -function SDL_RenderTargetSupported(renderer: PSDL_Renderer): Boolean cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderTargetSupported' {$ENDIF} {$ENDIF}; - - {** - * Set a texture as the current rendering target. - * - * renderer The renderer. - * texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target - * - * 0 on success, or -1 on error - * - * SDL_GetRenderTarget() - *} -function SDL_SetRenderTarget(renderer: PSDL_Renderer; texture: PSDL_Texture): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRenderTarget' {$ENDIF} {$ENDIF}; - - {** - * Get the current render target or NULL for the default render target. - * - * The current render target - * - * SDL_SetRenderTarget() - *} -function SDL_GetRenderTarget(renderer: PSDL_Renderer): PSDL_Texture cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderTarget' {$ENDIF} {$ENDIF}; - - {** - * Set device independent resolution for rendering - * - * renderer The renderer for which resolution should be set. - * w The width of the logical resolution - * h The height of the logical resolution - * - * This function uses the viewport and scaling functionality to allow a fixed logical - * resolution for rendering, regardless of the actual output resolution. If the actual - * output resolution doesn't have the same aspect ratio the output rendering will be - * centered within the output display. - * - * If the output display is a window, mouse events in the window will be filtered - * and scaled so they seem to arrive within the logical resolution. - * - * If this function results in scaling or subpixel drawing by the - * rendering backend, it will be handled using the appropriate - * quality hints. - * - * SDL_RenderGetLogicalSize() - * SDL_RenderSetScale() - * SDL_RenderSetViewport() - *} -function SDL_RenderSetLogicalSize(renderer: PSDL_Renderer; w: cint32; h: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetLogicalSize' {$ENDIF} {$ENDIF}; - - {** - * Get device independent resolution for rendering - * - * renderer The renderer from which resolution should be queried. - * w A pointer filled with the width of the logical resolution - * h A pointer filled with the height of the logical resolution - * - * SDL_RenderSetLogicalSize() - *} -procedure SDL_RenderGetLogicalSize(renderer: PSDL_Renderer; w: pcint; h: pcint) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetLogicalSize' {$ENDIF} {$ENDIF}; - -{** - * \brief Set whether to force integer scales for resolution-independent rendering - * - * \param renderer The renderer for which integer scaling should be set. - * \param enable Enable or disable integer scaling - * - * This function restricts the logical viewport to integer values - that is, when - * a resolution is between two multiples of a logical size, the viewport size is - * rounded down to the lower multiple. - * - * \sa SDL_RenderSetLogicalSize() - *} -function SDL_RenderSetIntegerScale(renderer: PSDL_Renderer; enable : TSDL_bool): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetIntegerScale' {$ENDIF} {$ENDIF}; - -{** - * \brief Get whether integer scales are forced for resolution-independent rendering - * - * \param renderer The renderer from which integer scaling should be queried. - * - * \sa SDL_RenderSetIntegerScale() - *} -function SDL_RenderGetIntegerScale(renderer: PSDL_Renderer): TSDL_bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetIntegerScale' {$ENDIF} {$ENDIF}; - - {** - * Set the drawing area for rendering on the current target. - * - * renderer The renderer for which the drawing area should be set. - * rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target. - * - * The x,y of the viewport rect represents the origin for rendering. - * - * 0 on success, or -1 on error - * - * If the window associated with the renderer is resized, the viewport is automatically reset. - * - * SDL_RenderGetViewport() - * SDL_RenderSetLogicalSize() - *} -function SDL_RenderSetViewport(renderer: PSDL_Renderer; const rect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetViewport' {$ENDIF} {$ENDIF}; - - {** - * Get the drawing area for the current target. - * - * SDL_RenderSetViewport() - *} -procedure SDL_RenderGetViewport(renderer: PSDL_Renderer; rect: PSDL_Rect) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetViewport' {$ENDIF} {$ENDIF}; - - {** - * Set the clip rectangle for the current target. - * - * renderer The renderer for which clip rectangle should be set. - * rect A pointer to the rectangle to set as the clip rectangle, or - * NULL to disable clipping. - * - * 0 on success, or -1 on error - * - * SDL_RenderGetClipRect() - *} -function SDL_RenderSetClipRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetClipRect' {$ENDIF} {$ENDIF}; - - {** - * Get the clip rectangle for the current target. - * - * renderer The renderer from which clip rectangle should be queried. - * rect A pointer filled in with the current clip rectangle, or - * an empty rectangle if clipping is disabled. - * - * SDL_RenderSetClipRect() - *} -procedure SDL_RenderGetClipRect(renderer: PSDL_Renderer; rect: PSDL_Rect) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetClipRect' {$ENDIF} {$ENDIF}; - - {** - * \brief Get whether clipping is enabled on the given renderer. - * - * \param renderer The renderer from which clip state should be queried. - * - * \sa SDL_RenderGetClipRect() - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RenderIsClipEnabled_fun = function(renderer: PSDL_Renderer): TSDL_Bool; cdecl; -Var - SDL_RenderIsClipEnabled : TSDL_RenderIsClipEnabled_fun = Nil; -{$else} - -function SDL_RenderIsClipEnabled(renderer: PSDL_Renderer): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderIsClipEnabled' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Set the drawing scale for rendering on the current target. - * - * renderer The renderer for which the drawing scale should be set. - * scaleX The horizontal scaling factor - * scaleY The vertical scaling factor - * - * The drawing coordinates are scaled by the x/y scaling factors - * before they are used by the renderer. This allows resolution - * independent drawing with a single coordinate system. - * - * If this results in scaling or subpixel drawing by the - * rendering backend, it will be handled using the appropriate - * quality hints. For best results use integer scaling factors. - * - * SDL_RenderGetScale() - * SDL_RenderSetLogicalSize() - *} -function SDL_RenderSetScale(renderer: PSDL_Renderer; scaleX: cfloat; scaleY: cfloat): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetScale' {$ENDIF} {$ENDIF}; - - {** - * Get the drawing scale for the current target. - * - * renderer The renderer from which drawing scale should be queried. - * scaleX A pointer filled in with the horizontal scaling factor - * scaleY A pointer filled in with the vertical scaling factor - * - * SDL_RenderSetScale() - *} -procedure SDL_RenderGetScale(renderer: PSDL_Renderer; scaleX: pcfloat; scaleY: pcfloat) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetScale' {$ENDIF} {$ENDIF}; - -{** - * Get logical coordinates of point in renderer when given real coordinates of - * point in window. Logical coordinates will differ from real coordinates when - * render is scaled and logical renderer size set. - *} -procedure SDL_RenderWindowToLogical(renderer: PSDL_Renderer; windowX, windowY: cint; logicalX, logicalY: PSingle); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderWindowToLogical' {$ENDIF} {$ENDIF}; - -{** - * Get real coordinates of point in window when given logical coordinates of - * point in renderer. Logical coordinates will differ from real coordinate - * when render is scaled and logical renderer size set. - *} -procedure SDL_RenderLogicalToWindow(renderer: PSDL_Renderer; logicalX, logicalY: Single; windowX, windowY: Pcint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderLogicalToWindow' {$ENDIF} {$ENDIF}; - - {** - * Set the color used for drawing operations (Rect, Line and Clear). - * - * renderer The renderer for which drawing color should be set. - * r The red value used to draw on the rendering target. - * g The green value used to draw on the rendering target. - * b The blue value used to draw on the rendering target. - * a The alpha value used to draw on the rendering target, usually - * SDL_ALPHA_OPAQUE (255). - * - * 0 on success, or -1 on error - *} -function SDL_SetRenderDrawColor(renderer: PSDL_Renderer; r: cuint8; g: cuint8; b: cuint8; a: cuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRenderDrawColor' {$ENDIF} {$ENDIF}; - - {** - * Get the color used for drawing operations (Rect, Line and Clear). - * - * renderer The renderer from which drawing color should be queried. - * r A pointer to the red value used to draw on the rendering target. - * g A pointer to the green value used to draw on the rendering target. - * b A pointer to the blue value used to draw on the rendering target. - * a A pointer to the alpha value used to draw on the rendering target, - * usually SDL_ALPHA_OPAQUE (255). - * - * 0 on success, or -1 on error - *} -function SDL_GetRenderDrawColor(renderer: PSDL_Renderer; r: pcuint8; g: pcuint8; b: pcuint8; a: pcuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderDrawColor' {$ENDIF} {$ENDIF}; - - {** - * Set the blend mode used for drawing operations (Fill and Line). - * - * renderer The renderer for which blend mode should be set. - * blendMode SDL_BlendMode to use for blending. - * - * 0 on success, or -1 on error - * - * If the blend mode is not supported, the closest supported mode is - * chosen. - * - * SDL_GetRenderDrawBlendMode() - *} -function SDL_SetRenderDrawBlendMode(renderer: PSDL_Renderer; blendMode: TSDL_BlendMode): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRenderDrawBlendMode' {$ENDIF} {$ENDIF}; - - {** - * Get the blend mode used for drawing operations. - * - * renderer The renderer from which blend mode should be queried. - * blendMode A pointer filled in with the current blend mode. - * - * 0 on success, or -1 on error - * - * SDL_SetRenderDrawBlendMode() - *} -function SDL_GetRenderDrawBlendMode(renderer: PSDL_Renderer; blendMode: PSDL_BlendMode): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderDrawBlendMode' {$ENDIF} {$ENDIF}; - - {** - * Clear the current rendering target with the drawing color - * - * This function clears the entire rendering target, ignoring the viewport. - * - * 0 on success, or -1 on error - *} -function SDL_RenderClear(renderer: PSDL_Renderer): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderClear' {$ENDIF} {$ENDIF}; - - {** - * Draw a point on the current rendering target. - * - * renderer The renderer which should draw a point. - * x The x coordinate of the point. - * y The y coordinate of the point. - * - * 0 on success, or -1 on error - *} -function SDL_RenderDrawPoint(renderer: PSDL_Renderer; x: cint32; y: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPoint' {$ENDIF} {$ENDIF}; - - {** - * Draw a point on the current rendering target. - * - * renderer The renderer which should draw a point. - * x The x coordinate of the point. - * y The y coordinate of the point. - * - * 0 on success, or -1 on error - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RenderDrawPointF_fun = function(renderer: PSDL_Renderer; x, y: single): cint32 cdecl; -Var - SDL_RenderDrawPointF : TSDL_RenderDrawPointF_fun = Nil; -{$else} - -function SDL_RenderDrawPointF(renderer: PSDL_Renderer; x, y: single): cint32 cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPointF' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Draw multiple points on the current rendering target. - * - * renderer The renderer which should draw multiple points. - * points The points to draw - * count The number of points to draw - * - * 0 on success, or -1 on error - *} -function SDL_RenderDrawPoints(renderer: PSDL_Renderer; points: PSDL_Point; count: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPoints' {$ENDIF} {$ENDIF}; - - {** - * Draw multiple points on the current rendering target. - * - * renderer The renderer which should draw multiple points. - * points The points to draw - * count The number of points to draw - * - * 0 on success, or -1 on error - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RenderDrawPointsF_fun = function(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl; -Var - SDL_RenderDrawPointsF : TSDL_RenderDrawPointsF_fun = Nil; -{$else} - -function SDL_RenderDrawPointsF(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPointsF' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Draw a line on the current rendering target. - * - * renderer The renderer which should draw a line. - * x1 The x coordinate of the start point. - * y1 The y coordinate of the start point. - * x2 The x coordinate of the end point. - * y2 The y coordinate of the end point. - * - * 0 on success, or -1 on error - *} -function SDL_RenderDrawLine(renderer: PSDL_Renderer; x1: cint32; y1: cint32; x2: cint32; y2: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLine' {$ENDIF} {$ENDIF}; - - {** - * Draw a line on the current rendering target. - * - * renderer The renderer which should draw a line. - * x1 The x coordinate of the start point. - * y1 The y coordinate of the start point. - * x2 The x coordinate of the end point. - * y2 The y coordinate of the end point. - * - * 0 on success, or -1 on error - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RenderDrawLineF_fun = function(renderer: PSDL_Renderer; x1, y1, x2, y2: single): cint32 cdecl; -Var - SDL_RenderDrawLineF : TSDL_RenderDrawLineF_fun = Nil; -{$else} - -function SDL_RenderDrawLineF(renderer: PSDL_Renderer; x1, y1, x2, y2: single): cint32 cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLineF' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * \brief Draw a series of connected lines on the current rendering target. - * - * \param renderer The renderer which should draw multiple lines. - * \param points The points along the lines - * \param count The number of points, drawing count-1 lines - * - * \return 0 on success, or -1 on error - *} -function SDL_RenderDrawLines(renderer: PSDL_Renderer; points: PSDL_Point; count: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLines' {$ENDIF} {$ENDIF}; - - {** - * Draw a series of connected lines on the current rendering target. - * - * renderer The renderer which should draw multiple lines. - * points The points along the lines - * count The number of points, drawing count-1 lines - * - * 0 on success, or -1 on error - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RenderDrawLinesF_fun = function(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl; -Var - SDL_RenderDrawLinesF : TSDL_RenderDrawLinesF_fun = Nil; -{$else} - -function SDL_RenderDrawLinesF(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLinesF' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Draw a rectangle on the current rendering target. - * - * renderer The renderer which should draw a rectangle. - * rect A pointer to the destination rectangle, or NULL to outline the entire rendering target. - * - * 0 on success, or -1 on error - *} -function SDL_RenderDrawRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRect' {$ENDIF} {$ENDIF}; - - {** - * Draw a rectangle on the current rendering target. - * - * renderer The renderer which should draw a rectangle. - * rect A pointer to the destination rectangle, or NULL to outline the entire rendering target. - * - * 0 on success, or -1 on error - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RenderDrawRectF_fun = function(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl; -Var - SDL_RenderDrawRectF : TSDL_RenderDrawRectF_fun = Nil; -{$else} - -function SDL_RenderDrawRectF(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRectF' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Draw some number of rectangles on the current rendering target. - * - * renderer The renderer which should draw multiple rectangles. - * rects A pointer to an array of destination rectangles. - * count The number of rectangles. - * - * 0 on success, or -1 on error - *} -function SDL_RenderDrawRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRects' {$ENDIF} {$ENDIF}; - - {** - * Draw some number of rectangles on the current rendering target. - * - * renderer The renderer which should draw multiple rectangles. - * rects A pointer to an array of destination rectangles. - * count The number of rectangles. - * - * 0 on success, or -1 on error - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RenderDrawRectsF_fun = function(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl; -Var - SDL_RenderDrawRectsF : TSDL_RenderDrawRectsF_fun = Nil; -{$else} - -function SDL_RenderDrawRectsF(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRectsF' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Fill a rectangle on the current rendering target with the drawing color. - * - * renderer The renderer which should fill a rectangle. - * rect A pointer to the destination rectangle, or NULL for the entire - * rendering target. - * - * 0 on success, or -1 on error - *} -function SDL_RenderFillRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRect' {$ENDIF} {$ENDIF}; - - {** - * Fill a rectangle on the current rendering target with the drawing color. - * - * renderer The renderer which should fill a rectangle. - * rect A pointer to the destination rectangle, or NULL for the entire rendering target. - * - * 0 on success, or -1 on error - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RenderFillRectF_fun = function(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl; -Var - SDL_RenderFillRectF : TSDL_RenderFillRectF_fun = Nil; -{$else} - -function SDL_RenderFillRectF(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRectF' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Fill some number of rectangles on the current rendering target with the drawing color. - * - * renderer The renderer which should fill multiple rectangles. - * rects A pointer to an array of destination rectangles. - * count The number of rectangles. - * - * 0 on success, or -1 on error - *} -function SDL_RenderFillRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRects' {$ENDIF} {$ENDIF}; - - {** - * Fill some number of rectangles on the current rendering target with the drawing color. - * - * renderer The renderer which should fill multiple rectangles. - * rects A pointer to an array of destination rectangles. - * count The number of rectangles. - * - * 0 on success, or -1 on error - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RenderFillRectsF_fun = function(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl; -Var - SDL_RenderFillRectsF : TSDL_RenderFillRectsF_fun = Nil; -{$else} - -function SDL_RenderFillRectsF(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRectsF' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Copy a portion of the texture to the current rendering target. - * - * renderer The renderer which should copy parts of a texture. - * texture The source texture. - * srcrect A pointer to the source rectangle, or NULL for the entire - * texture. - * dstrect A pointer to the destination rectangle, or NULL for the - * entire rendering target. - * - * 0 on success, or -1 on error - *} -function SDL_RenderCopy(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: PSDL_Rect; dstrect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopy' {$ENDIF} {$ENDIF}; - - {** - * Copy a portion of the texture to the current rendering target. - * - * renderer The renderer which should copy parts of a texture. - * texture The source texture. - * srcrect A pointer to the source rectangle, or NIL for the entire texture. - * dstrect A pointer to the destination rectangle, or NIL for the entire rendering target. - * - * 0 on success, or -1 on error - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RenderCopyF_fun = function(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: PSDL_Rect; dstrect: PSDL_FRect): cint32 cdecl; -Var - SDL_RenderCopyF : TSDL_RenderCopyF_fun = Nil; -{$else} - -function SDL_RenderCopyF(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: PSDL_Rect; dstrect: PSDL_FRect): cint32 cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopyF' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center - * - * renderer The renderer which should copy parts of a texture. - * texture The source texture. - * srcrect A pointer to the source rectangle, or NULL for the entire - * texture. - * dstrect A pointer to the destination rectangle, or NULL for the - * entire rendering target. - * angle An angle in degrees that indicates the rotation that will be applied to dstrect - * center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done aroud dstrect.w/2, dstrect.h/2) - * flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture - * - * 0 on success, or -1 on error - *} -function SDL_RenderCopyEx(renderer: PSDL_Renderer; texture: PSDL_Texture; const srcrect: PSDL_Rect; dstrect: PSDL_Rect; angle: cdouble; center: PSDL_Point; flip: TSDL_RenderFlip): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopyEx' {$ENDIF} {$ENDIF}; - - {** - * Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center - * - * renderer The renderer which should copy parts of a texture. - * texture The source texture. - * srcrect A pointer to the source rectangle, or NIL for the entire texture. - * dstrect A pointer to the destination rectangle, or NIL for the entire rendering target. - * angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction - * center A pointer to a point indicating the point around which dstrect will be rotated (if NIL, rotation will be done around dstrect.w/2, dstrect.h/2). - * flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture - * - * 0 on success, or -1 on error - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RenderCopyExF_fun = function(renderer: PSDL_Renderer; texture: PSDL_Texture; const srcrect: PSDL_Rect; dstrect: PSDL_FRect; angle: cdouble; center: PSDL_FPoint; flip: TSDL_RenderFlip): cint32 cdecl; -Var - SDL_RenderCopyExF : TSDL_RenderCopyExF_fun = Nil; -{$else} - -function SDL_RenderCopyExF(renderer: PSDL_Renderer; texture: PSDL_Texture; const srcrect: PSDL_Rect; dstrect: PSDL_FRect; angle: cdouble; center: PSDL_FPoint; flip: TSDL_RenderFlip): cint32 cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopyExF' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Render a list of triangles, optionally using a texture and indices into the - * vertex array. Color and alpha modulation is done per vertex. - * SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored. - *} -function SDL_RenderGeometry( - renderer: PSDL_Renderer; - texture: PSDL_Texture; - Const vertices: PSDL_Vertex; num_vertices: cint; - Const indices: Pcint; num_indices: cint -): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGeometry' {$ENDIF} {$ENDIF}; - -{** - * Render a list of triangles, optionally using a texture and indices into the - * vertex arrays. Color and alpha modulation is done per vertex. - * SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored. - *} -function SDL_RenderGeometryRaw( - renderer: PSDL_Renderer; - texture: PSDL_Texture; - Const xy: PSingle; xy_stride: cint; - Const color: PSDL_Color; color_stride: cint; - Const uv: PSingle; uv_stride: cint; - num_vertices: cint; - Const indices: Pointer; num_indices, size_indices: cint -): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGeometryRaw' {$ENDIF} {$ENDIF}; - - {** - * Read pixels from the current rendering target. - * - * renderer The renderer from which pixels should be read. - * rect A pointer to the rectangle to read, or NULL for the entire - * render target. - * format The desired format of the pixel data, or 0 to use the format - * of the rendering target - * pixels A pointer to be filled in with the pixel data - * pitch The pitch of the pixels parameter. - * - * 0 on success, or -1 if pixel reading is not supported. - * - * This is a very slow operation, and should not be used frequently. - *} -function SDL_RenderReadPixels(renderer: PSDL_Renderer; rect: PSDL_Rect; format: cuint32; pixels: Pointer; pitch: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderReadPixels' {$ENDIF} {$ENDIF}; - - {** - * Update the screen with rendering performed. - *} -procedure SDL_RenderPresent(renderer: PSDL_Renderer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderPresent' {$ENDIF} {$ENDIF}; - - {** - * Destroy the specified texture. - * - * SDL_CreateTexture() - * SDL_CreateTextureFromSurface() - *} -procedure SDL_DestroyTexture(texture: PSDL_Texture) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyTexture' {$ENDIF} {$ENDIF}; - - {** - * Destroy the rendering context for a window and free associated - * textures. - * - * SDL_CreateRenderer() - *} -procedure SDL_DestroyRenderer(renderer: PSDL_Renderer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyRenderer' {$ENDIF} {$ENDIF}; - -{** - * Force the rendering context to flush any pending commands to the underlying - * rendering API. - * - * You do not need to (and in fact, shouldn't) call this function unless you - * are planning to call into OpenGL/Direct3D/Metal/whatever directly in - * addition to using an SDL_Renderer. - * - * This is for a very-specific case: if you are using SDL's render API, you - * asked for a specific renderer backend (OpenGL, Direct3D, etc), you set - * SDL_HINT_RENDER_BATCHING to "1", and you plan to make OpenGL/D3D/whatever - * calls in addition to SDL render API calls. If all of this applies, you - * should call SDL_RenderFlush() between calls to SDL's render API and the - * low-level API you're using in cooperation. - * - * In all other cases, you can ignore this function. This is only here to get - * maximum performance out of a specific situation. In all other cases, SDL - * will do the right thing, perhaps at a performance loss. - * - * This function is first available in SDL 2.0.10, and is not needed in 2.0.9 - * and earlier, as earlier versions did not queue rendering commands at all, - * instead flushing them to the OS immediately. - *} -function SDL_RenderFlush(renderer: PSDL_Renderer): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFlush' {$ENDIF} {$ENDIF}; - - {** - * Bind the texture to the current OpenGL/ES/ES2 context for use with - * OpenGL instructions. - * - * texture The SDL texture to bind - * texw A pointer to a float that will be filled with the texture width - * texh A pointer to a float that will be filled with the texture height - * - * 0 on success, or -1 if the operation is not supported - *} -function SDL_GL_BindTexture(texture: PSDL_Texture; texw: pcfloat; texh: pcfloat): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_BindTexture' {$ENDIF} {$ENDIF}; - - {** - * Unbind a texture from the current OpenGL/ES/ES2 context. - * - * texture The SDL texture to unbind - * - * 0 on success, or -1 if the operation is not supported - *} -function SDL_GL_UnbindTexture(texture: PSDL_Texture): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_UnbindTexture' {$ENDIF} {$ENDIF}; - -{** - * Get the CAMetalLayer associated with the given Metal renderer. - * - * This function returns a raw Pointer, so SDL doesn't have to include Metal's headers, - * but it can be safely cast to a pointer to `CAMetalLayer`. - * - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RenderGetMetalLayer_fun = function(renderer: PSDL_Renderer): Pointer; cdecl; -Var - SDL_RenderGetMetalLayer : TSDL_RenderGetMetalLayer_fun = Nil; -{$else} - -function SDL_RenderGetMetalLayer(renderer: PSDL_Renderer): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetMetalLayer' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the Metal command encoder for the current frame - * - * This function returns a raw Pointer, so SDL doesn't have to include Metal's headers, - * but it can be safely cast to an `id`. - * - * Note that as of SDL 2.0.18, this will return NULL if Metal refuses to give - * SDL a drawable to render to, which might happen if the window is - * hidden/minimized/offscreen. This doesn't apply to command encoders for - * render targets, just the window's backbacker. Check your return values! - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RenderGetMetalCommandEncoder_fun = function(renderer: PSDL_Renderer): Pointer; cdecl; -Var - SDL_RenderGetMetalCommandEncoder : TSDL_RenderGetMetalCommandEncoder_fun = Nil; -{$else} - -function SDL_RenderGetMetalCommandEncoder(renderer: PSDL_Renderer): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetMetalCommandEncoder' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Toggle VSync of the given renderer. - *} -function SDL_RenderSetVSync(renderer: PSDL_Renderer; vsync: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetVSync' {$ENDIF} {$ENDIF}; - - {** - * Update a rectangle within a planar YV12 or IYUV texture with new pixel data. - * - * texture The texture to update - * rect A pointer to the rectangle of pixels to update, or NULL to update the entire texture. - * Yplane The raw pixel data for the Y plane. - * Ypitch The number of bytes between rows of pixel data for the Y plane. - * Uplane The raw pixel data for the U plane. - * Upitch The number of bytes between rows of pixel data for the U plane. - * Vplane The raw pixel data for the V plane. - * Vpitch The number of bytes between rows of pixel data for the V plane. - * - * 0 on success, or -1 if the texture is not valid. - * - * You can use SDL_UpdateTexture() as long as your pixel data is - * a contiguous block of Y and U/V planes in the proper order, but - * this function is available if your pixel data is not contiguous. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_UpdateYUVTexture_fun = function(texture: PSDL_Texture; rect: PSDL_Rect; Yplane: pcuint8; Ypitch: cint32; Uplane: pcuint8; UPitch: cint32; Vplane: pcuint8; VPitch: cint32):cint32; - cdecl; -Var - SDL_UpdateYUVTexture : TSDL_UpdateYUVTexture_fun = Nil; -{$else} - -function SDL_UpdateYUVTexture(texture: PSDL_Texture; rect: PSDL_Rect; Yplane: pcuint8; Ypitch: cint32; Uplane: pcuint8; UPitch: cint32; Vplane: pcuint8; VPitch: cint32):cint32; - cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateYUVTexture' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Update a rectangle within a planar NV12 or NV21 texture with new pixels. - * - * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous - * block of NV12/21 planes in the proper order, but this function is available - * if your pixel data is not contiguous. - *} -function SDL_UpdateNVTexture( - texture: PSDL_Texture; - Const rect: PSDL_Rect; - Const Yplane: Pcuint8; Ypitch: cint; - Const UVplane: Pcuint8; UVpitch: cint -): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateNVTexture' {$ENDIF} {$ENDIF}; +//from "sdl_renderer.h" + + {** + * Flags used when creating a rendering context + *} +const + SDL_RENDERER_SOFTWARE = $00000001; {**< The renderer is a software fallback *} + SDL_RENDERER_ACCELERATED = $00000002; {**< The renderer uses hardware + acceleration *} + SDL_RENDERER_PRESENTVSYNC = $00000004; {**< Present is synchronized + with the refresh rate *} + SDL_RENDERER_TARGETTEXTURE = $00000008; {**< The renderer supports + rendering to texture *} + +type + PPSDL_RendererFlags = ^PSDL_RendererFlags; + PSDL_RendererFlags = ^TSDL_RendererFlags; + TSDL_RendererFlags = Word; + + {** + * Information on the capabilities of a render driver or context. + *} + PPSDL_RendererInfo = ^PSDL_RendererInfo; + PSDL_RendererInfo = ^TSDL_RendererInfo; + TSDL_RendererInfo = record + name: PAnsiChar; {**< The name of the renderer *} + flags: cuint32; {**< Supported ::SDL_RendererFlags *} + num_texture_formats: cuint32; {**< The number of available texture formats *} + texture_formats: array[0..15] of cuint32; {**< The available texture formats *} + max_texture_width: cint32; {**< The maximimum texture width *} + max_texture_height: cint32; {**< The maximimum texture height *} + end; + + PPSDL_Vertex = ^PSDL_Vertex; + PSDL_Vertex = ^TSDL_Vertex; + TSDL_Vertex = record + position: TSDL_FPoint; + color: TSDL_Color; + tex_coord: TSDL_FPoint; + end; + +{** + * The scaling mode for a texture. + *} + PPSDL_ScaleMode = ^PSDL_ScaleMode; + PSDL_ScaleMode = ^TSDL_ScaleMode; + TSDL_ScaleMode = type cint; + +const + SDL_ScaleModeNearest = TSDL_ScaleMode(0); {**< nearest pixel sampling *} + SDL_ScaleModeLinear = TSDL_ScaleMode(1); {**< linear filtering *} + SDL_ScaleModeBest = TSDL_ScaleMode(2); {**< anisotropic filtering *} + + {** + * The access pattern allowed for a texture. + *} +type + PPSDL_TextureAccess = ^PSDL_TextureAccess; + PSDL_TextureAccess = ^TSDL_TextureAccess; + TSDL_TextureAccess = type cint; + +const + SDL_TEXTUREACCESS_STATIC = 0; {**< Changes rarely, not lockable *} + SDL_TEXTUREACCESS_STREAMING = 1; {**< Changes frequently, lockable *} + SDL_TEXTUREACCESS_TARGET = 2; {**< Texture can be used as a render target *} + +type + {** + * The texture channel modulation used in SDL_RenderCopy(). + *} + PPSDL_TextureModulate = ^PSDL_TextureModulate; + PSDL_TextureModulate = ^TSDL_TextureModulate; + TSDL_TextureModulate = type cint; + +const + SDL_TEXTUREMODULATE_NONE = TSDL_TextureModulate(0); {**< No modulation *} + SDL_TEXTUREMODULATE_COLOR = TSDL_TextureModulate(1); {**< srcC = srcC * color *} + SDL_TEXTUREMODULATE_ALPHA = TSDL_TextureModulate(2); {**< srcA = srcA * alpha *} + +type + {** + * Flip constants for SDL_RenderCopyEx + *} + PPSDL_RenderFlip = ^PSDL_RenderFlip; + PSDL_RenderFlip = ^TSDL_RenderFlip; + TSDL_RenderFlip = type cint; + +const + SDL_FLIP_NONE = TSDL_RenderFlip($0); {**< Do not flip *} + SDL_FLIP_HORIZONTAL = TSDL_RenderFlip($1); {**< flip horizontally *} + SDL_FLIP_VERTICAL = TSDL_RenderFlip($2); {**< flip vertically *} + +type + {** + * A structure representing rendering state + *} + + PPSDL_Renderer = ^PSDL_Renderer; + PSDL_Renderer = type Pointer; + + {** + * An efficient driver-specific representation of pixel data + *} + PPSDL_Texture = ^PSDL_Texture; + PSDL_Texture = type Pointer; + + {* Function prototypes *} + + {** + * Get the number of 2D rendering drivers available for the current + * display. + * + * A render driver is a set of code that handles rendering and texture + * management on a particular display. Normally there is only one, but + * some drivers may have several available with different capabilities. + * + * SDL_GetRenderDriverInfo() + * SDL_CreateRenderer() + *} +function SDL_GetNumRenderDrivers: cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumRenderDrivers' {$ENDIF} {$ENDIF}; + + {** + * Get information about a specific 2D rendering driver for the current + * display. + * + * index The index of the driver to query information about. + * info A pointer to an SDL_RendererInfo struct to be filled with + * information on the rendering driver. + * + * 0 on success, -1 if the index was out of range. + * + * SDL_CreateRenderer() + *} +function SDL_GetRenderDriverInfo(index: cint32; info: PSDL_RendererInfo): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderDriverInfo' {$ENDIF} {$ENDIF}; + + {** + * Create a window and default renderer + * + * width The width of the window + * height The height of the window + * window_flags The flags used to create the window + * window A pointer filled with the window, or NULL on error + * renderer A pointer filled with the renderer, or NULL on error + * + * 0 on success, or -1 on error + *} +function SDL_CreateWindowAndRenderer(width: cint32; height: cint32; window_flags: cuint32; window: PPSDL_Window; renderer: PPSDL_Renderer): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateWindowAndRenderer' {$ENDIF} {$ENDIF}; + + {** + * Create a 2D rendering context for a window. + * + * window The window where rendering is displayed. + * index The index of the rendering driver to initialize, or -1 to + * initialize the first one supporting the requested flags. + * flags ::SDL_RendererFlags. + * + * A valid rendering context or NULL if there was an error. + * + * SDL_CreateSoftwareRenderer() + * SDL_GetRendererInfo() + * SDL_DestroyRenderer() + *} +function SDL_CreateRenderer(window: PSDL_Window; index: cint32; flags: cuint32): PSDL_Renderer cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRenderer' {$ENDIF} {$ENDIF}; + + {** + * Create a 2D software rendering context for a surface. + * + * surface The surface where rendering is done. + * + * A valid rendering context or NULL if there was an error. + * + * SDL_CreateRenderer() + * SDL_DestroyRenderer() + *} +function SDL_CreateSoftwareRenderer(surface: PSDL_Surface): PSDL_Renderer cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateSoftwareRenderer' {$ENDIF} {$ENDIF}; + + {** + * Get the renderer associated with a window. + *} +function SDL_GetRenderer(window: PSDL_Window): PSDL_Renderer cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderer' {$ENDIF} {$ENDIF}; + +{** + * Get the window associated with a renderer. + *} +function SDL_RenderGetWindow(renderer: PSDL_Renderer): PSDL_Window; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetWindow' {$ENDIF} {$ENDIF}; + + {** + * Get information about a rendering context. + *} +function SDL_GetRendererInfo(renderer: PSDL_Renderer; info: PSDL_RendererInfo): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRendererInfo' {$ENDIF} {$ENDIF}; + + {** + * Get the output size of a rendering context. + *} +function SDL_GetRendererOutputSize(renderer: PSDL_Renderer; w: pcint; h: pcint): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRendererOutputSize' {$ENDIF} {$ENDIF}; + + {** + * Create a texture for a rendering context. + * + * renderer The renderer. + * format The format of the texture. + * access One of the enumerated values in ::SDL_TextureAccess. + * w The width of the texture in pixels. + * h The height of the texture in pixels. + * + * The created texture is returned, or 0 if no rendering context was + * active, the format was unsupported, or the width or height were out + * of range. + * + * SDL_QueryTexture() + * SDL_UpdateTexture() + * SDL_DestroyTexture() + *} +function SDL_CreateTexture(renderer: PSDL_Renderer; format: cuint32; access: cint32; w: cint32; h: cint32): PSDL_Texture cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateTexture' {$ENDIF} {$ENDIF}; + + {** + * Create a texture from an existing surface. + * + * renderer The renderer. + * surface The surface containing pixel data used to fill the texture. + * + * The created texture is returned, or 0 on error. + * + * The surface is not modified or freed by this function. + * + * SDL_QueryTexture() + * SDL_DestroyTexture() + *} +function SDL_CreateTextureFromSurface(renderer: PSDL_Renderer; surface: PSDL_Surface): PSDL_Texture cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateTextureFromSurface' {$ENDIF} {$ENDIF}; + + {** + * Query the attributes of a texture + * + * texture A texture to be queried. + * format A pointer filled in with the raw format of the texture. The + * actual format may differ, but pixel transfers will use this + * format. + * access A pointer filled in with the actual access to the texture. + * w A pointer filled in with the width of the texture in pixels. + * h A pointer filled in with the height of the texture in pixels. + * + * 0 on success, or -1 if the texture is not valid. + *} +function SDL_QueryTexture(texture: PSDL_Texture; format: pcuint32; access: pcint; w: pcint; h: pcint): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_QueryTexture' {$ENDIF} {$ENDIF}; + + {** + * Set an additional color value used in render copy operations. + * + * texture The texture to update. + * r The red color value multiplied into copy operations. + * g The green color value multiplied into copy operations. + * b The blue color value multiplied into copy operations. + * + * 0 on success, or -1 if the texture is not valid or color modulation + * is not supported. + * + * SDL_GetTextureColorMod() + *} +function SDL_SetTextureColorMod(texture: PSDL_Texture; r: cuint8; g: cuint8; b: cuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureColorMod' {$ENDIF} {$ENDIF}; + + {** + * Get the additional color value used in render copy operations. + * + * texture The texture to query. + * r A pointer filled in with the current red color value. + * g A pointer filled in with the current green color value. + * b A pointer filled in with the current blue color value. + * + * 0 on success, or -1 if the texture is not valid. + * + * SDL_SetTextureColorMod() + *} +function SDL_GetTextureColorMod(texture: PSDL_Texture; r: pcuint8; g: pcuint8; b: pcuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureColorMod' {$ENDIF} {$ENDIF}; + + {** + * Set an additional alpha value used in render copy operations. + * + * texture The texture to update. + * alpha The alpha value multiplied into copy operations. + * + * 0 on success, or -1 if the texture is not valid or alpha modulation + * is not supported. + * + * SDL_GetTextureAlphaMod() + *} +function SDL_SetTextureAlphaMod(texture: PSDL_Texture; alpha: cuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureAlphaMod' {$ENDIF} {$ENDIF}; + + {** + * Get the additional alpha value used in render copy operations. + * + * texture The texture to query. + * alpha A pointer filled in with the current alpha value. + * + * 0 on success, or -1 if the texture is not valid. + * + * SDL_SetTextureAlphaMod() + *} +function SDL_GetTextureAlphaMod(texture: PSDL_Texture; alpha: pcuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureAlphaMod' {$ENDIF} {$ENDIF}; + + {** + * Set the blend mode used for texture copy operations. + * + * texture The texture to update. + * blendMode ::SDL_BlendMode to use for texture blending. + * + * 0 on success, or -1 if the texture is not valid or the blend mode is + * not supported. + * + * If the blend mode is not supported, the closest supported mode is + * chosen. + * + * SDL_GetTextureBlendMode() + *} +function SDL_SetTextureBlendMode(texture: PSDL_Texture; blendMode: TSDL_BlendMode): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureBlendMode' {$ENDIF} {$ENDIF}; + + {** + * Get the blend mode used for texture copy operations. + * + * texture The texture to query. + * blendMode A pointer filled in with the current blend mode. + * + * 0 on success, or -1 if the texture is not valid. + * + * SDL_SetTextureBlendMode() + *} +function SDL_GetTextureBlendMode(texture: PSDL_Texture; blendMode: PSDL_BlendMode): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureBlendMode' {$ENDIF} {$ENDIF}; + +{** + * Set the scale mode used for texture scale operations. + * If the scale mode is not supported, the closest supported mode is chosen. + *} +function SDL_SetTextureScaleMode(texture: PSDL_Texture; scaleMode: TSDL_ScaleMode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureScaleMode' {$ENDIF} {$ENDIF}; + +{** + * Get the scale mode used for texture scale operations. + *} +function SDL_GetTextureScaleMode(texture: PSDL_Texture; scaleMode: PSDL_ScaleMode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureScaleMode' {$ENDIF} {$ENDIF}; + +{** + * Associate a user-specified pointer with a texture. + *} +function SDL_SetTextureUserData(texture: PSDL_Texture; userdata: Pointer): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureUserData' {$ENDIF} {$ENDIF}; + +{** + * Get the user-specified pointer associated with a texture. + *} +function SDL_GetTextureUserData(texture: PSDL_Texture): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureUserData' {$ENDIF} {$ENDIF}; + + {** + * Update the given texture rectangle with new pixel data. + * + * texture The texture to update + * rect A pointer to the rectangle of pixels to update, or NULL to + * update the entire texture. + * pixels The raw pixel data. + * pitch The number of bytes between rows of pixel data. + * + * 0 on success, or -1 if the texture is not valid. + * + * This is a fairly slow function. + *} +function SDL_UpdateTexture(texture: PSDL_Texture; rect: PSDL_Rect; pixels: Pointer; pitch: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateTexture' {$ENDIF} {$ENDIF}; + + {** + * Lock a portion of the texture for write-only pixel access. + * + * texture The texture to lock for access, which was created with + * SDL_TEXTUREACCESS_STREAMING. + * rect A pointer to the rectangle to lock for access. If the rect + * is NULL, the entire texture will be locked. + * pixels This is filled in with a pointer to the locked pixels, + * appropriately offset by the locked area. + * pitch This is filled in with the pitch of the locked pixels. + * + * 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING. + * + * SDL_UnlockTexture() + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LockTexture_fun = function(texture: PSDL_Texture; const rect: PSDL_Rect; pixels: PPointer; pitch: pcint): cint; cdecl; +Var + SDL_LockTexture : TSDL_LockTexture_fun = Nil; +{$else} + +function SDL_LockTexture(texture: PSDL_Texture; const rect: PSDL_Rect; pixels: PPointer; pitch: pcint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockTexture' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Lock a portion of the texture for write-only pixel access. + * Expose it as a SDL surface. + * + * \param texture The texture to lock for access, which was created with + * ::SDL_TEXTUREACCESS_STREAMING. + * \param rect A pointer to the rectangle to lock for access. If the rect + * is NULL, the entire texture will be locked. + * \param surface This is filled in with a SDL surface representing the locked area + * Surface is freed internally after calling SDL_UnlockTexture or SDL_DestroyTexture. + * + * \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING. + * + * \sa SDL_UnlockTexture() + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LockTextureToSurface_fun = function(texture: PSDL_Texture; const rect: PSDL_Rect; surface: PPSDL_Surface): cint; cdecl; +Var + SDL_LockTextureToSurface : TSDL_LockTextureToSurface_fun = Nil; +{$else} + +function SDL_LockTextureToSurface(texture: PSDL_Texture; const rect: PSDL_Rect; surface: PPSDL_Surface): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockTextureToSurface' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Unlock a texture, uploading the changes to video memory, if needed. + * + * SDL_LockTexture() + *} +procedure SDL_UnlockTexture(texture: PSDL_Texture) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockTexture' {$ENDIF} {$ENDIF}; + + {** + * Determines whether a window supports the use of render targets + * + * renderer The renderer that will be checked + * + * SDL_TRUE if supported, SDL_FALSE if not. + *} +function SDL_RenderTargetSupported(renderer: PSDL_Renderer): Boolean cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderTargetSupported' {$ENDIF} {$ENDIF}; + + {** + * Set a texture as the current rendering target. + * + * renderer The renderer. + * texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target + * + * 0 on success, or -1 on error + * + * SDL_GetRenderTarget() + *} +function SDL_SetRenderTarget(renderer: PSDL_Renderer; texture: PSDL_Texture): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRenderTarget' {$ENDIF} {$ENDIF}; + + {** + * Get the current render target or NULL for the default render target. + * + * The current render target + * + * SDL_SetRenderTarget() + *} +function SDL_GetRenderTarget(renderer: PSDL_Renderer): PSDL_Texture cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderTarget' {$ENDIF} {$ENDIF}; + + {** + * Set device independent resolution for rendering + * + * renderer The renderer for which resolution should be set. + * w The width of the logical resolution + * h The height of the logical resolution + * + * This function uses the viewport and scaling functionality to allow a fixed logical + * resolution for rendering, regardless of the actual output resolution. If the actual + * output resolution doesn't have the same aspect ratio the output rendering will be + * centered within the output display. + * + * If the output display is a window, mouse events in the window will be filtered + * and scaled so they seem to arrive within the logical resolution. + * + * If this function results in scaling or subpixel drawing by the + * rendering backend, it will be handled using the appropriate + * quality hints. + * + * SDL_RenderGetLogicalSize() + * SDL_RenderSetScale() + * SDL_RenderSetViewport() + *} +function SDL_RenderSetLogicalSize(renderer: PSDL_Renderer; w: cint32; h: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetLogicalSize' {$ENDIF} {$ENDIF}; + + {** + * Get device independent resolution for rendering + * + * renderer The renderer from which resolution should be queried. + * w A pointer filled with the width of the logical resolution + * h A pointer filled with the height of the logical resolution + * + * SDL_RenderSetLogicalSize() + *} +procedure SDL_RenderGetLogicalSize(renderer: PSDL_Renderer; w: pcint; h: pcint) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetLogicalSize' {$ENDIF} {$ENDIF}; + +{** + * \brief Set whether to force integer scales for resolution-independent rendering + * + * \param renderer The renderer for which integer scaling should be set. + * \param enable Enable or disable integer scaling + * + * This function restricts the logical viewport to integer values - that is, when + * a resolution is between two multiples of a logical size, the viewport size is + * rounded down to the lower multiple. + * + * \sa SDL_RenderSetLogicalSize() + *} +function SDL_RenderSetIntegerScale(renderer: PSDL_Renderer; enable : TSDL_bool): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetIntegerScale' {$ENDIF} {$ENDIF}; + +{** + * \brief Get whether integer scales are forced for resolution-independent rendering + * + * \param renderer The renderer from which integer scaling should be queried. + * + * \sa SDL_RenderSetIntegerScale() + *} +function SDL_RenderGetIntegerScale(renderer: PSDL_Renderer): TSDL_bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetIntegerScale' {$ENDIF} {$ENDIF}; + + {** + * Set the drawing area for rendering on the current target. + * + * renderer The renderer for which the drawing area should be set. + * rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target. + * + * The x,y of the viewport rect represents the origin for rendering. + * + * 0 on success, or -1 on error + * + * If the window associated with the renderer is resized, the viewport is automatically reset. + * + * SDL_RenderGetViewport() + * SDL_RenderSetLogicalSize() + *} +function SDL_RenderSetViewport(renderer: PSDL_Renderer; const rect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetViewport' {$ENDIF} {$ENDIF}; + + {** + * Get the drawing area for the current target. + * + * SDL_RenderSetViewport() + *} +procedure SDL_RenderGetViewport(renderer: PSDL_Renderer; rect: PSDL_Rect) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetViewport' {$ENDIF} {$ENDIF}; + + {** + * Set the clip rectangle for the current target. + * + * renderer The renderer for which clip rectangle should be set. + * rect A pointer to the rectangle to set as the clip rectangle, or + * NULL to disable clipping. + * + * 0 on success, or -1 on error + * + * SDL_RenderGetClipRect() + *} +function SDL_RenderSetClipRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetClipRect' {$ENDIF} {$ENDIF}; + + {** + * Get the clip rectangle for the current target. + * + * renderer The renderer from which clip rectangle should be queried. + * rect A pointer filled in with the current clip rectangle, or + * an empty rectangle if clipping is disabled. + * + * SDL_RenderSetClipRect() + *} +procedure SDL_RenderGetClipRect(renderer: PSDL_Renderer; rect: PSDL_Rect) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetClipRect' {$ENDIF} {$ENDIF}; + + {** + * \brief Get whether clipping is enabled on the given renderer. + * + * \param renderer The renderer from which clip state should be queried. + * + * \sa SDL_RenderGetClipRect() + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderIsClipEnabled_fun = function(renderer: PSDL_Renderer): TSDL_Bool; cdecl; +Var + SDL_RenderIsClipEnabled : TSDL_RenderIsClipEnabled_fun = Nil; +{$else} + +function SDL_RenderIsClipEnabled(renderer: PSDL_Renderer): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderIsClipEnabled' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the drawing scale for rendering on the current target. + * + * renderer The renderer for which the drawing scale should be set. + * scaleX The horizontal scaling factor + * scaleY The vertical scaling factor + * + * The drawing coordinates are scaled by the x/y scaling factors + * before they are used by the renderer. This allows resolution + * independent drawing with a single coordinate system. + * + * If this results in scaling or subpixel drawing by the + * rendering backend, it will be handled using the appropriate + * quality hints. For best results use integer scaling factors. + * + * SDL_RenderGetScale() + * SDL_RenderSetLogicalSize() + *} +function SDL_RenderSetScale(renderer: PSDL_Renderer; scaleX: cfloat; scaleY: cfloat): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetScale' {$ENDIF} {$ENDIF}; + + {** + * Get the drawing scale for the current target. + * + * renderer The renderer from which drawing scale should be queried. + * scaleX A pointer filled in with the horizontal scaling factor + * scaleY A pointer filled in with the vertical scaling factor + * + * SDL_RenderSetScale() + *} +procedure SDL_RenderGetScale(renderer: PSDL_Renderer; scaleX: pcfloat; scaleY: pcfloat) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetScale' {$ENDIF} {$ENDIF}; + +{** + * Get logical coordinates of point in renderer when given real coordinates of + * point in window. Logical coordinates will differ from real coordinates when + * render is scaled and logical renderer size set. + *} +procedure SDL_RenderWindowToLogical(renderer: PSDL_Renderer; windowX, windowY: cint; logicalX, logicalY: PSingle); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderWindowToLogical' {$ENDIF} {$ENDIF}; + +{** + * Get real coordinates of point in window when given logical coordinates of + * point in renderer. Logical coordinates will differ from real coordinate + * when render is scaled and logical renderer size set. + *} +procedure SDL_RenderLogicalToWindow(renderer: PSDL_Renderer; logicalX, logicalY: Single; windowX, windowY: Pcint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderLogicalToWindow' {$ENDIF} {$ENDIF}; + + {** + * Set the color used for drawing operations (Rect, Line and Clear). + * + * renderer The renderer for which drawing color should be set. + * r The red value used to draw on the rendering target. + * g The green value used to draw on the rendering target. + * b The blue value used to draw on the rendering target. + * a The alpha value used to draw on the rendering target, usually + * SDL_ALPHA_OPAQUE (255). + * + * 0 on success, or -1 on error + *} +function SDL_SetRenderDrawColor(renderer: PSDL_Renderer; r: cuint8; g: cuint8; b: cuint8; a: cuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRenderDrawColor' {$ENDIF} {$ENDIF}; + + {** + * Get the color used for drawing operations (Rect, Line and Clear). + * + * renderer The renderer from which drawing color should be queried. + * r A pointer to the red value used to draw on the rendering target. + * g A pointer to the green value used to draw on the rendering target. + * b A pointer to the blue value used to draw on the rendering target. + * a A pointer to the alpha value used to draw on the rendering target, + * usually SDL_ALPHA_OPAQUE (255). + * + * 0 on success, or -1 on error + *} +function SDL_GetRenderDrawColor(renderer: PSDL_Renderer; r: pcuint8; g: pcuint8; b: pcuint8; a: pcuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderDrawColor' {$ENDIF} {$ENDIF}; + + {** + * Set the blend mode used for drawing operations (Fill and Line). + * + * renderer The renderer for which blend mode should be set. + * blendMode SDL_BlendMode to use for blending. + * + * 0 on success, or -1 on error + * + * If the blend mode is not supported, the closest supported mode is + * chosen. + * + * SDL_GetRenderDrawBlendMode() + *} +function SDL_SetRenderDrawBlendMode(renderer: PSDL_Renderer; blendMode: TSDL_BlendMode): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRenderDrawBlendMode' {$ENDIF} {$ENDIF}; + + {** + * Get the blend mode used for drawing operations. + * + * renderer The renderer from which blend mode should be queried. + * blendMode A pointer filled in with the current blend mode. + * + * 0 on success, or -1 on error + * + * SDL_SetRenderDrawBlendMode() + *} +function SDL_GetRenderDrawBlendMode(renderer: PSDL_Renderer; blendMode: PSDL_BlendMode): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderDrawBlendMode' {$ENDIF} {$ENDIF}; + + {** + * Clear the current rendering target with the drawing color + * + * This function clears the entire rendering target, ignoring the viewport. + * + * 0 on success, or -1 on error + *} +function SDL_RenderClear(renderer: PSDL_Renderer): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderClear' {$ENDIF} {$ENDIF}; + + {** + * Draw a point on the current rendering target. + * + * renderer The renderer which should draw a point. + * x The x coordinate of the point. + * y The y coordinate of the point. + * + * 0 on success, or -1 on error + *} +function SDL_RenderDrawPoint(renderer: PSDL_Renderer; x: cint32; y: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPoint' {$ENDIF} {$ENDIF}; + + {** + * Draw a point on the current rendering target. + * + * renderer The renderer which should draw a point. + * x The x coordinate of the point. + * y The y coordinate of the point. + * + * 0 on success, or -1 on error + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderDrawPointF_fun = function(renderer: PSDL_Renderer; x, y: single): cint32 cdecl; +Var + SDL_RenderDrawPointF : TSDL_RenderDrawPointF_fun = Nil; +{$else} + +function SDL_RenderDrawPointF(renderer: PSDL_Renderer; x, y: single): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPointF' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Draw multiple points on the current rendering target. + * + * renderer The renderer which should draw multiple points. + * points The points to draw + * count The number of points to draw + * + * 0 on success, or -1 on error + *} +function SDL_RenderDrawPoints(renderer: PSDL_Renderer; points: PSDL_Point; count: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPoints' {$ENDIF} {$ENDIF}; + + {** + * Draw multiple points on the current rendering target. + * + * renderer The renderer which should draw multiple points. + * points The points to draw + * count The number of points to draw + * + * 0 on success, or -1 on error + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderDrawPointsF_fun = function(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl; +Var + SDL_RenderDrawPointsF : TSDL_RenderDrawPointsF_fun = Nil; +{$else} + +function SDL_RenderDrawPointsF(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPointsF' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Draw a line on the current rendering target. + * + * renderer The renderer which should draw a line. + * x1 The x coordinate of the start point. + * y1 The y coordinate of the start point. + * x2 The x coordinate of the end point. + * y2 The y coordinate of the end point. + * + * 0 on success, or -1 on error + *} +function SDL_RenderDrawLine(renderer: PSDL_Renderer; x1: cint32; y1: cint32; x2: cint32; y2: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLine' {$ENDIF} {$ENDIF}; + + {** + * Draw a line on the current rendering target. + * + * renderer The renderer which should draw a line. + * x1 The x coordinate of the start point. + * y1 The y coordinate of the start point. + * x2 The x coordinate of the end point. + * y2 The y coordinate of the end point. + * + * 0 on success, or -1 on error + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderDrawLineF_fun = function(renderer: PSDL_Renderer; x1, y1, x2, y2: single): cint32 cdecl; +Var + SDL_RenderDrawLineF : TSDL_RenderDrawLineF_fun = Nil; +{$else} + +function SDL_RenderDrawLineF(renderer: PSDL_Renderer; x1, y1, x2, y2: single): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLineF' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * \brief Draw a series of connected lines on the current rendering target. + * + * \param renderer The renderer which should draw multiple lines. + * \param points The points along the lines + * \param count The number of points, drawing count-1 lines + * + * \return 0 on success, or -1 on error + *} +function SDL_RenderDrawLines(renderer: PSDL_Renderer; points: PSDL_Point; count: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLines' {$ENDIF} {$ENDIF}; + + {** + * Draw a series of connected lines on the current rendering target. + * + * renderer The renderer which should draw multiple lines. + * points The points along the lines + * count The number of points, drawing count-1 lines + * + * 0 on success, or -1 on error + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderDrawLinesF_fun = function(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl; +Var + SDL_RenderDrawLinesF : TSDL_RenderDrawLinesF_fun = Nil; +{$else} + +function SDL_RenderDrawLinesF(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLinesF' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Draw a rectangle on the current rendering target. + * + * renderer The renderer which should draw a rectangle. + * rect A pointer to the destination rectangle, or NULL to outline the entire rendering target. + * + * 0 on success, or -1 on error + *} +function SDL_RenderDrawRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRect' {$ENDIF} {$ENDIF}; + + {** + * Draw a rectangle on the current rendering target. + * + * renderer The renderer which should draw a rectangle. + * rect A pointer to the destination rectangle, or NULL to outline the entire rendering target. + * + * 0 on success, or -1 on error + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderDrawRectF_fun = function(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl; +Var + SDL_RenderDrawRectF : TSDL_RenderDrawRectF_fun = Nil; +{$else} + +function SDL_RenderDrawRectF(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRectF' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Draw some number of rectangles on the current rendering target. + * + * renderer The renderer which should draw multiple rectangles. + * rects A pointer to an array of destination rectangles. + * count The number of rectangles. + * + * 0 on success, or -1 on error + *} +function SDL_RenderDrawRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRects' {$ENDIF} {$ENDIF}; + + {** + * Draw some number of rectangles on the current rendering target. + * + * renderer The renderer which should draw multiple rectangles. + * rects A pointer to an array of destination rectangles. + * count The number of rectangles. + * + * 0 on success, or -1 on error + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderDrawRectsF_fun = function(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl; +Var + SDL_RenderDrawRectsF : TSDL_RenderDrawRectsF_fun = Nil; +{$else} + +function SDL_RenderDrawRectsF(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRectsF' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Fill a rectangle on the current rendering target with the drawing color. + * + * renderer The renderer which should fill a rectangle. + * rect A pointer to the destination rectangle, or NULL for the entire + * rendering target. + * + * 0 on success, or -1 on error + *} +function SDL_RenderFillRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRect' {$ENDIF} {$ENDIF}; + + {** + * Fill a rectangle on the current rendering target with the drawing color. + * + * renderer The renderer which should fill a rectangle. + * rect A pointer to the destination rectangle, or NULL for the entire rendering target. + * + * 0 on success, or -1 on error + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderFillRectF_fun = function(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl; +Var + SDL_RenderFillRectF : TSDL_RenderFillRectF_fun = Nil; +{$else} + +function SDL_RenderFillRectF(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRectF' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Fill some number of rectangles on the current rendering target with the drawing color. + * + * renderer The renderer which should fill multiple rectangles. + * rects A pointer to an array of destination rectangles. + * count The number of rectangles. + * + * 0 on success, or -1 on error + *} +function SDL_RenderFillRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRects' {$ENDIF} {$ENDIF}; + + {** + * Fill some number of rectangles on the current rendering target with the drawing color. + * + * renderer The renderer which should fill multiple rectangles. + * rects A pointer to an array of destination rectangles. + * count The number of rectangles. + * + * 0 on success, or -1 on error + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderFillRectsF_fun = function(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl; +Var + SDL_RenderFillRectsF : TSDL_RenderFillRectsF_fun = Nil; +{$else} + +function SDL_RenderFillRectsF(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRectsF' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Copy a portion of the texture to the current rendering target. + * + * renderer The renderer which should copy parts of a texture. + * texture The source texture. + * srcrect A pointer to the source rectangle, or NULL for the entire + * texture. + * dstrect A pointer to the destination rectangle, or NULL for the + * entire rendering target. + * + * 0 on success, or -1 on error + *} +function SDL_RenderCopy(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: PSDL_Rect; dstrect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopy' {$ENDIF} {$ENDIF}; + + {** + * Copy a portion of the texture to the current rendering target. + * + * renderer The renderer which should copy parts of a texture. + * texture The source texture. + * srcrect A pointer to the source rectangle, or NIL for the entire texture. + * dstrect A pointer to the destination rectangle, or NIL for the entire rendering target. + * + * 0 on success, or -1 on error + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderCopyF_fun = function(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: PSDL_Rect; dstrect: PSDL_FRect): cint32 cdecl; +Var + SDL_RenderCopyF : TSDL_RenderCopyF_fun = Nil; +{$else} + +function SDL_RenderCopyF(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: PSDL_Rect; dstrect: PSDL_FRect): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopyF' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center + * + * renderer The renderer which should copy parts of a texture. + * texture The source texture. + * srcrect A pointer to the source rectangle, or NULL for the entire + * texture. + * dstrect A pointer to the destination rectangle, or NULL for the + * entire rendering target. + * angle An angle in degrees that indicates the rotation that will be applied to dstrect + * center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done aroud dstrect.w/2, dstrect.h/2) + * flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture + * + * 0 on success, or -1 on error + *} +function SDL_RenderCopyEx(renderer: PSDL_Renderer; texture: PSDL_Texture; const srcrect: PSDL_Rect; dstrect: PSDL_Rect; angle: cdouble; center: PSDL_Point; flip: TSDL_RenderFlip): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopyEx' {$ENDIF} {$ENDIF}; + + {** + * Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center + * + * renderer The renderer which should copy parts of a texture. + * texture The source texture. + * srcrect A pointer to the source rectangle, or NIL for the entire texture. + * dstrect A pointer to the destination rectangle, or NIL for the entire rendering target. + * angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction + * center A pointer to a point indicating the point around which dstrect will be rotated (if NIL, rotation will be done around dstrect.w/2, dstrect.h/2). + * flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture + * + * 0 on success, or -1 on error + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderCopyExF_fun = function(renderer: PSDL_Renderer; texture: PSDL_Texture; const srcrect: PSDL_Rect; dstrect: PSDL_FRect; angle: cdouble; center: PSDL_FPoint; flip: TSDL_RenderFlip): cint32 cdecl; +Var + SDL_RenderCopyExF : TSDL_RenderCopyExF_fun = Nil; +{$else} + +function SDL_RenderCopyExF(renderer: PSDL_Renderer; texture: PSDL_Texture; const srcrect: PSDL_Rect; dstrect: PSDL_FRect; angle: cdouble; center: PSDL_FPoint; flip: TSDL_RenderFlip): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopyExF' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Render a list of triangles, optionally using a texture and indices into the + * vertex array. Color and alpha modulation is done per vertex. + * SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored. + *} +function SDL_RenderGeometry( + renderer: PSDL_Renderer; + texture: PSDL_Texture; + Const vertices: PSDL_Vertex; num_vertices: cint; + Const indices: Pcint; num_indices: cint +): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGeometry' {$ENDIF} {$ENDIF}; + +{** + * Render a list of triangles, optionally using a texture and indices into the + * vertex arrays. Color and alpha modulation is done per vertex. + * SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored. + *} +function SDL_RenderGeometryRaw( + renderer: PSDL_Renderer; + texture: PSDL_Texture; + Const xy: PSingle; xy_stride: cint; + Const color: PSDL_Color; color_stride: cint; + Const uv: PSingle; uv_stride: cint; + num_vertices: cint; + Const indices: Pointer; num_indices, size_indices: cint +): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGeometryRaw' {$ENDIF} {$ENDIF}; + + {** + * Read pixels from the current rendering target. + * + * renderer The renderer from which pixels should be read. + * rect A pointer to the rectangle to read, or NULL for the entire + * render target. + * format The desired format of the pixel data, or 0 to use the format + * of the rendering target + * pixels A pointer to be filled in with the pixel data + * pitch The pitch of the pixels parameter. + * + * 0 on success, or -1 if pixel reading is not supported. + * + * This is a very slow operation, and should not be used frequently. + *} +function SDL_RenderReadPixels(renderer: PSDL_Renderer; rect: PSDL_Rect; format: cuint32; pixels: Pointer; pitch: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderReadPixels' {$ENDIF} {$ENDIF}; + + {** + * Update the screen with rendering performed. + *} +procedure SDL_RenderPresent(renderer: PSDL_Renderer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderPresent' {$ENDIF} {$ENDIF}; + + {** + * Destroy the specified texture. + * + * SDL_CreateTexture() + * SDL_CreateTextureFromSurface() + *} +procedure SDL_DestroyTexture(texture: PSDL_Texture) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyTexture' {$ENDIF} {$ENDIF}; + + {** + * Destroy the rendering context for a window and free associated + * textures. + * + * SDL_CreateRenderer() + *} +procedure SDL_DestroyRenderer(renderer: PSDL_Renderer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyRenderer' {$ENDIF} {$ENDIF}; + +{** + * Force the rendering context to flush any pending commands to the underlying + * rendering API. + * + * You do not need to (and in fact, shouldn't) call this function unless you + * are planning to call into OpenGL/Direct3D/Metal/whatever directly in + * addition to using an SDL_Renderer. + * + * This is for a very-specific case: if you are using SDL's render API, you + * asked for a specific renderer backend (OpenGL, Direct3D, etc), you set + * SDL_HINT_RENDER_BATCHING to "1", and you plan to make OpenGL/D3D/whatever + * calls in addition to SDL render API calls. If all of this applies, you + * should call SDL_RenderFlush() between calls to SDL's render API and the + * low-level API you're using in cooperation. + * + * In all other cases, you can ignore this function. This is only here to get + * maximum performance out of a specific situation. In all other cases, SDL + * will do the right thing, perhaps at a performance loss. + * + * This function is first available in SDL 2.0.10, and is not needed in 2.0.9 + * and earlier, as earlier versions did not queue rendering commands at all, + * instead flushing them to the OS immediately. + *} +function SDL_RenderFlush(renderer: PSDL_Renderer): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFlush' {$ENDIF} {$ENDIF}; + + {** + * Bind the texture to the current OpenGL/ES/ES2 context for use with + * OpenGL instructions. + * + * texture The SDL texture to bind + * texw A pointer to a float that will be filled with the texture width + * texh A pointer to a float that will be filled with the texture height + * + * 0 on success, or -1 if the operation is not supported + *} +function SDL_GL_BindTexture(texture: PSDL_Texture; texw: pcfloat; texh: pcfloat): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_BindTexture' {$ENDIF} {$ENDIF}; + + {** + * Unbind a texture from the current OpenGL/ES/ES2 context. + * + * texture The SDL texture to unbind + * + * 0 on success, or -1 if the operation is not supported + *} +function SDL_GL_UnbindTexture(texture: PSDL_Texture): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_UnbindTexture' {$ENDIF} {$ENDIF}; + +{** + * Get the CAMetalLayer associated with the given Metal renderer. + * + * This function returns a raw Pointer, so SDL doesn't have to include Metal's headers, + * but it can be safely cast to a pointer to `CAMetalLayer`. + * + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderGetMetalLayer_fun = function(renderer: PSDL_Renderer): Pointer; cdecl; +Var + SDL_RenderGetMetalLayer : TSDL_RenderGetMetalLayer_fun = Nil; +{$else} + +function SDL_RenderGetMetalLayer(renderer: PSDL_Renderer): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetMetalLayer' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the Metal command encoder for the current frame + * + * This function returns a raw Pointer, so SDL doesn't have to include Metal's headers, + * but it can be safely cast to an `id`. + * + * Note that as of SDL 2.0.18, this will return NULL if Metal refuses to give + * SDL a drawable to render to, which might happen if the window is + * hidden/minimized/offscreen. This doesn't apply to command encoders for + * render targets, just the window's backbacker. Check your return values! + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderGetMetalCommandEncoder_fun = function(renderer: PSDL_Renderer): Pointer; cdecl; +Var + SDL_RenderGetMetalCommandEncoder : TSDL_RenderGetMetalCommandEncoder_fun = Nil; +{$else} + +function SDL_RenderGetMetalCommandEncoder(renderer: PSDL_Renderer): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetMetalCommandEncoder' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Toggle VSync of the given renderer. + *} +function SDL_RenderSetVSync(renderer: PSDL_Renderer; vsync: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetVSync' {$ENDIF} {$ENDIF}; + + {** + * Update a rectangle within a planar YV12 or IYUV texture with new pixel data. + * + * texture The texture to update + * rect A pointer to the rectangle of pixels to update, or NULL to update the entire texture. + * Yplane The raw pixel data for the Y plane. + * Ypitch The number of bytes between rows of pixel data for the Y plane. + * Uplane The raw pixel data for the U plane. + * Upitch The number of bytes between rows of pixel data for the U plane. + * Vplane The raw pixel data for the V plane. + * Vpitch The number of bytes between rows of pixel data for the V plane. + * + * 0 on success, or -1 if the texture is not valid. + * + * You can use SDL_UpdateTexture() as long as your pixel data is + * a contiguous block of Y and U/V planes in the proper order, but + * this function is available if your pixel data is not contiguous. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UpdateYUVTexture_fun = function(texture: PSDL_Texture; rect: PSDL_Rect; Yplane: pcuint8; Ypitch: cint32; Uplane: pcuint8; UPitch: cint32; Vplane: pcuint8; VPitch: cint32):cint32; + cdecl; +Var + SDL_UpdateYUVTexture : TSDL_UpdateYUVTexture_fun = Nil; +{$else} + +function SDL_UpdateYUVTexture(texture: PSDL_Texture; rect: PSDL_Rect; Yplane: pcuint8; Ypitch: cint32; Uplane: pcuint8; UPitch: cint32; Vplane: pcuint8; VPitch: cint32):cint32; + cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateYUVTexture' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Update a rectangle within a planar NV12 or NV21 texture with new pixels. + * + * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous + * block of NV12/21 planes in the proper order, but this function is available + * if your pixel data is not contiguous. + *} +function SDL_UpdateNVTexture( + texture: PSDL_Texture; + Const rect: PSDL_Rect; + Const Yplane: Pcuint8; Ypitch: cint; + Const UVplane: Pcuint8; UVpitch: cint +): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateNVTexture' {$ENDIF} {$ENDIF}; diff --git a/units/sdlrwops.inc b/units/sdlrwops.inc index 2b1f6162..8f07ea0a 100644 --- a/units/sdlrwops.inc +++ b/units/sdlrwops.inc @@ -1,496 +1,496 @@ -//based on "sdl_rwops" (2.0.14) - -{** - * \file SDL_rwops.h - * - * This file provides a general interface for SDL to read and write - * data streams. It can easily be extended to files, memory, etc. - *} - -const - {* RWops Types *} - SDL_RWOPS_UNKNOWN = 0; {* Unknown stream type *} - SDL_RWOPS_WINFILE = 1; {* Win32 file *} - SDL_RWOPS_STDFILE = 2; {* Stdio file *} - SDL_RWOPS_JNIFILE = 3; {* Android asset *} - SDL_RWOPS_MEMORY = 4; {* Memory stream *} - SDL_RWOPS_MEMORY_RO = 5; {* Read-Only memory stream *} - -type - PPSDL_RWops = ^PSDL_RWops; - PSDL_RWops = ^TSDL_RWops; - - {** - * This is the read/write operation structure -- very basic. - *} - - {** - * Return the size of the file in this rwops, or -1 if unknown - *} - TSize = function(context: PSDL_RWops): cint64; {$IFNDEF GPC} cdecl; {$ENDIF} - - {** - * Seek to offset relative to whence, one of stdio's whence values: - * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END - * - * the final offset in the data stream, or -1 on error. - *} - TSeek = function(context: PSDL_RWops; offset: cint64; whence: cint): cint64; {$IFNDEF GPC} cdecl; {$ENDIF} - - {** - * Read up to maxnum objects each of size size from the data - * stream to the area pointed at by ptr. - * - * the number of objects read, or 0 at error or end of file. - *} - TRead = function(context: PSDL_RWops; ptr: Pointer; size: csize_t; maxnum: csize_t): csize_t; {$IFNDEF GPC} cdecl; {$ENDIF} - - {** - * Write exactly num objects each of size size from the area - * pointed at by ptr to data stream. - * - * the number of objects written, or 0 at error or end of file. - *} - TWrite = function(context: PSDL_RWops; const ptr: Pointer; size: csize_t; num: csize_t): csize_t; {$IFNDEF GPC} cdecl; {$ENDIF} - - {** - * Close and free an allocated SDL_RWops structure. - * - * 0 if successful or -1 on write error when flushing data. - *} - TClose = function(context: PSDL_RWops): cint; {$IFNDEF GPC} cdecl; {$ENDIF} - - // (2.0.14) Outdated decl., kept commented just in case. - {TAndroidIO = record - fileNameRef: Pointer; - inputStreamRef: Pointer; - readableByteChannelRef: Pointer; - readMethod: Pointer; - assetFileDescriptorRef: Pointer; - position: LongInt; - size: LongInt; - offset: LongInt; - fd: cint32; - end;} - - TAndroidIO = record - asset: Pointer; - end; - - TWindowsIOBuffer = record - data: Pointer; - size: csize_t; - left: csize_t; - end; - - TWindowsIO = record - append: TSDL_Bool; - h: Pointer; - buffer: TWindowsIOBuffer; - end; - - TStdio = record - autoclose: TSDL_Bool; - fp: file; // Is this appropriate? C FILE --> Pascal file - end; - - TMem = record - base: pcuint8; - here: pcuint8; - stop: pcuint8; - end; - - TUnknown = record - data1: Pointer; - data2: Pointer; - end; - - TSDL_RWops = packed record - size: TSize; - seek: TSeek; - read: TRead; - write: TWrite; - close: TClose; - - _type: cuint32; - - case hidden: cint of - {$IFDEF ANDROID} - 0: (androidio: TAndroidIO); - {$ENDIF} - {$IFDEF WINDOWS} - 0: (windowsio: TWindowsIO); - {$ENDIF} - 1: (stdio: TStdio); - 2: (mem: TMem); - 3: (unknown: TUnknown); - end; - -{** - * RWFrom functions - * - * Functions to create SDL_RWops structures from various data streams. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RWFromFile_fun = function(const _file: PAnsiChar; const mode: PAnsiChar): PSDL_RWops; cdecl; -Var - SDL_RWFromFile : TSDL_RWFromFile_fun = Nil; -{$else} - -function SDL_RWFromFile(const _file: PAnsiChar; const mode: PAnsiChar): PSDL_RWops; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWFromFile' {$ENDIF} {$ENDIF}; -{$endif} - -{function SDL_RWFromFP(fp: file; autoclose: TSDL_Bool): PSDL_RWops; cdecl; - external SDL_LibName;} //don't know if this works - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RWFromFP_fun = function(fp: Pointer; autoclose: TSDL_Bool): PSDL_RWops; cdecl; -Var - SDL_RWFromFP : TSDL_RWFromFP_fun = Nil; -{$else} - -function SDL_RWFromFP(fp: Pointer; autoclose: TSDL_Bool): PSDL_RWops; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWFromFP' {$ENDIF} {$ENDIF}; -{$endif} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RWFromMem_fun = function(mem: Pointer; size: cint): PSDL_RWops; cdecl; -Var - SDL_RWFromMem : TSDL_RWFromMem_fun = Nil; -{$else} - -function SDL_RWFromMem(mem: Pointer; size: cint): PSDL_RWops; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWFromMem' {$ENDIF} {$ENDIF}; -{$endif} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RWFromConstMem_fun = function(const mem: Pointer; size: cint): PSDL_RWops; cdecl; -Var - SDL_RWFromConstMem : TSDL_RWFromConstMem_fun = Nil; -{$else} - -function SDL_RWFromConstMem(const mem: Pointer; size: cint): PSDL_RWops; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWFromConstMem' {$ENDIF} {$ENDIF}; -{$endif} - -{*RWFrom functions*} -function SDL_AllocRW: PSDL_RWops; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AllocRW' {$ENDIF} {$ENDIF}; - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_FreeRW_proc = procedure(area: PSDL_RWops); cdecl; -Var - SDL_FreeRW : TSDL_FreeRW_proc = Nil; -{$else} - -procedure SDL_FreeRW(area: PSDL_RWops); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeRW' {$ENDIF} {$ENDIF}; -{$endif} - -const - RW_SEEK_SET = 0; {**< Seek from the beginning of data *} - RW_SEEK_CUR = 1; {**< Seek relative to current read point *} - RW_SEEK_END = 2; {**< Seek relative to the end of data *} - -{** - * Return the size of the file in this rwops, or -1 if unknown - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RWsize_fun = function(context: PSDL_RWops): cint64; cdecl; -Var - SDL_RWsize : TSDL_RWsize_fun = Nil; -{$else} - -function SDL_RWsize(context: PSDL_RWops): cint64; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWsize' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Seek to \c offset relative to \c whence, one of stdio's whence values: - * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END - * - * \return the final offset in the data stream, or -1 on error. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RWseek_fun = function(context: PSDL_RWops; offset: cint64; whence: cint): cint64; cdecl; -Var - SDL_RWseek : TSDL_RWseek_fun = Nil; -{$else} - -function SDL_RWseek(context: PSDL_RWops; offset: cint64; whence: cint): cint64; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_RWseek' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Return the current offset in the data stream, or -1 on error. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RWtell_fun = function(context: PSDL_RWops): cint64; cdecl; -Var - SDL_RWtell : TSDL_RWtell_fun = Nil; -{$else} - -function SDL_RWtell(context: PSDL_RWops): cint64; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWtell' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Read up to \c maxnum objects each of size \c size from the data - * stream to the area pointed at by \c ptr. - * - * \return the number of objects read, or 0 at error or end of file. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RWread_fun = function(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t): csize_t; cdecl; -Var - SDL_RWread : TSDL_RWread_fun = Nil; -{$else} - -function SDL_RWread(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t): csize_t; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWread' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Write exactly \c num objects each of size \c size from the area - * pointed at by \c ptr to data stream. - * - * \return the number of objects written, or 0 at error or end of file. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RWwrite_fun = function(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t): csize_t; cdecl; -Var - SDL_RWwrite : TSDL_RWwrite_fun = Nil; -{$else} - -function SDL_RWwrite(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t): csize_t; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWwrite' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Close and free an allocated SDL_RWops structure. - * - * \return 0 if successful or -1 on write error when flushing data. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RWclose_fun = function(context: PSDL_RWops): cint; cdecl; -Var - SDL_RWclose : TSDL_RWclose_fun = Nil; -{$else} - -function SDL_RWclose(context: PSDL_RWops): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWclose' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Load all the data from an SDL data stream. - * - * The data is allocated with a zero byte at the end (null terminated) - * - * If \c datasize is not NULL, it is filled with the size of the data read. - * - * If \c freesrc is non-zero, the stream will be closed after being read. - * - * The data should be freed with SDL_free(). - * - * \return the data, or NULL if there was an error. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LoadFile_RW_fun = function(src: PSDL_RWops; datasize: pcsize_t; freesrc: cint): Pointer; cdecl; -Var - SDL_LoadFile_RW : TSDL_LoadFile_RW_fun = Nil; -{$else} - -function SDL_LoadFile_RW(src: PSDL_RWops; datasize: pcsize_t; freesrc: cint): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadFile_RW' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Load an entire file. - * - * The data is allocated with a zero byte at the end (null terminated) - * - * If \c datasize is not NULL, it is filled with the size of the data read. - * - * If \c freesrc is non-zero, the stream will be closed after being read. - * - * The data should be freed with SDL_free(). - * - * \return the data, or NULL if there was an error. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LoadFile_fun = function(file_: PAnsiChar; datasize: pcsize_t): Pointer; cdecl; -Var - SDL_LoadFile : TSDL_LoadFile_fun = Nil; -{$else} - -function SDL_LoadFile(file_: PAnsiChar; datasize: pcsize_t): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadFile' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Read endian functions - * - * Read an item of the specified endianness and return in native format. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_ReadU8_fun = function(src: PSDL_RWops): cuint8; cdecl; -Var - SDL_ReadU8 : TSDL_ReadU8_fun = Nil; -{$else} - -function SDL_ReadU8(src: PSDL_RWops): cuint8; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadU8' {$ENDIF} {$ENDIF}; -{$endif} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_ReadLE16_fun = function(src: PSDL_RWops): cuint16; cdecl; -Var - SDL_ReadLE16 : TSDL_ReadLE16_fun = Nil; -{$else} - -function SDL_ReadLE16(src: PSDL_RWops): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadLE16' {$ENDIF} {$ENDIF}; -{$endif} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_ReadBE16_fun = function(src: PSDL_RWops): cuint16; cdecl; -Var - SDL_ReadBE16 : TSDL_ReadBE16_fun = Nil; -{$else} - -function SDL_ReadBE16(src: PSDL_RWops): cuint16; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadBE16' {$ENDIF} {$ENDIF}; -{$endif} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_ReadLE32_fun = function(src: PSDL_RWops): cuint32; cdecl; -Var - SDL_ReadLE32 : TSDL_ReadLE32_fun = Nil; -{$else} - -function SDL_ReadLE32(src: PSDL_RWops): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadLE32' {$ENDIF} {$ENDIF}; -{$endif} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_ReadBE32_fun = function(src: PSDL_RWops): cuint32; cdecl; -Var - SDL_ReadBE32 : TSDL_ReadBE32_fun = Nil; -{$else} - -function SDL_ReadBE32(src: PSDL_RWops): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadBE32' {$ENDIF} {$ENDIF}; -{$endif} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_ReadLE64_fun = function(src: PSDL_RWops): cuint64; cdecl; -Var - SDL_ReadLE64 : TSDL_ReadLE64_fun = Nil; -{$else} - -function SDL_ReadLE64(src: PSDL_RWops): cuint64; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadLE64' {$ENDIF} {$ENDIF}; -{$endif} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_ReadBE64_fun = function(src: PSDL_RWops): cuint64; cdecl; -Var - SDL_ReadBE64 : TSDL_ReadBE64_fun = Nil; -{$else} - -function SDL_ReadBE64(src: PSDL_RWops): cuint64; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadBE64' {$ENDIF} {$ENDIF}; -{$endif} -{ Read endian functions } - -{** - * Write endian functions - * - * Write an item of native format to the specified endianness. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_WriteU8_fun = function(dst: PSDL_RWops; value: cuint8): csize_t; cdecl; -Var - SDL_WriteU8 : TSDL_WriteU8_fun = Nil; -{$else} - -function SDL_WriteU8(dst: PSDL_RWops; value: cuint8): csize_t; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteU8' {$ENDIF} {$ENDIF}; -{$endif} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_WriteLE16_fun = function(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; -Var - SDL_WriteLE16 : TSDL_WriteLE16_fun = Nil; -{$else} - -function SDL_WriteLE16(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteLE16' {$ENDIF} {$ENDIF}; -{$endif} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_WriteBE16_fun = function(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; -Var - SDL_WriteBE16 : TSDL_WriteBE16_fun = Nil; -{$else} - -function SDL_WriteBE16(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteBE16' {$ENDIF} {$ENDIF}; -{$endif} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_WriteLE32_fun = function(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; -Var - SDL_WriteLE32 : TSDL_WriteLE32_fun = Nil; -{$else} - -function SDL_WriteLE32(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteLE32' {$ENDIF} {$ENDIF}; -{$endif} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_WriteBE32_fun = function(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; -Var - SDL_WriteBE32 : TSDL_WriteBE32_fun = Nil; -{$else} - -function SDL_WriteBE32(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteBE32' {$ENDIF} {$ENDIF}; -{$endif} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_WriteLE64_fun = function(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; -Var - SDL_WriteLE64 : TSDL_WriteLE64_fun = Nil; -{$else} - -function SDL_WriteLE64(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteLE64' {$ENDIF} {$ENDIF}; -{$endif} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_WriteBE64_fun = function(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; -Var - SDL_WriteBE64 : TSDL_WriteBE64_fun = Nil; -{$else} - -function SDL_WriteBE64(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteBE64' {$ENDIF} {$ENDIF}; -{$endif} -{ Write endian functions } +//based on "sdl_rwops" (2.0.14) + +{** + * \file SDL_rwops.h + * + * This file provides a general interface for SDL to read and write + * data streams. It can easily be extended to files, memory, etc. + *} + +const + {* RWops Types *} + SDL_RWOPS_UNKNOWN = 0; {* Unknown stream type *} + SDL_RWOPS_WINFILE = 1; {* Win32 file *} + SDL_RWOPS_STDFILE = 2; {* Stdio file *} + SDL_RWOPS_JNIFILE = 3; {* Android asset *} + SDL_RWOPS_MEMORY = 4; {* Memory stream *} + SDL_RWOPS_MEMORY_RO = 5; {* Read-Only memory stream *} + +type + PPSDL_RWops = ^PSDL_RWops; + PSDL_RWops = ^TSDL_RWops; + + {** + * This is the read/write operation structure -- very basic. + *} + + {** + * Return the size of the file in this rwops, or -1 if unknown + *} + TSize = function(context: PSDL_RWops): cint64; {$IFNDEF GPC} cdecl; {$ENDIF} + + {** + * Seek to offset relative to whence, one of stdio's whence values: + * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END + * + * the final offset in the data stream, or -1 on error. + *} + TSeek = function(context: PSDL_RWops; offset: cint64; whence: cint): cint64; {$IFNDEF GPC} cdecl; {$ENDIF} + + {** + * Read up to maxnum objects each of size size from the data + * stream to the area pointed at by ptr. + * + * the number of objects read, or 0 at error or end of file. + *} + TRead = function(context: PSDL_RWops; ptr: Pointer; size: csize_t; maxnum: csize_t): csize_t; {$IFNDEF GPC} cdecl; {$ENDIF} + + {** + * Write exactly num objects each of size size from the area + * pointed at by ptr to data stream. + * + * the number of objects written, or 0 at error or end of file. + *} + TWrite = function(context: PSDL_RWops; const ptr: Pointer; size: csize_t; num: csize_t): csize_t; {$IFNDEF GPC} cdecl; {$ENDIF} + + {** + * Close and free an allocated SDL_RWops structure. + * + * 0 if successful or -1 on write error when flushing data. + *} + TClose = function(context: PSDL_RWops): cint; {$IFNDEF GPC} cdecl; {$ENDIF} + + // (2.0.14) Outdated decl., kept commented just in case. + {TAndroidIO = record + fileNameRef: Pointer; + inputStreamRef: Pointer; + readableByteChannelRef: Pointer; + readMethod: Pointer; + assetFileDescriptorRef: Pointer; + position: LongInt; + size: LongInt; + offset: LongInt; + fd: cint32; + end;} + + TAndroidIO = record + asset: Pointer; + end; + + TWindowsIOBuffer = record + data: Pointer; + size: csize_t; + left: csize_t; + end; + + TWindowsIO = record + append: TSDL_Bool; + h: Pointer; + buffer: TWindowsIOBuffer; + end; + + TStdio = record + autoclose: TSDL_Bool; + fp: file; // Is this appropriate? C FILE --> Pascal file + end; + + TMem = record + base: pcuint8; + here: pcuint8; + stop: pcuint8; + end; + + TUnknown = record + data1: Pointer; + data2: Pointer; + end; + + TSDL_RWops = packed record + size: TSize; + seek: TSeek; + read: TRead; + write: TWrite; + close: TClose; + + _type: cuint32; + + case hidden: cint of + {$IFDEF ANDROID} + 0: (androidio: TAndroidIO); + {$ENDIF} + {$IFDEF WINDOWS} + 0: (windowsio: TWindowsIO); + {$ENDIF} + 1: (stdio: TStdio); + 2: (mem: TMem); + 3: (unknown: TUnknown); + end; + +{** + * RWFrom functions + * + * Functions to create SDL_RWops structures from various data streams. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RWFromFile_fun = function(const _file: PAnsiChar; const mode: PAnsiChar): PSDL_RWops; cdecl; +Var + SDL_RWFromFile : TSDL_RWFromFile_fun = Nil; +{$else} + +function SDL_RWFromFile(const _file: PAnsiChar; const mode: PAnsiChar): PSDL_RWops; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWFromFile' {$ENDIF} {$ENDIF}; +{$endif} + +{function SDL_RWFromFP(fp: file; autoclose: TSDL_Bool): PSDL_RWops; cdecl; + external SDL_LibName;} //don't know if this works + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RWFromFP_fun = function(fp: Pointer; autoclose: TSDL_Bool): PSDL_RWops; cdecl; +Var + SDL_RWFromFP : TSDL_RWFromFP_fun = Nil; +{$else} + +function SDL_RWFromFP(fp: Pointer; autoclose: TSDL_Bool): PSDL_RWops; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWFromFP' {$ENDIF} {$ENDIF}; +{$endif} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RWFromMem_fun = function(mem: Pointer; size: cint): PSDL_RWops; cdecl; +Var + SDL_RWFromMem : TSDL_RWFromMem_fun = Nil; +{$else} + +function SDL_RWFromMem(mem: Pointer; size: cint): PSDL_RWops; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWFromMem' {$ENDIF} {$ENDIF}; +{$endif} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RWFromConstMem_fun = function(const mem: Pointer; size: cint): PSDL_RWops; cdecl; +Var + SDL_RWFromConstMem : TSDL_RWFromConstMem_fun = Nil; +{$else} + +function SDL_RWFromConstMem(const mem: Pointer; size: cint): PSDL_RWops; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWFromConstMem' {$ENDIF} {$ENDIF}; +{$endif} + +{*RWFrom functions*} +function SDL_AllocRW: PSDL_RWops; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AllocRW' {$ENDIF} {$ENDIF}; + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_FreeRW_proc = procedure(area: PSDL_RWops); cdecl; +Var + SDL_FreeRW : TSDL_FreeRW_proc = Nil; +{$else} + +procedure SDL_FreeRW(area: PSDL_RWops); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeRW' {$ENDIF} {$ENDIF}; +{$endif} + +const + RW_SEEK_SET = 0; {**< Seek from the beginning of data *} + RW_SEEK_CUR = 1; {**< Seek relative to current read point *} + RW_SEEK_END = 2; {**< Seek relative to the end of data *} + +{** + * Return the size of the file in this rwops, or -1 if unknown + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RWsize_fun = function(context: PSDL_RWops): cint64; cdecl; +Var + SDL_RWsize : TSDL_RWsize_fun = Nil; +{$else} + +function SDL_RWsize(context: PSDL_RWops): cint64; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWsize' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Seek to \c offset relative to \c whence, one of stdio's whence values: + * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END + * + * \return the final offset in the data stream, or -1 on error. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RWseek_fun = function(context: PSDL_RWops; offset: cint64; whence: cint): cint64; cdecl; +Var + SDL_RWseek : TSDL_RWseek_fun = Nil; +{$else} + +function SDL_RWseek(context: PSDL_RWops; offset: cint64; whence: cint): cint64; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_RWseek' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Return the current offset in the data stream, or -1 on error. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RWtell_fun = function(context: PSDL_RWops): cint64; cdecl; +Var + SDL_RWtell : TSDL_RWtell_fun = Nil; +{$else} + +function SDL_RWtell(context: PSDL_RWops): cint64; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWtell' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Read up to \c maxnum objects each of size \c size from the data + * stream to the area pointed at by \c ptr. + * + * \return the number of objects read, or 0 at error or end of file. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RWread_fun = function(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t): csize_t; cdecl; +Var + SDL_RWread : TSDL_RWread_fun = Nil; +{$else} + +function SDL_RWread(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t): csize_t; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWread' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Write exactly \c num objects each of size \c size from the area + * pointed at by \c ptr to data stream. + * + * \return the number of objects written, or 0 at error or end of file. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RWwrite_fun = function(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t): csize_t; cdecl; +Var + SDL_RWwrite : TSDL_RWwrite_fun = Nil; +{$else} + +function SDL_RWwrite(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t): csize_t; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWwrite' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Close and free an allocated SDL_RWops structure. + * + * \return 0 if successful or -1 on write error when flushing data. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RWclose_fun = function(context: PSDL_RWops): cint; cdecl; +Var + SDL_RWclose : TSDL_RWclose_fun = Nil; +{$else} + +function SDL_RWclose(context: PSDL_RWops): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWclose' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Load all the data from an SDL data stream. + * + * The data is allocated with a zero byte at the end (null terminated) + * + * If \c datasize is not NULL, it is filled with the size of the data read. + * + * If \c freesrc is non-zero, the stream will be closed after being read. + * + * The data should be freed with SDL_free(). + * + * \return the data, or NULL if there was an error. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LoadFile_RW_fun = function(src: PSDL_RWops; datasize: pcsize_t; freesrc: cint): Pointer; cdecl; +Var + SDL_LoadFile_RW : TSDL_LoadFile_RW_fun = Nil; +{$else} + +function SDL_LoadFile_RW(src: PSDL_RWops; datasize: pcsize_t; freesrc: cint): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadFile_RW' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Load an entire file. + * + * The data is allocated with a zero byte at the end (null terminated) + * + * If \c datasize is not NULL, it is filled with the size of the data read. + * + * If \c freesrc is non-zero, the stream will be closed after being read. + * + * The data should be freed with SDL_free(). + * + * \return the data, or NULL if there was an error. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LoadFile_fun = function(file_: PAnsiChar; datasize: pcsize_t): Pointer; cdecl; +Var + SDL_LoadFile : TSDL_LoadFile_fun = Nil; +{$else} + +function SDL_LoadFile(file_: PAnsiChar; datasize: pcsize_t): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadFile' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Read endian functions + * + * Read an item of the specified endianness and return in native format. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ReadU8_fun = function(src: PSDL_RWops): cuint8; cdecl; +Var + SDL_ReadU8 : TSDL_ReadU8_fun = Nil; +{$else} + +function SDL_ReadU8(src: PSDL_RWops): cuint8; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadU8' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ReadLE16_fun = function(src: PSDL_RWops): cuint16; cdecl; +Var + SDL_ReadLE16 : TSDL_ReadLE16_fun = Nil; +{$else} + +function SDL_ReadLE16(src: PSDL_RWops): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadLE16' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ReadBE16_fun = function(src: PSDL_RWops): cuint16; cdecl; +Var + SDL_ReadBE16 : TSDL_ReadBE16_fun = Nil; +{$else} + +function SDL_ReadBE16(src: PSDL_RWops): cuint16; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadBE16' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ReadLE32_fun = function(src: PSDL_RWops): cuint32; cdecl; +Var + SDL_ReadLE32 : TSDL_ReadLE32_fun = Nil; +{$else} + +function SDL_ReadLE32(src: PSDL_RWops): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadLE32' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ReadBE32_fun = function(src: PSDL_RWops): cuint32; cdecl; +Var + SDL_ReadBE32 : TSDL_ReadBE32_fun = Nil; +{$else} + +function SDL_ReadBE32(src: PSDL_RWops): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadBE32' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ReadLE64_fun = function(src: PSDL_RWops): cuint64; cdecl; +Var + SDL_ReadLE64 : TSDL_ReadLE64_fun = Nil; +{$else} + +function SDL_ReadLE64(src: PSDL_RWops): cuint64; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadLE64' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ReadBE64_fun = function(src: PSDL_RWops): cuint64; cdecl; +Var + SDL_ReadBE64 : TSDL_ReadBE64_fun = Nil; +{$else} + +function SDL_ReadBE64(src: PSDL_RWops): cuint64; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadBE64' {$ENDIF} {$ENDIF}; +{$endif} +{ Read endian functions } + +{** + * Write endian functions + * + * Write an item of native format to the specified endianness. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WriteU8_fun = function(dst: PSDL_RWops; value: cuint8): csize_t; cdecl; +Var + SDL_WriteU8 : TSDL_WriteU8_fun = Nil; +{$else} + +function SDL_WriteU8(dst: PSDL_RWops; value: cuint8): csize_t; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteU8' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WriteLE16_fun = function(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; +Var + SDL_WriteLE16 : TSDL_WriteLE16_fun = Nil; +{$else} + +function SDL_WriteLE16(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteLE16' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WriteBE16_fun = function(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; +Var + SDL_WriteBE16 : TSDL_WriteBE16_fun = Nil; +{$else} + +function SDL_WriteBE16(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteBE16' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WriteLE32_fun = function(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; +Var + SDL_WriteLE32 : TSDL_WriteLE32_fun = Nil; +{$else} + +function SDL_WriteLE32(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteLE32' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WriteBE32_fun = function(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; +Var + SDL_WriteBE32 : TSDL_WriteBE32_fun = Nil; +{$else} + +function SDL_WriteBE32(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteBE32' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WriteLE64_fun = function(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; +Var + SDL_WriteLE64 : TSDL_WriteLE64_fun = Nil; +{$else} + +function SDL_WriteLE64(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteLE64' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WriteBE64_fun = function(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; +Var + SDL_WriteBE64 : TSDL_WriteBE64_fun = Nil; +{$else} + +function SDL_WriteBE64(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteBE64' {$ENDIF} {$ENDIF}; +{$endif} +{ Write endian functions } diff --git a/units/sdlscancode.inc b/units/sdlscancode.inc index a621ea71..13aafe9c 100644 --- a/units/sdlscancode.inc +++ b/units/sdlscancode.inc @@ -1,394 +1,394 @@ -//from "sdl_scancode.h" - - {** - * The SDL keyboard scancode representation. - * - * Values of this type are used to represent keyboard keys, among other places - * in the SDL_Keysym.scancode key.keysym.scancode \endlink field of the - * SDL_Event structure. - * - * The values in this enumeration are based on the USB usage page standard: - * https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf - *} -type - PPSDL_ScanCode = ^PSDL_ScanCode; - PSDL_ScanCode = ^TSDL_ScanCode; - TSDL_ScanCode = type cint; - -const - SDL_SCANCODE_UNKNOWN = TSDL_ScanCode(0); - - {** - * Usage page $07 - * - * These values are from usage page $07 (USB keyboard page). - *} - - SDL_SCANCODE_A = TSDL_ScanCode(4); - SDL_SCANCODE_B = TSDL_ScanCode(5); - SDL_SCANCODE_C = TSDL_ScanCode(6); - SDL_SCANCODE_D = TSDL_ScanCode(7); - SDL_SCANCODE_E = TSDL_ScanCode(8); - SDL_SCANCODE_F = TSDL_ScanCode(9); - SDL_SCANCODE_G = TSDL_ScanCode(10); - SDL_SCANCODE_H = TSDL_ScanCode(11); - SDL_SCANCODE_I = TSDL_ScanCode(12); - SDL_SCANCODE_J = TSDL_ScanCode(13); - SDL_SCANCODE_K = TSDL_ScanCode(14); - SDL_SCANCODE_L = TSDL_ScanCode(15); - SDL_SCANCODE_M = TSDL_ScanCode(16); - SDL_SCANCODE_N = TSDL_ScanCode(17); - SDL_SCANCODE_O = TSDL_ScanCode(18); - SDL_SCANCODE_P = TSDL_ScanCode(19); - SDL_SCANCODE_Q = TSDL_ScanCode(20); - SDL_SCANCODE_R = TSDL_ScanCode(21); - SDL_SCANCODE_S = TSDL_ScanCode(22); - SDL_SCANCODE_T = TSDL_ScanCode(23); - SDL_SCANCODE_U = TSDL_ScanCode(24); - SDL_SCANCODE_V = TSDL_ScanCode(25); - SDL_SCANCODE_W = TSDL_ScanCode(26); - SDL_SCANCODE_X = TSDL_ScanCode(27); - SDL_SCANCODE_Y = TSDL_ScanCode(28); - SDL_SCANCODE_Z = TSDL_ScanCode(29); - - SDL_SCANCODE_1 = TSDL_ScanCode(30); - SDL_SCANCODE_2 = TSDL_ScanCode(31); - SDL_SCANCODE_3 = TSDL_ScanCode(32); - SDL_SCANCODE_4 = TSDL_ScanCode(33); - SDL_SCANCODE_5 = TSDL_ScanCode(34); - SDL_SCANCODE_6 = TSDL_ScanCode(35); - SDL_SCANCODE_7 = TSDL_ScanCode(36); - SDL_SCANCODE_8 = TSDL_ScanCode(37); - SDL_SCANCODE_9 = TSDL_ScanCode(38); - SDL_SCANCODE_0 = TSDL_ScanCode(39); - - SDL_SCANCODE_RETURN = TSDL_ScanCode(40); - SDL_SCANCODE_ESCAPE = TSDL_ScanCode(41); - SDL_SCANCODE_BACKSPACE = TSDL_ScanCode(42); - SDL_SCANCODE_TAB = TSDL_ScanCode(43); - SDL_SCANCODE_SPACE = TSDL_ScanCode(44); - - SDL_SCANCODE_MINUS = TSDL_ScanCode(45); - SDL_SCANCODE_EQUALS = TSDL_ScanCode(46); - SDL_SCANCODE_LEFTBRACKET = TSDL_ScanCode(47); - SDL_SCANCODE_RIGHTBRACKET = TSDL_ScanCode(48); - SDL_SCANCODE_BACKSLASH = TSDL_ScanCode(49); {**< Located at the lower left of the return - * key on ISO keyboards and at the right end - * of the QWERTY row on ANSI keyboards. - * Produces REVERSE SOLIDUS (backslash) and - * VERTICAL LINE in a US layout; REVERSE - * SOLIDUS and VERTICAL LINE in a UK Mac - * layout; NUMBER SIGN and TILDE in a UK - * Windows layout; DOLLAR SIGN and POUND SIGN - * in a Swiss German layout; NUMBER SIGN and - * APOSTROPHE in a German layout; GRAVE - * ACCENT and POUND SIGN in a French Mac - * layout; and ASTERISK and MICRO SIGN in a - * French Windows layout. - *} - SDL_SCANCODE_NONUSHASH = TSDL_ScanCode(50); {**< ISO USB keyboards actually use this code - * instead of 49 for the same key; but all - * OSes I've seen treat the two codes - * identically. So; as an implementor; unless - * your keyboard generates both of those - * codes and your OS treats them differently; - * you should generate SDL_SCANCODE_BACKSLASH - * instead of this code. As a user; you - * should not rely on this code because SDL - * will never generate it with most (all?) - * keyboards. - *} - SDL_SCANCODE_SEMICOLON = TSDL_ScanCode(51); - SDL_SCANCODE_APOSTROPHE = TSDL_ScanCode(52); - SDL_SCANCODE_GRAVE = TSDL_ScanCode(53); {**< Located in the top left corner (on both ANSI - * and ISO keyboards). Produces GRAVE ACCENT and - * TILDE in a US Windows layout and in US and UK - * Mac layouts on ANSI keyboards; GRAVE ACCENT - * and NOT SIGN in a UK Windows layout; SECTION - * SIGN and PLUS-MINUS SIGN in US and UK Mac - * layouts on ISO keyboards; SECTION SIGN and - * DEGREE SIGN in a Swiss German layout (Mac: - * only on ISO keyboards); CIRCUMFLEX ACCENT and - * DEGREE SIGN in a German layout (Mac: only on - * ISO keyboards); SUPERSCRIPT TWO and TILDE in a - * French Windows layout; COMMERCIAL AT and - * NUMBER SIGN in a French Mac layout on ISO - * keyboards; and LESS-THAN SIGN and GREATER-THAN - * SIGN in a Swiss German; German; or French Mac - * layout on ANSI keyboards. - *} - SDL_SCANCODE_COMMA = TSDL_ScanCode(54); - SDL_SCANCODE_PERIOD = TSDL_ScanCode(55); - SDL_SCANCODE_SLASH = TSDL_ScanCode(56); - - SDL_SCANCODE_CAPSLOCK = TSDL_ScanCode(57); - - SDL_SCANCODE_F1 = TSDL_ScanCode(58); - SDL_SCANCODE_F2 = TSDL_ScanCode(59); - SDL_SCANCODE_F3 = TSDL_ScanCode(60); - SDL_SCANCODE_F4 = TSDL_ScanCode(61); - SDL_SCANCODE_F5 = TSDL_ScanCode(62); - SDL_SCANCODE_F6 = TSDL_ScanCode(63); - SDL_SCANCODE_F7 = TSDL_ScanCode(64); - SDL_SCANCODE_F8 = TSDL_ScanCode(65); - SDL_SCANCODE_F9 = TSDL_ScanCode(66); - SDL_SCANCODE_F10 = TSDL_ScanCode(67); - SDL_SCANCODE_F11 = TSDL_ScanCode(68); - SDL_SCANCODE_F12 = TSDL_ScanCode(69); - - SDL_SCANCODE_PRINTSCREEN = TSDL_ScanCode(70); - SDL_SCANCODE_SCROLLLOCK = TSDL_ScanCode(71); - SDL_SCANCODE_PAUSE = TSDL_ScanCode(72); - SDL_SCANCODE_INSERT = TSDL_ScanCode(73); {**< insert on PC; help on some Mac keyboards (but - does send code 73; not 117) *} - SDL_SCANCODE_HOME = TSDL_ScanCode(74); - SDL_SCANCODE_PAGEUP = TSDL_ScanCode(75); - SDL_SCANCODE_DELETE = TSDL_ScanCode(76); - SDL_SCANCODE_END = TSDL_ScanCode(77); - SDL_SCANCODE_PAGEDOWN = TSDL_ScanCode(78); - SDL_SCANCODE_RIGHT = TSDL_ScanCode(79); - SDL_SCANCODE_LEFT = TSDL_ScanCode(80); - SDL_SCANCODE_DOWN = TSDL_ScanCode(81); - SDL_SCANCODE_UP = TSDL_ScanCode(82); - - SDL_SCANCODE_NUMLOCKCLEAR = TSDL_ScanCode(83); {**< num lock on PC; clear on Mac keyboards - *} - SDL_SCANCODE_KP_DIVIDE = TSDL_ScanCode(84); - SDL_SCANCODE_KP_MULTIPLY = TSDL_ScanCode(85); - SDL_SCANCODE_KP_MINUS = TSDL_ScanCode(86); - SDL_SCANCODE_KP_PLUS = TSDL_ScanCode(87); - SDL_SCANCODE_KP_ENTER = TSDL_ScanCode(88); - SDL_SCANCODE_KP_1 = TSDL_ScanCode(89); - SDL_SCANCODE_KP_2 = TSDL_ScanCode(90); - SDL_SCANCODE_KP_3 = TSDL_ScanCode(91); - SDL_SCANCODE_KP_4 = TSDL_ScanCode(92); - SDL_SCANCODE_KP_5 = TSDL_ScanCode(93); - SDL_SCANCODE_KP_6 = TSDL_ScanCode(94); - SDL_SCANCODE_KP_7 = TSDL_ScanCode(95); - SDL_SCANCODE_KP_8 = TSDL_ScanCode(96); - SDL_SCANCODE_KP_9 = TSDL_ScanCode(97); - SDL_SCANCODE_KP_0 = TSDL_ScanCode(98); - SDL_SCANCODE_KP_PERIOD = TSDL_ScanCode(99); - - SDL_SCANCODE_NONUSBACKSLASH = TSDL_ScanCode(100); {**< This is the additional key that ISO - * keyboards have over ANSI ones; - * located between left shift and Y. - * Produces GRAVE ACCENT and TILDE in a - * US or UK Mac layout; REVERSE SOLIDUS - * (backslash) and VERTICAL LINE in a - * US or UK Windows layout; and - * LESS-THAN SIGN and GREATER-THAN SIGN - * in a Swiss German; German; or French - * layout. *} - SDL_SCANCODE_APPLICATION = TSDL_ScanCode(101); {**< windows contextual menu; compose *} - SDL_SCANCODE_POWER = TSDL_ScanCode(102); {**< The USB document says this is a status flag; - * not a physical key - but some Mac keyboards - * do have a power key. *} - SDL_SCANCODE_KP_EQUALS = TSDL_ScanCode(103); - SDL_SCANCODE_F13 = TSDL_ScanCode(104); - SDL_SCANCODE_F14 = TSDL_ScanCode(105); - SDL_SCANCODE_F15 = TSDL_ScanCode(106); - SDL_SCANCODE_F16 = TSDL_ScanCode(107); - SDL_SCANCODE_F17 = TSDL_ScanCode(108); - SDL_SCANCODE_F18 = TSDL_ScanCode(109); - SDL_SCANCODE_F19 = TSDL_ScanCode(110); - SDL_SCANCODE_F20 = TSDL_ScanCode(111); - SDL_SCANCODE_F21 = TSDL_ScanCode(112); - SDL_SCANCODE_F22 = TSDL_ScanCode(113); - SDL_SCANCODE_F23 = TSDL_ScanCode(114); - SDL_SCANCODE_F24 = TSDL_ScanCode(115); - SDL_SCANCODE_EXECUTE = TSDL_ScanCode(116); - SDL_SCANCODE_HELP = TSDL_ScanCode(117); { AL Integrated Help Center } - SDL_SCANCODE_MENU = TSDL_ScanCode(118); { Menu (show menu) } - SDL_SCANCODE_SELECT = TSDL_ScanCode(119); - SDL_SCANCODE_STOP = TSDL_ScanCode(120); { AC Stop } - SDL_SCANCODE_AGAIN = TSDL_ScanCode(121); { AC Redo/Repeat } - SDL_SCANCODE_UNDO = TSDL_ScanCode(122); { AC Undo } - SDL_SCANCODE_CUT = TSDL_ScanCode(123); { AC Cut } - SDL_SCANCODE_COPY = TSDL_ScanCode(124); { AC Copy } - SDL_SCANCODE_PASTE = TSDL_ScanCode(125); { AC Paste } - SDL_SCANCODE_FIND = TSDL_ScanCode(126); { AC Find } - SDL_SCANCODE_MUTE = TSDL_ScanCode(127); - SDL_SCANCODE_VOLUMEUP = TSDL_ScanCode(128); - SDL_SCANCODE_VOLUMEDOWN = TSDL_ScanCode(129); - {* not sure whether there's a reason to enable these *} - {* SDL_SCANCODE_LOCKINGCAPSLOCK = 130; *} - {* SDL_SCANCODE_LOCKINGNUMLOCK = 131; *} - {* SDL_SCANCODE_LOCKINGSCROLLLOCK = 132; *} - SDL_SCANCODE_KP_COMMA = TSDL_ScanCode(133); - SDL_SCANCODE_KP_EQUALSAS400 = TSDL_ScanCode(134); - - SDL_SCANCODE_INTERNATIONAL1 = TSDL_ScanCode(135); {**< used on Asian keyboards; see - footnotes in USB doc *} - SDL_SCANCODE_INTERNATIONAL2 = TSDL_ScanCode(136); - SDL_SCANCODE_INTERNATIONAL3 = TSDL_ScanCode(137); {**< Yen *} - SDL_SCANCODE_INTERNATIONAL4 = TSDL_ScanCode(138); - SDL_SCANCODE_INTERNATIONAL5 = TSDL_ScanCode(139); - SDL_SCANCODE_INTERNATIONAL6 = TSDL_ScanCode(140); - SDL_SCANCODE_INTERNATIONAL7 = TSDL_ScanCode(141); - SDL_SCANCODE_INTERNATIONAL8 = TSDL_ScanCode(142); - SDL_SCANCODE_INTERNATIONAL9 = TSDL_ScanCode(143); - SDL_SCANCODE_LANG1 = TSDL_ScanCode(144); {**< Hangul/English toggle *} - SDL_SCANCODE_LANG2 = TSDL_ScanCode(145); {**< Hanja conversion *} - SDL_SCANCODE_LANG3 = TSDL_ScanCode(146); {**< Katakana *} - SDL_SCANCODE_LANG4 = TSDL_ScanCode(147); {**< Hiragana *} - SDL_SCANCODE_LANG5 = TSDL_ScanCode(148); {**< Zenkaku/Hankaku *} - SDL_SCANCODE_LANG6 = TSDL_ScanCode(149); {**< reserved *} - SDL_SCANCODE_LANG7 = TSDL_ScanCode(150); {**< reserved *} - SDL_SCANCODE_LANG8 = TSDL_ScanCode(151); {**< reserved *} - SDL_SCANCODE_LANG9 = TSDL_ScanCode(152); {**< reserved *} - - SDL_SCANCODE_ALTERASE = TSDL_ScanCode(153); {**< Erase-Eaze *} - SDL_SCANCODE_SYSREQ = TSDL_ScanCode(154); - SDL_SCANCODE_CANCEL = TSDL_ScanCode(155); { AC Cancel } - SDL_SCANCODE_CLEAR = TSDL_ScanCode(156); - SDL_SCANCODE_PRIOR = TSDL_ScanCode(157); - SDL_SCANCODE_RETURN2 = TSDL_ScanCode(158); - SDL_SCANCODE_SEPARATOR = TSDL_ScanCode(159); - SDL_SCANCODE_OUT = TSDL_ScanCode(160); - SDL_SCANCODE_OPER = TSDL_ScanCode(161); - SDL_SCANCODE_CLEARAGAIN = TSDL_ScanCode(162); - SDL_SCANCODE_CRSEL = TSDL_ScanCode(163); - SDL_SCANCODE_EXSEL = TSDL_ScanCode(164); - - SDL_SCANCODE_KP_00 = TSDL_ScanCode(176); - SDL_SCANCODE_KP_000 = TSDL_ScanCode(177); - SDL_SCANCODE_THOUSANDSSEPARATOR = TSDL_ScanCode(178); - SDL_SCANCODE_DECIMALSEPARATOR = TSDL_ScanCode(179); - SDL_SCANCODE_CURRENCYUNIT = TSDL_ScanCode(180); - SDL_SCANCODE_CURRENCYSUBUNIT = TSDL_ScanCode(181); - SDL_SCANCODE_KP_LEFTPAREN = TSDL_ScanCode(182); - SDL_SCANCODE_KP_RIGHTPAREN = TSDL_ScanCode(183); - SDL_SCANCODE_KP_LEFTBRACE = TSDL_ScanCode(184); - SDL_SCANCODE_KP_RIGHTBRACE = TSDL_ScanCode(185); - SDL_SCANCODE_KP_TAB = TSDL_ScanCode(186); - SDL_SCANCODE_KP_BACKSPACE = TSDL_ScanCode(187); - SDL_SCANCODE_KP_A = TSDL_ScanCode(188); - SDL_SCANCODE_KP_B = TSDL_ScanCode(189); - SDL_SCANCODE_KP_C = TSDL_ScanCode(190); - SDL_SCANCODE_KP_D = TSDL_ScanCode(191); - SDL_SCANCODE_KP_E = TSDL_ScanCode(192); - SDL_SCANCODE_KP_F = TSDL_ScanCode(193); - SDL_SCANCODE_KP_XOR = TSDL_ScanCode(194); - SDL_SCANCODE_KP_POWER = TSDL_ScanCode(195); - SDL_SCANCODE_KP_PERCENT = TSDL_ScanCode(196); - SDL_SCANCODE_KP_LESS = TSDL_ScanCode(197); - SDL_SCANCODE_KP_GREATER = TSDL_ScanCode(198); - SDL_SCANCODE_KP_AMPERSAND = TSDL_ScanCode(199); - SDL_SCANCODE_KP_DBLAMPERSAND = TSDL_ScanCode(200); - SDL_SCANCODE_KP_VERTICALBAR = TSDL_ScanCode(201); - SDL_SCANCODE_KP_DBLVERTICALBAR = TSDL_ScanCode(202); - SDL_SCANCODE_KP_COLON = TSDL_ScanCode(203); - SDL_SCANCODE_KP_HASH = TSDL_ScanCode(204); - SDL_SCANCODE_KP_SPACE = TSDL_ScanCode(205); - SDL_SCANCODE_KP_AT = TSDL_ScanCode(206); - SDL_SCANCODE_KP_EXCLAM = TSDL_ScanCode(207); - SDL_SCANCODE_KP_MEMSTORE = TSDL_ScanCode(208); - SDL_SCANCODE_KP_MEMRECALL = TSDL_ScanCode(209); - SDL_SCANCODE_KP_MEMCLEAR = TSDL_ScanCode(210); - SDL_SCANCODE_KP_MEMADD = TSDL_ScanCode(211); - SDL_SCANCODE_KP_MEMSUBTRACT = TSDL_ScanCode(212); - SDL_SCANCODE_KP_MEMMULTIPLY = TSDL_ScanCode(213); - SDL_SCANCODE_KP_MEMDIVIDE = TSDL_ScanCode(214); - SDL_SCANCODE_KP_PLUSMINUS = TSDL_ScanCode(215); - SDL_SCANCODE_KP_CLEAR = TSDL_ScanCode(216); - SDL_SCANCODE_KP_CLEARENTRY = TSDL_ScanCode(217); - SDL_SCANCODE_KP_BINARY = TSDL_ScanCode(218); - SDL_SCANCODE_KP_OCTAL = TSDL_ScanCode(219); - SDL_SCANCODE_KP_DECIMAL = TSDL_ScanCode(220); - SDL_SCANCODE_KP_HEXADECIMAL = TSDL_ScanCode(221); - - SDL_SCANCODE_LCTRL = TSDL_ScanCode(224); - SDL_SCANCODE_LSHIFT = TSDL_ScanCode(225); - SDL_SCANCODE_LALT = TSDL_ScanCode(226); {**< alt; option *} - SDL_SCANCODE_LGUI = TSDL_ScanCode(227); {**< windows; command (apple); meta *} - SDL_SCANCODE_RCTRL = TSDL_ScanCode(228); - SDL_SCANCODE_RSHIFT = TSDL_ScanCode(229); - SDL_SCANCODE_RALT = TSDL_ScanCode(230); {**< alt gr; option *} - SDL_SCANCODE_RGUI = TSDL_ScanCode(231); {**< windows; command (apple); meta *} - - SDL_SCANCODE_MODE = TSDL_ScanCode(257); {**< I'm not sure if this is really not covered - * by any of the above; but since there's a - * special KMOD_MODE for it I'm adding it here - *} - - {** - * \name Usage page 0x0C - * - * These values are mapped from usage page 0x0C (USB consumer page). - * See https://usb.org/sites/default/files/hut1_2.pdf - * - * There are way more keys in the spec than we can represent in the - * current scancode range, so pick the ones that commonly come up in - * real world usage. - */ These values are mapped from usage page $0C (USB consumer page). - *} - - SDL_SCANCODE_AUDIONEXT = TSDL_ScanCode(258); - SDL_SCANCODE_AUDIOPREV = TSDL_ScanCode(259); - SDL_SCANCODE_AUDIOSTOP = TSDL_ScanCode(260); - SDL_SCANCODE_AUDIOPLAY = TSDL_ScanCode(261); - SDL_SCANCODE_AUDIOMUTE = TSDL_ScanCode(262); - SDL_SCANCODE_MEDIASELECT = TSDL_ScanCode(263); - SDL_SCANCODE_WWW = TSDL_ScanCode(264); - SDL_SCANCODE_MAIL = TSDL_ScanCode(265); - SDL_SCANCODE_CALCULATOR = TSDL_ScanCode(266); - SDL_SCANCODE_COMPUTER = TSDL_ScanCode(267); - SDL_SCANCODE_AC_SEARCH = TSDL_ScanCode(268); - SDL_SCANCODE_AC_HOME = TSDL_ScanCode(269); - SDL_SCANCODE_AC_BACK = TSDL_ScanCode(270); - SDL_SCANCODE_AC_FORWARD = TSDL_ScanCode(271); - SDL_SCANCODE_AC_STOP = TSDL_ScanCode(272); - SDL_SCANCODE_AC_REFRESH = TSDL_ScanCode(273); - SDL_SCANCODE_AC_BOOKMARKS = TSDL_ScanCode(274); - - {** - * Walther keys - * - * These are values that Christian Walther added (for mac keyboard?). - *} - - SDL_SCANCODE_BRIGHTNESSDOWN = TSDL_ScanCode(275); - SDL_SCANCODE_BRIGHTNESSUP = TSDL_ScanCode(276); - SDL_SCANCODE_DISPLAYSWITCH = TSDL_ScanCode(277); {**< display mirroring/dual display - switch; video mode switch *} - SDL_SCANCODE_KBDILLUMTOGGLE = TSDL_ScanCode(278); - SDL_SCANCODE_KBDILLUMDOWN = TSDL_ScanCode(279); - SDL_SCANCODE_KBDILLUMUP = TSDL_ScanCode(280); - SDL_SCANCODE_EJECT = TSDL_ScanCode(281); - SDL_SCANCODE_SLEEP = TSDL_ScanCode(282); { SC System Sleep } - - SDL_SCANCODE_APP1 = TSDL_ScanCode(283); - SDL_SCANCODE_APP2 = TSDL_ScanCode(284); - - {** - * \name Usage page 0x0C (additional media keys) - * - * These values are mapped from usage page 0x0C (USB consumer page). - *} - - SDL_SCANCODE_AUDIOREWIND = TSDL_ScanCode(285); - SDL_SCANCODE_AUDIOFASTFORWARD = TSDL_ScanCode(286); - - {** - * \name Mobile keys - * - * These are values that are often used on mobile phones. - *} - - SDL_SCANCODE_SOFTLEFT = TSDL_ScanCode(287); {**< Usually situated below the display on phones and - used as a multi-function feature key for selecting - a software defined function shown on the bottom left - of the display. *} - SDL_SCANCODE_SOFTRIGHT = TSDL_ScanCode(288); {**< Usually situated below the display on phones and - used as a multi-function feature key for selecting - a software defined function shown on the bottom right - of the display. *} - SDL_SCANCODE_CALL = TSDL_ScanCode(289); {**< Used for accepting phone calls. *} - SDL_SCANCODE_ENDCALL = TSDL_ScanCode(290); {**< Used for rejecting phone calls. *} - - {* Add any other keys here. *} - - SDL_NUM_SCANCODES = TSDL_ScanCode(512); {**< not a key, just marks the number of scancodes - for array bounds *} - +//from "sdl_scancode.h" + + {** + * The SDL keyboard scancode representation. + * + * Values of this type are used to represent keyboard keys, among other places + * in the SDL_Keysym.scancode key.keysym.scancode \endlink field of the + * SDL_Event structure. + * + * The values in this enumeration are based on the USB usage page standard: + * https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf + *} +type + PPSDL_ScanCode = ^PSDL_ScanCode; + PSDL_ScanCode = ^TSDL_ScanCode; + TSDL_ScanCode = type cint; + +const + SDL_SCANCODE_UNKNOWN = TSDL_ScanCode(0); + + {** + * Usage page $07 + * + * These values are from usage page $07 (USB keyboard page). + *} + + SDL_SCANCODE_A = TSDL_ScanCode(4); + SDL_SCANCODE_B = TSDL_ScanCode(5); + SDL_SCANCODE_C = TSDL_ScanCode(6); + SDL_SCANCODE_D = TSDL_ScanCode(7); + SDL_SCANCODE_E = TSDL_ScanCode(8); + SDL_SCANCODE_F = TSDL_ScanCode(9); + SDL_SCANCODE_G = TSDL_ScanCode(10); + SDL_SCANCODE_H = TSDL_ScanCode(11); + SDL_SCANCODE_I = TSDL_ScanCode(12); + SDL_SCANCODE_J = TSDL_ScanCode(13); + SDL_SCANCODE_K = TSDL_ScanCode(14); + SDL_SCANCODE_L = TSDL_ScanCode(15); + SDL_SCANCODE_M = TSDL_ScanCode(16); + SDL_SCANCODE_N = TSDL_ScanCode(17); + SDL_SCANCODE_O = TSDL_ScanCode(18); + SDL_SCANCODE_P = TSDL_ScanCode(19); + SDL_SCANCODE_Q = TSDL_ScanCode(20); + SDL_SCANCODE_R = TSDL_ScanCode(21); + SDL_SCANCODE_S = TSDL_ScanCode(22); + SDL_SCANCODE_T = TSDL_ScanCode(23); + SDL_SCANCODE_U = TSDL_ScanCode(24); + SDL_SCANCODE_V = TSDL_ScanCode(25); + SDL_SCANCODE_W = TSDL_ScanCode(26); + SDL_SCANCODE_X = TSDL_ScanCode(27); + SDL_SCANCODE_Y = TSDL_ScanCode(28); + SDL_SCANCODE_Z = TSDL_ScanCode(29); + + SDL_SCANCODE_1 = TSDL_ScanCode(30); + SDL_SCANCODE_2 = TSDL_ScanCode(31); + SDL_SCANCODE_3 = TSDL_ScanCode(32); + SDL_SCANCODE_4 = TSDL_ScanCode(33); + SDL_SCANCODE_5 = TSDL_ScanCode(34); + SDL_SCANCODE_6 = TSDL_ScanCode(35); + SDL_SCANCODE_7 = TSDL_ScanCode(36); + SDL_SCANCODE_8 = TSDL_ScanCode(37); + SDL_SCANCODE_9 = TSDL_ScanCode(38); + SDL_SCANCODE_0 = TSDL_ScanCode(39); + + SDL_SCANCODE_RETURN = TSDL_ScanCode(40); + SDL_SCANCODE_ESCAPE = TSDL_ScanCode(41); + SDL_SCANCODE_BACKSPACE = TSDL_ScanCode(42); + SDL_SCANCODE_TAB = TSDL_ScanCode(43); + SDL_SCANCODE_SPACE = TSDL_ScanCode(44); + + SDL_SCANCODE_MINUS = TSDL_ScanCode(45); + SDL_SCANCODE_EQUALS = TSDL_ScanCode(46); + SDL_SCANCODE_LEFTBRACKET = TSDL_ScanCode(47); + SDL_SCANCODE_RIGHTBRACKET = TSDL_ScanCode(48); + SDL_SCANCODE_BACKSLASH = TSDL_ScanCode(49); {**< Located at the lower left of the return + * key on ISO keyboards and at the right end + * of the QWERTY row on ANSI keyboards. + * Produces REVERSE SOLIDUS (backslash) and + * VERTICAL LINE in a US layout; REVERSE + * SOLIDUS and VERTICAL LINE in a UK Mac + * layout; NUMBER SIGN and TILDE in a UK + * Windows layout; DOLLAR SIGN and POUND SIGN + * in a Swiss German layout; NUMBER SIGN and + * APOSTROPHE in a German layout; GRAVE + * ACCENT and POUND SIGN in a French Mac + * layout; and ASTERISK and MICRO SIGN in a + * French Windows layout. + *} + SDL_SCANCODE_NONUSHASH = TSDL_ScanCode(50); {**< ISO USB keyboards actually use this code + * instead of 49 for the same key; but all + * OSes I've seen treat the two codes + * identically. So; as an implementor; unless + * your keyboard generates both of those + * codes and your OS treats them differently; + * you should generate SDL_SCANCODE_BACKSLASH + * instead of this code. As a user; you + * should not rely on this code because SDL + * will never generate it with most (all?) + * keyboards. + *} + SDL_SCANCODE_SEMICOLON = TSDL_ScanCode(51); + SDL_SCANCODE_APOSTROPHE = TSDL_ScanCode(52); + SDL_SCANCODE_GRAVE = TSDL_ScanCode(53); {**< Located in the top left corner (on both ANSI + * and ISO keyboards). Produces GRAVE ACCENT and + * TILDE in a US Windows layout and in US and UK + * Mac layouts on ANSI keyboards; GRAVE ACCENT + * and NOT SIGN in a UK Windows layout; SECTION + * SIGN and PLUS-MINUS SIGN in US and UK Mac + * layouts on ISO keyboards; SECTION SIGN and + * DEGREE SIGN in a Swiss German layout (Mac: + * only on ISO keyboards); CIRCUMFLEX ACCENT and + * DEGREE SIGN in a German layout (Mac: only on + * ISO keyboards); SUPERSCRIPT TWO and TILDE in a + * French Windows layout; COMMERCIAL AT and + * NUMBER SIGN in a French Mac layout on ISO + * keyboards; and LESS-THAN SIGN and GREATER-THAN + * SIGN in a Swiss German; German; or French Mac + * layout on ANSI keyboards. + *} + SDL_SCANCODE_COMMA = TSDL_ScanCode(54); + SDL_SCANCODE_PERIOD = TSDL_ScanCode(55); + SDL_SCANCODE_SLASH = TSDL_ScanCode(56); + + SDL_SCANCODE_CAPSLOCK = TSDL_ScanCode(57); + + SDL_SCANCODE_F1 = TSDL_ScanCode(58); + SDL_SCANCODE_F2 = TSDL_ScanCode(59); + SDL_SCANCODE_F3 = TSDL_ScanCode(60); + SDL_SCANCODE_F4 = TSDL_ScanCode(61); + SDL_SCANCODE_F5 = TSDL_ScanCode(62); + SDL_SCANCODE_F6 = TSDL_ScanCode(63); + SDL_SCANCODE_F7 = TSDL_ScanCode(64); + SDL_SCANCODE_F8 = TSDL_ScanCode(65); + SDL_SCANCODE_F9 = TSDL_ScanCode(66); + SDL_SCANCODE_F10 = TSDL_ScanCode(67); + SDL_SCANCODE_F11 = TSDL_ScanCode(68); + SDL_SCANCODE_F12 = TSDL_ScanCode(69); + + SDL_SCANCODE_PRINTSCREEN = TSDL_ScanCode(70); + SDL_SCANCODE_SCROLLLOCK = TSDL_ScanCode(71); + SDL_SCANCODE_PAUSE = TSDL_ScanCode(72); + SDL_SCANCODE_INSERT = TSDL_ScanCode(73); {**< insert on PC; help on some Mac keyboards (but + does send code 73; not 117) *} + SDL_SCANCODE_HOME = TSDL_ScanCode(74); + SDL_SCANCODE_PAGEUP = TSDL_ScanCode(75); + SDL_SCANCODE_DELETE = TSDL_ScanCode(76); + SDL_SCANCODE_END = TSDL_ScanCode(77); + SDL_SCANCODE_PAGEDOWN = TSDL_ScanCode(78); + SDL_SCANCODE_RIGHT = TSDL_ScanCode(79); + SDL_SCANCODE_LEFT = TSDL_ScanCode(80); + SDL_SCANCODE_DOWN = TSDL_ScanCode(81); + SDL_SCANCODE_UP = TSDL_ScanCode(82); + + SDL_SCANCODE_NUMLOCKCLEAR = TSDL_ScanCode(83); {**< num lock on PC; clear on Mac keyboards + *} + SDL_SCANCODE_KP_DIVIDE = TSDL_ScanCode(84); + SDL_SCANCODE_KP_MULTIPLY = TSDL_ScanCode(85); + SDL_SCANCODE_KP_MINUS = TSDL_ScanCode(86); + SDL_SCANCODE_KP_PLUS = TSDL_ScanCode(87); + SDL_SCANCODE_KP_ENTER = TSDL_ScanCode(88); + SDL_SCANCODE_KP_1 = TSDL_ScanCode(89); + SDL_SCANCODE_KP_2 = TSDL_ScanCode(90); + SDL_SCANCODE_KP_3 = TSDL_ScanCode(91); + SDL_SCANCODE_KP_4 = TSDL_ScanCode(92); + SDL_SCANCODE_KP_5 = TSDL_ScanCode(93); + SDL_SCANCODE_KP_6 = TSDL_ScanCode(94); + SDL_SCANCODE_KP_7 = TSDL_ScanCode(95); + SDL_SCANCODE_KP_8 = TSDL_ScanCode(96); + SDL_SCANCODE_KP_9 = TSDL_ScanCode(97); + SDL_SCANCODE_KP_0 = TSDL_ScanCode(98); + SDL_SCANCODE_KP_PERIOD = TSDL_ScanCode(99); + + SDL_SCANCODE_NONUSBACKSLASH = TSDL_ScanCode(100); {**< This is the additional key that ISO + * keyboards have over ANSI ones; + * located between left shift and Y. + * Produces GRAVE ACCENT and TILDE in a + * US or UK Mac layout; REVERSE SOLIDUS + * (backslash) and VERTICAL LINE in a + * US or UK Windows layout; and + * LESS-THAN SIGN and GREATER-THAN SIGN + * in a Swiss German; German; or French + * layout. *} + SDL_SCANCODE_APPLICATION = TSDL_ScanCode(101); {**< windows contextual menu; compose *} + SDL_SCANCODE_POWER = TSDL_ScanCode(102); {**< The USB document says this is a status flag; + * not a physical key - but some Mac keyboards + * do have a power key. *} + SDL_SCANCODE_KP_EQUALS = TSDL_ScanCode(103); + SDL_SCANCODE_F13 = TSDL_ScanCode(104); + SDL_SCANCODE_F14 = TSDL_ScanCode(105); + SDL_SCANCODE_F15 = TSDL_ScanCode(106); + SDL_SCANCODE_F16 = TSDL_ScanCode(107); + SDL_SCANCODE_F17 = TSDL_ScanCode(108); + SDL_SCANCODE_F18 = TSDL_ScanCode(109); + SDL_SCANCODE_F19 = TSDL_ScanCode(110); + SDL_SCANCODE_F20 = TSDL_ScanCode(111); + SDL_SCANCODE_F21 = TSDL_ScanCode(112); + SDL_SCANCODE_F22 = TSDL_ScanCode(113); + SDL_SCANCODE_F23 = TSDL_ScanCode(114); + SDL_SCANCODE_F24 = TSDL_ScanCode(115); + SDL_SCANCODE_EXECUTE = TSDL_ScanCode(116); + SDL_SCANCODE_HELP = TSDL_ScanCode(117); { AL Integrated Help Center } + SDL_SCANCODE_MENU = TSDL_ScanCode(118); { Menu (show menu) } + SDL_SCANCODE_SELECT = TSDL_ScanCode(119); + SDL_SCANCODE_STOP = TSDL_ScanCode(120); { AC Stop } + SDL_SCANCODE_AGAIN = TSDL_ScanCode(121); { AC Redo/Repeat } + SDL_SCANCODE_UNDO = TSDL_ScanCode(122); { AC Undo } + SDL_SCANCODE_CUT = TSDL_ScanCode(123); { AC Cut } + SDL_SCANCODE_COPY = TSDL_ScanCode(124); { AC Copy } + SDL_SCANCODE_PASTE = TSDL_ScanCode(125); { AC Paste } + SDL_SCANCODE_FIND = TSDL_ScanCode(126); { AC Find } + SDL_SCANCODE_MUTE = TSDL_ScanCode(127); + SDL_SCANCODE_VOLUMEUP = TSDL_ScanCode(128); + SDL_SCANCODE_VOLUMEDOWN = TSDL_ScanCode(129); + {* not sure whether there's a reason to enable these *} + {* SDL_SCANCODE_LOCKINGCAPSLOCK = 130; *} + {* SDL_SCANCODE_LOCKINGNUMLOCK = 131; *} + {* SDL_SCANCODE_LOCKINGSCROLLLOCK = 132; *} + SDL_SCANCODE_KP_COMMA = TSDL_ScanCode(133); + SDL_SCANCODE_KP_EQUALSAS400 = TSDL_ScanCode(134); + + SDL_SCANCODE_INTERNATIONAL1 = TSDL_ScanCode(135); {**< used on Asian keyboards; see + footnotes in USB doc *} + SDL_SCANCODE_INTERNATIONAL2 = TSDL_ScanCode(136); + SDL_SCANCODE_INTERNATIONAL3 = TSDL_ScanCode(137); {**< Yen *} + SDL_SCANCODE_INTERNATIONAL4 = TSDL_ScanCode(138); + SDL_SCANCODE_INTERNATIONAL5 = TSDL_ScanCode(139); + SDL_SCANCODE_INTERNATIONAL6 = TSDL_ScanCode(140); + SDL_SCANCODE_INTERNATIONAL7 = TSDL_ScanCode(141); + SDL_SCANCODE_INTERNATIONAL8 = TSDL_ScanCode(142); + SDL_SCANCODE_INTERNATIONAL9 = TSDL_ScanCode(143); + SDL_SCANCODE_LANG1 = TSDL_ScanCode(144); {**< Hangul/English toggle *} + SDL_SCANCODE_LANG2 = TSDL_ScanCode(145); {**< Hanja conversion *} + SDL_SCANCODE_LANG3 = TSDL_ScanCode(146); {**< Katakana *} + SDL_SCANCODE_LANG4 = TSDL_ScanCode(147); {**< Hiragana *} + SDL_SCANCODE_LANG5 = TSDL_ScanCode(148); {**< Zenkaku/Hankaku *} + SDL_SCANCODE_LANG6 = TSDL_ScanCode(149); {**< reserved *} + SDL_SCANCODE_LANG7 = TSDL_ScanCode(150); {**< reserved *} + SDL_SCANCODE_LANG8 = TSDL_ScanCode(151); {**< reserved *} + SDL_SCANCODE_LANG9 = TSDL_ScanCode(152); {**< reserved *} + + SDL_SCANCODE_ALTERASE = TSDL_ScanCode(153); {**< Erase-Eaze *} + SDL_SCANCODE_SYSREQ = TSDL_ScanCode(154); + SDL_SCANCODE_CANCEL = TSDL_ScanCode(155); { AC Cancel } + SDL_SCANCODE_CLEAR = TSDL_ScanCode(156); + SDL_SCANCODE_PRIOR = TSDL_ScanCode(157); + SDL_SCANCODE_RETURN2 = TSDL_ScanCode(158); + SDL_SCANCODE_SEPARATOR = TSDL_ScanCode(159); + SDL_SCANCODE_OUT = TSDL_ScanCode(160); + SDL_SCANCODE_OPER = TSDL_ScanCode(161); + SDL_SCANCODE_CLEARAGAIN = TSDL_ScanCode(162); + SDL_SCANCODE_CRSEL = TSDL_ScanCode(163); + SDL_SCANCODE_EXSEL = TSDL_ScanCode(164); + + SDL_SCANCODE_KP_00 = TSDL_ScanCode(176); + SDL_SCANCODE_KP_000 = TSDL_ScanCode(177); + SDL_SCANCODE_THOUSANDSSEPARATOR = TSDL_ScanCode(178); + SDL_SCANCODE_DECIMALSEPARATOR = TSDL_ScanCode(179); + SDL_SCANCODE_CURRENCYUNIT = TSDL_ScanCode(180); + SDL_SCANCODE_CURRENCYSUBUNIT = TSDL_ScanCode(181); + SDL_SCANCODE_KP_LEFTPAREN = TSDL_ScanCode(182); + SDL_SCANCODE_KP_RIGHTPAREN = TSDL_ScanCode(183); + SDL_SCANCODE_KP_LEFTBRACE = TSDL_ScanCode(184); + SDL_SCANCODE_KP_RIGHTBRACE = TSDL_ScanCode(185); + SDL_SCANCODE_KP_TAB = TSDL_ScanCode(186); + SDL_SCANCODE_KP_BACKSPACE = TSDL_ScanCode(187); + SDL_SCANCODE_KP_A = TSDL_ScanCode(188); + SDL_SCANCODE_KP_B = TSDL_ScanCode(189); + SDL_SCANCODE_KP_C = TSDL_ScanCode(190); + SDL_SCANCODE_KP_D = TSDL_ScanCode(191); + SDL_SCANCODE_KP_E = TSDL_ScanCode(192); + SDL_SCANCODE_KP_F = TSDL_ScanCode(193); + SDL_SCANCODE_KP_XOR = TSDL_ScanCode(194); + SDL_SCANCODE_KP_POWER = TSDL_ScanCode(195); + SDL_SCANCODE_KP_PERCENT = TSDL_ScanCode(196); + SDL_SCANCODE_KP_LESS = TSDL_ScanCode(197); + SDL_SCANCODE_KP_GREATER = TSDL_ScanCode(198); + SDL_SCANCODE_KP_AMPERSAND = TSDL_ScanCode(199); + SDL_SCANCODE_KP_DBLAMPERSAND = TSDL_ScanCode(200); + SDL_SCANCODE_KP_VERTICALBAR = TSDL_ScanCode(201); + SDL_SCANCODE_KP_DBLVERTICALBAR = TSDL_ScanCode(202); + SDL_SCANCODE_KP_COLON = TSDL_ScanCode(203); + SDL_SCANCODE_KP_HASH = TSDL_ScanCode(204); + SDL_SCANCODE_KP_SPACE = TSDL_ScanCode(205); + SDL_SCANCODE_KP_AT = TSDL_ScanCode(206); + SDL_SCANCODE_KP_EXCLAM = TSDL_ScanCode(207); + SDL_SCANCODE_KP_MEMSTORE = TSDL_ScanCode(208); + SDL_SCANCODE_KP_MEMRECALL = TSDL_ScanCode(209); + SDL_SCANCODE_KP_MEMCLEAR = TSDL_ScanCode(210); + SDL_SCANCODE_KP_MEMADD = TSDL_ScanCode(211); + SDL_SCANCODE_KP_MEMSUBTRACT = TSDL_ScanCode(212); + SDL_SCANCODE_KP_MEMMULTIPLY = TSDL_ScanCode(213); + SDL_SCANCODE_KP_MEMDIVIDE = TSDL_ScanCode(214); + SDL_SCANCODE_KP_PLUSMINUS = TSDL_ScanCode(215); + SDL_SCANCODE_KP_CLEAR = TSDL_ScanCode(216); + SDL_SCANCODE_KP_CLEARENTRY = TSDL_ScanCode(217); + SDL_SCANCODE_KP_BINARY = TSDL_ScanCode(218); + SDL_SCANCODE_KP_OCTAL = TSDL_ScanCode(219); + SDL_SCANCODE_KP_DECIMAL = TSDL_ScanCode(220); + SDL_SCANCODE_KP_HEXADECIMAL = TSDL_ScanCode(221); + + SDL_SCANCODE_LCTRL = TSDL_ScanCode(224); + SDL_SCANCODE_LSHIFT = TSDL_ScanCode(225); + SDL_SCANCODE_LALT = TSDL_ScanCode(226); {**< alt; option *} + SDL_SCANCODE_LGUI = TSDL_ScanCode(227); {**< windows; command (apple); meta *} + SDL_SCANCODE_RCTRL = TSDL_ScanCode(228); + SDL_SCANCODE_RSHIFT = TSDL_ScanCode(229); + SDL_SCANCODE_RALT = TSDL_ScanCode(230); {**< alt gr; option *} + SDL_SCANCODE_RGUI = TSDL_ScanCode(231); {**< windows; command (apple); meta *} + + SDL_SCANCODE_MODE = TSDL_ScanCode(257); {**< I'm not sure if this is really not covered + * by any of the above; but since there's a + * special KMOD_MODE for it I'm adding it here + *} + + {** + * \name Usage page 0x0C + * + * These values are mapped from usage page 0x0C (USB consumer page). + * See https://usb.org/sites/default/files/hut1_2.pdf + * + * There are way more keys in the spec than we can represent in the + * current scancode range, so pick the ones that commonly come up in + * real world usage. + */ These values are mapped from usage page $0C (USB consumer page). + *} + + SDL_SCANCODE_AUDIONEXT = TSDL_ScanCode(258); + SDL_SCANCODE_AUDIOPREV = TSDL_ScanCode(259); + SDL_SCANCODE_AUDIOSTOP = TSDL_ScanCode(260); + SDL_SCANCODE_AUDIOPLAY = TSDL_ScanCode(261); + SDL_SCANCODE_AUDIOMUTE = TSDL_ScanCode(262); + SDL_SCANCODE_MEDIASELECT = TSDL_ScanCode(263); + SDL_SCANCODE_WWW = TSDL_ScanCode(264); + SDL_SCANCODE_MAIL = TSDL_ScanCode(265); + SDL_SCANCODE_CALCULATOR = TSDL_ScanCode(266); + SDL_SCANCODE_COMPUTER = TSDL_ScanCode(267); + SDL_SCANCODE_AC_SEARCH = TSDL_ScanCode(268); + SDL_SCANCODE_AC_HOME = TSDL_ScanCode(269); + SDL_SCANCODE_AC_BACK = TSDL_ScanCode(270); + SDL_SCANCODE_AC_FORWARD = TSDL_ScanCode(271); + SDL_SCANCODE_AC_STOP = TSDL_ScanCode(272); + SDL_SCANCODE_AC_REFRESH = TSDL_ScanCode(273); + SDL_SCANCODE_AC_BOOKMARKS = TSDL_ScanCode(274); + + {** + * Walther keys + * + * These are values that Christian Walther added (for mac keyboard?). + *} + + SDL_SCANCODE_BRIGHTNESSDOWN = TSDL_ScanCode(275); + SDL_SCANCODE_BRIGHTNESSUP = TSDL_ScanCode(276); + SDL_SCANCODE_DISPLAYSWITCH = TSDL_ScanCode(277); {**< display mirroring/dual display + switch; video mode switch *} + SDL_SCANCODE_KBDILLUMTOGGLE = TSDL_ScanCode(278); + SDL_SCANCODE_KBDILLUMDOWN = TSDL_ScanCode(279); + SDL_SCANCODE_KBDILLUMUP = TSDL_ScanCode(280); + SDL_SCANCODE_EJECT = TSDL_ScanCode(281); + SDL_SCANCODE_SLEEP = TSDL_ScanCode(282); { SC System Sleep } + + SDL_SCANCODE_APP1 = TSDL_ScanCode(283); + SDL_SCANCODE_APP2 = TSDL_ScanCode(284); + + {** + * \name Usage page 0x0C (additional media keys) + * + * These values are mapped from usage page 0x0C (USB consumer page). + *} + + SDL_SCANCODE_AUDIOREWIND = TSDL_ScanCode(285); + SDL_SCANCODE_AUDIOFASTFORWARD = TSDL_ScanCode(286); + + {** + * \name Mobile keys + * + * These are values that are often used on mobile phones. + *} + + SDL_SCANCODE_SOFTLEFT = TSDL_ScanCode(287); {**< Usually situated below the display on phones and + used as a multi-function feature key for selecting + a software defined function shown on the bottom left + of the display. *} + SDL_SCANCODE_SOFTRIGHT = TSDL_ScanCode(288); {**< Usually situated below the display on phones and + used as a multi-function feature key for selecting + a software defined function shown on the bottom right + of the display. *} + SDL_SCANCODE_CALL = TSDL_ScanCode(289); {**< Used for accepting phone calls. *} + SDL_SCANCODE_ENDCALL = TSDL_ScanCode(290); {**< Used for rejecting phone calls. *} + + {* Add any other keys here. *} + + SDL_NUM_SCANCODES = TSDL_ScanCode(512); {**< not a key, just marks the number of scancodes + for array bounds *} + diff --git a/units/sdlsensor.inc b/units/sdlsensor.inc index 12b66ec0..995fa7d1 100644 --- a/units/sdlsensor.inc +++ b/units/sdlsensor.inc @@ -1,295 +1,295 @@ -// based on SDL_sensor.h - - -{** - * \brief SDL_sensor.h - * - * In order to use these functions, SDL_Init() must have been called - * with the ::SDL_INIT_SENSOR flag. This causes SDL to scan the system - * for sensors, and load appropriate drivers. - *} -type - PPSDL_Sensor = ^PSDL_Sensor; - PSDL_Sensor = type Pointer; - -{** - * This is a unique ID for a sensor for the time it is connected to the system, - * and is never reused for the lifetime of the application. - * - * The ID value starts at 0 and increments from there. The value -1 is an invalid ID. - *} -type - PPSDL_SensorID = ^PSDL_SensorID; - PSDL_SensorID = ^TSDL_SensorID; - TSDL_SensorID = type cint32; - -{** - * The different sensors defined by SDL - * - * Additional sensors may be available, using platform dependent semantics. - * - * Hare are the additional Android sensors: - * https://developer.android.com/reference/android/hardware/SensorEvent.html#values - *} -type - PPSDL_SensorType = ^PSDL_SensorType; - PSDL_SensorType = ^TSDL_SensorType; - TSDL_SensorType = type cint; - -const - SDL_SENSOR_INVALID = TSDL_SensorType(-1); {**< Returned for an invalid sensor *} - SDL_SENSOR_UNKNOWN = TSDL_SensorType(0); {**< Unknown sensor type *} - SDL_SENSOR_ACCEL = TSDL_SensorType(1); {**< Accelerometer *} - SDL_SENSOR_GYRO = TSDL_SensorType(2); {**< Gyroscope *} - SDL_SENSOR_ACCEL_L = TSDL_SensorType(3); {**< Accelerometer for left Joy-Con controller and Wii nunchuk *} - SDL_SENSOR_GYRO_L = TSDL_SensorType(4); {**< Gyroscope for left Joy-Con controller *} - SDL_SENSOR_ACCEL_R = TSDL_SensorType(5); {**< Accelerometer for right Joy-Con controller *} - SDL_SENSOR_GYRO_R = TSDL_SensorType(6); {**< Gyroscope for right Joy-Con controller *} - -{** - * Accelerometer sensor - * - * The accelerometer returns the current acceleration in SI meters per - * second squared. This measurement includes the force of gravity, so - * a device at rest will have an value of SDL_STANDARD_GRAVITY away - * from the center of the earth. - * - * values[0]: Acceleration on the x axis - * values[1]: Acceleration on the y axis - * values[2]: Acceleration on the z axis - * - * For phones held in portrait mode and game controllers held in front of you, - * the axes are defined as follows: - * -X ... +X : left ... right - * -Y ... +Y : bottom ... top - * -Z ... +Z : farther ... closer - * - * The axis data is not changed when the phone is rotated. - * - * \sa SDL_GetDisplayOrientation() - *} -const - SDL_STANDARD_GRAVITY = 9.80665; - -{** - * Gyroscope sensor - * - * The gyroscope returns the current rate of rotation in radians per second. - * The rotation is positive in the counter-clockwise direction. That is, - * an observer looking from a positive location on one of the axes would - * see positive rotation on that axis when it appeared to be rotating - * counter-clockwise. - * - * values[0]: Angular speed around the x axis (pitch) - * values[1]: Angular speed around the y axis (yaw) - * values[2]: Angular speed around the z axis (roll) - * - * For phones held in portrait mode and game controllers held in front of you, - * the axes are defined as follows: - * -X ... +X : left ... right - * -Y ... +Y : bottom ... top - * -Z ... +Z : farther ... closer - * - * The axis data is not changed when the phone or controller is rotated. - * - * \sa SDL_GetDisplayOrientation() - *} - -{--- Function prototypes ---} - -{** - * Locking for multi-threaded access to the sensor API - * - * If you are using the sensor API or handling events from multiple threads - * you should use these locking functions to protect access to the sensors. - * - * In particular, you are guaranteed that the sensor list won't change, so - * the API functions that take a sensor index will be valid, and sensor - * events will not be delivered. - * - * \since This function is available since SDL 2.0.14. - *} -procedure SDL_LockSensors(); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockSensors' {$ENDIF} {$ENDIF}; -procedure SDL_UnlockSensors(); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnlockSensors' {$ENDIF} {$ENDIF}; - -{** - * Count the number of sensors attached to the system right now. - * - * \returns the number of sensors detected. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_NumSensors(): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_NumSensors' {$ENDIF} {$ENDIF}; - -{** - * Get the implementation dependent name of a sensor. - * - * \param device_index The sensor to obtain name from - * \returns the sensor name, or NIL if `device_index` is out of range. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_SensorGetDeviceName(device_index: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetDeviceName' {$ENDIF} {$ENDIF}; - -{** - * Get the type of a sensor. - * - * \param device_index The sensor to get the type from - * \returns the SDL_SensorType, or `SDL_SENSOR_INVALID` if `device_index` is - * out of range. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_SensorGetDeviceType(device_index: cint): TSDL_SensorType; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetDeviceType' {$ENDIF} {$ENDIF}; - -{** - * Get the platform dependent type of a sensor. - * - * \param device_index The sensor to check - * \returns the sensor platform dependent type, or -1 if `device_index` is out - * of range. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_SensorGetDeviceNonPortableType(device_index: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetDeviceNonPortableType' {$ENDIF} {$ENDIF}; - -{** - * Get the instance ID of a sensor. - * - * \param device_index The sensor to get instance id from - * \returns the sensor instance ID, or -1 if `device_index` is out of range. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_SensorGetDeviceInstanceID(device_index: cint): TSDL_SensorID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetDeviceInstanceID' {$ENDIF} {$ENDIF}; - -{** - * Open a sensor for use. - * - * \param device_index The sensor to open - * \returns an SDL_Sensor sensor object, or NIL if an error occurred. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_SensorOpen(device_index: cint): PSDL_Sensor; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorOpen' {$ENDIF} {$ENDIF}; - -{** - * Return the SDL_Sensor associated with an instance id. - * - * \param instance_id The sensor from instance id - * \returns an SDL_Sensor object. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_SensorFromInstanceID(instance_id: TSDL_SensorID): PSDL_Sensor; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorFromInstanceID' {$ENDIF} {$ENDIF}; - -{** - * Get the implementation dependent name of a sensor - * - * \param sensor The SDL_Sensor object - * \returns the sensor name, or NIL if `sensor` is NIL. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_SensorGetName(sensor: PSDL_Sensor): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetName' {$ENDIF} {$ENDIF}; - -{** - * Get the type of a sensor. - * - * \param sensor The SDL_Sensor object to inspect - * \returns the SDL_SensorType type, or `SDL_SENSOR_INVALID` - * if `sensor` is NIL. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_SensorGetType(sensor: PSDL_Sensor): TSDL_SensorType; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetType' {$ENDIF} {$ENDIF}; - -{** - * Get the platform dependent type of a sensor. - * - * \param sensor The SDL_Sensor object to inspect - * \returns the sensor platform dependent type, or -1 if `sensor` is NIL. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_SensorGetNonPortableType(sensor: PSDL_Sensor): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetNonPortableType' {$ENDIF} {$ENDIF}; - -{** - * Get the instance ID of a sensor. - * - * \param sensor The SDL_Sensor object to inspect - * \returns the sensor instance ID, or -1 if `sensor` is NIL. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_SensorGetInstanceID(sensor: PSDL_Sensor): TSDL_SensorID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetInstanceID' {$ENDIF} {$ENDIF}; - -{** - * Get the current state of an opened sensor. - * - * The number of values and interpretation of the data is sensor dependent. - * - * \param sensor The SDL_Sensor object to query - * \param data A pointer filled with the current sensor state - * \param num_values The number of values to write to data - * \returns 0 or -1 if an error occurred. - * - * \since This function is available since SDL 2.0.9. - *} -function SDL_SensorGetData(sensor: PSDL_Sensor; data: pcfloat; num_values: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetData' {$ENDIF} {$ENDIF}; - -{** - * Get the current state of an opened sensor with the timestamp of the last - * update. - * - * The number of values and interpretation of the data is sensor dependent. - * - * \param sensor The SDL_Sensor object to query - * \param timestamp A pointer filled with the timestamp in microseconds of the - * current sensor reading if available, or 0 if not - * \param data A pointer filled with the current sensor state - * \param num_values The number of values to write to data - * \returns 0 or -1 if an error occurred. - * - * \since This function is available since SDL 2.26.0. - *} -function SDL_SensorGetDataWithTimestamp(sensor: PSDL_Sensor; timestamp: pcuint64; data: pcfloat; num_values: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetDataWithTimestamp' {$ENDIF} {$ENDIF}; - -{** - * Close a sensor previously opened with SDL_SensorOpen(). - * - * \param sensor The SDL_Sensor object to close - * - * \since This function is available since SDL 2.0.9. - *} -procedure SDL_SensorClose(sensor: PSDL_Sensor); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorClose' {$ENDIF} {$ENDIF}; - -{** - * Update the current state of the open sensors. - * - * This is called automatically by the event loop if sensor events are - * enabled. - * - * This needs to be called from the thread that initialized the sensor - * subsystem. - * - * \since This function is available since SDL 2.0.9. - *} -procedure SDL_SensorUpdate(); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorUpdate' {$ENDIF} {$ENDIF}; +// based on SDL_sensor.h + + +{** + * \brief SDL_sensor.h + * + * In order to use these functions, SDL_Init() must have been called + * with the ::SDL_INIT_SENSOR flag. This causes SDL to scan the system + * for sensors, and load appropriate drivers. + *} +type + PPSDL_Sensor = ^PSDL_Sensor; + PSDL_Sensor = type Pointer; + +{** + * This is a unique ID for a sensor for the time it is connected to the system, + * and is never reused for the lifetime of the application. + * + * The ID value starts at 0 and increments from there. The value -1 is an invalid ID. + *} +type + PPSDL_SensorID = ^PSDL_SensorID; + PSDL_SensorID = ^TSDL_SensorID; + TSDL_SensorID = type cint32; + +{** + * The different sensors defined by SDL + * + * Additional sensors may be available, using platform dependent semantics. + * + * Hare are the additional Android sensors: + * https://developer.android.com/reference/android/hardware/SensorEvent.html#values + *} +type + PPSDL_SensorType = ^PSDL_SensorType; + PSDL_SensorType = ^TSDL_SensorType; + TSDL_SensorType = type cint; + +const + SDL_SENSOR_INVALID = TSDL_SensorType(-1); {**< Returned for an invalid sensor *} + SDL_SENSOR_UNKNOWN = TSDL_SensorType(0); {**< Unknown sensor type *} + SDL_SENSOR_ACCEL = TSDL_SensorType(1); {**< Accelerometer *} + SDL_SENSOR_GYRO = TSDL_SensorType(2); {**< Gyroscope *} + SDL_SENSOR_ACCEL_L = TSDL_SensorType(3); {**< Accelerometer for left Joy-Con controller and Wii nunchuk *} + SDL_SENSOR_GYRO_L = TSDL_SensorType(4); {**< Gyroscope for left Joy-Con controller *} + SDL_SENSOR_ACCEL_R = TSDL_SensorType(5); {**< Accelerometer for right Joy-Con controller *} + SDL_SENSOR_GYRO_R = TSDL_SensorType(6); {**< Gyroscope for right Joy-Con controller *} + +{** + * Accelerometer sensor + * + * The accelerometer returns the current acceleration in SI meters per + * second squared. This measurement includes the force of gravity, so + * a device at rest will have an value of SDL_STANDARD_GRAVITY away + * from the center of the earth. + * + * values[0]: Acceleration on the x axis + * values[1]: Acceleration on the y axis + * values[2]: Acceleration on the z axis + * + * For phones held in portrait mode and game controllers held in front of you, + * the axes are defined as follows: + * -X ... +X : left ... right + * -Y ... +Y : bottom ... top + * -Z ... +Z : farther ... closer + * + * The axis data is not changed when the phone is rotated. + * + * \sa SDL_GetDisplayOrientation() + *} +const + SDL_STANDARD_GRAVITY = 9.80665; + +{** + * Gyroscope sensor + * + * The gyroscope returns the current rate of rotation in radians per second. + * The rotation is positive in the counter-clockwise direction. That is, + * an observer looking from a positive location on one of the axes would + * see positive rotation on that axis when it appeared to be rotating + * counter-clockwise. + * + * values[0]: Angular speed around the x axis (pitch) + * values[1]: Angular speed around the y axis (yaw) + * values[2]: Angular speed around the z axis (roll) + * + * For phones held in portrait mode and game controllers held in front of you, + * the axes are defined as follows: + * -X ... +X : left ... right + * -Y ... +Y : bottom ... top + * -Z ... +Z : farther ... closer + * + * The axis data is not changed when the phone or controller is rotated. + * + * \sa SDL_GetDisplayOrientation() + *} + +{--- Function prototypes ---} + +{** + * Locking for multi-threaded access to the sensor API + * + * If you are using the sensor API or handling events from multiple threads + * you should use these locking functions to protect access to the sensors. + * + * In particular, you are guaranteed that the sensor list won't change, so + * the API functions that take a sensor index will be valid, and sensor + * events will not be delivered. + * + * \since This function is available since SDL 2.0.14. + *} +procedure SDL_LockSensors(); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockSensors' {$ENDIF} {$ENDIF}; +procedure SDL_UnlockSensors(); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnlockSensors' {$ENDIF} {$ENDIF}; + +{** + * Count the number of sensors attached to the system right now. + * + * \returns the number of sensors detected. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_NumSensors(): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_NumSensors' {$ENDIF} {$ENDIF}; + +{** + * Get the implementation dependent name of a sensor. + * + * \param device_index The sensor to obtain name from + * \returns the sensor name, or NIL if `device_index` is out of range. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_SensorGetDeviceName(device_index: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetDeviceName' {$ENDIF} {$ENDIF}; + +{** + * Get the type of a sensor. + * + * \param device_index The sensor to get the type from + * \returns the SDL_SensorType, or `SDL_SENSOR_INVALID` if `device_index` is + * out of range. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_SensorGetDeviceType(device_index: cint): TSDL_SensorType; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetDeviceType' {$ENDIF} {$ENDIF}; + +{** + * Get the platform dependent type of a sensor. + * + * \param device_index The sensor to check + * \returns the sensor platform dependent type, or -1 if `device_index` is out + * of range. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_SensorGetDeviceNonPortableType(device_index: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetDeviceNonPortableType' {$ENDIF} {$ENDIF}; + +{** + * Get the instance ID of a sensor. + * + * \param device_index The sensor to get instance id from + * \returns the sensor instance ID, or -1 if `device_index` is out of range. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_SensorGetDeviceInstanceID(device_index: cint): TSDL_SensorID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetDeviceInstanceID' {$ENDIF} {$ENDIF}; + +{** + * Open a sensor for use. + * + * \param device_index The sensor to open + * \returns an SDL_Sensor sensor object, or NIL if an error occurred. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_SensorOpen(device_index: cint): PSDL_Sensor; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorOpen' {$ENDIF} {$ENDIF}; + +{** + * Return the SDL_Sensor associated with an instance id. + * + * \param instance_id The sensor from instance id + * \returns an SDL_Sensor object. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_SensorFromInstanceID(instance_id: TSDL_SensorID): PSDL_Sensor; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorFromInstanceID' {$ENDIF} {$ENDIF}; + +{** + * Get the implementation dependent name of a sensor + * + * \param sensor The SDL_Sensor object + * \returns the sensor name, or NIL if `sensor` is NIL. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_SensorGetName(sensor: PSDL_Sensor): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetName' {$ENDIF} {$ENDIF}; + +{** + * Get the type of a sensor. + * + * \param sensor The SDL_Sensor object to inspect + * \returns the SDL_SensorType type, or `SDL_SENSOR_INVALID` + * if `sensor` is NIL. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_SensorGetType(sensor: PSDL_Sensor): TSDL_SensorType; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetType' {$ENDIF} {$ENDIF}; + +{** + * Get the platform dependent type of a sensor. + * + * \param sensor The SDL_Sensor object to inspect + * \returns the sensor platform dependent type, or -1 if `sensor` is NIL. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_SensorGetNonPortableType(sensor: PSDL_Sensor): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetNonPortableType' {$ENDIF} {$ENDIF}; + +{** + * Get the instance ID of a sensor. + * + * \param sensor The SDL_Sensor object to inspect + * \returns the sensor instance ID, or -1 if `sensor` is NIL. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_SensorGetInstanceID(sensor: PSDL_Sensor): TSDL_SensorID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetInstanceID' {$ENDIF} {$ENDIF}; + +{** + * Get the current state of an opened sensor. + * + * The number of values and interpretation of the data is sensor dependent. + * + * \param sensor The SDL_Sensor object to query + * \param data A pointer filled with the current sensor state + * \param num_values The number of values to write to data + * \returns 0 or -1 if an error occurred. + * + * \since This function is available since SDL 2.0.9. + *} +function SDL_SensorGetData(sensor: PSDL_Sensor; data: pcfloat; num_values: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetData' {$ENDIF} {$ENDIF}; + +{** + * Get the current state of an opened sensor with the timestamp of the last + * update. + * + * The number of values and interpretation of the data is sensor dependent. + * + * \param sensor The SDL_Sensor object to query + * \param timestamp A pointer filled with the timestamp in microseconds of the + * current sensor reading if available, or 0 if not + * \param data A pointer filled with the current sensor state + * \param num_values The number of values to write to data + * \returns 0 or -1 if an error occurred. + * + * \since This function is available since SDL 2.26.0. + *} +function SDL_SensorGetDataWithTimestamp(sensor: PSDL_Sensor; timestamp: pcuint64; data: pcfloat; num_values: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorGetDataWithTimestamp' {$ENDIF} {$ENDIF}; + +{** + * Close a sensor previously opened with SDL_SensorOpen(). + * + * \param sensor The SDL_Sensor object to close + * + * \since This function is available since SDL 2.0.9. + *} +procedure SDL_SensorClose(sensor: PSDL_Sensor); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorClose' {$ENDIF} {$ENDIF}; + +{** + * Update the current state of the open sensors. + * + * This is called automatically by the event loop if sensor events are + * enabled. + * + * This needs to be called from the thread that initialized the sensor + * subsystem. + * + * \since This function is available since SDL 2.0.9. + *} +procedure SDL_SensorUpdate(); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorUpdate' {$ENDIF} {$ENDIF}; diff --git a/units/sdlshape.inc b/units/sdlshape.inc index a57790e4..0237146e 100644 --- a/units/sdlshape.inc +++ b/units/sdlshape.inc @@ -1,161 +1,161 @@ -// from "sdl_shape.h" - -{** SDL_shape.h - * - * Header file for the shaped window API. - *} -const - SDL_NONSHAPEABLE_WINDOW = -1; - SDL_INVALID_SHAPE_ARGUMENT = -2; - SDL_WINDOW_LACKS_SHAPE = -3; - -{** - * Create a window that can be shaped with the specified position, dimensions, - * and flags. - * - * \param title The title of the window, in UTF-8 encoding. - * \param x The x position of the window, SDL_WINDOWPOS_CENTERED, - * or SDL_WINDOWPOS_UNDEFINED. - * \param y The y position of the window, SDL_WINDOWPOS_CENTERED, - * or SDL_WINDOWPOS_UNDEFINED. - * \param w The width of the window. - * \param h The height of the window. - * \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with - * any of the following: SDL_WINDOW_OPENGL, - * SDL_WINDOW_INPUT_GRABBED, SDL_WINDOW_HIDDEN, - * SDL_WINDOW_RESIZABLE, SDL_WINDOW_MAXIMIZED, - * SDL_WINDOW_MINIMIZED. - * SDL_WINDOW_BORDERLESS is always set, - * and SDL_WINDOW_FULLSCREEN is always unset. - * \return the window created, or NIL if window creation failed. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_DestroyWindow - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_CreateShapedWindow_fun = function(title: PAnsiChar; x: cuint; y: cuint; w: cuint; h: cuint; flags: cuint32): PSDL_Window; cdecl; -Var - SDL_CreateShapedWindow : TSDL_CreateShapedWindow_fun = Nil; -{$else} - -function SDL_CreateShapedWindow(title: PAnsiChar; x: cuint; y: cuint; w: cuint; h: cuint; flags: cuint32): PSDL_Window; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateShapedWindow' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Return whether the given window is a shaped window. - * - * \param window The window to query for being shaped. - * \return SDL_TRUE if the window is a window that can be shaped, - * SDL_FALSE if the window is unshaped or NIL. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_CreateShapedWindow - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_IsShapedWindow_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; -Var - SDL_IsShapedWindow : TSDL_IsShapedWindow_fun = Nil; -{$else} - -function SDL_IsShapedWindow(window: PSDL_Window): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsShapedWindow' {$ENDIF} {$ENDIF}; -{$endif} - - -type - {** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. *} - PPWindowShapeMode = ^PWindowShapeMode; - PWindowShapeMode = ^TWindowShapeMode; - TWindowShapeMode = type Integer; - -const - {** \brief The default mode, a binarized alpha cutoff of 1. *} - ShapeModeDefault = TWindowShapeMode(0); - {** \brief A binarized alpha cutoff with a given integer value. *} - ShapeModeBinarizeAlpha = TWindowShapeMode(1); - {** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. *} - ShapeModeReverseBinarizeAlpha = TWindowShapeMode(2); - {** \brief A color key is applied. *} - ShapeModeColorKey = TWindowShapeMode(3); - -function SDL_SHAPEMODEALPHA(mode: TWindowShapeMode): Boolean; - -type - {** A union containing parameters for shaped windows. *} - PPSDL_WindowShapeParams = ^PSDL_WindowShapeParams; - PSDL_WindowShapeParams = ^TSDL_WindowShapeParams; - TSDL_WindowShapeParams = record - case cint of - {** a cutoff alpha value for binarization of the window shape's alpha channel. *} - 0: (binarizationCutoff: cuint8;); - 1: (colorKey: TSDL_Color;); - end; - - {** A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. *} - PPSDL_WindowShapeMode = ^PSDL_WindowShapeMode; - PSDL_WindowShapeMode = ^TSDL_WindowShapeMode; - TSDL_WindowShapeMode = record - {** The mode of these window-shape parameters. *} - mode: TWindowShapeMode; - {** Window-shape parameters. *} - parameters: TSDL_WindowShapeParams; - end; - -{** - * Set the shape and parameters of a shaped window. - * - * \param window The shaped window whose parameters should be set. - * \param shape A surface encoding the desired shape for the window. - * \param shape_mode The parameters to set for the shaped window. - * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape - * argument, or SDL_NONSHAPEABLE_WINDOW if the SDL_Window given does - * not reference a valid shaped window. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_WindowShapeMode - * \sa SDL_GetShapedWindowMode - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowShape_fun = function(window: PSDL_Window; shape: PSDL_Surface; shape_mode: PSDL_WindowShapeMode): cint; cdecl; -Var - SDL_SetWindowShape : TSDL_SetWindowShape_fun = Nil; -{$else} - -function SDL_SetWindowShape(window: PSDL_Window; shape: PSDL_Surface; shape_mode: PSDL_WindowShapeMode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowShape' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the shape parameters of a shaped window. - * - * \param window The shaped window whose parameters should be retrieved. - * \param shape_mode An empty shape-mode structure to fill, or NIL to check - * whether the window has a shape. - * \return 0 if the window has a shape and, provided shape_mode was not NIL, - * shape_mode has been filled with the mode data, - * SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped - * window, or SDL_WINDOW_LACKS_SHAPE if the SDL_Window given is a - * shapeable window currently lacking a shape. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_WindowShapeMode - * \sa SDL_SetWindowShape - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetShapedWindowMode_fun = function(window: PSDL_Window; shape_mode: PSDL_WindowShapeMode): cint; cdecl; -Var - SDL_GetShapedWindowMode : TSDL_GetShapedWindowMode_fun = Nil; -{$else} - -function SDL_GetShapedWindowMode(window: PSDL_Window; shape_mode: PSDL_WindowShapeMode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetShapedWindowMode' {$ENDIF} {$ENDIF}; -{$endif} +// from "sdl_shape.h" + +{** SDL_shape.h + * + * Header file for the shaped window API. + *} +const + SDL_NONSHAPEABLE_WINDOW = -1; + SDL_INVALID_SHAPE_ARGUMENT = -2; + SDL_WINDOW_LACKS_SHAPE = -3; + +{** + * Create a window that can be shaped with the specified position, dimensions, + * and flags. + * + * \param title The title of the window, in UTF-8 encoding. + * \param x The x position of the window, SDL_WINDOWPOS_CENTERED, + * or SDL_WINDOWPOS_UNDEFINED. + * \param y The y position of the window, SDL_WINDOWPOS_CENTERED, + * or SDL_WINDOWPOS_UNDEFINED. + * \param w The width of the window. + * \param h The height of the window. + * \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with + * any of the following: SDL_WINDOW_OPENGL, + * SDL_WINDOW_INPUT_GRABBED, SDL_WINDOW_HIDDEN, + * SDL_WINDOW_RESIZABLE, SDL_WINDOW_MAXIMIZED, + * SDL_WINDOW_MINIMIZED. + * SDL_WINDOW_BORDERLESS is always set, + * and SDL_WINDOW_FULLSCREEN is always unset. + * \return the window created, or NIL if window creation failed. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_DestroyWindow + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateShapedWindow_fun = function(title: PAnsiChar; x: cuint; y: cuint; w: cuint; h: cuint; flags: cuint32): PSDL_Window; cdecl; +Var + SDL_CreateShapedWindow : TSDL_CreateShapedWindow_fun = Nil; +{$else} + +function SDL_CreateShapedWindow(title: PAnsiChar; x: cuint; y: cuint; w: cuint; h: cuint; flags: cuint32): PSDL_Window; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateShapedWindow' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Return whether the given window is a shaped window. + * + * \param window The window to query for being shaped. + * \return SDL_TRUE if the window is a window that can be shaped, + * SDL_FALSE if the window is unshaped or NIL. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_CreateShapedWindow + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_IsShapedWindow_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; +Var + SDL_IsShapedWindow : TSDL_IsShapedWindow_fun = Nil; +{$else} + +function SDL_IsShapedWindow(window: PSDL_Window): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsShapedWindow' {$ENDIF} {$ENDIF}; +{$endif} + + +type + {** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. *} + PPWindowShapeMode = ^PWindowShapeMode; + PWindowShapeMode = ^TWindowShapeMode; + TWindowShapeMode = type Integer; + +const + {** \brief The default mode, a binarized alpha cutoff of 1. *} + ShapeModeDefault = TWindowShapeMode(0); + {** \brief A binarized alpha cutoff with a given integer value. *} + ShapeModeBinarizeAlpha = TWindowShapeMode(1); + {** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. *} + ShapeModeReverseBinarizeAlpha = TWindowShapeMode(2); + {** \brief A color key is applied. *} + ShapeModeColorKey = TWindowShapeMode(3); + +function SDL_SHAPEMODEALPHA(mode: TWindowShapeMode): Boolean; + +type + {** A union containing parameters for shaped windows. *} + PPSDL_WindowShapeParams = ^PSDL_WindowShapeParams; + PSDL_WindowShapeParams = ^TSDL_WindowShapeParams; + TSDL_WindowShapeParams = record + case cint of + {** a cutoff alpha value for binarization of the window shape's alpha channel. *} + 0: (binarizationCutoff: cuint8;); + 1: (colorKey: TSDL_Color;); + end; + + {** A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. *} + PPSDL_WindowShapeMode = ^PSDL_WindowShapeMode; + PSDL_WindowShapeMode = ^TSDL_WindowShapeMode; + TSDL_WindowShapeMode = record + {** The mode of these window-shape parameters. *} + mode: TWindowShapeMode; + {** Window-shape parameters. *} + parameters: TSDL_WindowShapeParams; + end; + +{** + * Set the shape and parameters of a shaped window. + * + * \param window The shaped window whose parameters should be set. + * \param shape A surface encoding the desired shape for the window. + * \param shape_mode The parameters to set for the shaped window. + * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape + * argument, or SDL_NONSHAPEABLE_WINDOW if the SDL_Window given does + * not reference a valid shaped window. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_WindowShapeMode + * \sa SDL_GetShapedWindowMode + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowShape_fun = function(window: PSDL_Window; shape: PSDL_Surface; shape_mode: PSDL_WindowShapeMode): cint; cdecl; +Var + SDL_SetWindowShape : TSDL_SetWindowShape_fun = Nil; +{$else} + +function SDL_SetWindowShape(window: PSDL_Window; shape: PSDL_Surface; shape_mode: PSDL_WindowShapeMode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowShape' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the shape parameters of a shaped window. + * + * \param window The shaped window whose parameters should be retrieved. + * \param shape_mode An empty shape-mode structure to fill, or NIL to check + * whether the window has a shape. + * \return 0 if the window has a shape and, provided shape_mode was not NIL, + * shape_mode has been filled with the mode data, + * SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped + * window, or SDL_WINDOW_LACKS_SHAPE if the SDL_Window given is a + * shapeable window currently lacking a shape. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_WindowShapeMode + * \sa SDL_SetWindowShape + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetShapedWindowMode_fun = function(window: PSDL_Window; shape_mode: PSDL_WindowShapeMode): cint; cdecl; +Var + SDL_GetShapedWindowMode : TSDL_GetShapedWindowMode_fun = Nil; +{$else} + +function SDL_GetShapedWindowMode(window: PSDL_Window; shape_mode: PSDL_WindowShapeMode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetShapedWindowMode' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlstdinc.inc b/units/sdlstdinc.inc index b7d1c3ad..48310dae 100644 --- a/units/sdlstdinc.inc +++ b/units/sdlstdinc.inc @@ -1,1217 +1,1217 @@ -//types from SDL_stdinc.h - -{ SDL-For-Pascal: A lot of the functions are missing. Some functions are useless - if working with Pascal (e. g. memory management functions), - others could be useful (e. g. math functions). - - TODO: Investigate header file and translate potentially useful functions. } - -type - PPSDL_Bool = ^PSDL_Bool; - PSDL_Bool = ^TSDL_Bool; - TSDL_Bool = cbool; - -const - SDL_FALSE = TSDL_Bool(0); - SDL_TRUE = TSDL_Bool(1); - - SDL_MAX_SINT8 = High(cint8); - SDL_MIN_SINT8 = Low(cint8); - - SDL_MAX_UINT8 = High(cuint8); - SDL_MIN_UINT8 = Low(cuint8); - - SDL_MAX_SINT16 = High(cint16); - SDL_MIN_SINT16 = Low(cint16); - - SDL_MAX_UINT16 = High(cuint16); - SDL_MIN_UINT16 = Low(cuint16); - - SDL_MAX_SINT32 = High(cint32); - SDL_MIN_SINT32 = Low(cint32); - - SDL_MAX_UINT32 = High(cuint32); - SDL_MIN_UINT32 = Low(cuint32); - - {$IFDEF Has_Int64} - SDL_MAX_SINT64 = High(cint64); - SDL_MIN_SINT64 = Low(cint64); - - SDL_MAX_UINT64 = High(cuint64); - SDL_MIN_UINT64 = Low(cuint64); - {$ELSE} - SDL_MAX_SINT64: cuint64 = (hi: SDL_MAX_SINT32; lo: SDL_MAX_UINT32); - SDL_MIN_SINT64: cuint64 = (hi: SDL_MIN_SINT32; lo: 0); - - SDL_MAX_UINT64: cuint64 = (hi: SDL_MAX_UINT32; lo: SDL_MAX_UINT32); - SDL_MIN_UINT64: cuint64 = (hi: 0; lo: 0); - {$ENDIF} - - SDL_FLT_EPSILON = cfloat(1.1920928955078125e-07); - -type - PPSDL_malloc_func = ^PSDL_malloc_func; - PSDL_malloc_func = ^TSDL_malloc_func; - TSDL_malloc_func = function(size: csize_t): Pointer; cdecl; - - PPSDL_calloc_func = ^PSDL_calloc_func; - PSDL_calloc_func = ^TSDL_calloc_func; - TSDL_calloc_func = function(nmemb, size: csize_t): Pointer; cdecl; - - PPSDL_realloc_func = ^PSDL_realloc_func; - PSDL_realloc_func = ^TSDL_realloc_func; - TSDL_realloc_func = function(mem: Pointer; size: csize_t): Pointer; cdecl; - - PPSDL_free_func = ^PSDL_free_func; - PSDL_free_func = ^TSDL_free_func; - TSDL_free_func = procedure(mem: Pointer); cdecl; - -{** - * Get the original set of SDL memory functions - * - * \since This function is available since SDL 2.24.0. - *} -procedure SDL_GetOriginalMemoryFunctions( - malloc_func: PSDL_malloc_func; - calloc_func: PSDL_calloc_func; - realloc_func: PSDL_realloc_func; - free_func: PSDL_free_func -); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetOriginalMemoryFunctions' {$ENDIF} {$ENDIF}; - -(** - * Get the current set of SDL memory functions - * - * \since This function is available since SDL 2.0.7. - *) -procedure SDL_GetMemoryFunctions( - malloc_func: PSDL_malloc_func; - calloc_func: PSDL_calloc_func; - realloc_func: PSDL_realloc_func; - free_func: PSDL_free_func -); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetMemoryFunctions' {$ENDIF} {$ENDIF}; - -(** - * Replace SDL's memory allocation functions with a custom set - * - * \since This function is available since SDL 2.0.7. - *) -function SDL_SetMemoryFunctions( - malloc_func: TSDL_malloc_func; - calloc_func: TSDL_calloc_func; - realloc_func: TSDL_realloc_func; - free_func: TSDL_free_func -): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetMemoryFunctions' {$ENDIF} {$ENDIF}; - -(** - * Get the number of outstanding (unfreed) allocations - * - * \since This function is available since SDL 2.0.7. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetNumAllocations_fun = function(): cint; cdecl; -Var - SDL_GetNumAllocations : TSDL_GetNumAllocations_fun = Nil; -{$else} - -function SDL_GetNumAllocations(): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumAllocations' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Allocate a block of memory. The memory is *not* initialized. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_malloc_fun = function(size: csize_t): Pointer; cdecl; -Var - SDL_malloc : TSDL_malloc_fun = Nil; -{$else} - -function SDL_malloc(size: csize_t): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_malloc' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Allocate a block of memory that can fit an array of nmemb elements, each of given size. - * The memory is initialized by setting every byte to 0. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_calloc_fun = function(nmemb, size: csize_t): Pointer; cdecl; -Var - SDL_calloc : TSDL_calloc_fun = Nil; -{$else} - -function SDL_calloc(nmemb, size: csize_t): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_calloc' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Resize a block of memory allocated previously with SDL_malloc() or SDL_calloc(). - * - * The returned pointer may or may not be the same as the original pointer. - * If the new size is larger than the old size, any new memory will *not* be initialized. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_realloc_fun = function(mem: Pointer; size: csize_t): Pointer; cdecl; -Var - SDL_realloc : TSDL_realloc_fun = Nil; -{$else} - -function SDL_realloc(mem: Pointer; size: csize_t): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_realloc' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Free memory returned by functions like SDL_GetBasePath(), SDL_GetPrefPath(), etc. - * - * Calling SDL_free() on the same pointer twice is undefined behaviour and may cause - * your program to crash or behave in unexpected ways. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_free_proc = procedure(mem: Pointer); cdecl; -Var - SDL_free : TSDL_free_proc = Nil; -{$else} - -procedure SDL_free(mem: Pointer); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_free' {$ENDIF} {$ENDIF}; -{$endif} - - - -{*** --- Character functions --- *** - -SDL2-for-Pascal: All comments are added by us and not found in the include file.} - - -(** - * Check if the provided ASCII character is an alphabetic character (a letter). - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.16. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_isalpha_fun = function(x: cint):cint; cdecl; -Var - SDL_isalpha : TSDL_isalpha_fun = Nil; -{$else} - -function SDL_isalpha(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isalpha' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Check if the provided ASCII character is an alphanumeric character. - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.16. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_isalnum_fun = function(x: cint):cint; cdecl; -Var - SDL_isalnum : TSDL_isalnum_fun = Nil; -{$else} - -function SDL_isalnum(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isalnum' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Check if the provided ASCII character is a blank character (a space or a tab). - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.16. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_isblank_fun = function(x: cint):cint; cdecl; -Var - SDL_isblank : TSDL_isblank_fun = Nil; -{$else} - -function SDL_isblank(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isblank' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Check if the provided ASCII character is a control character. - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.16. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_iscntrl_fun = function(x: cint):cint; cdecl; -Var - SDL_iscntrl : TSDL_iscntrl_fun = Nil; -{$else} - -function SDL_iscntrl(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iscntrl' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Check if the provided ASCII character is a decimal digit. - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.4. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_isdigit_fun = function(x: cint):cint; cdecl; -Var - SDL_isdigit : TSDL_isdigit_fun = Nil; -{$else} - -function SDL_isdigit(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isdigit' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Check if the provided ASCII character is a hexadecimal digit. - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.16. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_isxdigit_fun = function(x: cint):cint; cdecl; -Var - SDL_isxdigit : TSDL_isxdigit_fun = Nil; -{$else} - -function SDL_isxdigit(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isxdigit' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Check if the provided ASCII character is any printable character - * which is not a space or an alphanumeric character. - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.16. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_ispunct_fun = function(x: cint):cint; cdecl; -Var - SDL_ispunct : TSDL_ispunct_fun = Nil; -{$else} - -function SDL_ispunct(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ispunct' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Check if the provided ASCII character is a whitespace character. - * This set includes the following characters: space, - * form feed (FF), newline/line feed (LF), carriage return (CR), - * horizontal tab (HT), vertical tab (VT). - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.4. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_isspace_fun = function(x: cint):cint; cdecl; -Var - SDL_isspace : TSDL_isspace_fun = Nil; -{$else} - -function SDL_isspace(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isspace' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Check if the provided ASCII character is an uppercase letter. - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.12. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_isupper_fun = function(x: cint):cint; cdecl; -Var - SDL_isupper : TSDL_isupper_fun = Nil; -{$else} - -function SDL_isupper(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isupper' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Check if the provided ASCII character is a lowercase letter. - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.12. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_islower_fun = function(x: cint):cint; cdecl; -Var - SDL_islower : TSDL_islower_fun = Nil; -{$else} - -function SDL_islower(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_islower' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Check if the provided ASCII character is a printable character (including space). - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.16. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_isprint_fun = function(x: cint):cint; cdecl; -Var - SDL_isprint : TSDL_isprint_fun = Nil; -{$else} - -function SDL_isprint(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isprint' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Check if the provided ASCII character is a printable character (excluding space). - * - * \returns 1 if the check passes, 0 otherwise. - * - * \since This function is available since SDL 2.0.16. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_isgraph_fun = function(x: cint):cint; cdecl; -Var - SDL_isgraph : TSDL_isgraph_fun = Nil; -{$else} - -function SDL_isgraph(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isgraph' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * If the given ASCII character is a lowercase letter, converts it to uppercase. - * Otherwise returns the original value. - * - * \since This function is available since SDL 2.0.4. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_toupper_fun = function(x: cint):cint; cdecl; -Var - SDL_toupper : TSDL_toupper_fun = Nil; -{$else} - -function SDL_toupper(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_toupper' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * If the given ASCII character is an uppercase letter, converts it to lowercase. - * Otherwise returns the original value. - * - * \since This function is available since SDL 2.0.4. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_tolower_fun = function(x: cint):cint; cdecl; -Var - SDL_tolower : TSDL_tolower_fun = Nil; -{$else} - -function SDL_tolower(x: cint):cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_tolower' {$ENDIF} {$ENDIF}; -{$endif} - - - -(*** --- Math functions --- ***) - - -(** - * Calculate the arc cosine of x; - * that is, the value (in radians) whose cosine equals x. - * - * \since This function is available since SDL 2.0.4. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_acos_fun = function(x: cdouble): cdouble; cdecl; -Var - SDL_acos : TSDL_acos_fun = Nil; -{$else} - -function SDL_acos(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_acos' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the arc cosine of x; - * that is, the value (in radians) whose cosine equals x. - * - * \since This function is available since SDL 2.0.8. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_acosf_fun = function(x: cfloat): cfloat; cdecl; -Var - SDL_acosf : TSDL_acosf_fun = Nil; -{$else} - -function SDL_acosf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_acosf' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the arc sine of x; - * that is, the value (in radians) whose sine equals x. - * - * \since This function is available since SDL 2.0.4. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_asin_fun = function(x: cdouble): cdouble; cdecl; -Var - SDL_asin : TSDL_asin_fun = Nil; -{$else} - -function SDL_asin(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_asin' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the arc sine of x; - * that is, the value (in radians) whose sine equals x. - * - * \since This function is available since SDL 2.0.8. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_asinf_fun = function(x: cfloat): cfloat; cdecl; -Var - SDL_asinf : TSDL_asinf_fun = Nil; -{$else} - -function SDL_asinf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_asinf' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the arc tangent of x; - * that is, the value (in radians) whose tangent equals x. - * - * \since This function is available since SDL 2.0.4. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_atan_fun = function(x: cdouble): cdouble; cdecl; -Var - SDL_atan : TSDL_atan_fun = Nil; -{$else} - -function SDL_atan(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_atan' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the arc tangent of x; - * that is, the value (in radians) whose tangent equals x. - * - * \since This function is available since SDL 2.0.8. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_atanf_fun = function(x: cfloat): cfloat; cdecl; -Var - SDL_atanf : TSDL_atanf_fun = Nil; -{$else} - -function SDL_atanf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_atanf' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the arc tangent of y/x, using the signs of the two arguments - * to determine the quadrant of the result. - * - * \since This function is available since SDL 2.0.4. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_atan2_fun = function(y, x: cdouble): cdouble; cdecl; -Var - SDL_atan2 : TSDL_atan2_fun = Nil; -{$else} - -function SDL_atan2(y, x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_atan2' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the arc tangent of y/x, using the signs of the two arguments - * to determine the quadrant of the result. - * - * \since This function is available since SDL 2.0.8. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_atan2f_fun = function(y, x: cfloat): cfloat; cdecl; -Var - SDL_atan2f : TSDL_atan2f_fun = Nil; -{$else} - -function SDL_atan2f(y, x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_atan2f' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the smallest integral value that is not less than x. - * - * \since This function is available since SDL 2.0.4. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_ceil_fun = function(x: cdouble): cdouble; cdecl; -Var - SDL_ceil : TSDL_ceil_fun = Nil; -{$else} - -function SDL_ceil(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ceil' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the smallest integral value that is not less than x. - * - * \since This function is available since SDL 2.0.8. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_ceilf_fun = function(x: cfloat): cfloat; cdecl; -Var - SDL_ceilf : TSDL_ceilf_fun = Nil; -{$else} - -function SDL_ceilf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ceilf' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Return a number whose absolute value matches that of x, - * but the sign matches that of y. - * - * \since This function is available since SDL 2.0.4. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_copysign_fun = function(x, y: cdouble): cdouble; cdecl; -Var - SDL_copysign : TSDL_copysign_fun = Nil; -{$else} - -function SDL_copysign(x, y: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_copysign' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Return a number whose absolute value matches that of x, - * but the sign matches that of y. - * - * \since This function is available since SDL 2.0.8. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_copysignf_fun = function(x, y: cfloat): cfloat; cdecl; -Var - SDL_copysignf : TSDL_copysignf_fun = Nil; -{$else} - -function SDL_copysignf(x, y: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_copysignf' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the cosine of x, where x is given in radians. - * - * \since This function is available since SDL 2.0.4. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_cos_fun = function(x: cdouble): cdouble; cdecl; -Var - SDL_cos : TSDL_cos_fun = Nil; -{$else} - -function SDL_cos(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_cos' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the cosine of x, where x is given in radians. - * - * \since This function is available since SDL 2.0.4. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_cosf_fun = function(x: cfloat): cfloat; cdecl; -Var - SDL_cosf : TSDL_cosf_fun = Nil; -{$else} - -function SDL_cosf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_cosf' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the value of e (the base of natural logarithms) - * raised to the power of x. - * - * \since This function is available since SDL 2.0.9. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_exp_fun = function(x: cdouble): cdouble; cdecl; -Var - SDL_exp : TSDL_exp_fun = Nil; -{$else} - -function SDL_exp(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_exp' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the value of e (the base of natural logarithms) - * raised to the power of x. - * - * \since This function is available since SDL 2.0.9. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_expf_fun = function(x: cfloat): cfloat; cdecl; -Var - SDL_expf : TSDL_expf_fun = Nil; -{$else} - -function SDL_expf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_expf' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the absolute value of x. - * - * \since This function is available since SDL 2.0.4. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_fabs_fun = function(x: cdouble): cdouble; cdecl; -Var - SDL_fabs : TSDL_fabs_fun = Nil; -{$else} - -function SDL_fabs(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_fabs' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the absolute value of x. - * - * \since This function is available since SDL 2.0.8. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_fabsf_fun = function(x: cfloat): cfloat; cdecl; -Var - SDL_fabsf : TSDL_fabsf_fun = Nil; -{$else} - -function SDL_fabsf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_fabsf' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the largest integral value that is not greater than x. - * - * \since This function is available since SDL 2.0.4. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_floor_fun = function(x: cdouble): cdouble; cdecl; -Var - SDL_floor : TSDL_floor_fun = Nil; -{$else} - -function SDL_floor(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_floor' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the largest integral value that is not greater than x. - * - * \since This function is available since SDL 2.0.8. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_floorf_fun = function(x: cfloat): cfloat; cdecl; -Var - SDL_floorf : TSDL_floorf_fun = Nil; -{$else} - -function SDL_floorf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_floorf' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the floating-point remainder of dividing x by y. - * - * \since This function is available since SDL 2.0.8. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_fmod_fun = function(x, y: cdouble): cdouble; cdecl; -Var - SDL_fmod : TSDL_fmod_fun = Nil; -{$else} - -function SDL_fmod(x, y: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_fmod' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the floating-point remainder of dividing x by y. - * - * \since This function is available since SDL 2.0.8. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_fmodf_fun = function(x, y: cfloat): cfloat; cdecl; -Var - SDL_fmodf : TSDL_fmodf_fun = Nil; -{$else} - -function SDL_fmodf(x, y: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_fmodf' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the natural logarithm of x. - * - * \since This function is available since SDL 2.0.4. - - SDL2-for-Pascal: ATTENTION: The original C name of this function is SDL_log, - but since Pascal names are case-insensitive, it is in conflict with SDL_Log (logging function). - Hence we decided to rename it. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_nlog_fun = function(x: cdouble): cdouble; cdecl; -Var - SDL_nlog : TSDL_nlog_fun = Nil; -{$else} - -function SDL_nlog(x: cdouble): cdouble; cdecl; - external SDL_LibName - name {$IF DEFINED(DELPHI) AND DEFINED(MACOS)} '_SDL_log' {$ELSE} 'SDL_log' {$ENDIF}; -{$endif} - -(** - * Calculate the natural logarithm of x. - * - * \since This function is available since SDL 2.0.8. - - SDL2-for-Pascal: ATTENTION: The original C name of this function is SDL_logf, - but to be consistent with the renamed SDL_log function (see comment of SDL_nlog - for details), we decided to rename it. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_nlogf_fun = function(x: cfloat): cfloat; cdecl; -Var - SDL_nlogf : TSDL_nlogf_fun = Nil; -{$else} - -function SDL_nlogf(x: cfloat): cfloat; cdecl; - external SDL_LibName - name {$IF DEFINED(DELPHI) AND DEFINED(MACOS)} '_SDL_logf' {$ELSE} 'SDL_logf' {$ENDIF}; -{$endif} - -(** - * Calculate the base 10 logarithm of x. - * - * \since This function is available since SDL 2.0.8. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_log10_fun = function(x: cdouble): cdouble; cdecl; -Var - SDL_log10 : TSDL_log10_fun = Nil; -{$else} - -function SDL_log10(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_log10' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the base 10 logarithm of x. - * - * \since This function is available since SDL 2.0.8. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_log10f_fun = function(x: cfloat): cfloat; cdecl; -Var - SDL_log10f : TSDL_log10f_fun = Nil; -{$else} - -function SDL_log10f(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_log10f' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Round to nearest integer, away from zero. - * - * \since This function is available since SDL 2.0.16. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_lround_fun = function(x: cdouble): clong; cdecl; -Var - SDL_lround : TSDL_lround_fun = Nil; -{$else} - -function SDL_lround(x: cdouble): clong; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_lround' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Round to nearest integer, away from zero. - * - * \since This function is available since SDL 2.0.16. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_lroundf_fun = function(x: cfloat): clong; cdecl; -Var - SDL_lroundf : TSDL_lroundf_fun = Nil; -{$else} - -function SDL_lroundf(x: cfloat): clong; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_lroundf' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the value of x raised to the power of y. - * - * \since This function is available since SDL 2.0.4. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_pow_fun = function(x, y: cdouble): cdouble; cdecl; -Var - SDL_pow : TSDL_pow_fun = Nil; -{$else} - -function SDL_pow(x, y: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_pow' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the value of x raised to the power of y. - * - * \since This function is available since SDL 2.0.8. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_powf_fun = function(x, y: cfloat): cfloat; cdecl; -Var - SDL_powf : TSDL_powf_fun = Nil; -{$else} - -function SDL_powf(x, y: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_powf' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Round to nearest integral value, away from zero. - * - * \since This function is available since SDL 2.0.16. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_round_fun = function(x: cdouble): cdouble; cdecl; -Var - SDL_round : TSDL_round_fun = Nil; -{$else} - -function SDL_round(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_round' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Round to nearest integral value, away from zero. - * - * \since This function is available since SDL 2.0.16. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_roundf_fun = function(x: cfloat): cfloat; cdecl; -Var - SDL_roundf : TSDL_roundf_fun = Nil; -{$else} - -function SDL_roundf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_roundf' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate x multiplied by the floating-point radix to the power of n. - * On most systems, the radix is 2, making this equivalent to x*(2**n). - * - * \since This function is available since SDL 2.0.4. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_scalbn_fun = function(x: cdouble; n: cint): cdouble; cdecl; -Var - SDL_scalbn : TSDL_scalbn_fun = Nil; -{$else} - -function SDL_scalbn(x: cdouble; n: cint): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_scalbn' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate x multiplied by the floating-point radix to the power of n. - * On most systems, the radix is 2, making this equivalent to x*(2**n). - * - * \since This function is available since SDL 2.0.8. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_scalbnf_fun = function(x: cfloat; n: cint): cfloat; cdecl; -Var - SDL_scalbnf : TSDL_scalbnf_fun = Nil; -{$else} - -function SDL_scalbnf(x: cfloat; n: cint): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_scalbnf' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the sine of x, where x is given in radians. - * - * \since This function is available since SDL 2.0.4. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_sin_fun = function(x: cdouble): cdouble; cdecl; -Var - SDL_sin : TSDL_sin_fun = Nil; -{$else} - -function SDL_sin(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_sin' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the sine of x, where x is given in radians. - * - * \since This function is available since SDL 2.0.4. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_sinf_fun = function(x: cfloat): cfloat; cdecl; -Var - SDL_sinf : TSDL_sinf_fun = Nil; -{$else} - -function SDL_sinf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_sinf' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the non-negative square root of x. - * - * \since This function is available since SDL 2.0.4. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_sqrt_fun = function(x: cdouble): cdouble; cdecl; -Var - SDL_sqrt : TSDL_sqrt_fun = Nil; -{$else} - -function SDL_sqrt(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_sqrt' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the non-negative square root of x. - * - * \since This function is available since SDL 2.0.4. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_sqrtf_fun = function(x: cfloat): cfloat; cdecl; -Var - SDL_sqrtf : TSDL_sqrtf_fun = Nil; -{$else} - -function SDL_sqrtf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_sqrtf' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the tangent of x, where x is given in radians. - * - * \since This function is available since SDL 2.0.4. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_tan_fun = function(x: cdouble): cdouble; cdecl; -Var - SDL_tan : TSDL_tan_fun = Nil; -{$else} - -function SDL_tan(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_tan' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Calculate the tangent of x, where x is given in radians. - * - * \since This function is available since SDL 2.0.4. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_tanf_fun = function(x: cfloat): cfloat; cdecl; -Var - SDL_tanf : TSDL_tanf_fun = Nil; -{$else} - -function SDL_tanf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_tanf' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Round to nearest integral value, towards zero. - * - * \since This function is available since SDL 2.0.14. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_trunc_fun = function(x: cdouble): cdouble; cdecl; -Var - SDL_trunc : TSDL_trunc_fun = Nil; -{$else} - -function SDL_trunc(x: cdouble): cdouble; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_trunc' {$ENDIF} {$ENDIF}; -{$endif} - -(** - * Round to nearest integral value, towards zero. - * - * \since This function is available since SDL 2.0.14. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_truncf_fun = function(x: cfloat): cfloat; cdecl; -Var - SDL_truncf : TSDL_truncf_fun = Nil; -{$else} - -function SDL_truncf(x: cfloat): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_truncf' {$ENDIF} {$ENDIF}; -{$endif} - - - -(*** --- iconv functions --- ***) - - -(** - * This function converts a string between encodings in one pass, returning a - * string that must be freed with SDL_free(), or NIL on error. - * - * \since This function is available since SDL 2.0.0. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_iconv_string_fun = function(Const tocode, fromcode, inbuf: PAnsiChar; inbytesleft: csize_t): PAnsiChar; cdecl; -Var - SDL_iconv_string : TSDL_iconv_string_fun = Nil; -{$else} - -function SDL_iconv_string(Const tocode, fromcode, inbuf: PAnsiChar; inbytesleft: csize_t): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iconv_string' {$ENDIF} {$ENDIF}; -{$endif} - -// These are macros in the original C headers, we will reimplement them as simple Pascal functions. -function SDL_iconv_utf8_locale(Const str: PAnsiChar): PAnsiChar; cdecl; -function SDL_iconv_utf8_ucs2(Const str: PAnsiChar): pcUint16; cdecl; -function SDL_iconv_utf8_ucs4(Const str: PAnsiChar): pcUint32; cdecl; - -(* The SDL implementation of iconv() returns these error codes *) -const - SDL_ICONV_ERROR = csize_t(-1); - SDL_ICONV_E2BIG = csize_t(-2); - SDL_ICONV_EILSEQ = csize_t(-3); - SDL_ICONV_EINVAL = csize_t(-4); - -type - PSDL_iconv = type Pointer; - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_iconv_open_fun = function(Const tocode, fromcode: PAnsiChar): PSDL_iconv; cdecl; -Var - SDL_iconv_open : TSDL_iconv_open_fun = Nil; -{$else} - -function SDL_iconv_open(Const tocode, fromcode: PAnsiChar): PSDL_iconv; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iconv_open' {$ENDIF} {$ENDIF}; -{$endif} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_iconv_close_fun = function(cd: PSDL_iconv): cint; cdecl; -Var - SDL_iconv_close : TSDL_iconv_close_fun = Nil; -{$else} - -function SDL_iconv_close(cd: PSDL_iconv): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iconv_close' {$ENDIF} {$ENDIF}; -{$endif} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_iconv_fun = function(cd: PSDL_iconv; Const inbuf: PPAnsiChar; inbytesleft: pcsize_t; outbuf: PPAnsiChar; outbytesleft: pcsize_t): csize_t; cdecl; -Var - SDL_iconv : TSDL_iconv_fun = Nil; -{$else} - -function SDL_iconv(cd: PSDL_iconv; Const inbuf: PPAnsiChar; inbytesleft: pcsize_t; outbuf: PPAnsiChar; outbytesleft: pcsize_t): csize_t; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iconv' {$ENDIF} {$ENDIF}; -{$endif} +//types from SDL_stdinc.h + +{ SDL-For-Pascal: A lot of the functions are missing. Some functions are useless + if working with Pascal (e. g. memory management functions), + others could be useful (e. g. math functions). + + TODO: Investigate header file and translate potentially useful functions. } + +type + PPSDL_Bool = ^PSDL_Bool; + PSDL_Bool = ^TSDL_Bool; + TSDL_Bool = cbool; + +const + SDL_FALSE = TSDL_Bool(0); + SDL_TRUE = TSDL_Bool(1); + + SDL_MAX_SINT8 = High(cint8); + SDL_MIN_SINT8 = Low(cint8); + + SDL_MAX_UINT8 = High(cuint8); + SDL_MIN_UINT8 = Low(cuint8); + + SDL_MAX_SINT16 = High(cint16); + SDL_MIN_SINT16 = Low(cint16); + + SDL_MAX_UINT16 = High(cuint16); + SDL_MIN_UINT16 = Low(cuint16); + + SDL_MAX_SINT32 = High(cint32); + SDL_MIN_SINT32 = Low(cint32); + + SDL_MAX_UINT32 = High(cuint32); + SDL_MIN_UINT32 = Low(cuint32); + + {$IFDEF Has_Int64} + SDL_MAX_SINT64 = High(cint64); + SDL_MIN_SINT64 = Low(cint64); + + SDL_MAX_UINT64 = High(cuint64); + SDL_MIN_UINT64 = Low(cuint64); + {$ELSE} + SDL_MAX_SINT64: cuint64 = (hi: SDL_MAX_SINT32; lo: SDL_MAX_UINT32); + SDL_MIN_SINT64: cuint64 = (hi: SDL_MIN_SINT32; lo: 0); + + SDL_MAX_UINT64: cuint64 = (hi: SDL_MAX_UINT32; lo: SDL_MAX_UINT32); + SDL_MIN_UINT64: cuint64 = (hi: 0; lo: 0); + {$ENDIF} + + SDL_FLT_EPSILON = cfloat(1.1920928955078125e-07); + +type + PPSDL_malloc_func = ^PSDL_malloc_func; + PSDL_malloc_func = ^TSDL_malloc_func; + TSDL_malloc_func = function(size: csize_t): Pointer; cdecl; + + PPSDL_calloc_func = ^PSDL_calloc_func; + PSDL_calloc_func = ^TSDL_calloc_func; + TSDL_calloc_func = function(nmemb, size: csize_t): Pointer; cdecl; + + PPSDL_realloc_func = ^PSDL_realloc_func; + PSDL_realloc_func = ^TSDL_realloc_func; + TSDL_realloc_func = function(mem: Pointer; size: csize_t): Pointer; cdecl; + + PPSDL_free_func = ^PSDL_free_func; + PSDL_free_func = ^TSDL_free_func; + TSDL_free_func = procedure(mem: Pointer); cdecl; + +{** + * Get the original set of SDL memory functions + * + * \since This function is available since SDL 2.24.0. + *} +procedure SDL_GetOriginalMemoryFunctions( + malloc_func: PSDL_malloc_func; + calloc_func: PSDL_calloc_func; + realloc_func: PSDL_realloc_func; + free_func: PSDL_free_func +); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetOriginalMemoryFunctions' {$ENDIF} {$ENDIF}; + +(** + * Get the current set of SDL memory functions + * + * \since This function is available since SDL 2.0.7. + *) +procedure SDL_GetMemoryFunctions( + malloc_func: PSDL_malloc_func; + calloc_func: PSDL_calloc_func; + realloc_func: PSDL_realloc_func; + free_func: PSDL_free_func +); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetMemoryFunctions' {$ENDIF} {$ENDIF}; + +(** + * Replace SDL's memory allocation functions with a custom set + * + * \since This function is available since SDL 2.0.7. + *) +function SDL_SetMemoryFunctions( + malloc_func: TSDL_malloc_func; + calloc_func: TSDL_calloc_func; + realloc_func: TSDL_realloc_func; + free_func: TSDL_free_func +): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetMemoryFunctions' {$ENDIF} {$ENDIF}; + +(** + * Get the number of outstanding (unfreed) allocations + * + * \since This function is available since SDL 2.0.7. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetNumAllocations_fun = function(): cint; cdecl; +Var + SDL_GetNumAllocations : TSDL_GetNumAllocations_fun = Nil; +{$else} + +function SDL_GetNumAllocations(): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumAllocations' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Allocate a block of memory. The memory is *not* initialized. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_malloc_fun = function(size: csize_t): Pointer; cdecl; +Var + SDL_malloc : TSDL_malloc_fun = Nil; +{$else} + +function SDL_malloc(size: csize_t): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_malloc' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Allocate a block of memory that can fit an array of nmemb elements, each of given size. + * The memory is initialized by setting every byte to 0. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_calloc_fun = function(nmemb, size: csize_t): Pointer; cdecl; +Var + SDL_calloc : TSDL_calloc_fun = Nil; +{$else} + +function SDL_calloc(nmemb, size: csize_t): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_calloc' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Resize a block of memory allocated previously with SDL_malloc() or SDL_calloc(). + * + * The returned pointer may or may not be the same as the original pointer. + * If the new size is larger than the old size, any new memory will *not* be initialized. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_realloc_fun = function(mem: Pointer; size: csize_t): Pointer; cdecl; +Var + SDL_realloc : TSDL_realloc_fun = Nil; +{$else} + +function SDL_realloc(mem: Pointer; size: csize_t): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_realloc' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Free memory returned by functions like SDL_GetBasePath(), SDL_GetPrefPath(), etc. + * + * Calling SDL_free() on the same pointer twice is undefined behaviour and may cause + * your program to crash or behave in unexpected ways. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_free_proc = procedure(mem: Pointer); cdecl; +Var + SDL_free : TSDL_free_proc = Nil; +{$else} + +procedure SDL_free(mem: Pointer); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_free' {$ENDIF} {$ENDIF}; +{$endif} + + + +{*** --- Character functions --- *** + +SDL2-for-Pascal: All comments are added by us and not found in the include file.} + + +(** + * Check if the provided ASCII character is an alphabetic character (a letter). + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_isalpha_fun = function(x: cint):cint; cdecl; +Var + SDL_isalpha : TSDL_isalpha_fun = Nil; +{$else} + +function SDL_isalpha(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isalpha' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Check if the provided ASCII character is an alphanumeric character. + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_isalnum_fun = function(x: cint):cint; cdecl; +Var + SDL_isalnum : TSDL_isalnum_fun = Nil; +{$else} + +function SDL_isalnum(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isalnum' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Check if the provided ASCII character is a blank character (a space or a tab). + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_isblank_fun = function(x: cint):cint; cdecl; +Var + SDL_isblank : TSDL_isblank_fun = Nil; +{$else} + +function SDL_isblank(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isblank' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Check if the provided ASCII character is a control character. + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_iscntrl_fun = function(x: cint):cint; cdecl; +Var + SDL_iscntrl : TSDL_iscntrl_fun = Nil; +{$else} + +function SDL_iscntrl(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iscntrl' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Check if the provided ASCII character is a decimal digit. + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_isdigit_fun = function(x: cint):cint; cdecl; +Var + SDL_isdigit : TSDL_isdigit_fun = Nil; +{$else} + +function SDL_isdigit(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isdigit' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Check if the provided ASCII character is a hexadecimal digit. + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_isxdigit_fun = function(x: cint):cint; cdecl; +Var + SDL_isxdigit : TSDL_isxdigit_fun = Nil; +{$else} + +function SDL_isxdigit(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isxdigit' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Check if the provided ASCII character is any printable character + * which is not a space or an alphanumeric character. + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ispunct_fun = function(x: cint):cint; cdecl; +Var + SDL_ispunct : TSDL_ispunct_fun = Nil; +{$else} + +function SDL_ispunct(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ispunct' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Check if the provided ASCII character is a whitespace character. + * This set includes the following characters: space, + * form feed (FF), newline/line feed (LF), carriage return (CR), + * horizontal tab (HT), vertical tab (VT). + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_isspace_fun = function(x: cint):cint; cdecl; +Var + SDL_isspace : TSDL_isspace_fun = Nil; +{$else} + +function SDL_isspace(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isspace' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Check if the provided ASCII character is an uppercase letter. + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.12. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_isupper_fun = function(x: cint):cint; cdecl; +Var + SDL_isupper : TSDL_isupper_fun = Nil; +{$else} + +function SDL_isupper(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isupper' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Check if the provided ASCII character is a lowercase letter. + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.12. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_islower_fun = function(x: cint):cint; cdecl; +Var + SDL_islower : TSDL_islower_fun = Nil; +{$else} + +function SDL_islower(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_islower' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Check if the provided ASCII character is a printable character (including space). + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_isprint_fun = function(x: cint):cint; cdecl; +Var + SDL_isprint : TSDL_isprint_fun = Nil; +{$else} + +function SDL_isprint(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isprint' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Check if the provided ASCII character is a printable character (excluding space). + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_isgraph_fun = function(x: cint):cint; cdecl; +Var + SDL_isgraph : TSDL_isgraph_fun = Nil; +{$else} + +function SDL_isgraph(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isgraph' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * If the given ASCII character is a lowercase letter, converts it to uppercase. + * Otherwise returns the original value. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_toupper_fun = function(x: cint):cint; cdecl; +Var + SDL_toupper : TSDL_toupper_fun = Nil; +{$else} + +function SDL_toupper(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_toupper' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * If the given ASCII character is an uppercase letter, converts it to lowercase. + * Otherwise returns the original value. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_tolower_fun = function(x: cint):cint; cdecl; +Var + SDL_tolower : TSDL_tolower_fun = Nil; +{$else} + +function SDL_tolower(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_tolower' {$ENDIF} {$ENDIF}; +{$endif} + + + +(*** --- Math functions --- ***) + + +(** + * Calculate the arc cosine of x; + * that is, the value (in radians) whose cosine equals x. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_acos_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_acos : TSDL_acos_fun = Nil; +{$else} + +function SDL_acos(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_acos' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the arc cosine of x; + * that is, the value (in radians) whose cosine equals x. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_acosf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_acosf : TSDL_acosf_fun = Nil; +{$else} + +function SDL_acosf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_acosf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the arc sine of x; + * that is, the value (in radians) whose sine equals x. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_asin_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_asin : TSDL_asin_fun = Nil; +{$else} + +function SDL_asin(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_asin' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the arc sine of x; + * that is, the value (in radians) whose sine equals x. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_asinf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_asinf : TSDL_asinf_fun = Nil; +{$else} + +function SDL_asinf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_asinf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the arc tangent of x; + * that is, the value (in radians) whose tangent equals x. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_atan_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_atan : TSDL_atan_fun = Nil; +{$else} + +function SDL_atan(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_atan' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the arc tangent of x; + * that is, the value (in radians) whose tangent equals x. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_atanf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_atanf : TSDL_atanf_fun = Nil; +{$else} + +function SDL_atanf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_atanf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the arc tangent of y/x, using the signs of the two arguments + * to determine the quadrant of the result. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_atan2_fun = function(y, x: cdouble): cdouble; cdecl; +Var + SDL_atan2 : TSDL_atan2_fun = Nil; +{$else} + +function SDL_atan2(y, x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_atan2' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the arc tangent of y/x, using the signs of the two arguments + * to determine the quadrant of the result. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_atan2f_fun = function(y, x: cfloat): cfloat; cdecl; +Var + SDL_atan2f : TSDL_atan2f_fun = Nil; +{$else} + +function SDL_atan2f(y, x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_atan2f' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the smallest integral value that is not less than x. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ceil_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_ceil : TSDL_ceil_fun = Nil; +{$else} + +function SDL_ceil(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ceil' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the smallest integral value that is not less than x. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ceilf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_ceilf : TSDL_ceilf_fun = Nil; +{$else} + +function SDL_ceilf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ceilf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Return a number whose absolute value matches that of x, + * but the sign matches that of y. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_copysign_fun = function(x, y: cdouble): cdouble; cdecl; +Var + SDL_copysign : TSDL_copysign_fun = Nil; +{$else} + +function SDL_copysign(x, y: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_copysign' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Return a number whose absolute value matches that of x, + * but the sign matches that of y. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_copysignf_fun = function(x, y: cfloat): cfloat; cdecl; +Var + SDL_copysignf : TSDL_copysignf_fun = Nil; +{$else} + +function SDL_copysignf(x, y: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_copysignf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the cosine of x, where x is given in radians. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_cos_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_cos : TSDL_cos_fun = Nil; +{$else} + +function SDL_cos(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_cos' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the cosine of x, where x is given in radians. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_cosf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_cosf : TSDL_cosf_fun = Nil; +{$else} + +function SDL_cosf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_cosf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the value of e (the base of natural logarithms) + * raised to the power of x. + * + * \since This function is available since SDL 2.0.9. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_exp_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_exp : TSDL_exp_fun = Nil; +{$else} + +function SDL_exp(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_exp' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the value of e (the base of natural logarithms) + * raised to the power of x. + * + * \since This function is available since SDL 2.0.9. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_expf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_expf : TSDL_expf_fun = Nil; +{$else} + +function SDL_expf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_expf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the absolute value of x. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_fabs_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_fabs : TSDL_fabs_fun = Nil; +{$else} + +function SDL_fabs(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_fabs' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the absolute value of x. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_fabsf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_fabsf : TSDL_fabsf_fun = Nil; +{$else} + +function SDL_fabsf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_fabsf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the largest integral value that is not greater than x. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_floor_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_floor : TSDL_floor_fun = Nil; +{$else} + +function SDL_floor(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_floor' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the largest integral value that is not greater than x. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_floorf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_floorf : TSDL_floorf_fun = Nil; +{$else} + +function SDL_floorf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_floorf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the floating-point remainder of dividing x by y. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_fmod_fun = function(x, y: cdouble): cdouble; cdecl; +Var + SDL_fmod : TSDL_fmod_fun = Nil; +{$else} + +function SDL_fmod(x, y: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_fmod' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the floating-point remainder of dividing x by y. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_fmodf_fun = function(x, y: cfloat): cfloat; cdecl; +Var + SDL_fmodf : TSDL_fmodf_fun = Nil; +{$else} + +function SDL_fmodf(x, y: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_fmodf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the natural logarithm of x. + * + * \since This function is available since SDL 2.0.4. + + SDL2-for-Pascal: ATTENTION: The original C name of this function is SDL_log, + but since Pascal names are case-insensitive, it is in conflict with SDL_Log (logging function). + Hence we decided to rename it. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_nlog_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_nlog : TSDL_nlog_fun = Nil; +{$else} + +function SDL_nlog(x: cdouble): cdouble; cdecl; + external SDL_LibName + name {$IF DEFINED(DELPHI) AND DEFINED(MACOS)} '_SDL_log' {$ELSE} 'SDL_log' {$ENDIF}; +{$endif} + +(** + * Calculate the natural logarithm of x. + * + * \since This function is available since SDL 2.0.8. + + SDL2-for-Pascal: ATTENTION: The original C name of this function is SDL_logf, + but to be consistent with the renamed SDL_log function (see comment of SDL_nlog + for details), we decided to rename it. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_nlogf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_nlogf : TSDL_nlogf_fun = Nil; +{$else} + +function SDL_nlogf(x: cfloat): cfloat; cdecl; + external SDL_LibName + name {$IF DEFINED(DELPHI) AND DEFINED(MACOS)} '_SDL_logf' {$ELSE} 'SDL_logf' {$ENDIF}; +{$endif} + +(** + * Calculate the base 10 logarithm of x. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_log10_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_log10 : TSDL_log10_fun = Nil; +{$else} + +function SDL_log10(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_log10' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the base 10 logarithm of x. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_log10f_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_log10f : TSDL_log10f_fun = Nil; +{$else} + +function SDL_log10f(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_log10f' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Round to nearest integer, away from zero. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_lround_fun = function(x: cdouble): clong; cdecl; +Var + SDL_lround : TSDL_lround_fun = Nil; +{$else} + +function SDL_lround(x: cdouble): clong; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_lround' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Round to nearest integer, away from zero. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_lroundf_fun = function(x: cfloat): clong; cdecl; +Var + SDL_lroundf : TSDL_lroundf_fun = Nil; +{$else} + +function SDL_lroundf(x: cfloat): clong; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_lroundf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the value of x raised to the power of y. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_pow_fun = function(x, y: cdouble): cdouble; cdecl; +Var + SDL_pow : TSDL_pow_fun = Nil; +{$else} + +function SDL_pow(x, y: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_pow' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the value of x raised to the power of y. + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_powf_fun = function(x, y: cfloat): cfloat; cdecl; +Var + SDL_powf : TSDL_powf_fun = Nil; +{$else} + +function SDL_powf(x, y: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_powf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Round to nearest integral value, away from zero. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_round_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_round : TSDL_round_fun = Nil; +{$else} + +function SDL_round(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_round' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Round to nearest integral value, away from zero. + * + * \since This function is available since SDL 2.0.16. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_roundf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_roundf : TSDL_roundf_fun = Nil; +{$else} + +function SDL_roundf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_roundf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate x multiplied by the floating-point radix to the power of n. + * On most systems, the radix is 2, making this equivalent to x*(2**n). + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_scalbn_fun = function(x: cdouble; n: cint): cdouble; cdecl; +Var + SDL_scalbn : TSDL_scalbn_fun = Nil; +{$else} + +function SDL_scalbn(x: cdouble; n: cint): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_scalbn' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate x multiplied by the floating-point radix to the power of n. + * On most systems, the radix is 2, making this equivalent to x*(2**n). + * + * \since This function is available since SDL 2.0.8. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_scalbnf_fun = function(x: cfloat; n: cint): cfloat; cdecl; +Var + SDL_scalbnf : TSDL_scalbnf_fun = Nil; +{$else} + +function SDL_scalbnf(x: cfloat; n: cint): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_scalbnf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the sine of x, where x is given in radians. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_sin_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_sin : TSDL_sin_fun = Nil; +{$else} + +function SDL_sin(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_sin' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the sine of x, where x is given in radians. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_sinf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_sinf : TSDL_sinf_fun = Nil; +{$else} + +function SDL_sinf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_sinf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the non-negative square root of x. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_sqrt_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_sqrt : TSDL_sqrt_fun = Nil; +{$else} + +function SDL_sqrt(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_sqrt' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the non-negative square root of x. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_sqrtf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_sqrtf : TSDL_sqrtf_fun = Nil; +{$else} + +function SDL_sqrtf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_sqrtf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the tangent of x, where x is given in radians. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_tan_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_tan : TSDL_tan_fun = Nil; +{$else} + +function SDL_tan(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_tan' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Calculate the tangent of x, where x is given in radians. + * + * \since This function is available since SDL 2.0.4. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_tanf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_tanf : TSDL_tanf_fun = Nil; +{$else} + +function SDL_tanf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_tanf' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Round to nearest integral value, towards zero. + * + * \since This function is available since SDL 2.0.14. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_trunc_fun = function(x: cdouble): cdouble; cdecl; +Var + SDL_trunc : TSDL_trunc_fun = Nil; +{$else} + +function SDL_trunc(x: cdouble): cdouble; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_trunc' {$ENDIF} {$ENDIF}; +{$endif} + +(** + * Round to nearest integral value, towards zero. + * + * \since This function is available since SDL 2.0.14. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_truncf_fun = function(x: cfloat): cfloat; cdecl; +Var + SDL_truncf : TSDL_truncf_fun = Nil; +{$else} + +function SDL_truncf(x: cfloat): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_truncf' {$ENDIF} {$ENDIF}; +{$endif} + + + +(*** --- iconv functions --- ***) + + +(** + * This function converts a string between encodings in one pass, returning a + * string that must be freed with SDL_free(), or NIL on error. + * + * \since This function is available since SDL 2.0.0. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_iconv_string_fun = function(Const tocode, fromcode, inbuf: PAnsiChar; inbytesleft: csize_t): PAnsiChar; cdecl; +Var + SDL_iconv_string : TSDL_iconv_string_fun = Nil; +{$else} + +function SDL_iconv_string(Const tocode, fromcode, inbuf: PAnsiChar; inbytesleft: csize_t): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iconv_string' {$ENDIF} {$ENDIF}; +{$endif} + +// These are macros in the original C headers, we will reimplement them as simple Pascal functions. +function SDL_iconv_utf8_locale(Const str: PAnsiChar): PAnsiChar; cdecl; +function SDL_iconv_utf8_ucs2(Const str: PAnsiChar): pcUint16; cdecl; +function SDL_iconv_utf8_ucs4(Const str: PAnsiChar): pcUint32; cdecl; + +(* The SDL implementation of iconv() returns these error codes *) +const + SDL_ICONV_ERROR = csize_t(-1); + SDL_ICONV_E2BIG = csize_t(-2); + SDL_ICONV_EILSEQ = csize_t(-3); + SDL_ICONV_EINVAL = csize_t(-4); + +type + PSDL_iconv = type Pointer; + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_iconv_open_fun = function(Const tocode, fromcode: PAnsiChar): PSDL_iconv; cdecl; +Var + SDL_iconv_open : TSDL_iconv_open_fun = Nil; +{$else} + +function SDL_iconv_open(Const tocode, fromcode: PAnsiChar): PSDL_iconv; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iconv_open' {$ENDIF} {$ENDIF}; +{$endif} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_iconv_close_fun = function(cd: PSDL_iconv): cint; cdecl; +Var + SDL_iconv_close : TSDL_iconv_close_fun = Nil; +{$else} + +function SDL_iconv_close(cd: PSDL_iconv): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iconv_close' {$ENDIF} {$ENDIF}; +{$endif} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_iconv_fun = function(cd: PSDL_iconv; Const inbuf: PPAnsiChar; inbytesleft: pcsize_t; outbuf: PPAnsiChar; outbytesleft: pcsize_t): csize_t; cdecl; +Var + SDL_iconv : TSDL_iconv_fun = Nil; +{$else} + +function SDL_iconv(cd: PSDL_iconv; Const inbuf: PPAnsiChar; inbytesleft: pcsize_t; outbuf: PPAnsiChar; outbytesleft: pcsize_t): csize_t; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iconv' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlsurface.inc b/units/sdlsurface.inc index a7c0590d..98a505df 100644 --- a/units/sdlsurface.inc +++ b/units/sdlsurface.inc @@ -1,847 +1,847 @@ -//from "sdl_surface.h" - -const - {** - * Surface flags - * - * These are the currently supported flags for the ::SDL_surface. - * - * Used internally (read-only). - *} - - SDL_SWSURFACE = 0; {**< Just here for compatibility *} - SDL_PREALLOC = $00000001; {**< Surface uses preallocated memory *} - SDL_RLEACCEL = $00000002; {**< Surface is RLE encoded *} - SDL_DONTFREE = $00000004; {**< Surface is referenced internally *} - SDL_SIMD_ALIGNED = $00000008; {**< Surface uses aligned memory *} - -type - {** - * A collection of pixels used in software blitting. - * - * This structure should be treated as read-only, except for \c pixels, - * which, if not NULL, contains the raw pixel data for the surface. - *} - PPSDL_BlitMap = ^PSDL_BlitMap; - PSDL_BlitMap = type Pointer; - - PPSDL_Surface = ^PSDL_Surface; - PSDL_Surface = ^TSDL_Surface; - TSDL_Surface = record - flags: cuint32; {**< Read-only *} - format: PSDL_PixelFormat; {**< Read-only *} - w, h: cint; {**< Read-only *} - pitch: cint; {**< Read-only *} - pixels: Pointer; {**< Read-write *} - - {** Application data associated with the surface *} - userdata: Pointer; {**< Read-write *} - - {** information needed for surfaces requiring locks *} - locked: cint; {**< Read-only *} - //lock_data: Pointer; {**< Read-only *} // field gone in or before 2.0.14? - - {** list of BlitMap that hold a reference to this surface *} - list_blitmap: Pointer; {**< Private *} - - {** clipping information *} - clip_rect: TSDL_Rect; {**< Read-only *} - - {** info for fast blit mapping to other surfaces *} - map: PSDL_BlitMap; {**< Private *} - - {** Reference count -- used when freeing surface *} - refcount: cint; {**< Read-mostly *} - end; - -// Evaluates to true if the surface needs to be locked before access. -function SDL_MUSTLOCK(Const S:PSDL_Surface):Boolean; - -type - {** - * The type of function used for surface blitting functions. - *} - PPSDL_Blit = ^PSDL_Blit; - PSDL_Blit = ^TSDL_Blit; - TSDL_Blit = function(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; - -type - {** - * \brief The formula used for converting between YUV and RGB - *} - TSDL_YUV_CONVERSION_MODE = type Integer; - -const - SDL_YUV_CONVERSION_JPEG = TSDL_YUV_CONVERSION_MODE(0); {**< Full range JPEG *} - SDL_YUV_CONVERSION_BT601 = TSDL_YUV_CONVERSION_MODE(1); {**< BT.601 (the default) *} - SDL_YUV_CONVERSION_BT709 = TSDL_YUV_CONVERSION_MODE(2); {**< BT.709 *} - SDL_YUV_CONVERSION_AUTOMATIC = TSDL_YUV_CONVERSION_MODE(3); {**< BT.601 for SD content, BT.709 for HD content *} - - {** - * Allocate and free an RGB surface. - * - * If the depth is 4 or 8 bits, an empty palette is allocated for the surface. - * If the depth is greater than 8 bits, the pixel format is set using the - * flags '[RGB]mask'. - * - * If the function runs out of memory, it will return NULL. - * - * \param flags The \c flags are obsolete and should be set to 0. - * \param width The width in pixels of the surface to create. - * \param height The height in pixels of the surface to create. - * \param depth The depth in bits of the surface to create. - * \param Rmask The red mask of the surface to create. - * \param Gmask The green mask of the surface to create. - * \param Bmask The blue mask of the surface to create. - * \param Amask The alpha mask of the surface to create. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_CreateRGBSurface_fun = function(flags: cuint32; width: cint; height: cint; depth: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl; -Var - SDL_CreateRGBSurface : TSDL_CreateRGBSurface_fun = Nil; -{$else} - -function SDL_CreateRGBSurface(flags: cuint32; width: cint; height: cint; depth: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurface' {$ENDIF} {$ENDIF}; -{$endif} -{* !!! FIXME for 2.1: why does this ask for depth? Format provides that. *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_CreateRGBSurfaceWithFormat_fun = function(flags: cuint32; width, height, depth: cint; format: cuint32):PSDL_Surface; cdecl; -Var - SDL_CreateRGBSurfaceWithFormat : TSDL_CreateRGBSurfaceWithFormat_fun = Nil; -{$else} - -function SDL_CreateRGBSurfaceWithFormat(flags: cuint32; width, height, depth: cint; format: cuint32):PSDL_Surface; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurfaceWithFormat' {$ENDIF} {$ENDIF}; -{$endif} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_CreateRGBSurfaceFrom_fun = function(pixels: Pointer; width: cint; height: cint; depth: cint; pitch: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl; -Var - SDL_CreateRGBSurfaceFrom : TSDL_CreateRGBSurfaceFrom_fun = Nil; -{$else} - -function SDL_CreateRGBSurfaceFrom(pixels: Pointer; width: cint; height: cint; depth: cint; pitch: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurfaceFrom' {$ENDIF} {$ENDIF}; -{$endif} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_CreateRGBSurfaceWithFormatFrom_fun = function(pixels: Pointer; width, height, depth, pitch: cint; format: cuint32):PSDL_Surface; cdecl; -Var - SDL_CreateRGBSurfaceWithFormatFrom : TSDL_CreateRGBSurfaceWithFormatFrom_fun = Nil; -{$else} - -function SDL_CreateRGBSurfaceWithFormatFrom(pixels: Pointer; width, height, depth, pitch: cint; format: cuint32):PSDL_Surface; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurfaceWithFormatFrom' {$ENDIF} {$ENDIF}; -{$endif} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_FreeSurface_proc = procedure(surface: PSDL_Surface); cdecl; -Var - SDL_FreeSurface : TSDL_FreeSurface_proc = Nil; -{$else} - -procedure SDL_FreeSurface(surface: PSDL_Surface); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeSurface' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Set the palette used by a surface. - * - * 0, or -1 if the surface format doesn't use a palette. - * - * A single palette can be shared with many surfaces. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetSurfacePalette_fun = function(surface: PSDL_Surface; palette: PSDL_Palette): cint; cdecl; -Var - SDL_SetSurfacePalette : TSDL_SetSurfacePalette_fun = Nil; -{$else} - -function SDL_SetSurfacePalette(surface: PSDL_Surface; palette: PSDL_Palette): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfacePalette' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Sets up a surface for directly accessing the pixels. - * - * Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write - * to and read from surface.pixels, using the pixel format stored in - * surface.format. Once you are done accessing the surface, you should - * use SDL_UnlockSurface() to release it. - * - * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates - * to 0, then you can read and write to the surface at any time, and the - * pixel format of the surface will not change. - * - * No operating system or library calls should be made between lock/unlock - * pairs, as critical system locks may be held during this time. - * - * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. - * - * SDL_UnlockSurface() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LockSurface_fun = function(surface: PSDL_Surface): cint; cdecl; -Var - SDL_LockSurface : TSDL_LockSurface_fun = Nil; -{$else} - -function SDL_LockSurface(surface: PSDL_Surface): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockSurface' {$ENDIF} {$ENDIF}; -{$endif} - - {** SDL_LockSurface() *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_UnlockSurface_proc = procedure(surface: PSDL_Surface); cdecl; -Var - SDL_UnlockSurface : TSDL_UnlockSurface_proc = Nil; -{$else} - -procedure SDL_UnlockSurface(surface: PSDL_Surface); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnlockSurface' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Load a surface from a seekable SDL data stream (memory or file). - * - * If freesrc is non-zero, the stream will be closed after being read. - * - * The new surface should be freed with SDL_FreeSurface(). - * - * the new surface, or NULL if there was an error. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LoadBMP_RW_fun = function(src: PSDL_RWops; freesrc: cint): PSDL_Surface; cdecl; -Var - SDL_LoadBMP_RW : TSDL_LoadBMP_RW_fun = Nil; -{$else} - -function SDL_LoadBMP_RW(src: PSDL_RWops; freesrc: cint): PSDL_Surface; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadBMP_RW' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Load a surface from a file. - * - * Convenience macro. - *} - -function SDL_LoadBMP(_file: PAnsiChar): PSDL_Surface; - - {** - * Save a surface to a seekable SDL data stream (memory or file). - * - * Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the - * BMP directly. Other RGB formats with 8-bit or higher get converted to a - * 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit - * surface before they are saved. YUV and paletted 1-bit and 4-bit formats are - * not supported. - * - * If \c freedst is non-zero, the stream will be closed after being written. - * - * \return 0 if successful or -1 if there was an error. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SaveBMP_RW_fun = function(surface: PSDL_Surface; dst: PSDL_RWops; freedst: cint): cint; cdecl; -Var - SDL_SaveBMP_RW : TSDL_SaveBMP_RW_fun = Nil; -{$else} - -function SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SaveBMP_RW' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Save a surface to a file. - * - * Convenience macro. - *} -{ TODO : Check: Why AnsiString instead of PAnsiChar used here? Compare SDL_LoadBMP macro. } -function SDL_SaveBMP(const surface: PSDL_Surface; const filename:AnsiString): cint; - - {** - * Sets the RLE acceleration hint for a surface. - * - * 0 on success, or -1 if the surface is not valid - * - * If RLE is enabled, colorkey and alpha blending blits are much faster, - * but the surface must be locked before directly accessing the pixels. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetSurfaceRLE_fun = function(surface: PSDL_Surface; flag: cint): cint; cdecl; -Var - SDL_SetSurfaceRLE : TSDL_SetSurfaceRLE_fun = Nil; -{$else} - -function SDL_SetSurfaceRLE(surface: PSDL_Surface; flag: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfaceRLE' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * \brief Returns whether the surface is RLE enabled - * - * \return SDL_TRUE if the surface is RLE enabled, or SDL_FALSE if the surface is NULL or not RLE enabled - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HasSurfaceRLE_fun = function(surface: PSDL_Surface): TSDL_Bool; cdecl; -Var - SDL_HasSurfaceRLE : TSDL_HasSurfaceRLE_fun = Nil; -{$else} - - function SDL_HasSurfaceRLE(surface: PSDL_Surface): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSurfaceRLE' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Sets the color key (transparent pixel) in a blittable surface. - * - * surface The surface to update - * flag Non-zero to enable colorkey and 0 to disable colorkey - * key The transparent pixel in the native surface format - * - * 0 on success, or -1 if the surface is not valid - * - * You can pass SDL_RLEACCEL to enable RLE accelerated blits. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetColorKey_fun = function(surface: PSDL_Surface; flag: cint; key: cuint32): cint; cdecl; -Var - SDL_SetColorKey : TSDL_SetColorKey_fun = Nil; -{$else} - -function SDL_SetColorKey(surface: PSDL_Surface; flag: cint; key: cuint32): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetColorKey' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * \brief Returns whether the surface has a color key - * - * \return SDL_TRUE if the surface has a color key, or SDL_FALSE if the surface is NULL or has no color key - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HasColorKey_fun = function(surface: PSDL_Surface): TSDL_Bool; cdecl; -Var - SDL_HasColorKey : TSDL_HasColorKey_fun = Nil; -{$else} - -function SDL_HasColorKey(surface: PSDL_Surface): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasColorKey' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Gets the color key (transparent pixel) in a blittable surface. - * - * surface The surface to update - * key A pointer filled in with the transparent pixel in the native - * surface format - * - * 0 on success, or -1 if the surface is not valid or colorkey is not - * enabled. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetColorKey_fun = function(surface: PSDL_Surface; key: pcuint32): cint; cdecl; -Var - SDL_GetColorKey : TSDL_GetColorKey_fun = Nil; -{$else} - -function SDL_GetColorKey(surface: PSDL_Surface; key: pcuint32): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetColorKey' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Set an additional color value used in blit operations. - * - * surface The surface to update. - * r The red color value multiplied into blit operations. - * g The green color value multiplied into blit operations. - * b The blue color value multiplied into blit operations. - * - * 0 on success, or -1 if the surface is not valid. - * - * SDL_GetSurfaceColorMod() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetSurfaceColorMod_fun = function(surface: PSDL_Surface; r: cuint8; g: cuint8; b: cuint8): cint; cdecl; -Var - SDL_SetSurfaceColorMod : TSDL_SetSurfaceColorMod_fun = Nil; -{$else} - -function SDL_SetSurfaceColorMod(surface: PSDL_Surface; r: cuint8; g: cuint8; b: cuint8): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfaceColorMod' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the additional color value used in blit operations. - * - * surface The surface to query. - * r A pointer filled in with the current red color value. - * g A pointer filled in with the current green color value. - * b A pointer filled in with the current blue color value. - * - * 0 on success, or -1 if the surface is not valid. - * - * SDL_SetSurfaceColorMod() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetSurfaceColorMod_fun = function(surface: PSDL_Surface; r: pcuint8; g: pcuint8; b: pcuint8): cint; cdecl; -Var - SDL_GetSurfaceColorMod : TSDL_GetSurfaceColorMod_fun = Nil; -{$else} - -function SDL_GetSurfaceColorMod(surface: PSDL_Surface; r: pcuint8; g: pcuint8; b: pcuint8): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetSurfaceColorMod' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Set an additional alpha value used in blit operations. - * - * surface The surface to update. - * alpha The alpha value multiplied into blit operations. - * - * 0 on success, or -1 if the surface is not valid. - * - * SDL_GetSurfaceAlphaMod() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetSurfaceAlphaMod_fun = function(surface: PSDL_Surface; alpha: cuint8): cint; cdecl; -Var - SDL_SetSurfaceAlphaMod : TSDL_SetSurfaceAlphaMod_fun = Nil; -{$else} - -function SDL_SetSurfaceAlphaMod(surface: PSDL_Surface; alpha: cuint8): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfaceAlphaMod' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the additional alpha value used in blit operations. - * - * surface The surface to query. - * alpha A pointer filled in with the current alpha value. - * - * 0 on success, or -1 if the surface is not valid. - * - * SDL_SetSurfaceAlphaMod() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetSurfaceAlphaMod_fun = function(surface: PSDL_Surface; alpha: pcuint8): cint; cdecl; -Var - SDL_GetSurfaceAlphaMod : TSDL_GetSurfaceAlphaMod_fun = Nil; -{$else} - -function SDL_GetSurfaceAlphaMod(surface: PSDL_Surface; alpha: pcuint8): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetSurfaceAlphaMod' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Set the blend mode used for blit operations. - * - * surface The surface to update. - * blendMode ::SDL_BlendMode to use for blit blending. - * - * 0 on success, or -1 if the parameters are not valid. - * - * SDL_GetSurfaceBlendMode() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetSurfaceBlendMode_fun = function(surface: PSDL_Surface; blendMode: TSDL_BlendMode): cint; cdecl; -Var - SDL_SetSurfaceBlendMode : TSDL_SetSurfaceBlendMode_fun = Nil; -{$else} - -function SDL_SetSurfaceBlendMode(surface: PSDL_Surface; blendMode: TSDL_BlendMode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfaceBlendMode' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the blend mode used for blit operations. - * - * surface The surface to query. - * blendMode A pointer filled in with the current blend mode. - * - * 0 on success, or -1 if the surface is not valid. - * - * SDL_SetSurfaceBlendMode() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetSurfaceBlendMode_fun = function(surface: PSDL_Surface; blendMode: PSDL_BlendMode): cint; cdecl; -Var - SDL_GetSurfaceBlendMode : TSDL_GetSurfaceBlendMode_fun = Nil; -{$else} - -function SDL_GetSurfaceBlendMode(surface: PSDL_Surface; blendMode: PSDL_BlendMode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetSurfaceBlendMode' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Sets the clipping rectangle for the destination surface in a blit. - * - * If the clip rectangle is NULL, clipping will be disabled. - * - * If the clip rectangle doesn't intersect the surface, the function will - * return SDL_FALSE and blits will be completely clipped. Otherwise the - * function returns SDL_TRUE and blits to the surface will be clipped to - * the intersection of the surface area and the clipping rectangle. - * - * Note that blits are automatically clipped to the edges of the source - * and destination surfaces. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetClipRect_fun = function(surface: PSDL_Surface; const rect: PSDL_Rect): TSDL_Bool; cdecl; -Var - SDL_SetClipRect : TSDL_SetClipRect_fun = Nil; -{$else} - -function SDL_SetClipRect(surface: PSDL_Surface; const rect: PSDL_Rect): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetClipRect' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Gets the clipping rectangle for the destination surface in a blit. - * - * rect must be a pointer to a valid rectangle which will be filled - * with the correct values. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetClipRect_proc = procedure(surface: PSDL_Surface; rect: PSDL_Rect); cdecl; -Var - SDL_GetClipRect : TSDL_GetClipRect_proc = Nil; -{$else} - -procedure SDL_GetClipRect(surface: PSDL_Surface; rect: PSDL_Rect); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetClipRect' {$ENDIF} {$ENDIF}; -{$endif} - -{* - * Creates a new surface identical to the existing surface - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_DuplicateSurface_fun = function(surface: PSDL_Surface): PSDL_Surface; cdecl; -Var - SDL_DuplicateSurface : TSDL_DuplicateSurface_fun = Nil; -{$else} - -function SDL_DuplicateSurface(surface: PSDL_Surface): PSDL_Surface; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DuplicateSurface' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Creates a new surface of the specified format, and then copies and maps - * the given surface to it so the blit of the converted surface will be as - * fast as possible. If this function fails, it returns NULL. - * - * The flags parameter is passed to SDL_CreateRGBSurface() and has those - * semantics. You can also pass SDL_RLEACCEL in the flags parameter and - * SDL will try to RLE accelerate colorkey and alpha blits in the resulting - * surface. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_ConvertSurface_fun = function(src: PSDL_Surface; const fmt: PSDL_PixelFormat; flags: cuint32): PSDL_Surface; cdecl; -Var - SDL_ConvertSurface : TSDL_ConvertSurface_fun = Nil; -{$else} - -function SDL_ConvertSurface(src: PSDL_Surface; const fmt: PSDL_PixelFormat; flags: cuint32): PSDL_Surface; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ConvertSurface' {$ENDIF} {$ENDIF}; -{$endif} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_ConvertSurfaceFormat_fun = function(src: PSDL_Surface; pixel_format: cuint32; flags: cuint32): PSDL_Surface; cdecl; -Var - SDL_ConvertSurfaceFormat : TSDL_ConvertSurfaceFormat_fun = Nil; -{$else} - -function SDL_ConvertSurfaceFormat(src: PSDL_Surface; pixel_format: cuint32; flags: cuint32): PSDL_Surface; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ConvertSurfaceFormat' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Copy a block of pixels of one format to another format - * - * 0 on success, or -1 if there was an error - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_ConvertPixels_fun = function(width: cint; height: cint; src_format: cuint32; const src: Pointer; src_pitch: cint; dst_format: cuint32; dst: Pointer; dst_pitch: cint): cint; cdecl; -Var - SDL_ConvertPixels : TSDL_ConvertPixels_fun = Nil; -{$else} - -function SDL_ConvertPixels(width: cint; height: cint; src_format: cuint32; const src: Pointer; src_pitch: cint; dst_format: cuint32; dst: Pointer; dst_pitch: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ConvertPixels' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Performs a fast fill of the given rectangle with color. - * - * If rect is NULL, the whole surface will be filled with color. - * - * The color should be a pixel of the format used by the surface, and - * can be generated by the SDL_MapRGB() function. - * - * 0 on success, or -1 on error. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_FillRect_fun = function(dst: PSDL_Surface; const rect: PSDL_Rect; color: cuint32): cint; cdecl; -Var - SDL_FillRect : TSDL_FillRect_fun = Nil; -{$else} - -function SDL_FillRect(dst: PSDL_Surface; const rect: PSDL_Rect; color: cuint32): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FillRect' {$ENDIF} {$ENDIF}; -{$endif} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_FillRects_fun = function(dst: PSDL_Surface; const rects: PSDL_Rect; count: cint; color: cuint32): cint; cdecl; -Var - SDL_FillRects : TSDL_FillRects_fun = Nil; -{$else} - -function SDL_FillRects(dst: PSDL_Surface; const rects: PSDL_Rect; count: cint; color: cuint32): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FillRects' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Performs a fast blit from the source surface to the destination surface. - * - * This assumes that the source and destination rectangles are - * the same size. If either \c srcrect or \c dstrect are NULL, the entire - * surface ( src or dst) is copied. The final blit rectangles are saved - * in srcrect and dstrect after all clipping is performed. - * - * If the blit is successful, it returns 0, otherwise it returns -1. - * - * The blit function should not be called on a locked surface. - * - * The blit semantics for surfaces with and without alpha and colorkey - * are defined as follows: - * - RGBA->RGB: - SDL_SRCALPHA set: - alpha-blend (using alpha-channel). - SDL_SRCCOLORKEY ignored. - SDL_SRCALPHA not set: - copy RGB. - if SDL_SRCCOLORKEY set, only copy the pixels matching the - RGB values of the source colour key, ignoring alpha in the - comparison. - - RGB->RGBA: - SDL_SRCALPHA set: - alpha-blend (using the source per-surface alpha value); - set destination alpha to opaque. - SDL_SRCALPHA not set: - copy RGB, set destination alpha to source per-surface alpha value. - both: - if SDL_SRCCOLORKEY set, only copy the pixels matching the - source colour key. - - RGBA->RGBA: - SDL_SRCALPHA set: - alpha-blend (using the source alpha channel) the RGB values; - leave destination alpha untouched. [Note: is this correct?] - SDL_SRCCOLORKEY ignored. - SDL_SRCALPHA not set: - copy all of RGBA to the destination. - if SDL_SRCCOLORKEY set, only copy the pixels matching the - RGB values of the source colour key, ignoring alpha in the - comparison. - - RGB->RGB: - SDL_SRCALPHA set: - alpha-blend (using the source per-surface alpha value). - SDL_SRCALPHA not set: - copy RGB. - both: - if SDL_SRCCOLORKEY set, only copy the pixels matching the - source colour key.r - * - * You should call SDL_BlitSurface() unless you know exactly how SDL - * blitting works internally and how to use the other blit functions. - *} - -(* SDL_surface.h uses #define to change all SDL_BlitSurface() calls into SDL_UpperBlit() calls. * - * Since Pascal macro support is very limited, we workaround by outright pointing SDL_BlitSurface() to SDL_UpperBlit(). *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_BlitSurface_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; -Var - SDL_BlitSurface : TSDL_BlitSurface_fun = Nil; -{$else} - -function SDL_BlitSurface(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; - external SDL_LibName name {$IF DEFINED(DELPHI) AND DEFINED(MACOS)} '_SDL_UpperBlit' {$ELSE} 'SDL_UpperBlit' {$IFEND}; -{$endif} - - - {** - * This is the public blit function, SDL_BlitSurface(), and it performs - * rectangle validation and clipping before passing it to SDL_LowerBlit() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_UpperBlit_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; -Var - SDL_UpperBlit : TSDL_UpperBlit_fun = Nil; -{$else} - -function SDL_UpperBlit(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpperBlit' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * This is a semi-private blit function and it performs low-level surface - * blitting only. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LowerBlit_fun = function(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; -Var - SDL_LowerBlit : TSDL_LowerBlit_fun = Nil; -{$else} - -function SDL_LowerBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LowerBlit' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Perform a fast, low quality, stretch blit between two surfaces of the - * same pixel format. - * - * This function uses a static buffer, and is not thread-safe. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SoftStretch_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; const dstrect: PSDL_Surface): cint; cdecl; -Var - SDL_SoftStretch : TSDL_SoftStretch_fun = Nil; -{$else} - -function SDL_SoftStretch(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; const dstrect: PSDL_Surface): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SoftStretch' {$ENDIF} {$ENDIF}; -{$endif} - -(* SDL_surface.h uses #define to change all SDL_BlitSurfaceScaled() calls into SDL_UpperBlitScaled() calls. * - * Since Pascal macro support is very limited, we workaround by outright pointing SDL_BlitSurfaceScaled() to SDL_UpperBlitScaled(). *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_BlitSurfaceScaled_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; -Var - SDL_BlitSurfaceScaled : TSDL_BlitSurfaceScaled_fun = Nil; -{$else} - -function SDL_BlitSurfaceScaled(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; - external SDL_LibName name {$IF DEFINED(DELPHI) AND DEFINED(MACOS)} '_SDL_UpperBlitScaled' {$ELSE} 'SDL_UpperBlitScaled' {$IFEND}; -{$endif} - - {** - * This is the public scaled blit function, SDL_BlitScaled(), and it performs - * rectangle validation and clipping before passing it to SDL_LowerBlitScaled() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_UpperBlitScaled_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; -Var - SDL_UpperBlitScaled : TSDL_UpperBlitScaled_fun = Nil; -{$else} - -function SDL_UpperBlitScaled(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpperBlitScaled' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * This is a semi-private blit function and it performs low-level surface - * scaled blitting only. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LowerBlitScaled_fun = function(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; -Var - SDL_LowerBlitScaled : TSDL_LowerBlitScaled_fun = Nil; -{$else} - -function SDL_LowerBlitScaled(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LowerBlitScaled' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * \brief Set the YUV conversion mode - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetYUVConversionMode_proc = procedure(mode: TSDL_YUV_CONVERSION_MODE); cdecl; -Var - SDL_SetYUVConversionMode : TSDL_SetYUVConversionMode_proc = Nil; -{$else} - -procedure SDL_SetYUVConversionMode(mode: TSDL_YUV_CONVERSION_MODE); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetYUVConversionMode' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * \brief Get the YUV conversion mode - *} -function SDL_GetYUVConversionMode: TSDL_YUV_CONVERSION_MODE; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetYUVConversionMode' {$ENDIF} {$ENDIF}; - -{** - * \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetYUVConversionModeForResolution_fun = function(width: cint; height: cint): TSDL_YUV_CONVERSION_MODE; cdecl; -Var - SDL_GetYUVConversionModeForResolution : TSDL_GetYUVConversionModeForResolution_fun = Nil; -{$else} - -function SDL_GetYUVConversionModeForResolution(width: cint; height: cint): TSDL_YUV_CONVERSION_MODE; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetYUVConversionModeForResolution' {$ENDIF} {$ENDIF}; -{$endif} +//from "sdl_surface.h" + +const + {** + * Surface flags + * + * These are the currently supported flags for the ::SDL_surface. + * + * Used internally (read-only). + *} + + SDL_SWSURFACE = 0; {**< Just here for compatibility *} + SDL_PREALLOC = $00000001; {**< Surface uses preallocated memory *} + SDL_RLEACCEL = $00000002; {**< Surface is RLE encoded *} + SDL_DONTFREE = $00000004; {**< Surface is referenced internally *} + SDL_SIMD_ALIGNED = $00000008; {**< Surface uses aligned memory *} + +type + {** + * A collection of pixels used in software blitting. + * + * This structure should be treated as read-only, except for \c pixels, + * which, if not NULL, contains the raw pixel data for the surface. + *} + PPSDL_BlitMap = ^PSDL_BlitMap; + PSDL_BlitMap = type Pointer; + + PPSDL_Surface = ^PSDL_Surface; + PSDL_Surface = ^TSDL_Surface; + TSDL_Surface = record + flags: cuint32; {**< Read-only *} + format: PSDL_PixelFormat; {**< Read-only *} + w, h: cint; {**< Read-only *} + pitch: cint; {**< Read-only *} + pixels: Pointer; {**< Read-write *} + + {** Application data associated with the surface *} + userdata: Pointer; {**< Read-write *} + + {** information needed for surfaces requiring locks *} + locked: cint; {**< Read-only *} + //lock_data: Pointer; {**< Read-only *} // field gone in or before 2.0.14? + + {** list of BlitMap that hold a reference to this surface *} + list_blitmap: Pointer; {**< Private *} + + {** clipping information *} + clip_rect: TSDL_Rect; {**< Read-only *} + + {** info for fast blit mapping to other surfaces *} + map: PSDL_BlitMap; {**< Private *} + + {** Reference count -- used when freeing surface *} + refcount: cint; {**< Read-mostly *} + end; + +// Evaluates to true if the surface needs to be locked before access. +function SDL_MUSTLOCK(Const S:PSDL_Surface):Boolean; + +type + {** + * The type of function used for surface blitting functions. + *} + PPSDL_Blit = ^PSDL_Blit; + PSDL_Blit = ^TSDL_Blit; + TSDL_Blit = function(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; + +type + {** + * \brief The formula used for converting between YUV and RGB + *} + TSDL_YUV_CONVERSION_MODE = type Integer; + +const + SDL_YUV_CONVERSION_JPEG = TSDL_YUV_CONVERSION_MODE(0); {**< Full range JPEG *} + SDL_YUV_CONVERSION_BT601 = TSDL_YUV_CONVERSION_MODE(1); {**< BT.601 (the default) *} + SDL_YUV_CONVERSION_BT709 = TSDL_YUV_CONVERSION_MODE(2); {**< BT.709 *} + SDL_YUV_CONVERSION_AUTOMATIC = TSDL_YUV_CONVERSION_MODE(3); {**< BT.601 for SD content, BT.709 for HD content *} + + {** + * Allocate and free an RGB surface. + * + * If the depth is 4 or 8 bits, an empty palette is allocated for the surface. + * If the depth is greater than 8 bits, the pixel format is set using the + * flags '[RGB]mask'. + * + * If the function runs out of memory, it will return NULL. + * + * \param flags The \c flags are obsolete and should be set to 0. + * \param width The width in pixels of the surface to create. + * \param height The height in pixels of the surface to create. + * \param depth The depth in bits of the surface to create. + * \param Rmask The red mask of the surface to create. + * \param Gmask The green mask of the surface to create. + * \param Bmask The blue mask of the surface to create. + * \param Amask The alpha mask of the surface to create. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateRGBSurface_fun = function(flags: cuint32; width: cint; height: cint; depth: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl; +Var + SDL_CreateRGBSurface : TSDL_CreateRGBSurface_fun = Nil; +{$else} + +function SDL_CreateRGBSurface(flags: cuint32; width: cint; height: cint; depth: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurface' {$ENDIF} {$ENDIF}; +{$endif} +{* !!! FIXME for 2.1: why does this ask for depth? Format provides that. *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateRGBSurfaceWithFormat_fun = function(flags: cuint32; width, height, depth: cint; format: cuint32):PSDL_Surface; cdecl; +Var + SDL_CreateRGBSurfaceWithFormat : TSDL_CreateRGBSurfaceWithFormat_fun = Nil; +{$else} + +function SDL_CreateRGBSurfaceWithFormat(flags: cuint32; width, height, depth: cint; format: cuint32):PSDL_Surface; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurfaceWithFormat' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateRGBSurfaceFrom_fun = function(pixels: Pointer; width: cint; height: cint; depth: cint; pitch: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl; +Var + SDL_CreateRGBSurfaceFrom : TSDL_CreateRGBSurfaceFrom_fun = Nil; +{$else} + +function SDL_CreateRGBSurfaceFrom(pixels: Pointer; width: cint; height: cint; depth: cint; pitch: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurfaceFrom' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateRGBSurfaceWithFormatFrom_fun = function(pixels: Pointer; width, height, depth, pitch: cint; format: cuint32):PSDL_Surface; cdecl; +Var + SDL_CreateRGBSurfaceWithFormatFrom : TSDL_CreateRGBSurfaceWithFormatFrom_fun = Nil; +{$else} + +function SDL_CreateRGBSurfaceWithFormatFrom(pixels: Pointer; width, height, depth, pitch: cint; format: cuint32):PSDL_Surface; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurfaceWithFormatFrom' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_FreeSurface_proc = procedure(surface: PSDL_Surface); cdecl; +Var + SDL_FreeSurface : TSDL_FreeSurface_proc = Nil; +{$else} + +procedure SDL_FreeSurface(surface: PSDL_Surface); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeSurface' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the palette used by a surface. + * + * 0, or -1 if the surface format doesn't use a palette. + * + * A single palette can be shared with many surfaces. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetSurfacePalette_fun = function(surface: PSDL_Surface; palette: PSDL_Palette): cint; cdecl; +Var + SDL_SetSurfacePalette : TSDL_SetSurfacePalette_fun = Nil; +{$else} + +function SDL_SetSurfacePalette(surface: PSDL_Surface; palette: PSDL_Palette): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfacePalette' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Sets up a surface for directly accessing the pixels. + * + * Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write + * to and read from surface.pixels, using the pixel format stored in + * surface.format. Once you are done accessing the surface, you should + * use SDL_UnlockSurface() to release it. + * + * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates + * to 0, then you can read and write to the surface at any time, and the + * pixel format of the surface will not change. + * + * No operating system or library calls should be made between lock/unlock + * pairs, as critical system locks may be held during this time. + * + * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. + * + * SDL_UnlockSurface() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LockSurface_fun = function(surface: PSDL_Surface): cint; cdecl; +Var + SDL_LockSurface : TSDL_LockSurface_fun = Nil; +{$else} + +function SDL_LockSurface(surface: PSDL_Surface): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockSurface' {$ENDIF} {$ENDIF}; +{$endif} + + {** SDL_LockSurface() *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UnlockSurface_proc = procedure(surface: PSDL_Surface); cdecl; +Var + SDL_UnlockSurface : TSDL_UnlockSurface_proc = Nil; +{$else} + +procedure SDL_UnlockSurface(surface: PSDL_Surface); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnlockSurface' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Load a surface from a seekable SDL data stream (memory or file). + * + * If freesrc is non-zero, the stream will be closed after being read. + * + * The new surface should be freed with SDL_FreeSurface(). + * + * the new surface, or NULL if there was an error. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LoadBMP_RW_fun = function(src: PSDL_RWops; freesrc: cint): PSDL_Surface; cdecl; +Var + SDL_LoadBMP_RW : TSDL_LoadBMP_RW_fun = Nil; +{$else} + +function SDL_LoadBMP_RW(src: PSDL_RWops; freesrc: cint): PSDL_Surface; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadBMP_RW' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Load a surface from a file. + * + * Convenience macro. + *} + +function SDL_LoadBMP(_file: PAnsiChar): PSDL_Surface; + + {** + * Save a surface to a seekable SDL data stream (memory or file). + * + * Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the + * BMP directly. Other RGB formats with 8-bit or higher get converted to a + * 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit + * surface before they are saved. YUV and paletted 1-bit and 4-bit formats are + * not supported. + * + * If \c freedst is non-zero, the stream will be closed after being written. + * + * \return 0 if successful or -1 if there was an error. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SaveBMP_RW_fun = function(surface: PSDL_Surface; dst: PSDL_RWops; freedst: cint): cint; cdecl; +Var + SDL_SaveBMP_RW : TSDL_SaveBMP_RW_fun = Nil; +{$else} + +function SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SaveBMP_RW' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Save a surface to a file. + * + * Convenience macro. + *} +{ TODO : Check: Why AnsiString instead of PAnsiChar used here? Compare SDL_LoadBMP macro. } +function SDL_SaveBMP(const surface: PSDL_Surface; const filename:AnsiString): cint; + + {** + * Sets the RLE acceleration hint for a surface. + * + * 0 on success, or -1 if the surface is not valid + * + * If RLE is enabled, colorkey and alpha blending blits are much faster, + * but the surface must be locked before directly accessing the pixels. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetSurfaceRLE_fun = function(surface: PSDL_Surface; flag: cint): cint; cdecl; +Var + SDL_SetSurfaceRLE : TSDL_SetSurfaceRLE_fun = Nil; +{$else} + +function SDL_SetSurfaceRLE(surface: PSDL_Surface; flag: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfaceRLE' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Returns whether the surface is RLE enabled + * + * \return SDL_TRUE if the surface is RLE enabled, or SDL_FALSE if the surface is NULL or not RLE enabled + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HasSurfaceRLE_fun = function(surface: PSDL_Surface): TSDL_Bool; cdecl; +Var + SDL_HasSurfaceRLE : TSDL_HasSurfaceRLE_fun = Nil; +{$else} + + function SDL_HasSurfaceRLE(surface: PSDL_Surface): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasSurfaceRLE' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Sets the color key (transparent pixel) in a blittable surface. + * + * surface The surface to update + * flag Non-zero to enable colorkey and 0 to disable colorkey + * key The transparent pixel in the native surface format + * + * 0 on success, or -1 if the surface is not valid + * + * You can pass SDL_RLEACCEL to enable RLE accelerated blits. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetColorKey_fun = function(surface: PSDL_Surface; flag: cint; key: cuint32): cint; cdecl; +Var + SDL_SetColorKey : TSDL_SetColorKey_fun = Nil; +{$else} + +function SDL_SetColorKey(surface: PSDL_Surface; flag: cint; key: cuint32): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetColorKey' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Returns whether the surface has a color key + * + * \return SDL_TRUE if the surface has a color key, or SDL_FALSE if the surface is NULL or has no color key + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HasColorKey_fun = function(surface: PSDL_Surface): TSDL_Bool; cdecl; +Var + SDL_HasColorKey : TSDL_HasColorKey_fun = Nil; +{$else} + +function SDL_HasColorKey(surface: PSDL_Surface): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasColorKey' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Gets the color key (transparent pixel) in a blittable surface. + * + * surface The surface to update + * key A pointer filled in with the transparent pixel in the native + * surface format + * + * 0 on success, or -1 if the surface is not valid or colorkey is not + * enabled. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetColorKey_fun = function(surface: PSDL_Surface; key: pcuint32): cint; cdecl; +Var + SDL_GetColorKey : TSDL_GetColorKey_fun = Nil; +{$else} + +function SDL_GetColorKey(surface: PSDL_Surface; key: pcuint32): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetColorKey' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set an additional color value used in blit operations. + * + * surface The surface to update. + * r The red color value multiplied into blit operations. + * g The green color value multiplied into blit operations. + * b The blue color value multiplied into blit operations. + * + * 0 on success, or -1 if the surface is not valid. + * + * SDL_GetSurfaceColorMod() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetSurfaceColorMod_fun = function(surface: PSDL_Surface; r: cuint8; g: cuint8; b: cuint8): cint; cdecl; +Var + SDL_SetSurfaceColorMod : TSDL_SetSurfaceColorMod_fun = Nil; +{$else} + +function SDL_SetSurfaceColorMod(surface: PSDL_Surface; r: cuint8; g: cuint8; b: cuint8): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfaceColorMod' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the additional color value used in blit operations. + * + * surface The surface to query. + * r A pointer filled in with the current red color value. + * g A pointer filled in with the current green color value. + * b A pointer filled in with the current blue color value. + * + * 0 on success, or -1 if the surface is not valid. + * + * SDL_SetSurfaceColorMod() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetSurfaceColorMod_fun = function(surface: PSDL_Surface; r: pcuint8; g: pcuint8; b: pcuint8): cint; cdecl; +Var + SDL_GetSurfaceColorMod : TSDL_GetSurfaceColorMod_fun = Nil; +{$else} + +function SDL_GetSurfaceColorMod(surface: PSDL_Surface; r: pcuint8; g: pcuint8; b: pcuint8): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetSurfaceColorMod' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set an additional alpha value used in blit operations. + * + * surface The surface to update. + * alpha The alpha value multiplied into blit operations. + * + * 0 on success, or -1 if the surface is not valid. + * + * SDL_GetSurfaceAlphaMod() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetSurfaceAlphaMod_fun = function(surface: PSDL_Surface; alpha: cuint8): cint; cdecl; +Var + SDL_SetSurfaceAlphaMod : TSDL_SetSurfaceAlphaMod_fun = Nil; +{$else} + +function SDL_SetSurfaceAlphaMod(surface: PSDL_Surface; alpha: cuint8): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfaceAlphaMod' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the additional alpha value used in blit operations. + * + * surface The surface to query. + * alpha A pointer filled in with the current alpha value. + * + * 0 on success, or -1 if the surface is not valid. + * + * SDL_SetSurfaceAlphaMod() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetSurfaceAlphaMod_fun = function(surface: PSDL_Surface; alpha: pcuint8): cint; cdecl; +Var + SDL_GetSurfaceAlphaMod : TSDL_GetSurfaceAlphaMod_fun = Nil; +{$else} + +function SDL_GetSurfaceAlphaMod(surface: PSDL_Surface; alpha: pcuint8): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetSurfaceAlphaMod' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the blend mode used for blit operations. + * + * surface The surface to update. + * blendMode ::SDL_BlendMode to use for blit blending. + * + * 0 on success, or -1 if the parameters are not valid. + * + * SDL_GetSurfaceBlendMode() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetSurfaceBlendMode_fun = function(surface: PSDL_Surface; blendMode: TSDL_BlendMode): cint; cdecl; +Var + SDL_SetSurfaceBlendMode : TSDL_SetSurfaceBlendMode_fun = Nil; +{$else} + +function SDL_SetSurfaceBlendMode(surface: PSDL_Surface; blendMode: TSDL_BlendMode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetSurfaceBlendMode' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the blend mode used for blit operations. + * + * surface The surface to query. + * blendMode A pointer filled in with the current blend mode. + * + * 0 on success, or -1 if the surface is not valid. + * + * SDL_SetSurfaceBlendMode() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetSurfaceBlendMode_fun = function(surface: PSDL_Surface; blendMode: PSDL_BlendMode): cint; cdecl; +Var + SDL_GetSurfaceBlendMode : TSDL_GetSurfaceBlendMode_fun = Nil; +{$else} + +function SDL_GetSurfaceBlendMode(surface: PSDL_Surface; blendMode: PSDL_BlendMode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetSurfaceBlendMode' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Sets the clipping rectangle for the destination surface in a blit. + * + * If the clip rectangle is NULL, clipping will be disabled. + * + * If the clip rectangle doesn't intersect the surface, the function will + * return SDL_FALSE and blits will be completely clipped. Otherwise the + * function returns SDL_TRUE and blits to the surface will be clipped to + * the intersection of the surface area and the clipping rectangle. + * + * Note that blits are automatically clipped to the edges of the source + * and destination surfaces. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetClipRect_fun = function(surface: PSDL_Surface; const rect: PSDL_Rect): TSDL_Bool; cdecl; +Var + SDL_SetClipRect : TSDL_SetClipRect_fun = Nil; +{$else} + +function SDL_SetClipRect(surface: PSDL_Surface; const rect: PSDL_Rect): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetClipRect' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Gets the clipping rectangle for the destination surface in a blit. + * + * rect must be a pointer to a valid rectangle which will be filled + * with the correct values. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetClipRect_proc = procedure(surface: PSDL_Surface; rect: PSDL_Rect); cdecl; +Var + SDL_GetClipRect : TSDL_GetClipRect_proc = Nil; +{$else} + +procedure SDL_GetClipRect(surface: PSDL_Surface; rect: PSDL_Rect); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetClipRect' {$ENDIF} {$ENDIF}; +{$endif} + +{* + * Creates a new surface identical to the existing surface + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_DuplicateSurface_fun = function(surface: PSDL_Surface): PSDL_Surface; cdecl; +Var + SDL_DuplicateSurface : TSDL_DuplicateSurface_fun = Nil; +{$else} + +function SDL_DuplicateSurface(surface: PSDL_Surface): PSDL_Surface; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DuplicateSurface' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Creates a new surface of the specified format, and then copies and maps + * the given surface to it so the blit of the converted surface will be as + * fast as possible. If this function fails, it returns NULL. + * + * The flags parameter is passed to SDL_CreateRGBSurface() and has those + * semantics. You can also pass SDL_RLEACCEL in the flags parameter and + * SDL will try to RLE accelerate colorkey and alpha blits in the resulting + * surface. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ConvertSurface_fun = function(src: PSDL_Surface; const fmt: PSDL_PixelFormat; flags: cuint32): PSDL_Surface; cdecl; +Var + SDL_ConvertSurface : TSDL_ConvertSurface_fun = Nil; +{$else} + +function SDL_ConvertSurface(src: PSDL_Surface; const fmt: PSDL_PixelFormat; flags: cuint32): PSDL_Surface; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ConvertSurface' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ConvertSurfaceFormat_fun = function(src: PSDL_Surface; pixel_format: cuint32; flags: cuint32): PSDL_Surface; cdecl; +Var + SDL_ConvertSurfaceFormat : TSDL_ConvertSurfaceFormat_fun = Nil; +{$else} + +function SDL_ConvertSurfaceFormat(src: PSDL_Surface; pixel_format: cuint32; flags: cuint32): PSDL_Surface; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ConvertSurfaceFormat' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Copy a block of pixels of one format to another format + * + * 0 on success, or -1 if there was an error + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ConvertPixels_fun = function(width: cint; height: cint; src_format: cuint32; const src: Pointer; src_pitch: cint; dst_format: cuint32; dst: Pointer; dst_pitch: cint): cint; cdecl; +Var + SDL_ConvertPixels : TSDL_ConvertPixels_fun = Nil; +{$else} + +function SDL_ConvertPixels(width: cint; height: cint; src_format: cuint32; const src: Pointer; src_pitch: cint; dst_format: cuint32; dst: Pointer; dst_pitch: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ConvertPixels' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Performs a fast fill of the given rectangle with color. + * + * If rect is NULL, the whole surface will be filled with color. + * + * The color should be a pixel of the format used by the surface, and + * can be generated by the SDL_MapRGB() function. + * + * 0 on success, or -1 on error. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_FillRect_fun = function(dst: PSDL_Surface; const rect: PSDL_Rect; color: cuint32): cint; cdecl; +Var + SDL_FillRect : TSDL_FillRect_fun = Nil; +{$else} + +function SDL_FillRect(dst: PSDL_Surface; const rect: PSDL_Rect; color: cuint32): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FillRect' {$ENDIF} {$ENDIF}; +{$endif} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_FillRects_fun = function(dst: PSDL_Surface; const rects: PSDL_Rect; count: cint; color: cuint32): cint; cdecl; +Var + SDL_FillRects : TSDL_FillRects_fun = Nil; +{$else} + +function SDL_FillRects(dst: PSDL_Surface; const rects: PSDL_Rect; count: cint; color: cuint32): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FillRects' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Performs a fast blit from the source surface to the destination surface. + * + * This assumes that the source and destination rectangles are + * the same size. If either \c srcrect or \c dstrect are NULL, the entire + * surface ( src or dst) is copied. The final blit rectangles are saved + * in srcrect and dstrect after all clipping is performed. + * + * If the blit is successful, it returns 0, otherwise it returns -1. + * + * The blit function should not be called on a locked surface. + * + * The blit semantics for surfaces with and without alpha and colorkey + * are defined as follows: + * + RGBA->RGB: + SDL_SRCALPHA set: + alpha-blend (using alpha-channel). + SDL_SRCCOLORKEY ignored. + SDL_SRCALPHA not set: + copy RGB. + if SDL_SRCCOLORKEY set, only copy the pixels matching the + RGB values of the source colour key, ignoring alpha in the + comparison. + + RGB->RGBA: + SDL_SRCALPHA set: + alpha-blend (using the source per-surface alpha value); + set destination alpha to opaque. + SDL_SRCALPHA not set: + copy RGB, set destination alpha to source per-surface alpha value. + both: + if SDL_SRCCOLORKEY set, only copy the pixels matching the + source colour key. + + RGBA->RGBA: + SDL_SRCALPHA set: + alpha-blend (using the source alpha channel) the RGB values; + leave destination alpha untouched. [Note: is this correct?] + SDL_SRCCOLORKEY ignored. + SDL_SRCALPHA not set: + copy all of RGBA to the destination. + if SDL_SRCCOLORKEY set, only copy the pixels matching the + RGB values of the source colour key, ignoring alpha in the + comparison. + + RGB->RGB: + SDL_SRCALPHA set: + alpha-blend (using the source per-surface alpha value). + SDL_SRCALPHA not set: + copy RGB. + both: + if SDL_SRCCOLORKEY set, only copy the pixels matching the + source colour key.r + * + * You should call SDL_BlitSurface() unless you know exactly how SDL + * blitting works internally and how to use the other blit functions. + *} + +(* SDL_surface.h uses #define to change all SDL_BlitSurface() calls into SDL_UpperBlit() calls. * + * Since Pascal macro support is very limited, we workaround by outright pointing SDL_BlitSurface() to SDL_UpperBlit(). *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_BlitSurface_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; +Var + SDL_BlitSurface : TSDL_BlitSurface_fun = Nil; +{$else} + +function SDL_BlitSurface(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; + external SDL_LibName name {$IF DEFINED(DELPHI) AND DEFINED(MACOS)} '_SDL_UpperBlit' {$ELSE} 'SDL_UpperBlit' {$IFEND}; +{$endif} + + + {** + * This is the public blit function, SDL_BlitSurface(), and it performs + * rectangle validation and clipping before passing it to SDL_LowerBlit() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UpperBlit_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; +Var + SDL_UpperBlit : TSDL_UpperBlit_fun = Nil; +{$else} + +function SDL_UpperBlit(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpperBlit' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * This is a semi-private blit function and it performs low-level surface + * blitting only. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LowerBlit_fun = function(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; +Var + SDL_LowerBlit : TSDL_LowerBlit_fun = Nil; +{$else} + +function SDL_LowerBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LowerBlit' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Perform a fast, low quality, stretch blit between two surfaces of the + * same pixel format. + * + * This function uses a static buffer, and is not thread-safe. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SoftStretch_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; const dstrect: PSDL_Surface): cint; cdecl; +Var + SDL_SoftStretch : TSDL_SoftStretch_fun = Nil; +{$else} + +function SDL_SoftStretch(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; const dstrect: PSDL_Surface): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SoftStretch' {$ENDIF} {$ENDIF}; +{$endif} + +(* SDL_surface.h uses #define to change all SDL_BlitSurfaceScaled() calls into SDL_UpperBlitScaled() calls. * + * Since Pascal macro support is very limited, we workaround by outright pointing SDL_BlitSurfaceScaled() to SDL_UpperBlitScaled(). *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_BlitSurfaceScaled_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; +Var + SDL_BlitSurfaceScaled : TSDL_BlitSurfaceScaled_fun = Nil; +{$else} + +function SDL_BlitSurfaceScaled(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; + external SDL_LibName name {$IF DEFINED(DELPHI) AND DEFINED(MACOS)} '_SDL_UpperBlitScaled' {$ELSE} 'SDL_UpperBlitScaled' {$IFEND}; +{$endif} + + {** + * This is the public scaled blit function, SDL_BlitScaled(), and it performs + * rectangle validation and clipping before passing it to SDL_LowerBlitScaled() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UpperBlitScaled_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; +Var + SDL_UpperBlitScaled : TSDL_UpperBlitScaled_fun = Nil; +{$else} + +function SDL_UpperBlitScaled(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpperBlitScaled' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * This is a semi-private blit function and it performs low-level surface + * scaled blitting only. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LowerBlitScaled_fun = function(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; +Var + SDL_LowerBlitScaled : TSDL_LowerBlitScaled_fun = Nil; +{$else} + +function SDL_LowerBlitScaled(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LowerBlitScaled' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Set the YUV conversion mode + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetYUVConversionMode_proc = procedure(mode: TSDL_YUV_CONVERSION_MODE); cdecl; +Var + SDL_SetYUVConversionMode : TSDL_SetYUVConversionMode_proc = Nil; +{$else} + +procedure SDL_SetYUVConversionMode(mode: TSDL_YUV_CONVERSION_MODE); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetYUVConversionMode' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Get the YUV conversion mode + *} +function SDL_GetYUVConversionMode: TSDL_YUV_CONVERSION_MODE; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetYUVConversionMode' {$ENDIF} {$ENDIF}; + +{** + * \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetYUVConversionModeForResolution_fun = function(width: cint; height: cint): TSDL_YUV_CONVERSION_MODE; cdecl; +Var + SDL_GetYUVConversionModeForResolution : TSDL_GetYUVConversionModeForResolution_fun = Nil; +{$else} + +function SDL_GetYUVConversionModeForResolution(width: cint; height: cint): TSDL_YUV_CONVERSION_MODE; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetYUVConversionModeForResolution' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlsystem.inc b/units/sdlsystem.inc index e770339c..c5252e1c 100644 --- a/units/sdlsystem.inc +++ b/units/sdlsystem.inc @@ -1,753 +1,753 @@ -// from "SDL_system.h" - -(* Platform specific functions for Windows *) -{$IF DEFINED(WIN32) OR DEFINED(WIN64)} -type - PPSDL_WindowsMessageHook = ^PSDL_WindowsMessageHook; - PSDL_WindowsMessageHook = ^TSDL_WindowsMessageHook; - TSDL_WindowsMessageHook = procedure(userdata, hWnd: Pointer; mesage: cuint; wParam: cuint64; lParam: cint64); cdecl; - -{** - * Set a callback for every Windows message, run before TranslateMessage(). - * - * \param callback The SDL_WindowsMessageHook function to call. - * \param userdata a pointer to pass to every iteration of `callback` - * - * \since This function is available since SDL 2.0.4. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowsMessageHook_proc = procedure(callback: TSDL_WindowsMessageHook; userdata: Pointer); cdecl; -Var - SDL_SetWindowsMessageHook : TSDL_SetWindowsMessageHook_proc = Nil; -{$else} - -procedure SDL_SetWindowsMessageHook(callback: TSDL_WindowsMessageHook; userdata: Pointer); cdecl; - external SDL_LibName; -{$endif} - -{** - * Get the D3D9 adapter index that matches the specified display index. - * - * The returned adapter index can be passed to `IDirect3D9::CreateDevice` and - * controls on which monitor a full screen application will appear. - * - * \param displayIndex the display index for which to get the D3D9 adapter - * index - * \returns the D3D9 adapter index on success or a negative error code on - * failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.1. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_Direct3D9GetAdapterIndex_fun = function(displayIndex:cint):cint; cdecl; -Var - SDL_Direct3D9GetAdapterIndex : TSDL_Direct3D9GetAdapterIndex_fun = Nil; -{$else} - -function SDL_Direct3D9GetAdapterIndex(displayIndex:cint):cint; cdecl; - external SDL_LibName; -{$endif} - -type - PIDirect3DDevice9 = type Pointer; - PID3D11Device = type Pointer; - PID3D12Device = type Pointer; - -{** - * Get the D3D9 device associated with a renderer. - * - * Once you are done using the device, you should release it to avoid a - * resource leak. - * - * \param renderer the renderer from which to get the associated D3D device - * \returns the D3D9 device associated with given renderer or NIL if it is - * not a D3D9 renderer; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.1. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RenderGetD3D9Device_fun = function(renderer:PSDL_Renderer):PIDirect3DDevice9; cdecl; -Var - SDL_RenderGetD3D9Device : TSDL_RenderGetD3D9Device_fun = Nil; -{$else} - -function SDL_RenderGetD3D9Device(renderer:PSDL_Renderer):PIDirect3DDevice9; cdecl; - external SDL_LibName; -{$endif} - -{** - * Get the D3D11 device associated with a renderer. - * - * Once you are done using the device, you should release it to avoid a - * resource leak. - * - * \param renderer the renderer from which to get the associated D3D11 device - * \returns the D3D11 device associated with given renderer or NIL if it is - * not a D3D11 renderer; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.16. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RenderGetD3D11Device_fun = function(renderer:PSDL_Renderer):PID3D11Device; cdecl; -Var - SDL_RenderGetD3D11Device : TSDL_RenderGetD3D11Device_fun = Nil; -{$else} - -function SDL_RenderGetD3D11Device(renderer:PSDL_Renderer):PID3D11Device; cdecl; - external SDL_LibName; -{$endif} - -{** - * Get the D3D12 device associated with a renderer. - * - * Once you are done using the device, you should release it to avoid a - * resource leak. - * - * \param renderer the renderer from which to get the associated D3D12 device - * \returns the D3D12 device associated with given renderer or NIL if it is - * not a D3D12 renderer; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.24.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RenderGetD3D12Device_fun = function(renderer:PSDL_Renderer):PID3D12Device; cdecl; -Var - SDL_RenderGetD3D12Device : TSDL_RenderGetD3D12Device_fun = Nil; -{$else} - -function SDL_RenderGetD3D12Device(renderer:PSDL_Renderer):PID3D12Device; cdecl; - external SDL_LibName; -{$endif} - -{** - * Get the DXGI Adapter and Output indices for the specified display index. - * - * The DXGI Adapter and Output indices can be passed to `EnumAdapters` and - * `EnumOutputs` respectively to get the objects required to create a DX10 or - * DX11 device and swap chain. - * - * Before SDL 2.0.4 this function did not return a value. - * Since SDL 2.0.4 it returns a TSDL_bool. - * - * \param displayIndex the display index for which to get both indices - * \param adapterIndex a pointer to be filled in with the adapter index - * \param outputIndex a pointer to be filled in with the output index - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. - * - * \since This function is available since SDL 2.0.2. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_DXGIGetOutputInfo_fun = function(displayIndex: cint; adapterIndex, outputIndex: pcint): TSDL_Bool; cdecl; -Var - SDL_DXGIGetOutputInfo : TSDL_DXGIGetOutputInfo_fun = Nil; -{$else} - -function SDL_DXGIGetOutputInfo(displayIndex: cint; adapterIndex, outputIndex: pcint): TSDL_Bool; - external SDL_LibName; cdecl; -{$endif} -{$ENDIF WIN32 OR WIN64} - - -(* Platform specific functions for Linux *) -{$IFDEF LINUX} -{** - * Sets the UNIX nice value for a thread. - * - * This uses setpriority() if possible, and RealtimeKit if available. - * - * \param threadID the Unix thread ID to change priority of. - * \param priority The new, Unix-specific, priority value. - * \returns 0 on success, or -1 on error. - * - * \since This function is available since SDL 2.0.9. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LinuxSetThreadPriority_fun = function(threadID: cint64; priority: cint): cint; cdecl; -Var - SDL_LinuxSetThreadPriority : TSDL_LinuxSetThreadPriority_fun = Nil; -{$else} - -function SDL_LinuxSetThreadPriority(threadID: cint64; priority: cint): cint; cdecl; - external SDL_LibName; -{$endif} - -{** - * Sets the priority (not nice level) and scheduling policy for a thread. - * - * This uses setpriority() if possible, and RealtimeKit if available. - * - * \param threadID The Unix thread ID to change priority of. - * \param sdlPriority The new TSDL_ThreadPriority value. - * \param schedPolicy The new scheduling policy (SCHED_FIFO, SCHED_RR, - * SCHED_OTHER, etc...) - * \returns 0 on success, or -1 on error. - * - * \since This function is available since SDL 2.0.18. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_LinuxSetThreadPriorityAndPolicy_fun = function(threadID: cint64; sdlPriority, schedPolicy: cint): cint; cdecl; -Var - SDL_LinuxSetThreadPriorityAndPolicy : TSDL_LinuxSetThreadPriorityAndPolicy_fun = Nil; -{$else} - -function SDL_LinuxSetThreadPriorityAndPolicy(threadID: cint64; sdlPriority, schedPolicy: cint): cint; cdecl; - external SDL_LibName; -{$endif} -{$ENDIF LINUX} - - -(* Platform specific functions for iOS *) -{$IFDEF __IPHONEOS__} -type - PPSDL_iPhoneAnimationCallback = ^PSDL_iPhoneAnimationCallback; - PSDL_iPhoneAnimationCallback = ^TSDL_iPhoneAnimationCallback; - TSDL_iPhoneAnimationCallback = procedure(callbackParam: Pointer); cdecl; - -{** - * Use this function to set the animation callback on Apple iOS. - * - * This function is only available on Apple iOS. - * - * For more information see: - * https://github.com/libsdl-org/SDL/blob/main/docs/README-ios.md - * - * \param window the window for which the animation callback should be set - * \param interval the number of frames after which **callback** will be - * called - * \param callback the function to call for every frame. - * \param callbackParam a pointer that is passed to `callback`. - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_iPhoneSetEventPump - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_iPhoneSetAnimationCallback_fun = function(window: PSDL_Window; interval: cint; callback: TSDL_iPhoneAnimationCallback; callbackParam: Pointer); cdecl; -Var - SDL_iPhoneSetAnimationCallback : TSDL_iPhoneSetAnimationCallback_fun = Nil; -{$else} - -function SDL_iPhoneSetAnimationCallback(window: PSDL_Window; interval: cint; callback: TSDL_iPhoneAnimationCallback; callbackParam: Pointer); cdecl; - external SDL_LibName; -{$endif} - -{** - * Use this function to enable or disable the SDL event pump on Apple iOS. - * - * This function is only available on Apple iOS. - * - * \param enabled SDL_TRUE to enable the event pump, SDL_FALSE to disable it - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_iPhoneSetAnimationCallback - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_iPhoneSetEventPump_proc = procedure(enabled: TSDL_Bool); cdecl; -Var - SDL_iPhoneSetEventPump : TSDL_iPhoneSetEventPump_proc = Nil; -{$else} - -procedure SDL_iPhoneSetEventPump(enabled: TSDL_Bool); cdecl; - external SDL_LibName; -{$endif} -{$ENDIF __IPHONEOS__} - - -(* Platform specific functions for Android *) -{$IFDEF ANDROID} - -{** - * Get the Android Java Native Interface Environment of the current thread. - * - * This is the JNIEnv one needs to access the Java virtual machine from native - * code, and is needed for many Android APIs to be usable from Pascal. - * - * The prototype of the function in SDL's code actually declare a Pointer return - * type, even if the implementation returns a pointer to a JNIEnv. The - * rationale being that the SDL units can avoid using the JNI unit. - * - * \returns a pointer to Java native interface object (JNIEnv) to which the - * current thread is attached, or NIL on error. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AndroidGetActivity - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_AndroidGetJNIEnv_fun = function(): Pointer; cdecl; -Var - SDL_AndroidGetJNIEnv : TSDL_AndroidGetJNIEnv_fun = Nil; -{$else} - -function SDL_AndroidGetJNIEnv(): Pointer; cdecl; - external SDL_LibName; -{$endif} - -(** - * Retrieve the Java instance of the Android activity class. - * - * The prototype of the function in SDL's code actually declares a Pointer - * return type, even if the implementation returns a JObject. The rationale - * being that the SDL units can avoid using the JNI unit. - * - * The JObject returned by the function is a local reference and must be - * released by the caller. See the PushLocalFrame() and PopLocalFrame() or - * DeleteLocalRef() functions of the Java native interface: - * - * https://docs.oracle.com/javase/1.5.0/docs/guide/jni/spec/functions.html - * - * \returns the jobject representing the instance of the Activity class of the - * Android application, or NIL on error. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AndroidGetJNIEnv - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_AndroidGetActivity_fun = function(): Pointer; cdecl; -Var - SDL_AndroidGetActivity : TSDL_AndroidGetActivity_fun = Nil; -{$else} - -function SDL_AndroidGetActivity(): Pointer; cdecl; - external SDL_LibName; -{$endif} - -{** - * Query Android API level of the current device. - * - * - API level 34: Android 14 - * - API level 33: Android 13 - * - API level 32: Android 12L - * - API level 31: Android 12 - * - API level 30: Android 11 - * - API level 29: Android 10 - * - API level 28: Android 9 "Pie" - * - API level 27: Android 8.1 "Oreo" - * - API level 26: Android 8.0 "Oreo" - * - API level 25: Android 7.1 "Nougat" - * - API level 24: Android 7.0 "Nougat" - * - API level 23: Android 6.0 "Marshmallow" - * - API level 22: Android 5.1 "Lollipop" - * - API level 21: Android 5.0 "Lollipop" - * - API level 20: Android 4.4W "KitKat" - * - API level 19: Android 4.4 "KitKat" - * - API level 18: Android 4.3 "Jelly Bean" - * - API level 17: Android 4.2 "Jelly Bean" - * - API level 16: Android 4.1 "Jelly Bean" - * - API level 15: Android 4.0.3 "Ice Cream Sandwich" - * - API level 14: Android 4.0 "Ice Cream Sandwich" - * - API level 13: Android 3.2 "Honeycomb" - * - API level 12: Android 3.1 "Honeycomb" - * - API level 11: Android 3.0 "Honeycomb" - * - API level 10: Android 2.3.3 "Gingerbread" - * - * \returns the Android API level. - * - * \since This function is available since SDL 2.0.12. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetAndroidSDKVersion_fun = function(): cint; cdecl; -Var - SDL_GetAndroidSDKVersion : TSDL_GetAndroidSDKVersion_fun = Nil; -{$else} - -function SDL_GetAndroidSDKVersion(): cint; cdecl; - external SDL_LibName; -{$endif} - -{** - * Query if the application is running on Android TV. - * - * \returns SDL_TRUE if this is Android TV, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.8. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_IsAndroidTV_fun = function(): TSDL_Bool; cdecl; -Var - SDL_IsAndroidTV : TSDL_IsAndroidTV_fun = Nil; -{$else} - -function SDL_IsAndroidTV(): TSDL_Bool; cdecl; - external SDL_LibName; -{$endif} - -{** - * Query if the application is running on a Chromebook. - * - * \returns SDL_TRUE if this is a Chromebook, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.9. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_IsChromebook_fun = function(): TSDL_Bool; cdecl; -Var - SDL_IsChromebook : TSDL_IsChromebook_fun = Nil; -{$else} - -function SDL_IsChromebook(): TSDL_Bool; cdecl; - external SDL_LibName; -{$endif} - -{** - * Query if the application is running on a Samsung DeX docking station. - * - * \returns SDL_TRUE if this is a DeX docking station, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.9. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_IsDeXMode_fun = function(): TSDL_Bool; cdecl; -Var - SDL_IsDeXMode : TSDL_IsDeXMode_fun = Nil; -{$else} - -function SDL_IsDeXMode(): TSDL_Bool; cdecl; - external SDL_LibName; -{$endif} - -{** - * Trigger the Android system back button behavior. - * - * \since This function is available since SDL 2.0.9. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_AndroidBackButton_proc = procedure(); cdecl; -Var - SDL_AndroidBackButton : TSDL_AndroidBackButton_proc = Nil; -{$else} - -procedure SDL_AndroidBackButton(); cdecl; - external SDL_LibName; -{$endif} - -{** - See the official Android developer guide for more information: - http://developer.android.com/guide/topics/data/data-storage.html -*} -const - SDL_ANDROID_EXTERNAL_STORAGE_READ = $01; - SDL_ANDROID_EXTERNAL_STORAGE_WRITE = $02; - -{** - * Get the path used for internal storage for this application. - * - * This path is unique to your application and cannot be written to by other - * applications. - * - * Your internal storage path is typically: - * `/data/data/your.app.package/files`. - * - * \returns the path used for internal storage or NIL on failure; - * call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AndroidGetExternalStorageState - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_AndroidGetInternalStoragePath_fun = function(): PAnsiChar; cdecl; -Var - SDL_AndroidGetInternalStoragePath : TSDL_AndroidGetInternalStoragePath_fun = Nil; -{$else} - -function SDL_AndroidGetInternalStoragePath(): PAnsiChar; cdecl; - external SDL_LibName; -{$endif} - -{** - * Get the current state of external storage. - * - * The current state of external storage, a bitmask of these values: - * `SDL_ANDROID_EXTERNAL_STORAGE_READ`, `SDL_ANDROID_EXTERNAL_STORAGE_WRITE`. - * - * If external storage is currently unavailable, this will return 0. - * - * \returns the current state of external storage on success or 0 on failure; - * call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AndroidGetExternalStoragePath - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_AndroidGetExternalStorageState_fun = function(): cint; cdecl; -Var - SDL_AndroidGetExternalStorageState : TSDL_AndroidGetExternalStorageState_fun = Nil; -{$else} - -function SDL_AndroidGetExternalStorageState(): cint; cdecl; - external SDL_LibName; -{$endif} - -{** - * Get the path used for external storage for this application. - * - * This path is unique to your application, but is public and can be written - * to by other applications. - * - * Your external storage path is typically: - * `/storage/sdcard0/Android/data/your.app.package/files`. - * - * \returns the path used for external storage for this application on success - * or NIL on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_AndroidGetExternalStorageState - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_AndroidGetExternalStoragePath_fun = function(): PAnsiChar; cdecl; -Var - SDL_AndroidGetExternalStoragePath : TSDL_AndroidGetExternalStoragePath_fun = Nil; -{$else} - -function SDL_AndroidGetExternalStoragePath(): PAnsiChar; cdecl; - external SDL_LibName; -{$endif} - -{** - * Request permissions at runtime. - * - * This blocks the calling thread until the permission is granted or denied. - * - * For a full list of possible permission names, consult the Android docs: - * https://developer.android.com/reference/android/Manifest.permission - * - * \param permission The permission to request. - * \returns SDL_TRUE if the permission was granted, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.14. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_AndroidRequestPermission_fun = function(const permission: PAnsiChar): TSDL_Bool; cdecl; -Var - SDL_AndroidRequestPermission : TSDL_AndroidRequestPermission_fun = Nil; -{$else} - -function SDL_AndroidRequestPermission(const permission: PAnsiChar): TSDL_Bool; cdecl; - external SDL_LibName; -{$endif} - -{** - * Shows an Android toast notification. - * - * Toasts are a sort of lightweight notification that are unique to Android. - * - * https://developer.android.com/guide/topics/ui/notifiers/toasts - * - * Shows toast in UI thread. - * - * For the `gravity` parameter, choose a value from here, or -1 if you don't - * have a preference: - * - * https://developer.android.com/reference/android/view/Gravity - * - * \param message text message to be shown - * \param duration 0=short, 1=long - * \param gravity where the notification should appear on the screen. - * \param xoffset set this parameter only when gravity >=0 - * \param yoffset set this parameter only when gravity >=0 - * \returns 0 if success, -1 if any error occurs. - * - * \since This function is available since SDL 2.0.16. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_AndroidShowToast_fun = function(const message: PAnsiChar; duration, gravity, xoffset, yoffset: cint): cint; cdecl; -Var - SDL_AndroidShowToast : TSDL_AndroidShowToast_fun = Nil; -{$else} - -function SDL_AndroidShowToast(const message: PAnsiChar; duration, gravity, xoffset, yoffset: cint): cint; cdecl; - external SDL_LibName; -{$endif} - -{** - * Send a user command to SDLActivity. - * - * Override "boolean onUnhandledMessage(Message msg)" to handle the message. - * - * \param command user command that must be greater or equal to 0x8000 - * \param param user parameter - * - * \since This function is available since SDL 2.0.22. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_AndroidSendMessage_fun = function(command: cUint32; param: cint): cint; cdecl; -Var - SDL_AndroidSendMessage : TSDL_AndroidSendMessage_fun = Nil; -{$else} - -function SDL_AndroidSendMessage(command: cUint32; param: cint): cint; cdecl; - external SDL_LibName; -{$endif} -{$ENDIF ANDROID} - - -(* Platform specific functions for WinRT *) -{$IFDEF __WINRT__} -Type - {** WinRT / Windows Phone path types *} - PPSDL_WinRT_Path = ^PSDL_WinRT_Path; - PSDL_WinRT_Path = ^TSDL_WinRT_Path; - TSDL_WinRT_Path = ( - {** The installed app's root directory. - Files here are likely to be read-only. *} - SDL_WINRT_PATH_INSTALLED_LOCATION = 0, - {** The app's local data store. Files may be written here *} - SDL_WINRT_PATH_LOCAL_FOLDER = 1, - {** The app's roaming data store. Unsupported on Windows Phone. - Files written here may be copied to other machines via a network - connection. - *} - SDL_WINRT_PATH_ROAMING_FOLDER = 2, - {** The app's temporary data store. Unsupported on Windows Phone. - Files written here may be deleted at any time. *} - SDL_WINRT_PATH_TEMP_FOLDER = 3 - ); - - TSDL_WinRT_DeviceFamily = ( - {** Unknown family *} - SDL_WINRT_DEVICEFAMILY_UNKNOWN, - {** Desktop family *} - SDL_WINRT_DEVICEFAMILY_DESKTOP, - {** Mobile family (for example smartphone) *} - SDL_WINRT_DEVICEFAMILY_MOBILE, - {** XBox family *} - SDL_WINRT_DEVICEFAMILY_XBOX - ); - - - {** - * \brief Retrieves a WinRT defined path on the local file system - * - * \note Documentation on most app-specific path types on WinRT - * can be found on MSDN, at the URL: - * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx - * - * \param pathType The type of path to retrieve. - * \ret A UCS-2 string (16-bit, wide-char) containing the path, or NULL - * if the path is not available for any reason. Not all paths are - * available on all versions of Windows. This is especially true on - * Windows Phone. Check the documentation for the given - * SDL_WinRT_Path for more information on which path types are - * supported where. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_WinRTGetFSPathUNICODE_fun = function(pathT -Var - SDL_WinRTGetFSPathUNICODE : TSDL_WinRTGetFSPathUNICODE_fun = Nil; -{$else} - -function SDL_WinRTGetFSPathUNICODE(pathType :TSDL_WinRT_Path):PWideChar; - cdecl; external SDL_LibName; -{$endif} - - - {** - * \brief Retrieves a WinRT defined path on the local file system - * - * \note Documentation on most app-specific path types on WinRT - * can be found on MSDN, at the URL: - * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx - * - * \param pathType The type of path to retrieve. - * \ret A UTF-8 string (8-bit, multi-byte) containing the path, or NULL - * if the path is not available for any reason. Not all paths are - * available on all versions of Windows. This is especially true on - * Windows Phone. Check the documentation for the given - * SDL_WinRT_Path for more information on which path types are - * supported where. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_WinRTGetFSPathUTF8_fun = function(pathT -Var - SDL_WinRTGetFSPathUTF8 : TSDL_WinRTGetFSPathUTF8_fun = Nil; -{$else} - -function SDL_WinRTGetFSPathUTF8(pathType :TSDL_WinRT_Path):PChar; - cdecl; external SDL_LibName; -{$endif} - - -{** - * Detects the device family of WinRT platform at runtime. - * - * \returns a value from the SDL_WinRT_DeviceFamily enum. - * - * \since This function is available since SDL 2.0.8. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_WinRTGetDeviceFamily_fun = function(): TS -Var - SDL_WinRTGetDeviceFamily : TSDL_WinRTGetDeviceFamily_fun = Nil; -{$else} - -function SDL_WinRTGetDeviceFamily(): TSDL_WinRT_DeviceFamily; - cdecl; external SDL_LibName; -{$endif} -{$ENDIF __WINRT__} - - -{** - * Query if the current device is a tablet. - * - * If SDL can't determine this, it will return SDL_FALSE. - * - * \returns SDL_TRUE if the device is a tablet, SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.0.9. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_IsTablet_fun = function(): TSDL_Bool; cdecl; -Var - SDL_IsTablet : TSDL_IsTablet_fun = Nil; -{$else} - -function SDL_IsTablet(): TSDL_Bool; cdecl; - external SDL_LibName; -{$endif} - - -{ Functions used by iOS application delegates to notify SDL about state changes } -procedure SDL_OnApplicationWillTerminate(); cdecl; external SDL_LibName; -procedure SDL_OnApplicationDidReceiveMemoryWarning(); cdecl; external SDL_LibName; -procedure SDL_OnApplicationWillResignActive(); cdecl; external SDL_LibName; -procedure SDL_OnApplicationDidEnterBackground(); cdecl; external SDL_LibName; -procedure SDL_OnApplicationWillEnterForeground(); cdecl; external SDL_LibName; -procedure SDL_OnApplicationDidBecomeActive(); cdecl; external SDL_LibName; -{$IFDEF __IPHONEOS__} -procedure SDL_OnApplicationDidChangeStatusBarOrientation(); cdecl; external SDL_LibName; -{$ENDIF} +// from "SDL_system.h" + +(* Platform specific functions for Windows *) +{$IF DEFINED(WIN32) OR DEFINED(WIN64)} +type + PPSDL_WindowsMessageHook = ^PSDL_WindowsMessageHook; + PSDL_WindowsMessageHook = ^TSDL_WindowsMessageHook; + TSDL_WindowsMessageHook = procedure(userdata, hWnd: Pointer; mesage: cuint; wParam: cuint64; lParam: cint64); cdecl; + +{** + * Set a callback for every Windows message, run before TranslateMessage(). + * + * \param callback The SDL_WindowsMessageHook function to call. + * \param userdata a pointer to pass to every iteration of `callback` + * + * \since This function is available since SDL 2.0.4. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowsMessageHook_proc = procedure(callback: TSDL_WindowsMessageHook; userdata: Pointer); cdecl; +Var + SDL_SetWindowsMessageHook : TSDL_SetWindowsMessageHook_proc = Nil; +{$else} + +procedure SDL_SetWindowsMessageHook(callback: TSDL_WindowsMessageHook; userdata: Pointer); cdecl; + external SDL_LibName; +{$endif} + +{** + * Get the D3D9 adapter index that matches the specified display index. + * + * The returned adapter index can be passed to `IDirect3D9::CreateDevice` and + * controls on which monitor a full screen application will appear. + * + * \param displayIndex the display index for which to get the D3D9 adapter + * index + * \returns the D3D9 adapter index on success or a negative error code on + * failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.1. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_Direct3D9GetAdapterIndex_fun = function(displayIndex:cint):cint; cdecl; +Var + SDL_Direct3D9GetAdapterIndex : TSDL_Direct3D9GetAdapterIndex_fun = Nil; +{$else} + +function SDL_Direct3D9GetAdapterIndex(displayIndex:cint):cint; cdecl; + external SDL_LibName; +{$endif} + +type + PIDirect3DDevice9 = type Pointer; + PID3D11Device = type Pointer; + PID3D12Device = type Pointer; + +{** + * Get the D3D9 device associated with a renderer. + * + * Once you are done using the device, you should release it to avoid a + * resource leak. + * + * \param renderer the renderer from which to get the associated D3D device + * \returns the D3D9 device associated with given renderer or NIL if it is + * not a D3D9 renderer; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.1. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderGetD3D9Device_fun = function(renderer:PSDL_Renderer):PIDirect3DDevice9; cdecl; +Var + SDL_RenderGetD3D9Device : TSDL_RenderGetD3D9Device_fun = Nil; +{$else} + +function SDL_RenderGetD3D9Device(renderer:PSDL_Renderer):PIDirect3DDevice9; cdecl; + external SDL_LibName; +{$endif} + +{** + * Get the D3D11 device associated with a renderer. + * + * Once you are done using the device, you should release it to avoid a + * resource leak. + * + * \param renderer the renderer from which to get the associated D3D11 device + * \returns the D3D11 device associated with given renderer or NIL if it is + * not a D3D11 renderer; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.16. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderGetD3D11Device_fun = function(renderer:PSDL_Renderer):PID3D11Device; cdecl; +Var + SDL_RenderGetD3D11Device : TSDL_RenderGetD3D11Device_fun = Nil; +{$else} + +function SDL_RenderGetD3D11Device(renderer:PSDL_Renderer):PID3D11Device; cdecl; + external SDL_LibName; +{$endif} + +{** + * Get the D3D12 device associated with a renderer. + * + * Once you are done using the device, you should release it to avoid a + * resource leak. + * + * \param renderer the renderer from which to get the associated D3D12 device + * \returns the D3D12 device associated with given renderer or NIL if it is + * not a D3D12 renderer; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.24.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RenderGetD3D12Device_fun = function(renderer:PSDL_Renderer):PID3D12Device; cdecl; +Var + SDL_RenderGetD3D12Device : TSDL_RenderGetD3D12Device_fun = Nil; +{$else} + +function SDL_RenderGetD3D12Device(renderer:PSDL_Renderer):PID3D12Device; cdecl; + external SDL_LibName; +{$endif} + +{** + * Get the DXGI Adapter and Output indices for the specified display index. + * + * The DXGI Adapter and Output indices can be passed to `EnumAdapters` and + * `EnumOutputs` respectively to get the objects required to create a DX10 or + * DX11 device and swap chain. + * + * Before SDL 2.0.4 this function did not return a value. + * Since SDL 2.0.4 it returns a TSDL_bool. + * + * \param displayIndex the display index for which to get both indices + * \param adapterIndex a pointer to be filled in with the adapter index + * \param outputIndex a pointer to be filled in with the output index + * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() + * for more information. + * + * \since This function is available since SDL 2.0.2. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_DXGIGetOutputInfo_fun = function(displayIndex: cint; adapterIndex, outputIndex: pcint): TSDL_Bool; cdecl; +Var + SDL_DXGIGetOutputInfo : TSDL_DXGIGetOutputInfo_fun = Nil; +{$else} + +function SDL_DXGIGetOutputInfo(displayIndex: cint; adapterIndex, outputIndex: pcint): TSDL_Bool; + external SDL_LibName; cdecl; +{$endif} +{$ENDIF WIN32 OR WIN64} + + +(* Platform specific functions for Linux *) +{$IFDEF LINUX} +{** + * Sets the UNIX nice value for a thread. + * + * This uses setpriority() if possible, and RealtimeKit if available. + * + * \param threadID the Unix thread ID to change priority of. + * \param priority The new, Unix-specific, priority value. + * \returns 0 on success, or -1 on error. + * + * \since This function is available since SDL 2.0.9. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LinuxSetThreadPriority_fun = function(threadID: cint64; priority: cint): cint; cdecl; +Var + SDL_LinuxSetThreadPriority : TSDL_LinuxSetThreadPriority_fun = Nil; +{$else} + +function SDL_LinuxSetThreadPriority(threadID: cint64; priority: cint): cint; cdecl; + external SDL_LibName; +{$endif} + +{** + * Sets the priority (not nice level) and scheduling policy for a thread. + * + * This uses setpriority() if possible, and RealtimeKit if available. + * + * \param threadID The Unix thread ID to change priority of. + * \param sdlPriority The new TSDL_ThreadPriority value. + * \param schedPolicy The new scheduling policy (SCHED_FIFO, SCHED_RR, + * SCHED_OTHER, etc...) + * \returns 0 on success, or -1 on error. + * + * \since This function is available since SDL 2.0.18. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_LinuxSetThreadPriorityAndPolicy_fun = function(threadID: cint64; sdlPriority, schedPolicy: cint): cint; cdecl; +Var + SDL_LinuxSetThreadPriorityAndPolicy : TSDL_LinuxSetThreadPriorityAndPolicy_fun = Nil; +{$else} + +function SDL_LinuxSetThreadPriorityAndPolicy(threadID: cint64; sdlPriority, schedPolicy: cint): cint; cdecl; + external SDL_LibName; +{$endif} +{$ENDIF LINUX} + + +(* Platform specific functions for iOS *) +{$IFDEF __IPHONEOS__} +type + PPSDL_iPhoneAnimationCallback = ^PSDL_iPhoneAnimationCallback; + PSDL_iPhoneAnimationCallback = ^TSDL_iPhoneAnimationCallback; + TSDL_iPhoneAnimationCallback = procedure(callbackParam: Pointer); cdecl; + +{** + * Use this function to set the animation callback on Apple iOS. + * + * This function is only available on Apple iOS. + * + * For more information see: + * https://github.com/libsdl-org/SDL/blob/main/docs/README-ios.md + * + * \param window the window for which the animation callback should be set + * \param interval the number of frames after which **callback** will be + * called + * \param callback the function to call for every frame. + * \param callbackParam a pointer that is passed to `callback`. + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_iPhoneSetEventPump + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_iPhoneSetAnimationCallback_fun = function(window: PSDL_Window; interval: cint; callback: TSDL_iPhoneAnimationCallback; callbackParam: Pointer); cdecl; +Var + SDL_iPhoneSetAnimationCallback : TSDL_iPhoneSetAnimationCallback_fun = Nil; +{$else} + +function SDL_iPhoneSetAnimationCallback(window: PSDL_Window; interval: cint; callback: TSDL_iPhoneAnimationCallback; callbackParam: Pointer); cdecl; + external SDL_LibName; +{$endif} + +{** + * Use this function to enable or disable the SDL event pump on Apple iOS. + * + * This function is only available on Apple iOS. + * + * \param enabled SDL_TRUE to enable the event pump, SDL_FALSE to disable it + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_iPhoneSetAnimationCallback + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_iPhoneSetEventPump_proc = procedure(enabled: TSDL_Bool); cdecl; +Var + SDL_iPhoneSetEventPump : TSDL_iPhoneSetEventPump_proc = Nil; +{$else} + +procedure SDL_iPhoneSetEventPump(enabled: TSDL_Bool); cdecl; + external SDL_LibName; +{$endif} +{$ENDIF __IPHONEOS__} + + +(* Platform specific functions for Android *) +{$IFDEF ANDROID} + +{** + * Get the Android Java Native Interface Environment of the current thread. + * + * This is the JNIEnv one needs to access the Java virtual machine from native + * code, and is needed for many Android APIs to be usable from Pascal. + * + * The prototype of the function in SDL's code actually declare a Pointer return + * type, even if the implementation returns a pointer to a JNIEnv. The + * rationale being that the SDL units can avoid using the JNI unit. + * + * \returns a pointer to Java native interface object (JNIEnv) to which the + * current thread is attached, or NIL on error. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AndroidGetActivity + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AndroidGetJNIEnv_fun = function(): Pointer; cdecl; +Var + SDL_AndroidGetJNIEnv : TSDL_AndroidGetJNIEnv_fun = Nil; +{$else} + +function SDL_AndroidGetJNIEnv(): Pointer; cdecl; + external SDL_LibName; +{$endif} + +(** + * Retrieve the Java instance of the Android activity class. + * + * The prototype of the function in SDL's code actually declares a Pointer + * return type, even if the implementation returns a JObject. The rationale + * being that the SDL units can avoid using the JNI unit. + * + * The JObject returned by the function is a local reference and must be + * released by the caller. See the PushLocalFrame() and PopLocalFrame() or + * DeleteLocalRef() functions of the Java native interface: + * + * https://docs.oracle.com/javase/1.5.0/docs/guide/jni/spec/functions.html + * + * \returns the jobject representing the instance of the Activity class of the + * Android application, or NIL on error. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AndroidGetJNIEnv + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AndroidGetActivity_fun = function(): Pointer; cdecl; +Var + SDL_AndroidGetActivity : TSDL_AndroidGetActivity_fun = Nil; +{$else} + +function SDL_AndroidGetActivity(): Pointer; cdecl; + external SDL_LibName; +{$endif} + +{** + * Query Android API level of the current device. + * + * - API level 34: Android 14 + * - API level 33: Android 13 + * - API level 32: Android 12L + * - API level 31: Android 12 + * - API level 30: Android 11 + * - API level 29: Android 10 + * - API level 28: Android 9 "Pie" + * - API level 27: Android 8.1 "Oreo" + * - API level 26: Android 8.0 "Oreo" + * - API level 25: Android 7.1 "Nougat" + * - API level 24: Android 7.0 "Nougat" + * - API level 23: Android 6.0 "Marshmallow" + * - API level 22: Android 5.1 "Lollipop" + * - API level 21: Android 5.0 "Lollipop" + * - API level 20: Android 4.4W "KitKat" + * - API level 19: Android 4.4 "KitKat" + * - API level 18: Android 4.3 "Jelly Bean" + * - API level 17: Android 4.2 "Jelly Bean" + * - API level 16: Android 4.1 "Jelly Bean" + * - API level 15: Android 4.0.3 "Ice Cream Sandwich" + * - API level 14: Android 4.0 "Ice Cream Sandwich" + * - API level 13: Android 3.2 "Honeycomb" + * - API level 12: Android 3.1 "Honeycomb" + * - API level 11: Android 3.0 "Honeycomb" + * - API level 10: Android 2.3.3 "Gingerbread" + * + * \returns the Android API level. + * + * \since This function is available since SDL 2.0.12. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetAndroidSDKVersion_fun = function(): cint; cdecl; +Var + SDL_GetAndroidSDKVersion : TSDL_GetAndroidSDKVersion_fun = Nil; +{$else} + +function SDL_GetAndroidSDKVersion(): cint; cdecl; + external SDL_LibName; +{$endif} + +{** + * Query if the application is running on Android TV. + * + * \returns SDL_TRUE if this is Android TV, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.8. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_IsAndroidTV_fun = function(): TSDL_Bool; cdecl; +Var + SDL_IsAndroidTV : TSDL_IsAndroidTV_fun = Nil; +{$else} + +function SDL_IsAndroidTV(): TSDL_Bool; cdecl; + external SDL_LibName; +{$endif} + +{** + * Query if the application is running on a Chromebook. + * + * \returns SDL_TRUE if this is a Chromebook, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.9. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_IsChromebook_fun = function(): TSDL_Bool; cdecl; +Var + SDL_IsChromebook : TSDL_IsChromebook_fun = Nil; +{$else} + +function SDL_IsChromebook(): TSDL_Bool; cdecl; + external SDL_LibName; +{$endif} + +{** + * Query if the application is running on a Samsung DeX docking station. + * + * \returns SDL_TRUE if this is a DeX docking station, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.9. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_IsDeXMode_fun = function(): TSDL_Bool; cdecl; +Var + SDL_IsDeXMode : TSDL_IsDeXMode_fun = Nil; +{$else} + +function SDL_IsDeXMode(): TSDL_Bool; cdecl; + external SDL_LibName; +{$endif} + +{** + * Trigger the Android system back button behavior. + * + * \since This function is available since SDL 2.0.9. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AndroidBackButton_proc = procedure(); cdecl; +Var + SDL_AndroidBackButton : TSDL_AndroidBackButton_proc = Nil; +{$else} + +procedure SDL_AndroidBackButton(); cdecl; + external SDL_LibName; +{$endif} + +{** + See the official Android developer guide for more information: + http://developer.android.com/guide/topics/data/data-storage.html +*} +const + SDL_ANDROID_EXTERNAL_STORAGE_READ = $01; + SDL_ANDROID_EXTERNAL_STORAGE_WRITE = $02; + +{** + * Get the path used for internal storage for this application. + * + * This path is unique to your application and cannot be written to by other + * applications. + * + * Your internal storage path is typically: + * `/data/data/your.app.package/files`. + * + * \returns the path used for internal storage or NIL on failure; + * call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AndroidGetExternalStorageState + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AndroidGetInternalStoragePath_fun = function(): PAnsiChar; cdecl; +Var + SDL_AndroidGetInternalStoragePath : TSDL_AndroidGetInternalStoragePath_fun = Nil; +{$else} + +function SDL_AndroidGetInternalStoragePath(): PAnsiChar; cdecl; + external SDL_LibName; +{$endif} + +{** + * Get the current state of external storage. + * + * The current state of external storage, a bitmask of these values: + * `SDL_ANDROID_EXTERNAL_STORAGE_READ`, `SDL_ANDROID_EXTERNAL_STORAGE_WRITE`. + * + * If external storage is currently unavailable, this will return 0. + * + * \returns the current state of external storage on success or 0 on failure; + * call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AndroidGetExternalStoragePath + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AndroidGetExternalStorageState_fun = function(): cint; cdecl; +Var + SDL_AndroidGetExternalStorageState : TSDL_AndroidGetExternalStorageState_fun = Nil; +{$else} + +function SDL_AndroidGetExternalStorageState(): cint; cdecl; + external SDL_LibName; +{$endif} + +{** + * Get the path used for external storage for this application. + * + * This path is unique to your application, but is public and can be written + * to by other applications. + * + * Your external storage path is typically: + * `/storage/sdcard0/Android/data/your.app.package/files`. + * + * \returns the path used for external storage for this application on success + * or NIL on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_AndroidGetExternalStorageState + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AndroidGetExternalStoragePath_fun = function(): PAnsiChar; cdecl; +Var + SDL_AndroidGetExternalStoragePath : TSDL_AndroidGetExternalStoragePath_fun = Nil; +{$else} + +function SDL_AndroidGetExternalStoragePath(): PAnsiChar; cdecl; + external SDL_LibName; +{$endif} + +{** + * Request permissions at runtime. + * + * This blocks the calling thread until the permission is granted or denied. + * + * For a full list of possible permission names, consult the Android docs: + * https://developer.android.com/reference/android/Manifest.permission + * + * \param permission The permission to request. + * \returns SDL_TRUE if the permission was granted, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.14. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AndroidRequestPermission_fun = function(const permission: PAnsiChar): TSDL_Bool; cdecl; +Var + SDL_AndroidRequestPermission : TSDL_AndroidRequestPermission_fun = Nil; +{$else} + +function SDL_AndroidRequestPermission(const permission: PAnsiChar): TSDL_Bool; cdecl; + external SDL_LibName; +{$endif} + +{** + * Shows an Android toast notification. + * + * Toasts are a sort of lightweight notification that are unique to Android. + * + * https://developer.android.com/guide/topics/ui/notifiers/toasts + * + * Shows toast in UI thread. + * + * For the `gravity` parameter, choose a value from here, or -1 if you don't + * have a preference: + * + * https://developer.android.com/reference/android/view/Gravity + * + * \param message text message to be shown + * \param duration 0=short, 1=long + * \param gravity where the notification should appear on the screen. + * \param xoffset set this parameter only when gravity >=0 + * \param yoffset set this parameter only when gravity >=0 + * \returns 0 if success, -1 if any error occurs. + * + * \since This function is available since SDL 2.0.16. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AndroidShowToast_fun = function(const message: PAnsiChar; duration, gravity, xoffset, yoffset: cint): cint; cdecl; +Var + SDL_AndroidShowToast : TSDL_AndroidShowToast_fun = Nil; +{$else} + +function SDL_AndroidShowToast(const message: PAnsiChar; duration, gravity, xoffset, yoffset: cint): cint; cdecl; + external SDL_LibName; +{$endif} + +{** + * Send a user command to SDLActivity. + * + * Override "boolean onUnhandledMessage(Message msg)" to handle the message. + * + * \param command user command that must be greater or equal to 0x8000 + * \param param user parameter + * + * \since This function is available since SDL 2.0.22. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AndroidSendMessage_fun = function(command: cUint32; param: cint): cint; cdecl; +Var + SDL_AndroidSendMessage : TSDL_AndroidSendMessage_fun = Nil; +{$else} + +function SDL_AndroidSendMessage(command: cUint32; param: cint): cint; cdecl; + external SDL_LibName; +{$endif} +{$ENDIF ANDROID} + + +(* Platform specific functions for WinRT *) +{$IFDEF __WINRT__} +Type + {** WinRT / Windows Phone path types *} + PPSDL_WinRT_Path = ^PSDL_WinRT_Path; + PSDL_WinRT_Path = ^TSDL_WinRT_Path; + TSDL_WinRT_Path = ( + {** The installed app's root directory. + Files here are likely to be read-only. *} + SDL_WINRT_PATH_INSTALLED_LOCATION = 0, + {** The app's local data store. Files may be written here *} + SDL_WINRT_PATH_LOCAL_FOLDER = 1, + {** The app's roaming data store. Unsupported on Windows Phone. + Files written here may be copied to other machines via a network + connection. + *} + SDL_WINRT_PATH_ROAMING_FOLDER = 2, + {** The app's temporary data store. Unsupported on Windows Phone. + Files written here may be deleted at any time. *} + SDL_WINRT_PATH_TEMP_FOLDER = 3 + ); + + TSDL_WinRT_DeviceFamily = ( + {** Unknown family *} + SDL_WINRT_DEVICEFAMILY_UNKNOWN, + {** Desktop family *} + SDL_WINRT_DEVICEFAMILY_DESKTOP, + {** Mobile family (for example smartphone) *} + SDL_WINRT_DEVICEFAMILY_MOBILE, + {** XBox family *} + SDL_WINRT_DEVICEFAMILY_XBOX + ); + + + {** + * \brief Retrieves a WinRT defined path on the local file system + * + * \note Documentation on most app-specific path types on WinRT + * can be found on MSDN, at the URL: + * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx + * + * \param pathType The type of path to retrieve. + * \ret A UCS-2 string (16-bit, wide-char) containing the path, or NULL + * if the path is not available for any reason. Not all paths are + * available on all versions of Windows. This is especially true on + * Windows Phone. Check the documentation for the given + * SDL_WinRT_Path for more information on which path types are + * supported where. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WinRTGetFSPathUNICODE_fun = function(pathT +Var + SDL_WinRTGetFSPathUNICODE : TSDL_WinRTGetFSPathUNICODE_fun = Nil; +{$else} + +function SDL_WinRTGetFSPathUNICODE(pathType :TSDL_WinRT_Path):PWideChar; + cdecl; external SDL_LibName; +{$endif} + + + {** + * \brief Retrieves a WinRT defined path on the local file system + * + * \note Documentation on most app-specific path types on WinRT + * can be found on MSDN, at the URL: + * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx + * + * \param pathType The type of path to retrieve. + * \ret A UTF-8 string (8-bit, multi-byte) containing the path, or NULL + * if the path is not available for any reason. Not all paths are + * available on all versions of Windows. This is especially true on + * Windows Phone. Check the documentation for the given + * SDL_WinRT_Path for more information on which path types are + * supported where. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WinRTGetFSPathUTF8_fun = function(pathT +Var + SDL_WinRTGetFSPathUTF8 : TSDL_WinRTGetFSPathUTF8_fun = Nil; +{$else} + +function SDL_WinRTGetFSPathUTF8(pathType :TSDL_WinRT_Path):PChar; + cdecl; external SDL_LibName; +{$endif} + + +{** + * Detects the device family of WinRT platform at runtime. + * + * \returns a value from the SDL_WinRT_DeviceFamily enum. + * + * \since This function is available since SDL 2.0.8. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WinRTGetDeviceFamily_fun = function(): TS +Var + SDL_WinRTGetDeviceFamily : TSDL_WinRTGetDeviceFamily_fun = Nil; +{$else} + +function SDL_WinRTGetDeviceFamily(): TSDL_WinRT_DeviceFamily; + cdecl; external SDL_LibName; +{$endif} +{$ENDIF __WINRT__} + + +{** + * Query if the current device is a tablet. + * + * If SDL can't determine this, it will return SDL_FALSE. + * + * \returns SDL_TRUE if the device is a tablet, SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.0.9. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_IsTablet_fun = function(): TSDL_Bool; cdecl; +Var + SDL_IsTablet : TSDL_IsTablet_fun = Nil; +{$else} + +function SDL_IsTablet(): TSDL_Bool; cdecl; + external SDL_LibName; +{$endif} + + +{ Functions used by iOS application delegates to notify SDL about state changes } +procedure SDL_OnApplicationWillTerminate(); cdecl; external SDL_LibName; +procedure SDL_OnApplicationDidReceiveMemoryWarning(); cdecl; external SDL_LibName; +procedure SDL_OnApplicationWillResignActive(); cdecl; external SDL_LibName; +procedure SDL_OnApplicationDidEnterBackground(); cdecl; external SDL_LibName; +procedure SDL_OnApplicationWillEnterForeground(); cdecl; external SDL_LibName; +procedure SDL_OnApplicationDidBecomeActive(); cdecl; external SDL_LibName; +{$IFDEF __IPHONEOS__} +procedure SDL_OnApplicationDidChangeStatusBarOrientation(); cdecl; external SDL_LibName; +{$ENDIF} diff --git a/units/sdlsyswm.inc b/units/sdlsyswm.inc index 9ef78877..166626d5 100644 --- a/units/sdlsyswm.inc +++ b/units/sdlsyswm.inc @@ -1,369 +1,369 @@ -// from sdl_syswm.h - -{** - * \brief SDL_syswm.h - * - * Your application has access to a special type of event ::SDL_SYSWMEVENT, - * which contains window-manager specific information and arrives whenever - * an unhandled window event occurs. This event is ignored by default, but - * you can enable it with SDL_EventState(). - *} - -{$IFDEF WINDOWS} - {$DEFINE SDL_VIDEO_DRIVER_WINDOWS} -{$ENDIF} - -{$IFDEF UNIX} - {$IF NOT (DEFINED(DARWIN) OR DEFINED(ANDROID))} - {$DEFINE SDL_VIDEO_DRIVER_X11} - {$IFEND} -{$ENDIF} - -(* - * Disabled because FPC does not ship a DirectFB unit. - * If you have some working DirectFB bindings, feel welcome to enable this and check if it breaks anything. - *) -{$UNDEF SDL_VIDEO_DRIVER_DIRECTFB} - -{$IFDEF DARWIN} - {$DEFINE SDL_VIDEO_DRIVER_COCOA} -{$ENDIF} - -(* - * Disabled because it's a Mac-specific video driver and we have no means of testing it. - * If you own a Mac, feel welcome to enable this and check if it actually compiles and doesn't break anything. - *) -{$UNDEF SDL_VIDEO_DRIVER_UIKIT} - -(* - * Disabled because FPC does not ship a Wayland unit. - * If you have some working Wayland bindings, feel welcome to enable this, - * check if it actually compiles and doesn't break anything. - *) -{$UNDEF SDL_VIDEO_DRIVER_WAYLAND} - -(* - * Disabled because FPC does not ship a Mir unit. - * Also, support for Mir has been removed in SDL 2.0.10. - *) -{$UNDEF SDL_VIDEO_DRIVER_MIR} - -(* - * Disabled because FPC does not support WinRT. - *) -{$UNDEF SDL_VIDEO_DRIVER_WINRT} - -{$IFDEF ANDROID} - {$DEFINE SDL_VIDEO_DRIVER_ANDROID} -{$ENDIF} - -(* - * Disabled because this is an embedded platform and we have no means of testing this. - * If you're actually working with Vivante, feel welcome to enable this - * and check if it compiles and works properly. - *) -{$UNDEF SDL_VIDEO_DRIVER_VIVANTE} - -{$IFDEF OS2} - {$DEFINE SDL_VIDEO_DRIVER_OS2} -{$ENDIF} - -{ SDL2-for-Pascal: Disabled because there are no FPC/Delphi units available. } -{$UNDEF SDL_VIDEO_DRIVER_KMSDRM} - -{$IFDEF HAIKU} - {$DEFINE SDL_VIDEO_DRIVER_HAIKU} -{$ENDIF} - - -{** - * These are the various supported windowing subsystems - *} -type - TSDL_SYSWM_TYPE = type cint; - -const - SDL_SYSWM_UNKNOWN = TSDL_SYSWM_TYPE(0); - SDL_SYSWM_WINDOWS = TSDL_SYSWM_TYPE(1); - SDL_SYSWM_X11 = TSDL_SYSWM_TYPE(2); - SDL_SYSWM_DIRECTFB = TSDL_SYSWM_TYPE(3); - SDL_SYSWM_COCOA = TSDL_SYSWM_TYPE(4); - SDL_SYSWM_UIKIT = TSDL_SYSWM_TYPE(5); - SDL_SYSWM_WAYLAND = TSDL_SYSWM_TYPE(6); - SDL_SYSWM_MIR = TSDL_SYSWM_TYPE(7); // * no longer available, left for API/ABI compatibility. Remove in 2.1! * - SDL_SYSWM_WINRT = TSDL_SYSWM_TYPE(8); - SDL_SYSWM_ANDROID = TSDL_SYSWM_TYPE(9); - SDL_SYSWM_VIVANTE = TSDL_SYSWM_TYPE(10); - SDL_SYSWM_OS2 = TSDL_SYSWM_TYPE(11); - SDL_SYSWM_HAIKU = TSDL_SYSWM_TYPE(12); - SDL_SYSWM_KMSDRM = TSDL_SYSWM_TYPE(13); - SDL_SYSWM_RISCOS = TSDL_SYSWM_TYPE(14); - -/// sdl_syswm.h uses anonymous structs, declared right in SDL_SysWMmsg and SDL_SysWMinfo. -/// Since Pascal does not allow this, we workaround by introducing named types. -type -{$IFDEF SDL_VIDEO_DRIVER_WINDOWS} - __SYSWM_WINDOWS = record - hwnd: HWND; {**< The window for the message } - msg: UINT; {**< The type of message *} - wParam: WPARAM; {**< WORD message parameter *} - lParam: LPARAM; {**< LONG message parameter *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_X11} - __SYSWM_X11 = record - event: {$IFDEF FPC} TXEvent {$ELSE} XEvent {$ENDIF}; - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_DIRECTFB} - __SYSWM_DIRECTFB = record - event: DFBEvent; - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_COCOA} - __SYSWM_COCOA = record - (* No Cocoa window events yet *) - dummy: cint; - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_UIKIT} - __SYSWM_UIKIT = record - (* No UIKit window events yet *) - dummy: cint; - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_VIVANTE} - __SYSWM_VIVANTE = record - (* No Vivante window events yet *) - dummy: cint; - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_OS2} - __SYSWM_OS2 = record - fFrame: Boolean; {**< TRUE if hwnd is a frame window *} - hwnd: HWND; {**< The window receiving the message *} - msg: ULONG; {**< The message identifier *} - mp1: MPARAM; {**< The first first message parameter *} - mp2: MPARAM; {**< The second first message parameter *} - end; -{$ENDIF} - -{** - * The custom window manager information structure. - * - * When this structure is returned, it holds information about which - * low level system it is using, and will be one of SDL_SYSWM_TYPE. - *} - -{$IFDEF SDL_VIDEO_DRIVER_WINDOWS} - __WMINFO_WINDOWS = record - window: HWND; {**< The window handle *} - hdc: HDC; {**< The window device context *} - hinstance: HINST; {**< The instance handle *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_WINRT} - __WMINFO_WINRT = record - window: IInspectable; {**< The WinRT CoreWindow *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_X11} - __WMINFO_X11 = record - display: PDisplay; {**< The X11 display *} - window: TWindow; {**< The X11 window *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_DIRECTFB} - __WMINFO_DIRECTFB = record - dfb: IDirectFB; {**< The directfb main interface *} - window: IDirectFBWindow; {**< The directfb window handle *} - surface: IDirectFBSurface; {**< The directfb client surface *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_COCOA} - __WMINFO_COCOA = record - window: NSWindow; {* The Cocoa window *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_UIKIT} - __WMINFO_UIKIT = record - window: UIWindow; {* The UIKit window *} - framebuffer: GLuint; {* The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. *} - colorbuffer: GLuint; {* The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. *} - resolveFramebuffer: GLuint; {* The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_WAYLAND} - __WMINFO_WAYLAND = record - display: wl_display; {**< Wayland display *} - surface: wl_surface; {**< Wayland surface *} - shell_surface: Pointer; {**< DEPRECATED Wayland shell_surface (window manager handle) *} - egl_window: wl_egl_window; {**< Wayland EGL window (native window) *} - xdg_surface: xdg_surface; {**< Wayland xdg surface (window manager handle) *} - xdg_toplevel: xdg_toplevel; {**< Wayland xdg toplevel role *} - xdg_popup: xdg_popup; {**< Wayland xdg popup role *} - xdg_positioner: xdg_positioner; {**< Wayland xdg positioner, for popup *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_MIR} {* no longer available, left for API/ABI compatibility. Remove in 2.1! *} - __WMINFO_MIR = record - connection: PMirConnection; {**< Mir display server connection *} - surface: PMirSurface; {**< Mir surface *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_ANDROID} - __WMINFO_ANDROID = record - window: Pointer; // PANativeWindow; - surface: Pointer; // PEGLSurface; - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_OS2} - __WMINFO_OS2 = record - hwnd: HWND; {**< The window handle *} - hwndFrame: HWND; {**< The frame window handle *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_VIVANTE} - __WMINFO_VIVANTE = record - display: EGLNativeDisplayType; - window: EGLNativeWindowType; - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_KMSDRM} - __WMINFO_KMSDRM = record - dev_index: cint; {**< Device index (ex: the X in /dev/dri/cardX) *} - drm_fd: cint; {**< DRM FD (unavailable on Vulkan windows) *} - gbm_device: Pointer; // *gbm_dev {**< GBM device (unavailable on Vulkan windows) *} - end; -{$ENDIF} - - - - -{** - * The custom event structure. - *} - PPSDL_SysWMmsg = ^PSDL_SysWMmsg; - PSDL_SysWMmsg = ^TSDL_SysWMmsg; - TSDL_SysWMmsg = record - version: TSDL_version; - case subsystem: TSDL_SYSWM_TYPE of - {$IFDEF SDL_VIDEO_DRIVER_WINDOWS} - SDL_SYSWM_WINDOWS: (win: __SYSWM_WINDOWS); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_X11} - SDL_SYSWM_X11: (x11: __SYSWM_X11); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_DIRECTFB} - SDL_SYSWM_DIRECTFB: (dfb: __SYSWM_DIRECTFB); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_COCOA} - SDL_SYSWM_COCOA: (cocoa: __SYSWM_COCOA); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_UIKIT} - SDL_SYSWM_UIKIT: (uikit: __SYSWM_UIKIT); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_VIVANTE} - SDL_SYSWM_VIVANTE: (vivante: __SYSWM_VIVANTE); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_OS2} - SDL_SYSWM_OS2: (os2: __SYSWM_OS2); - {$ENDIF} - SDL_SYSWM_UNKNOWN: (dummy: integer); - end; - -{** - * The custom window manager information structure. - * - * When this structure is returned, it holds information about which - * low level system it is using, and will be one of SDL_SYSWM_TYPE. - *} - PPSDL_SysWMinfo = ^PSDL_SysWMinfo; - PSDL_SysWMinfo = ^TSDL_SysWMinfo; - TSDL_SysWMinfo = record - version: TSDL_version; - case subsystem: TSDL_SYSWM_TYPE of - {$IFDEF SDL_VIDEO_DRIVER_WINDOWS} - SDL_SYSWM_WINDOWS: (win : __WMINFO_WINDOWS); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_WINRT} - SDL_SYSWM_WINRT: (winrt : __WMINFO_WINRT); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_X11} - SDL_SYSWM_X11: (x11 : __WMINFO_X11); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_DIRECTFB} - SDL_SYSWM_DIRECTFB: (dfb : __WMINFO_DIRECTFB); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_COCOA} - SDL_SYSWM_COCOA: (cocoa : __WMINFO_COCOA); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_UIKIT} - SDL_SYSWM_UIKIT: (uikit : __WMINFO_UIKIT); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_WAYLAND} - SDL_SYSWM_WAYLAND: (wl : __WMINFO_WAYLAND); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_MIR} - SDL_SYSWM_MIR: (mir : __WMINFO_MIR); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_ANDROID} - SDL_SYSWM_ANDROID: (android: __WMINFO_ANDROID); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_VIVANTE} - SDL_SYSWM_VIVANTE: (vivante: __WMINFO_VIVANTE); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_OS2} - SDL_SYSWM_OS2: (os2: __WMINFO_OS2); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_KMSDRM} - SDL_SYSWM_KMSDRM: (kmsdrm: __WMINFO_KMSDRM); - {$ENDIF} - (* Ensure this union is always 64 bytes (8 64-bit pointers) *) - SDL_SYSWM_UNKNOWN: (dummy: array[0..63] of Byte); - end; - -(** - * Get driver-specific information about a window. - * - * You must include SDL_syswm.h for the declaration of SDL_SysWMinfo. - * - * The caller must initialize the `info` structure's version by using - * `SDL_VERSION(&info.version)`, and then this function will fill in the rest - * of the structure with information about the given window. - * - * \param window the window about which information is being requested - * \param info an SDL_SysWMinfo structure filled in with window information - * \returns SDL_TRUE if the function is implemented and the `version` member - * of the `info` struct is valid, or SDL_FALSE if the information - * could not be retrieved; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *) -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowWMInfo_fun = function(window: PSDL_Window; info: PSDL_SysWMinfo): TSDL_bool; cdecl; -Var - SDL_GetWindowWMInfo : TSDL_GetWindowWMInfo_fun = Nil; -{$else} - -function SDL_GetWindowWMInfo(window: PSDL_Window; info: PSDL_SysWMinfo): TSDL_bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowWMInfo' {$ENDIF} {$ENDIF}; -{$endif} +// from sdl_syswm.h + +{** + * \brief SDL_syswm.h + * + * Your application has access to a special type of event ::SDL_SYSWMEVENT, + * which contains window-manager specific information and arrives whenever + * an unhandled window event occurs. This event is ignored by default, but + * you can enable it with SDL_EventState(). + *} + +{$IFDEF WINDOWS} + {$DEFINE SDL_VIDEO_DRIVER_WINDOWS} +{$ENDIF} + +{$IFDEF UNIX} + {$IF NOT (DEFINED(DARWIN) OR DEFINED(ANDROID))} + {$DEFINE SDL_VIDEO_DRIVER_X11} + {$IFEND} +{$ENDIF} + +(* + * Disabled because FPC does not ship a DirectFB unit. + * If you have some working DirectFB bindings, feel welcome to enable this and check if it breaks anything. + *) +{$UNDEF SDL_VIDEO_DRIVER_DIRECTFB} + +{$IFDEF DARWIN} + {$DEFINE SDL_VIDEO_DRIVER_COCOA} +{$ENDIF} + +(* + * Disabled because it's a Mac-specific video driver and we have no means of testing it. + * If you own a Mac, feel welcome to enable this and check if it actually compiles and doesn't break anything. + *) +{$UNDEF SDL_VIDEO_DRIVER_UIKIT} + +(* + * Disabled because FPC does not ship a Wayland unit. + * If you have some working Wayland bindings, feel welcome to enable this, + * check if it actually compiles and doesn't break anything. + *) +{$UNDEF SDL_VIDEO_DRIVER_WAYLAND} + +(* + * Disabled because FPC does not ship a Mir unit. + * Also, support for Mir has been removed in SDL 2.0.10. + *) +{$UNDEF SDL_VIDEO_DRIVER_MIR} + +(* + * Disabled because FPC does not support WinRT. + *) +{$UNDEF SDL_VIDEO_DRIVER_WINRT} + +{$IFDEF ANDROID} + {$DEFINE SDL_VIDEO_DRIVER_ANDROID} +{$ENDIF} + +(* + * Disabled because this is an embedded platform and we have no means of testing this. + * If you're actually working with Vivante, feel welcome to enable this + * and check if it compiles and works properly. + *) +{$UNDEF SDL_VIDEO_DRIVER_VIVANTE} + +{$IFDEF OS2} + {$DEFINE SDL_VIDEO_DRIVER_OS2} +{$ENDIF} + +{ SDL2-for-Pascal: Disabled because there are no FPC/Delphi units available. } +{$UNDEF SDL_VIDEO_DRIVER_KMSDRM} + +{$IFDEF HAIKU} + {$DEFINE SDL_VIDEO_DRIVER_HAIKU} +{$ENDIF} + + +{** + * These are the various supported windowing subsystems + *} +type + TSDL_SYSWM_TYPE = type cint; + +const + SDL_SYSWM_UNKNOWN = TSDL_SYSWM_TYPE(0); + SDL_SYSWM_WINDOWS = TSDL_SYSWM_TYPE(1); + SDL_SYSWM_X11 = TSDL_SYSWM_TYPE(2); + SDL_SYSWM_DIRECTFB = TSDL_SYSWM_TYPE(3); + SDL_SYSWM_COCOA = TSDL_SYSWM_TYPE(4); + SDL_SYSWM_UIKIT = TSDL_SYSWM_TYPE(5); + SDL_SYSWM_WAYLAND = TSDL_SYSWM_TYPE(6); + SDL_SYSWM_MIR = TSDL_SYSWM_TYPE(7); // * no longer available, left for API/ABI compatibility. Remove in 2.1! * + SDL_SYSWM_WINRT = TSDL_SYSWM_TYPE(8); + SDL_SYSWM_ANDROID = TSDL_SYSWM_TYPE(9); + SDL_SYSWM_VIVANTE = TSDL_SYSWM_TYPE(10); + SDL_SYSWM_OS2 = TSDL_SYSWM_TYPE(11); + SDL_SYSWM_HAIKU = TSDL_SYSWM_TYPE(12); + SDL_SYSWM_KMSDRM = TSDL_SYSWM_TYPE(13); + SDL_SYSWM_RISCOS = TSDL_SYSWM_TYPE(14); + +/// sdl_syswm.h uses anonymous structs, declared right in SDL_SysWMmsg and SDL_SysWMinfo. +/// Since Pascal does not allow this, we workaround by introducing named types. +type +{$IFDEF SDL_VIDEO_DRIVER_WINDOWS} + __SYSWM_WINDOWS = record + hwnd: HWND; {**< The window for the message } + msg: UINT; {**< The type of message *} + wParam: WPARAM; {**< WORD message parameter *} + lParam: LPARAM; {**< LONG message parameter *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_X11} + __SYSWM_X11 = record + event: {$IFDEF FPC} TXEvent {$ELSE} XEvent {$ENDIF}; + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_DIRECTFB} + __SYSWM_DIRECTFB = record + event: DFBEvent; + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_COCOA} + __SYSWM_COCOA = record + (* No Cocoa window events yet *) + dummy: cint; + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_UIKIT} + __SYSWM_UIKIT = record + (* No UIKit window events yet *) + dummy: cint; + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_VIVANTE} + __SYSWM_VIVANTE = record + (* No Vivante window events yet *) + dummy: cint; + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_OS2} + __SYSWM_OS2 = record + fFrame: Boolean; {**< TRUE if hwnd is a frame window *} + hwnd: HWND; {**< The window receiving the message *} + msg: ULONG; {**< The message identifier *} + mp1: MPARAM; {**< The first first message parameter *} + mp2: MPARAM; {**< The second first message parameter *} + end; +{$ENDIF} + +{** + * The custom window manager information structure. + * + * When this structure is returned, it holds information about which + * low level system it is using, and will be one of SDL_SYSWM_TYPE. + *} + +{$IFDEF SDL_VIDEO_DRIVER_WINDOWS} + __WMINFO_WINDOWS = record + window: HWND; {**< The window handle *} + hdc: HDC; {**< The window device context *} + hinstance: HINST; {**< The instance handle *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_WINRT} + __WMINFO_WINRT = record + window: IInspectable; {**< The WinRT CoreWindow *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_X11} + __WMINFO_X11 = record + display: PDisplay; {**< The X11 display *} + window: TWindow; {**< The X11 window *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_DIRECTFB} + __WMINFO_DIRECTFB = record + dfb: IDirectFB; {**< The directfb main interface *} + window: IDirectFBWindow; {**< The directfb window handle *} + surface: IDirectFBSurface; {**< The directfb client surface *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_COCOA} + __WMINFO_COCOA = record + window: NSWindow; {* The Cocoa window *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_UIKIT} + __WMINFO_UIKIT = record + window: UIWindow; {* The UIKit window *} + framebuffer: GLuint; {* The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. *} + colorbuffer: GLuint; {* The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. *} + resolveFramebuffer: GLuint; {* The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_WAYLAND} + __WMINFO_WAYLAND = record + display: wl_display; {**< Wayland display *} + surface: wl_surface; {**< Wayland surface *} + shell_surface: Pointer; {**< DEPRECATED Wayland shell_surface (window manager handle) *} + egl_window: wl_egl_window; {**< Wayland EGL window (native window) *} + xdg_surface: xdg_surface; {**< Wayland xdg surface (window manager handle) *} + xdg_toplevel: xdg_toplevel; {**< Wayland xdg toplevel role *} + xdg_popup: xdg_popup; {**< Wayland xdg popup role *} + xdg_positioner: xdg_positioner; {**< Wayland xdg positioner, for popup *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_MIR} {* no longer available, left for API/ABI compatibility. Remove in 2.1! *} + __WMINFO_MIR = record + connection: PMirConnection; {**< Mir display server connection *} + surface: PMirSurface; {**< Mir surface *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_ANDROID} + __WMINFO_ANDROID = record + window: Pointer; // PANativeWindow; + surface: Pointer; // PEGLSurface; + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_OS2} + __WMINFO_OS2 = record + hwnd: HWND; {**< The window handle *} + hwndFrame: HWND; {**< The frame window handle *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_VIVANTE} + __WMINFO_VIVANTE = record + display: EGLNativeDisplayType; + window: EGLNativeWindowType; + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_KMSDRM} + __WMINFO_KMSDRM = record + dev_index: cint; {**< Device index (ex: the X in /dev/dri/cardX) *} + drm_fd: cint; {**< DRM FD (unavailable on Vulkan windows) *} + gbm_device: Pointer; // *gbm_dev {**< GBM device (unavailable on Vulkan windows) *} + end; +{$ENDIF} + + + + +{** + * The custom event structure. + *} + PPSDL_SysWMmsg = ^PSDL_SysWMmsg; + PSDL_SysWMmsg = ^TSDL_SysWMmsg; + TSDL_SysWMmsg = record + version: TSDL_version; + case subsystem: TSDL_SYSWM_TYPE of + {$IFDEF SDL_VIDEO_DRIVER_WINDOWS} + SDL_SYSWM_WINDOWS: (win: __SYSWM_WINDOWS); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_X11} + SDL_SYSWM_X11: (x11: __SYSWM_X11); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_DIRECTFB} + SDL_SYSWM_DIRECTFB: (dfb: __SYSWM_DIRECTFB); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_COCOA} + SDL_SYSWM_COCOA: (cocoa: __SYSWM_COCOA); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_UIKIT} + SDL_SYSWM_UIKIT: (uikit: __SYSWM_UIKIT); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_VIVANTE} + SDL_SYSWM_VIVANTE: (vivante: __SYSWM_VIVANTE); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_OS2} + SDL_SYSWM_OS2: (os2: __SYSWM_OS2); + {$ENDIF} + SDL_SYSWM_UNKNOWN: (dummy: integer); + end; + +{** + * The custom window manager information structure. + * + * When this structure is returned, it holds information about which + * low level system it is using, and will be one of SDL_SYSWM_TYPE. + *} + PPSDL_SysWMinfo = ^PSDL_SysWMinfo; + PSDL_SysWMinfo = ^TSDL_SysWMinfo; + TSDL_SysWMinfo = record + version: TSDL_version; + case subsystem: TSDL_SYSWM_TYPE of + {$IFDEF SDL_VIDEO_DRIVER_WINDOWS} + SDL_SYSWM_WINDOWS: (win : __WMINFO_WINDOWS); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_WINRT} + SDL_SYSWM_WINRT: (winrt : __WMINFO_WINRT); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_X11} + SDL_SYSWM_X11: (x11 : __WMINFO_X11); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_DIRECTFB} + SDL_SYSWM_DIRECTFB: (dfb : __WMINFO_DIRECTFB); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_COCOA} + SDL_SYSWM_COCOA: (cocoa : __WMINFO_COCOA); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_UIKIT} + SDL_SYSWM_UIKIT: (uikit : __WMINFO_UIKIT); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_WAYLAND} + SDL_SYSWM_WAYLAND: (wl : __WMINFO_WAYLAND); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_MIR} + SDL_SYSWM_MIR: (mir : __WMINFO_MIR); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_ANDROID} + SDL_SYSWM_ANDROID: (android: __WMINFO_ANDROID); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_VIVANTE} + SDL_SYSWM_VIVANTE: (vivante: __WMINFO_VIVANTE); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_OS2} + SDL_SYSWM_OS2: (os2: __WMINFO_OS2); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_KMSDRM} + SDL_SYSWM_KMSDRM: (kmsdrm: __WMINFO_KMSDRM); + {$ENDIF} + (* Ensure this union is always 64 bytes (8 64-bit pointers) *) + SDL_SYSWM_UNKNOWN: (dummy: array[0..63] of Byte); + end; + +(** + * Get driver-specific information about a window. + * + * You must include SDL_syswm.h for the declaration of SDL_SysWMinfo. + * + * The caller must initialize the `info` structure's version by using + * `SDL_VERSION(&info.version)`, and then this function will fill in the rest + * of the structure with information about the given window. + * + * \param window the window about which information is being requested + * \param info an SDL_SysWMinfo structure filled in with window information + * \returns SDL_TRUE if the function is implemented and the `version` member + * of the `info` struct is valid, or SDL_FALSE if the information + * could not be retrieved; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *) +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowWMInfo_fun = function(window: PSDL_Window; info: PSDL_SysWMinfo): TSDL_bool; cdecl; +Var + SDL_GetWindowWMInfo : TSDL_GetWindowWMInfo_fun = Nil; +{$else} + +function SDL_GetWindowWMInfo(window: PSDL_Window; info: PSDL_SysWMinfo): TSDL_bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowWMInfo' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlthread.inc b/units/sdlthread.inc index f8083c51..b8f8f73a 100644 --- a/units/sdlthread.inc +++ b/units/sdlthread.inc @@ -1,514 +1,514 @@ -// based on "sdl_thread.h" - -{** - * \file SDL_thread.h - * - * Header for the SDL thread management routines. - *} - -{* The SDL thread structure, defined in SDL_thread.c *} -type - PSDL_Thread = type Pointer; - - {* The SDL thread ID *} - PPSDL_threadID = ^PSDL_threadID; - PSDL_threadID = ^TSDL_threadID; - TSDL_threadID = culong; - - {* Thread local storage ID, 0 is the invalid ID *} - PPSDL_TLSID = ^PSDL_TLSID; - PSDL_TLSID = ^TSDL_TLSID; - TSDL_TLSID = cuint; - - {** - * The SDL thread priority. - * - * SDL will make system changes as necessary in order to apply the thread priority. - * Code which attempts to control thread state related to priority should be aware - * that calling SDL_SetThreadPriority may alter such state. - * SDL_HINT_THREAD_PRIORITY_POLICY can be used to control aspects of this behavior. - * - * \note On many systems you require special privileges to set high or time critical priority. - *} -type - PPSDL_ThreadPriority = ^PSDL_ThreadPriority; - PSDL_ThreadPriority = ^TSDL_ThreadPriority; - TSDL_ThreadPriority = cint; - -const - SDL_THREAD_PRIORITY_LOW = TSDL_ThreadPriority(0); - SDL_THREAD_PRIORITY_NORMAL = TSDL_ThreadPriority(1); - SDL_THREAD_PRIORITY_HIGH = TSDL_ThreadPriority(2); - SDL_THREAD_PRIORITY_TIME_CRITICAL = TSDL_ThreadPriority(3); - - {** - * The function passed to SDL_CreateThread(). - * - * \param data what was passed as `data` to SDL_CreateThread() - * \returns a value that can be reported through SDL_WaitThread(). - *} -type - PPSDL_ThreadFunction = ^PSDL_ThreadFunction; - PSDL_ThreadFunction = ^TSDL_ThreadFunction; - TSDL_ThreadFunction = function(data: Pointer): cint; cdecl; - -{$IFDEF WINDOWS} - {** - * SDL_thread.h - * - * We compile SDL into a DLL. This means, that it's the DLL which - * creates a new thread for the calling process with the SDL_CreateThread() - * API. There is a problem with this, that only the RTL of the SDL.DLL will - * be initialized for those threads, and not the RTL of the calling - * application! - * - * To solve this, we make a little hack here. - * - * We'll always use the caller's _beginthread() and _endthread() APIs to - * start a new thread. This way, if it's the SDL.DLL which uses this API, - * then the RTL of SDL.DLL will be used to create the new thread, and if it's - * the application, then the RTL of the application will be used. - * - * So, in short: - * Always use the _beginthread() and _endthread() of the calling runtime - * library! - *} -{$DEFINE SDL_PASSED_BEGINTHREAD_ENDTHREAD} - -type - { SDL2-for-Pascal: #todo : Needed? } - {$IFNDEF FPC} - {$IFNDEF DELPHI16UP} - TThreadID = Cardinal; - {$ENDIF} - {$ENDIF} - - { SDL2-for-Pascal #todo : Explanation needed } - TpfnSDL_CurrentBeginThread = function( - SecurityAttributes: Pointer; StackSize: cuint; ThreadFunc: TThreadFunc; - Parameter: Pointer {arg}; CreationFlags: cuint; var ThreadId: TThreadID {threadID}): cuintptr_t; cdecl; - - TpfnSDL_CurrentEndThread = procedure(code: cuint); cdecl; - - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_CreateThread_fun = function(fn: TSDL_ThreadFunction; name: PAnsiChar; - data: Pointer; - pfnBeginThread: TpfnSDL_CurrentBeginThread; - pfnEndThread: TpfnSDL_CurrentEndThread): PSDL_Thread; cdecl; -Var - SDL_CreateThread : TSDL_CreateThread_fun = Nil; -{$else} - -function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PAnsiChar; - data: Pointer; - pfnBeginThread: TpfnSDL_CurrentBeginThread; - pfnEndThread: TpfnSDL_CurrentEndThread): PSDL_Thread; cdecl; overload; - external SDL_LibName; -{$endif} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_CreateThreadWithStackSize_fun = function(fn: TSDL_ThreadFunction; - name: PAnsiChar; const stacksize: csize_t; data: Pointer; - pfnBeginThread: TpfnSDL_CurrentBeginThread; - pfnEndThread: TpfnSDL_CurrentEndThread): PSDL_Thread; cdecl; -Var - SDL_CreateThreadWithStackSize : TSDL_CreateThreadWithStackSize_fun = Nil; -{$else} - -function SDL_CreateThreadWithStackSize(fn: TSDL_ThreadFunction; - name: PAnsiChar; const stacksize: csize_t; data: Pointer; - pfnBeginThread: TpfnSDL_CurrentBeginThread; - pfnEndThread: TpfnSDL_CurrentEndThread): PSDL_Thread; cdecl; overload; - external SDL_LibName; -{$endif} - -{ SDL2-For-Pascal: #note : In the C header are two versions - of these macro functions. One for SDL's dynamic API and one without. - We can go with this for the moment. Improvement surely possible. } -function SDL_CreateThread2(fn: TSDL_ThreadFunction; name: PAnsiChar; - data: Pointer): PSDL_Thread; overload; - -function SDL_CreateThreadWithStackSize2(fn: TSDL_ThreadFunction; name: PAnsiChar; - const stacksize: csize_t; data: Pointer): PSDL_Thread; overload; - - -{ SDL2-For-Pascal: #todo : - The OS2 part of SDL_thread.h is not translated, yet. - The ELSE block is covering this right now. Not sure if the - OS2 platform switch is implemented in Delphi. } -//{$ELSEIF OS2} -//{* -// * just like the windows case above: We compile SDL2 -// * into a dll with Watcom's runtime statically linked. -// *} - -{ ... } - -{$ELSE} - - {** - * Create a thread. - * - * Thread naming is a little complicated: Most systems have very small - * limits for the string length (BeOS has 32 bytes, Linux currently has 16, - * Visual C++ 6.0 has nine!), and possibly other arbitrary rules. You'll - * have to see what happens with your system's debugger. The name should be - * UTF-8 (but using the naming limits of C identifiers is a better bet). - * There are no requirements for thread naming conventions, so long as the - * string is null-terminated UTF-8, but these guidelines are helpful in - * choosing a name: - * - * http://stackoverflow.com/questions/149932/naming-conventions-for-threads - * - * If a system imposes requirements, SDL will try to munge the string for - * it (truncate, etc), but the original string contents will be available - * from SDL_GetThreadName(). - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_CreateThread_fun = function(fn: TSDL_ThreadFunction; name: PAnsiChar; - data: Pointer): PSDL_Thread; cdecl; -Var - SDL_CreateThread : TSDL_CreateThread_fun = Nil; -{$else} - -function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PAnsiChar; - data: Pointer): PSDL_Thread; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateThread' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Create a new thread with a specific stack size. - * - * SDL makes an attempt to report `name` to the system, so that debuggers can - * display it. Not all platforms support this. - * - * Thread naming is a little complicated: Most systems have very small limits - * for the string length (Haiku has 32 bytes, Linux currently has 16, Visual - * C++ 6.0 has _nine_!), and possibly other arbitrary rules. You'll have to - * see what happens with your system's debugger. The name should be UTF-8 (but - * using the naming limits of C identifiers is a better bet). There are no - * requirements for thread naming conventions, so long as the string is - * null-terminated UTF-8, but these guidelines are helpful in choosing a name: - * - * https://stackoverflow.com/questions/149932/naming-conventions-for-threads - * - * If a system imposes requirements, SDL will try to munge the string for it - * (truncate, etc), but the original string contents will be available from - * SDL_GetThreadName(). - * - * The size (in bytes) of the new stack can be specified. Zero means "use the - * system default" which might be wildly different between platforms. x86 - * Linux generally defaults to eight megabytes, an embedded device might be a - * few kilobytes instead. You generally need to specify a stack that is a - * multiple of the system's page size (in many cases, this is 4 kilobytes, but - * check your system documentation). - * - * In SDL 2.1, stack size will be folded into the original SDL_CreateThread - * function, but for backwards compatibility, this is currently a separate - * function. - * - * \param fn the SDL_ThreadFunction function to call in the new thread - * \param name the name of the thread - * \param stacksize the size, in bytes, to allocate for the new thread stack. - * \param data a pointer that is passed to `fn` - * \returns an opaque pointer to the new thread object on success, NULL if the - * new thread could not be created; call SDL_GetError() for more - * information. - * - * \since This function is available since SDL 2.0.9. - * - * \sa SDL_WaitThread - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_CreateThreadWithStackSize_fun = function(fn: TSDL_ThreadFunction; name: PAnsiChar; - stacksize: csize_t; data: Pointer): PSDL_Thread; cdecl; -Var - SDL_CreateThreadWithStackSize : TSDL_CreateThreadWithStackSize_fun = Nil; -{$else} - -function SDL_CreateThreadWithStackSize(fn: TSDL_ThreadFunction; name: PAnsiChar; - stacksize: csize_t; data: Pointer): PSDL_Thread; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateThreadWithStackSize' {$ENDIF} {$ENDIF}; -{$endif} - - -{$ENDIF} - - {** - * Get the thread name as it was specified in SDL_CreateThread(). - * - * This is internal memory, not to be freed by the caller, and remains valid - * until the specified thread is cleaned up by SDL_WaitThread(). - * - * \param thread the thread to query - * \returns a pointer to a UTF-8 string that names the specified thread, or - * NULL if it doesn't have a name. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_CreateThread - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetThreadName_fun = function(thread: PSDL_Thread): PAnsiChar; cdecl; -Var - SDL_GetThreadName : TSDL_GetThreadName_fun = Nil; -{$else} - -function SDL_GetThreadName(thread: PSDL_Thread): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetThreadName' {$ENDIF}{$ENDIF}; -{$endif} - - {** - * Get the thread identifier for the current thread. - * - * This thread identifier is as reported by the underlying operating system. - * If SDL is running on a platform that does not support threads the return - * value will always be zero. - * - * This function also returns a valid thread ID when called from the main - * thread. - * - * \returns the ID of the current thread. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_GetThreadID - *} -function SDL_ThreadID: TSDL_ThreadID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ThreadID' {$ENDIF}{$ENDIF}; - - {** - * Get the thread identifier for the specified thread. - * - * This thread identifier is as reported by the underlying operating system. - * If SDL is running on a platform that does not support threads the return - * value will always be zero. - * - * \param thread the thread to query - * \returns the ID of the specified thread, or the ID of the current thread if - * `thread` is NULL. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_ThreadID - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetThreadID_fun = function(thread: PSDL_Thread): TSDL_ThreadID; cdecl; -Var - SDL_GetThreadID : TSDL_GetThreadID_fun = Nil; -{$else} - -function SDL_GetThreadID(thread: PSDL_Thread): TSDL_ThreadID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetThreadID' {$ENDIF}{$ENDIF}; -{$endif} - - {** - * Set the priority for the current thread. - * - * Note that some platforms will not let you alter the priority (or at least, - * promote the thread to a higher priority) at all, and some require you to be - * an administrator account. Be prepared for this to fail. - * - * \param priority the SDL_ThreadPriority to set - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetThreadPriority_fun = function(priority: TSDL_ThreadPriority): cint; cdecl; -Var - SDL_SetThreadPriority : TSDL_SetThreadPriority_fun = Nil; -{$else} - -function SDL_SetThreadPriority(priority: TSDL_ThreadPriority): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetThreadPriority' {$ENDIF}{$ENDIF}; -{$endif} - - {** - * Wait for a thread to finish. - * - * Threads that haven't been detached will remain (as a "zombie") until this - * function cleans them up. Not doing so is a resource leak. - * - * Once a thread has been cleaned up through this function, the SDL_Thread - * that references it becomes invalid and should not be referenced again. As - * such, only one thread may call SDL_WaitThread() on another. - * - * The return code for the thread function is placed in the area pointed to by - * `status`, if `status` is not NULL. - * - * You may not wait on a thread that has been used in a call to - * SDL_DetachThread(). Use either that function or this one, but not both, or - * behavior is undefined. - * - * It is safe to pass a NULL thread to this function; it is a no-op. - * - * Note that the thread pointer is freed by this function and is not valid - * afterward. - * - * \param thread the SDL_Thread pointer that was returned from the - * SDL_CreateThread() call that started this thread - * \param status pointer to an integer that will receive the value returned - * from the thread function by its 'return', or NULL to not - * receive such value back. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_CreateThread - * \sa SDL_DetachThread - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_WaitThread_proc = procedure(thread: PSDL_Thread; status: pcint); cdecl; -Var - SDL_WaitThread : TSDL_WaitThread_proc = Nil; -{$else} - -procedure SDL_WaitThread(thread: PSDL_Thread; status: pcint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WaitThread' {$ENDIF}{$ENDIF}; -{$endif} - - {** - * Let a thread clean up on exit without intervention. - * - * A thread may be "detached" to signify that it should not remain until - * another thread has called SDL_WaitThread() on it. Detaching a thread is - * useful for long-running threads that nothing needs to synchronize with or - * further manage. When a detached thread is done, it simply goes away. - * - * There is no way to recover the return code of a detached thread. If you - * need this, don't detach the thread and instead use SDL_WaitThread(). - * - * Once a thread is detached, you should usually assume the SDL_Thread isn't - * safe to reference again, as it will become invalid immediately upon the - * detached thread's exit, instead of remaining until someone has called - * SDL_WaitThread() to finally clean it up. As such, don't detach the same - * thread more than once. - * - * If a thread has already exited when passed to SDL_DetachThread(), it will - * stop waiting for a call to SDL_WaitThread() and clean up immediately. It is - * not safe to detach a thread that might be used with SDL_WaitThread(). - * - * You may not call SDL_WaitThread() on a thread that has been detached. Use - * either that function or this one, but not both, or behavior is undefined. - * - * It is safe to pass NULL to this function; it is a no-op. - * - * \param thread the SDL_Thread pointer that was returned from the - * SDL_CreateThread() call that started this thread - * - * \since This function is available since SDL 2.0.2. - * - * \sa SDL_CreateThread - * \sa SDL_WaitThread - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_DetachThread_proc = procedure(thread:PSDL_Thread); cdecl; -Var - SDL_DetachThread : TSDL_DetachThread_proc = Nil; -{$else} - -procedure SDL_DetachThread(thread:PSDL_Thread); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DetachThread' {$ENDIF}{$ENDIF}; -{$endif} - - {** - * Create a piece of thread-local storage. - * - * This creates an identifier that is globally visible to all threads but - * refers to data that is thread-specific. - * - * \returns the newly created thread local storage identifier or 0 on error. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_TLSGet - * \sa SDL_TLSSet - *} -function SDL_TLSCreate: TSDL_TLSID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TLSCreate' {$ENDIF} {$ENDIF}; - - {** - * Get the current thread's value associated with a thread local storage ID. - * - * \param id the thread local storage ID - * \returns the value associated with the ID for the current thread or NULL if - * no value has been set; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_TLSCreate - * \sa SDL_TLSSet - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_TLSGet_fun = function(id: TSDL_TLSID): Pointer; cdecl; -Var - SDL_TLSGet : TSDL_TLSGet_fun = Nil; -{$else} - -function SDL_TLSGet(id: TSDL_TLSID): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TLSGet' {$ENDIF} {$ENDIF}; -{$endif} - -type - { SDL2-For-Pascal: This function pointer is introduced to specifiy the - destructor pointer in the SDL_TLSSet function - according to C headers. - - The TTLSDestructor type itself is not defined - by the original SDL2 headers. } - TTLSDestructor = procedure(value: Pointer); cdecl; - - {** - * Set the current thread's value associated with a thread local storage ID. - * - * The function prototype for `destructor` is: - * - * ```c - * void destructor(void *value) - * ``` - * - * where its parameter `value` is what was passed as `value` to SDL_TLSSet(). - * - * \param id the thread local storage ID - * \param value the value to associate with the ID for the current thread - * \param destructor a function called when the thread exits, to free the - * value - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.0. - * - * \sa SDL_TLSCreate - * \sa SDL_TLSGet - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_TLSSet_fun = function(id: TSDL_TLSID; const value: Pointer; destructor_: TTLSDestructor): cint; cdecl; -Var - SDL_TLSSet : TSDL_TLSSet_fun = Nil; -{$else} - -function SDL_TLSSet(id: TSDL_TLSID; const value: Pointer; destructor_: TTLSDestructor): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TLSSet' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Cleanup all TLS data for this thread. - * - * \since This function is available since SDL 2.0.16. - *} -procedure SDL_TLSCleanup; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TLSCleanup' {$ENDIF} {$ENDIF}; - +// based on "sdl_thread.h" + +{** + * \file SDL_thread.h + * + * Header for the SDL thread management routines. + *} + +{* The SDL thread structure, defined in SDL_thread.c *} +type + PSDL_Thread = type Pointer; + + {* The SDL thread ID *} + PPSDL_threadID = ^PSDL_threadID; + PSDL_threadID = ^TSDL_threadID; + TSDL_threadID = culong; + + {* Thread local storage ID, 0 is the invalid ID *} + PPSDL_TLSID = ^PSDL_TLSID; + PSDL_TLSID = ^TSDL_TLSID; + TSDL_TLSID = cuint; + + {** + * The SDL thread priority. + * + * SDL will make system changes as necessary in order to apply the thread priority. + * Code which attempts to control thread state related to priority should be aware + * that calling SDL_SetThreadPriority may alter such state. + * SDL_HINT_THREAD_PRIORITY_POLICY can be used to control aspects of this behavior. + * + * \note On many systems you require special privileges to set high or time critical priority. + *} +type + PPSDL_ThreadPriority = ^PSDL_ThreadPriority; + PSDL_ThreadPriority = ^TSDL_ThreadPriority; + TSDL_ThreadPriority = cint; + +const + SDL_THREAD_PRIORITY_LOW = TSDL_ThreadPriority(0); + SDL_THREAD_PRIORITY_NORMAL = TSDL_ThreadPriority(1); + SDL_THREAD_PRIORITY_HIGH = TSDL_ThreadPriority(2); + SDL_THREAD_PRIORITY_TIME_CRITICAL = TSDL_ThreadPriority(3); + + {** + * The function passed to SDL_CreateThread(). + * + * \param data what was passed as `data` to SDL_CreateThread() + * \returns a value that can be reported through SDL_WaitThread(). + *} +type + PPSDL_ThreadFunction = ^PSDL_ThreadFunction; + PSDL_ThreadFunction = ^TSDL_ThreadFunction; + TSDL_ThreadFunction = function(data: Pointer): cint; cdecl; + +{$IFDEF WINDOWS} + {** + * SDL_thread.h + * + * We compile SDL into a DLL. This means, that it's the DLL which + * creates a new thread for the calling process with the SDL_CreateThread() + * API. There is a problem with this, that only the RTL of the SDL.DLL will + * be initialized for those threads, and not the RTL of the calling + * application! + * + * To solve this, we make a little hack here. + * + * We'll always use the caller's _beginthread() and _endthread() APIs to + * start a new thread. This way, if it's the SDL.DLL which uses this API, + * then the RTL of SDL.DLL will be used to create the new thread, and if it's + * the application, then the RTL of the application will be used. + * + * So, in short: + * Always use the _beginthread() and _endthread() of the calling runtime + * library! + *} +{$DEFINE SDL_PASSED_BEGINTHREAD_ENDTHREAD} + +type + { SDL2-for-Pascal: #todo : Needed? } + {$IFNDEF FPC} + {$IFNDEF DELPHI16UP} + TThreadID = Cardinal; + {$ENDIF} + {$ENDIF} + + { SDL2-for-Pascal #todo : Explanation needed } + TpfnSDL_CurrentBeginThread = function( + SecurityAttributes: Pointer; StackSize: cuint; ThreadFunc: TThreadFunc; + Parameter: Pointer {arg}; CreationFlags: cuint; var ThreadId: TThreadID {threadID}): cuintptr_t; cdecl; + + TpfnSDL_CurrentEndThread = procedure(code: cuint); cdecl; + + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateThread_fun = function(fn: TSDL_ThreadFunction; name: PAnsiChar; + data: Pointer; + pfnBeginThread: TpfnSDL_CurrentBeginThread; + pfnEndThread: TpfnSDL_CurrentEndThread): PSDL_Thread; cdecl; +Var + SDL_CreateThread : TSDL_CreateThread_fun = Nil; +{$else} + +function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PAnsiChar; + data: Pointer; + pfnBeginThread: TpfnSDL_CurrentBeginThread; + pfnEndThread: TpfnSDL_CurrentEndThread): PSDL_Thread; cdecl; overload; + external SDL_LibName; +{$endif} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateThreadWithStackSize_fun = function(fn: TSDL_ThreadFunction; + name: PAnsiChar; const stacksize: csize_t; data: Pointer; + pfnBeginThread: TpfnSDL_CurrentBeginThread; + pfnEndThread: TpfnSDL_CurrentEndThread): PSDL_Thread; cdecl; +Var + SDL_CreateThreadWithStackSize : TSDL_CreateThreadWithStackSize_fun = Nil; +{$else} + +function SDL_CreateThreadWithStackSize(fn: TSDL_ThreadFunction; + name: PAnsiChar; const stacksize: csize_t; data: Pointer; + pfnBeginThread: TpfnSDL_CurrentBeginThread; + pfnEndThread: TpfnSDL_CurrentEndThread): PSDL_Thread; cdecl; overload; + external SDL_LibName; +{$endif} + +{ SDL2-For-Pascal: #note : In the C header are two versions + of these macro functions. One for SDL's dynamic API and one without. + We can go with this for the moment. Improvement surely possible. } +function SDL_CreateThread2(fn: TSDL_ThreadFunction; name: PAnsiChar; + data: Pointer): PSDL_Thread; overload; + +function SDL_CreateThreadWithStackSize2(fn: TSDL_ThreadFunction; name: PAnsiChar; + const stacksize: csize_t; data: Pointer): PSDL_Thread; overload; + + +{ SDL2-For-Pascal: #todo : + The OS2 part of SDL_thread.h is not translated, yet. + The ELSE block is covering this right now. Not sure if the + OS2 platform switch is implemented in Delphi. } +//{$ELSEIF OS2} +//{* +// * just like the windows case above: We compile SDL2 +// * into a dll with Watcom's runtime statically linked. +// *} + +{ ... } + +{$ELSE} + + {** + * Create a thread. + * + * Thread naming is a little complicated: Most systems have very small + * limits for the string length (BeOS has 32 bytes, Linux currently has 16, + * Visual C++ 6.0 has nine!), and possibly other arbitrary rules. You'll + * have to see what happens with your system's debugger. The name should be + * UTF-8 (but using the naming limits of C identifiers is a better bet). + * There are no requirements for thread naming conventions, so long as the + * string is null-terminated UTF-8, but these guidelines are helpful in + * choosing a name: + * + * http://stackoverflow.com/questions/149932/naming-conventions-for-threads + * + * If a system imposes requirements, SDL will try to munge the string for + * it (truncate, etc), but the original string contents will be available + * from SDL_GetThreadName(). + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateThread_fun = function(fn: TSDL_ThreadFunction; name: PAnsiChar; + data: Pointer): PSDL_Thread; cdecl; +Var + SDL_CreateThread : TSDL_CreateThread_fun = Nil; +{$else} + +function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PAnsiChar; + data: Pointer): PSDL_Thread; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateThread' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Create a new thread with a specific stack size. + * + * SDL makes an attempt to report `name` to the system, so that debuggers can + * display it. Not all platforms support this. + * + * Thread naming is a little complicated: Most systems have very small limits + * for the string length (Haiku has 32 bytes, Linux currently has 16, Visual + * C++ 6.0 has _nine_!), and possibly other arbitrary rules. You'll have to + * see what happens with your system's debugger. The name should be UTF-8 (but + * using the naming limits of C identifiers is a better bet). There are no + * requirements for thread naming conventions, so long as the string is + * null-terminated UTF-8, but these guidelines are helpful in choosing a name: + * + * https://stackoverflow.com/questions/149932/naming-conventions-for-threads + * + * If a system imposes requirements, SDL will try to munge the string for it + * (truncate, etc), but the original string contents will be available from + * SDL_GetThreadName(). + * + * The size (in bytes) of the new stack can be specified. Zero means "use the + * system default" which might be wildly different between platforms. x86 + * Linux generally defaults to eight megabytes, an embedded device might be a + * few kilobytes instead. You generally need to specify a stack that is a + * multiple of the system's page size (in many cases, this is 4 kilobytes, but + * check your system documentation). + * + * In SDL 2.1, stack size will be folded into the original SDL_CreateThread + * function, but for backwards compatibility, this is currently a separate + * function. + * + * \param fn the SDL_ThreadFunction function to call in the new thread + * \param name the name of the thread + * \param stacksize the size, in bytes, to allocate for the new thread stack. + * \param data a pointer that is passed to `fn` + * \returns an opaque pointer to the new thread object on success, NULL if the + * new thread could not be created; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 2.0.9. + * + * \sa SDL_WaitThread + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateThreadWithStackSize_fun = function(fn: TSDL_ThreadFunction; name: PAnsiChar; + stacksize: csize_t; data: Pointer): PSDL_Thread; cdecl; +Var + SDL_CreateThreadWithStackSize : TSDL_CreateThreadWithStackSize_fun = Nil; +{$else} + +function SDL_CreateThreadWithStackSize(fn: TSDL_ThreadFunction; name: PAnsiChar; + stacksize: csize_t; data: Pointer): PSDL_Thread; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateThreadWithStackSize' {$ENDIF} {$ENDIF}; +{$endif} + + +{$ENDIF} + + {** + * Get the thread name as it was specified in SDL_CreateThread(). + * + * This is internal memory, not to be freed by the caller, and remains valid + * until the specified thread is cleaned up by SDL_WaitThread(). + * + * \param thread the thread to query + * \returns a pointer to a UTF-8 string that names the specified thread, or + * NULL if it doesn't have a name. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_CreateThread + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetThreadName_fun = function(thread: PSDL_Thread): PAnsiChar; cdecl; +Var + SDL_GetThreadName : TSDL_GetThreadName_fun = Nil; +{$else} + +function SDL_GetThreadName(thread: PSDL_Thread): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetThreadName' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Get the thread identifier for the current thread. + * + * This thread identifier is as reported by the underlying operating system. + * If SDL is running on a platform that does not support threads the return + * value will always be zero. + * + * This function also returns a valid thread ID when called from the main + * thread. + * + * \returns the ID of the current thread. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_GetThreadID + *} +function SDL_ThreadID: TSDL_ThreadID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ThreadID' {$ENDIF}{$ENDIF}; + + {** + * Get the thread identifier for the specified thread. + * + * This thread identifier is as reported by the underlying operating system. + * If SDL is running on a platform that does not support threads the return + * value will always be zero. + * + * \param thread the thread to query + * \returns the ID of the specified thread, or the ID of the current thread if + * `thread` is NULL. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_ThreadID + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetThreadID_fun = function(thread: PSDL_Thread): TSDL_ThreadID; cdecl; +Var + SDL_GetThreadID : TSDL_GetThreadID_fun = Nil; +{$else} + +function SDL_GetThreadID(thread: PSDL_Thread): TSDL_ThreadID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetThreadID' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Set the priority for the current thread. + * + * Note that some platforms will not let you alter the priority (or at least, + * promote the thread to a higher priority) at all, and some require you to be + * an administrator account. Be prepared for this to fail. + * + * \param priority the SDL_ThreadPriority to set + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetThreadPriority_fun = function(priority: TSDL_ThreadPriority): cint; cdecl; +Var + SDL_SetThreadPriority : TSDL_SetThreadPriority_fun = Nil; +{$else} + +function SDL_SetThreadPriority(priority: TSDL_ThreadPriority): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetThreadPriority' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Wait for a thread to finish. + * + * Threads that haven't been detached will remain (as a "zombie") until this + * function cleans them up. Not doing so is a resource leak. + * + * Once a thread has been cleaned up through this function, the SDL_Thread + * that references it becomes invalid and should not be referenced again. As + * such, only one thread may call SDL_WaitThread() on another. + * + * The return code for the thread function is placed in the area pointed to by + * `status`, if `status` is not NULL. + * + * You may not wait on a thread that has been used in a call to + * SDL_DetachThread(). Use either that function or this one, but not both, or + * behavior is undefined. + * + * It is safe to pass a NULL thread to this function; it is a no-op. + * + * Note that the thread pointer is freed by this function and is not valid + * afterward. + * + * \param thread the SDL_Thread pointer that was returned from the + * SDL_CreateThread() call that started this thread + * \param status pointer to an integer that will receive the value returned + * from the thread function by its 'return', or NULL to not + * receive such value back. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_CreateThread + * \sa SDL_DetachThread + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_WaitThread_proc = procedure(thread: PSDL_Thread; status: pcint); cdecl; +Var + SDL_WaitThread : TSDL_WaitThread_proc = Nil; +{$else} + +procedure SDL_WaitThread(thread: PSDL_Thread; status: pcint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WaitThread' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Let a thread clean up on exit without intervention. + * + * A thread may be "detached" to signify that it should not remain until + * another thread has called SDL_WaitThread() on it. Detaching a thread is + * useful for long-running threads that nothing needs to synchronize with or + * further manage. When a detached thread is done, it simply goes away. + * + * There is no way to recover the return code of a detached thread. If you + * need this, don't detach the thread and instead use SDL_WaitThread(). + * + * Once a thread is detached, you should usually assume the SDL_Thread isn't + * safe to reference again, as it will become invalid immediately upon the + * detached thread's exit, instead of remaining until someone has called + * SDL_WaitThread() to finally clean it up. As such, don't detach the same + * thread more than once. + * + * If a thread has already exited when passed to SDL_DetachThread(), it will + * stop waiting for a call to SDL_WaitThread() and clean up immediately. It is + * not safe to detach a thread that might be used with SDL_WaitThread(). + * + * You may not call SDL_WaitThread() on a thread that has been detached. Use + * either that function or this one, but not both, or behavior is undefined. + * + * It is safe to pass NULL to this function; it is a no-op. + * + * \param thread the SDL_Thread pointer that was returned from the + * SDL_CreateThread() call that started this thread + * + * \since This function is available since SDL 2.0.2. + * + * \sa SDL_CreateThread + * \sa SDL_WaitThread + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_DetachThread_proc = procedure(thread:PSDL_Thread); cdecl; +Var + SDL_DetachThread : TSDL_DetachThread_proc = Nil; +{$else} + +procedure SDL_DetachThread(thread:PSDL_Thread); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DetachThread' {$ENDIF}{$ENDIF}; +{$endif} + + {** + * Create a piece of thread-local storage. + * + * This creates an identifier that is globally visible to all threads but + * refers to data that is thread-specific. + * + * \returns the newly created thread local storage identifier or 0 on error. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_TLSGet + * \sa SDL_TLSSet + *} +function SDL_TLSCreate: TSDL_TLSID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TLSCreate' {$ENDIF} {$ENDIF}; + + {** + * Get the current thread's value associated with a thread local storage ID. + * + * \param id the thread local storage ID + * \returns the value associated with the ID for the current thread or NULL if + * no value has been set; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_TLSCreate + * \sa SDL_TLSSet + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_TLSGet_fun = function(id: TSDL_TLSID): Pointer; cdecl; +Var + SDL_TLSGet : TSDL_TLSGet_fun = Nil; +{$else} + +function SDL_TLSGet(id: TSDL_TLSID): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TLSGet' {$ENDIF} {$ENDIF}; +{$endif} + +type + { SDL2-For-Pascal: This function pointer is introduced to specifiy the + destructor pointer in the SDL_TLSSet function + according to C headers. + + The TTLSDestructor type itself is not defined + by the original SDL2 headers. } + TTLSDestructor = procedure(value: Pointer); cdecl; + + {** + * Set the current thread's value associated with a thread local storage ID. + * + * The function prototype for `destructor` is: + * + * ```c + * void destructor(void *value) + * ``` + * + * where its parameter `value` is what was passed as `value` to SDL_TLSSet(). + * + * \param id the thread local storage ID + * \param value the value to associate with the ID for the current thread + * \param destructor a function called when the thread exits, to free the + * value + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.0. + * + * \sa SDL_TLSCreate + * \sa SDL_TLSGet + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_TLSSet_fun = function(id: TSDL_TLSID; const value: Pointer; destructor_: TTLSDestructor): cint; cdecl; +Var + SDL_TLSSet : TSDL_TLSSet_fun = Nil; +{$else} + +function SDL_TLSSet(id: TSDL_TLSID; const value: Pointer; destructor_: TTLSDestructor): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TLSSet' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Cleanup all TLS data for this thread. + * + * \since This function is available since SDL 2.0.16. + *} +procedure SDL_TLSCleanup; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TLSCleanup' {$ENDIF} {$ENDIF}; + diff --git a/units/sdltimer.inc b/units/sdltimer.inc index 0d7d3e7b..b4502603 100644 --- a/units/sdltimer.inc +++ b/units/sdltimer.inc @@ -1,113 +1,113 @@ -// based on "sdl_timer.h" (2.0.14) - -{** - * Get the number of milliseconds since the SDL library initialization. - * - * This value wraps if the program runs for more than ~49 days. - *} -function SDL_GetTicks: cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTicks' {$ENDIF} {$ENDIF}; - -{** - * Get the number of milliseconds since SDL library initialization. - * - * Note that you should not use the SDL_TICKS_PASSED macro with values - * returned by this function, as that macro does clever math to compensate for - * the 32-bit overflow every ~49 days that SDL_GetTicks() suffers from. 64-bit - * values from this function can be safely compared directly. - *} -function SDL_GetTicks64: cuint64; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTicks64' {$ENDIF} {$ENDIF}; - -{** - * \brief Compare SDL ticks values, and return true if A has passed B - * - * e.g. if you want to wait 100 ms, you could do this: - * Uint32 timeout = SDL_GetTicks() + 100; - * while (!SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) [ - * ... do work until timeout has elapsed - * ] - *} -// #define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0) -{ Type conversion unnecessary bc. types are declared in func. param. list! } -function SDL_TICKS_PASSED(const A, B: cint32): Boolean; - -{** - * Get the current value of the high resolution counter - *} -function SDL_GetPerformanceCounter: cuint64; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPerformanceCounter' {$ENDIF} {$ENDIF}; - -{** - * Get the count per second of the high resolution counter - *} -function SDL_GetPerformanceFrequency: cuint64; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPerformanceFrequency' {$ENDIF} {$ENDIF}; - -{** - * Wait a specified number of milliseconds before returning. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_Delay_proc = procedure(ms: cuint32); cdecl; -Var - SDL_Delay : TSDL_Delay_proc = Nil; -{$else} - -procedure SDL_Delay(ms: cuint32); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Delay' {$ENDIF} {$ENDIF}; -{$endif} - -type - {** - * Function prototype for the timer callback function. - * - * The callback function is passed the current timer interval and returns - * the next timer interval. If the returned value is the same as the one - * passed in, the periodic alarm continues, otherwise a new alarm is - * scheduled. If the callback returns 0, the periodic alarm is cancelled. - *} - PPSDL_TimerCallback = ^PSDL_TimerCallback; - PSDL_TimerCallback = ^TSDL_TimerCallback; - TSDL_TimerCallback = function(interval: cuint32; param: Pointer): cuint32; cdecl; - - {** - * Definition of the timer ID type. - *} - PPSDL_TimerID = ^PSDL_TimerID; - PSDL_TimerID = ^TSDL_TimerID; - TSDL_TimerID = cint; - -{** - * Add a new timer to the pool of timers already running. - * - * A timer ID, or NULL when an error occurs. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_AddTimer_fun = function(interval: cuint32; callback: TSDL_TimerCallback; param: Pointer): TSDL_TimerID; cdecl; -Var - SDL_AddTimer : TSDL_AddTimer_fun = Nil; -{$else} - -function SDL_AddTimer(interval: cuint32; callback: TSDL_TimerCallback; param: Pointer): TSDL_TimerID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AddTimer' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Remove a timer knowing its ID. - * - * A boolean value indicating success or failure. - * - * It is not safe to remove a timer multiple times. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RemoveTimer_fun = function(id: TSDL_TimerID): Boolean; cdecl; -Var - SDL_RemoveTimer : TSDL_RemoveTimer_fun = Nil; -{$else} - -function SDL_RemoveTimer(id: TSDL_TimerID): Boolean; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RemoveTimer' {$ENDIF} {$ENDIF}; -{$endif} +// based on "sdl_timer.h" (2.0.14) + +{** + * Get the number of milliseconds since the SDL library initialization. + * + * This value wraps if the program runs for more than ~49 days. + *} +function SDL_GetTicks: cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTicks' {$ENDIF} {$ENDIF}; + +{** + * Get the number of milliseconds since SDL library initialization. + * + * Note that you should not use the SDL_TICKS_PASSED macro with values + * returned by this function, as that macro does clever math to compensate for + * the 32-bit overflow every ~49 days that SDL_GetTicks() suffers from. 64-bit + * values from this function can be safely compared directly. + *} +function SDL_GetTicks64: cuint64; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTicks64' {$ENDIF} {$ENDIF}; + +{** + * \brief Compare SDL ticks values, and return true if A has passed B + * + * e.g. if you want to wait 100 ms, you could do this: + * Uint32 timeout = SDL_GetTicks() + 100; + * while (!SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) [ + * ... do work until timeout has elapsed + * ] + *} +// #define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0) +{ Type conversion unnecessary bc. types are declared in func. param. list! } +function SDL_TICKS_PASSED(const A, B: cint32): Boolean; + +{** + * Get the current value of the high resolution counter + *} +function SDL_GetPerformanceCounter: cuint64; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPerformanceCounter' {$ENDIF} {$ENDIF}; + +{** + * Get the count per second of the high resolution counter + *} +function SDL_GetPerformanceFrequency: cuint64; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPerformanceFrequency' {$ENDIF} {$ENDIF}; + +{** + * Wait a specified number of milliseconds before returning. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_Delay_proc = procedure(ms: cuint32); cdecl; +Var + SDL_Delay : TSDL_Delay_proc = Nil; +{$else} + +procedure SDL_Delay(ms: cuint32); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Delay' {$ENDIF} {$ENDIF}; +{$endif} + +type + {** + * Function prototype for the timer callback function. + * + * The callback function is passed the current timer interval and returns + * the next timer interval. If the returned value is the same as the one + * passed in, the periodic alarm continues, otherwise a new alarm is + * scheduled. If the callback returns 0, the periodic alarm is cancelled. + *} + PPSDL_TimerCallback = ^PSDL_TimerCallback; + PSDL_TimerCallback = ^TSDL_TimerCallback; + TSDL_TimerCallback = function(interval: cuint32; param: Pointer): cuint32; cdecl; + + {** + * Definition of the timer ID type. + *} + PPSDL_TimerID = ^PSDL_TimerID; + PSDL_TimerID = ^TSDL_TimerID; + TSDL_TimerID = cint; + +{** + * Add a new timer to the pool of timers already running. + * + * A timer ID, or NULL when an error occurs. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_AddTimer_fun = function(interval: cuint32; callback: TSDL_TimerCallback; param: Pointer): TSDL_TimerID; cdecl; +Var + SDL_AddTimer : TSDL_AddTimer_fun = Nil; +{$else} + +function SDL_AddTimer(interval: cuint32; callback: TSDL_TimerCallback; param: Pointer): TSDL_TimerID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AddTimer' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Remove a timer knowing its ID. + * + * A boolean value indicating success or failure. + * + * It is not safe to remove a timer multiple times. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RemoveTimer_fun = function(id: TSDL_TimerID): Boolean; cdecl; +Var + SDL_RemoveTimer : TSDL_RemoveTimer_fun = Nil; +{$else} + +function SDL_RemoveTimer(id: TSDL_TimerID): Boolean; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RemoveTimer' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdltouch.inc b/units/sdltouch.inc index e3bd5b96..94db4b9e 100644 --- a/units/sdltouch.inc +++ b/units/sdltouch.inc @@ -1,128 +1,128 @@ -//from "sdl_touch.h" - -type - PPSDL_TouchID = ^PSDL_TouchID; - PSDL_TouchID = ^TSDL_TouchID; - TSDL_TouchID = type cint64; - - PPSDL_FingerID = ^PSDL_FingerID; - PSDL_FingerID = ^TSDL_FingerID; - TSDL_FingerID = type cint64; - - PPSDL_TouchDeviceType = ^PSDL_TouchDeviceType; - PSDL_TouchDeviceType = ^TSDL_TouchDeviceType; - TSDL_TouchDeviceType = type cint; - -const - SDL_TOUCH_DEVICE_INVALID = TSDL_TouchDeviceType(-1); - SDL_TOUCH_DEVICE_DIRECT = TSDL_TouchDeviceType(0); {* touch screen with window-relative coordinates *} - SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE = TSDL_TouchDeviceType(1); {* trackpad with absolute device coordinates *} - SDL_TOUCH_DEVICE_INDIRECT_RELATIVE = TSDL_TouchDeviceType(2); {* trackpad with relative device coordinates *} - -type - PPSDL_Finger = ^PSDL_Finger; - PSDL_Finger = ^TSDL_Finger; - TSDL_Finger = record - id: TSDL_FingerID; - x: cfloat; - y: cfloat; - pressure: cfloat; - end; - -const - {* Used as the device ID for mouse events simulated with touch input *} - SDL_TOUCH_MOUSEID = cuint32(-1); - {* Used as the SDL_TouchID for touch events simulated with mouse input *} - SDL_MOUSE_TOUCHID = TSDL_TouchID(-1); - - {* Function prototypes *} - - {** - * Get the number of registered touch devices. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetNumTouchDevices_fun = function(): cint; cdecl; -Var - SDL_GetNumTouchDevices : TSDL_GetNumTouchDevices_fun = Nil; -{$else} - -function SDL_GetNumTouchDevices(): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumTouchDevices' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the touch ID with the given index, or 0 if the index is invalid. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetTouchDevice_fun = function(index: cint): TSDL_TouchID; cdecl; -Var - SDL_GetTouchDevice : TSDL_GetTouchDevice_fun = Nil; -{$else} - -function SDL_GetTouchDevice(index: cint): TSDL_TouchID; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTouchDevice' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the touch device name as reported from the driver, - * or NIL if the index is invalid. - * - * \since This function is available since SDL 2.0.22. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetTouchName_fun = function(index: cint): PAnsiChar; cdecl; -Var - SDL_GetTouchName : TSDL_GetTouchName_fun = Nil; -{$else} - -function SDL_GetTouchName(index: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTouchName' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the type of the given touch device. - * - * \since This function is available since SDL 2.0.10. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetTouchDeviceType_fun = function(touchID: TSDL_TouchID): TSDL_TouchDeviceType; cdecl; -Var - SDL_GetTouchDeviceType : TSDL_GetTouchDeviceType_fun = Nil; -{$else} - -function SDL_GetTouchDeviceType(touchID: TSDL_TouchID): TSDL_TouchDeviceType; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTouchDeviceType' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the number of active fingers for a given touch device. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetNumTouchFingers_fun = function(touchID: TSDL_TouchID): cint; cdecl; -Var - SDL_GetNumTouchFingers : TSDL_GetNumTouchFingers_fun = Nil; -{$else} - -function SDL_GetNumTouchFingers(touchID: TSDL_TouchID): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumTouchFingers' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the finger object of the given touch, with the given index. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetTouchFinger_fun = function(touchID: TSDL_TouchID; index: cint): PSDL_Finger; cdecl; -Var - SDL_GetTouchFinger : TSDL_GetTouchFinger_fun = Nil; -{$else} - -function SDL_GetTouchFinger(touchID: TSDL_TouchID; index: cint): PSDL_Finger; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTouchFinger' {$ENDIF} {$ENDIF}; -{$endif} - +//from "sdl_touch.h" + +type + PPSDL_TouchID = ^PSDL_TouchID; + PSDL_TouchID = ^TSDL_TouchID; + TSDL_TouchID = type cint64; + + PPSDL_FingerID = ^PSDL_FingerID; + PSDL_FingerID = ^TSDL_FingerID; + TSDL_FingerID = type cint64; + + PPSDL_TouchDeviceType = ^PSDL_TouchDeviceType; + PSDL_TouchDeviceType = ^TSDL_TouchDeviceType; + TSDL_TouchDeviceType = type cint; + +const + SDL_TOUCH_DEVICE_INVALID = TSDL_TouchDeviceType(-1); + SDL_TOUCH_DEVICE_DIRECT = TSDL_TouchDeviceType(0); {* touch screen with window-relative coordinates *} + SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE = TSDL_TouchDeviceType(1); {* trackpad with absolute device coordinates *} + SDL_TOUCH_DEVICE_INDIRECT_RELATIVE = TSDL_TouchDeviceType(2); {* trackpad with relative device coordinates *} + +type + PPSDL_Finger = ^PSDL_Finger; + PSDL_Finger = ^TSDL_Finger; + TSDL_Finger = record + id: TSDL_FingerID; + x: cfloat; + y: cfloat; + pressure: cfloat; + end; + +const + {* Used as the device ID for mouse events simulated with touch input *} + SDL_TOUCH_MOUSEID = cuint32(-1); + {* Used as the SDL_TouchID for touch events simulated with mouse input *} + SDL_MOUSE_TOUCHID = TSDL_TouchID(-1); + + {* Function prototypes *} + + {** + * Get the number of registered touch devices. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetNumTouchDevices_fun = function(): cint; cdecl; +Var + SDL_GetNumTouchDevices : TSDL_GetNumTouchDevices_fun = Nil; +{$else} + +function SDL_GetNumTouchDevices(): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumTouchDevices' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the touch ID with the given index, or 0 if the index is invalid. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetTouchDevice_fun = function(index: cint): TSDL_TouchID; cdecl; +Var + SDL_GetTouchDevice : TSDL_GetTouchDevice_fun = Nil; +{$else} + +function SDL_GetTouchDevice(index: cint): TSDL_TouchID; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTouchDevice' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the touch device name as reported from the driver, + * or NIL if the index is invalid. + * + * \since This function is available since SDL 2.0.22. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetTouchName_fun = function(index: cint): PAnsiChar; cdecl; +Var + SDL_GetTouchName : TSDL_GetTouchName_fun = Nil; +{$else} + +function SDL_GetTouchName(index: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTouchName' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the type of the given touch device. + * + * \since This function is available since SDL 2.0.10. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetTouchDeviceType_fun = function(touchID: TSDL_TouchID): TSDL_TouchDeviceType; cdecl; +Var + SDL_GetTouchDeviceType : TSDL_GetTouchDeviceType_fun = Nil; +{$else} + +function SDL_GetTouchDeviceType(touchID: TSDL_TouchID): TSDL_TouchDeviceType; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTouchDeviceType' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the number of active fingers for a given touch device. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetNumTouchFingers_fun = function(touchID: TSDL_TouchID): cint; cdecl; +Var + SDL_GetNumTouchFingers : TSDL_GetNumTouchFingers_fun = Nil; +{$else} + +function SDL_GetNumTouchFingers(touchID: TSDL_TouchID): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumTouchFingers' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the finger object of the given touch, with the given index. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetTouchFinger_fun = function(touchID: TSDL_TouchID; index: cint): PSDL_Finger; cdecl; +Var + SDL_GetTouchFinger : TSDL_GetTouchFinger_fun = Nil; +{$else} + +function SDL_GetTouchFinger(touchID: TSDL_TouchID; index: cint): PSDL_Finger; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTouchFinger' {$ENDIF} {$ENDIF}; +{$endif} + diff --git a/units/sdltypes.inc b/units/sdltypes.inc index 71629f60..85b30bc1 100644 --- a/units/sdltypes.inc +++ b/units/sdltypes.inc @@ -1,10 +1,10 @@ -//types from SDLtypes.h - -{** - * \file SDL_types.h - * - * \deprecated - *} - -{* DEPRECATED *} -//#include "SDL_stdinc.h" +//types from SDLtypes.h + +{** + * \file SDL_types.h + * + * \deprecated + *} + +{* DEPRECATED *} +//#include "SDL_stdinc.h" diff --git a/units/sdlversion.inc b/units/sdlversion.inc index 0a6e01bc..e0ec8b0a 100644 --- a/units/sdlversion.inc +++ b/units/sdlversion.inc @@ -1,134 +1,134 @@ -// based on "sdl_version.h" (2.0.14) - -{** - * \file SDL_version.h - * - * This header defines the current SDL version. - *} - - {** - * Information the version of SDL in use. - * - * Represents the library's version as three levels: major revision - * (increments with massive changes, additions, and enhancements), - * minor revision (increments with backwards-compatible changes to the - * major revision), and patchlevel (increments with fixes to the minor - * revision). - * - * SDL_VERSION - * SDL_GetVersion - *} -type - PPSDL_Version = ^PSDL_Version; - PSDL_Version = ^TSDL_Version; - TSDL_Version = record - major, {**< major version *} - minor, {**< minor version *} - patch: cuint8; {**< update version *} - end; - -{* - Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL - - Last updated when TSDL_FPoint and TSDL_FRect were added. -*} -const - SDL_MAJOR_VERSION = 2; - SDL_MINOR_VERSION = 0; - SDL_PATCHLEVEL = 10; - -{** - * Macro to determine SDL version program was compiled against. - * - * This macro fills in a SDL_version structure with the version of the - * library you compiled against. This is determined by what header the - * compiler uses. Note that if you dynamically linked the library, you might - * have a slightly newer or older version at runtime. That version can be - * determined with SDL_GetVersion(), which, unlike SDL_VERSION(), - * is not a macro. - * - * x An instance on TSDL_Version to fill with version data. - * - * SDL_version - * SDL_GetVersion - *} -procedure SDL_VERSION(out x: TSDL_Version); - -{** - * This macro turns the version numbers into a numeric value: - * - * (1,2,3) -> (1203) - * - * - * This assumes that there will never be more than 100 patchlevels. - *} -function SDL_VERSIONNUM(X,Y,Z: cuint8): Cardinal; - -{** - * This is the version number macro for the current SDL version. - *} -function SDL_COMPILEDVERSION: Cardinal; - -{** - * This macro will evaluate to true if compiled with SDL at least X.Y.Z. - *} -function SDL_VERSION_ATLEAST(X,Y,Z: cuint8): Boolean; - -{** - * Get the version of SDL that is linked against your program. - * - * If you are linking to SDL dynamically, then it is possible that the - * current version will be different than the version you compiled against. - * This function returns the current version, while SDL_VERSION() is a - * macro that tells you what version you compiled with. - * - * - * compiled: TSDL_Version; - * linked: TSDL_Version; - * - * SDL_VERSION(@compiled); - * SDL_GetVersion(@linked); - * WriteLn('We compiled against SDL version: ' + - * IntToStr(compiled.major) + - * IntToStr(compiled.minor) + - * IntToStr(compiled.patch)); - * WriteLn('But we linked against SDL version:' + - * IntToStr(compiled.major) + - * IntToStr(compiled.minor) + - * IntToStr(compiled.patch)); - * - * - * This function may be called safely at any time, even before SDL_Init(). - * - * SDL_VERSION - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetVersion_proc = procedure(ver: PSDL_Version); cdecl; -Var - SDL_GetVersion : TSDL_GetVersion_proc = Nil; -{$else} - -procedure SDL_GetVersion(ver: PSDL_Version); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetVersion' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the code revision of SDL that is linked against your program. - * - * Returns an arbitrary string (a hash value) uniquely identifying the - * exact revision of the SDL library in use, and is only useful in comparing - * against other revisions. It is NOT an incrementing number. - *} -function SDL_GetRevision: PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRevision' {$ENDIF} {$ENDIF}; - -{** - * Get the revision number of SDL that is linked against your program. - * - * Returns a number uniquely identifying the exact revision of the SDL - * library in use. It is an incrementing number based on commits to - * hg.libsdl.org. - *} -function SDL_GetRevisionNumber: cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRevisionNumber' {$ENDIF} {$ENDIF}; +// based on "sdl_version.h" (2.0.14) + +{** + * \file SDL_version.h + * + * This header defines the current SDL version. + *} + + {** + * Information the version of SDL in use. + * + * Represents the library's version as three levels: major revision + * (increments with massive changes, additions, and enhancements), + * minor revision (increments with backwards-compatible changes to the + * major revision), and patchlevel (increments with fixes to the minor + * revision). + * + * SDL_VERSION + * SDL_GetVersion + *} +type + PPSDL_Version = ^PSDL_Version; + PSDL_Version = ^TSDL_Version; + TSDL_Version = record + major, {**< major version *} + minor, {**< minor version *} + patch: cuint8; {**< update version *} + end; + +{* + Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL + + Last updated when TSDL_FPoint and TSDL_FRect were added. +*} +const + SDL_MAJOR_VERSION = 2; + SDL_MINOR_VERSION = 0; + SDL_PATCHLEVEL = 10; + +{** + * Macro to determine SDL version program was compiled against. + * + * This macro fills in a SDL_version structure with the version of the + * library you compiled against. This is determined by what header the + * compiler uses. Note that if you dynamically linked the library, you might + * have a slightly newer or older version at runtime. That version can be + * determined with SDL_GetVersion(), which, unlike SDL_VERSION(), + * is not a macro. + * + * x An instance on TSDL_Version to fill with version data. + * + * SDL_version + * SDL_GetVersion + *} +procedure SDL_VERSION(out x: TSDL_Version); + +{** + * This macro turns the version numbers into a numeric value: + * + * (1,2,3) -> (1203) + * + * + * This assumes that there will never be more than 100 patchlevels. + *} +function SDL_VERSIONNUM(X,Y,Z: cuint8): Cardinal; + +{** + * This is the version number macro for the current SDL version. + *} +function SDL_COMPILEDVERSION: Cardinal; + +{** + * This macro will evaluate to true if compiled with SDL at least X.Y.Z. + *} +function SDL_VERSION_ATLEAST(X,Y,Z: cuint8): Boolean; + +{** + * Get the version of SDL that is linked against your program. + * + * If you are linking to SDL dynamically, then it is possible that the + * current version will be different than the version you compiled against. + * This function returns the current version, while SDL_VERSION() is a + * macro that tells you what version you compiled with. + * + * + * compiled: TSDL_Version; + * linked: TSDL_Version; + * + * SDL_VERSION(@compiled); + * SDL_GetVersion(@linked); + * WriteLn('We compiled against SDL version: ' + + * IntToStr(compiled.major) + + * IntToStr(compiled.minor) + + * IntToStr(compiled.patch)); + * WriteLn('But we linked against SDL version:' + + * IntToStr(compiled.major) + + * IntToStr(compiled.minor) + + * IntToStr(compiled.patch)); + * + * + * This function may be called safely at any time, even before SDL_Init(). + * + * SDL_VERSION + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetVersion_proc = procedure(ver: PSDL_Version); cdecl; +Var + SDL_GetVersion : TSDL_GetVersion_proc = Nil; +{$else} + +procedure SDL_GetVersion(ver: PSDL_Version); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetVersion' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the code revision of SDL that is linked against your program. + * + * Returns an arbitrary string (a hash value) uniquely identifying the + * exact revision of the SDL library in use, and is only useful in comparing + * against other revisions. It is NOT an incrementing number. + *} +function SDL_GetRevision: PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRevision' {$ENDIF} {$ENDIF}; + +{** + * Get the revision number of SDL that is linked against your program. + * + * Returns a number uniquely identifying the exact revision of the SDL + * library in use. It is an incrementing number based on commits to + * hg.libsdl.org. + *} +function SDL_GetRevisionNumber: cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRevisionNumber' {$ENDIF} {$ENDIF}; diff --git a/units/sdlvideo.inc b/units/sdlvideo.inc index 0f3ca1fc..3e006f0f 100644 --- a/units/sdlvideo.inc +++ b/units/sdlvideo.inc @@ -1,2223 +1,2223 @@ -// from "sdl_video.h" - - -type - PPSDL_Window = ^PSDL_Window; - PSDL_Window = type Pointer; - - {** - * The structure that defines a display mode - * - * SDL_GetNumDisplayModes() - * SDL_GetDisplayMode() - * SDL_GetDesktopDisplayMode() - * SDL_GetCurrentDisplayMode() - * SDL_GetClosestDisplayMode() - * SDL_SetWindowDisplayMode() - * SDL_GetWindowDisplayMode() - *} - PPSDL_DisplayMode = ^PSDL_DisplayMode; - PSDL_DisplayMode = ^TSDL_DisplayMode; - TSDL_DisplayMode = record - format: cuint32; {**< pixel format *} - w: cint; {**< width *} - h: cint; {**< height *} - refresh_rate: cint; {**< refresh rate (or zero for unspecified) *} - driverdata: Pointer; {**< driver-specific data, initialize to 0 *} - end; - -{** - * The flags on a window - * - * SDL_GetWindowFlags() - *} -type - PPSDL_WindowFlags = ^PSDL_WindowFlags; - PSDL_WindowFlags = ^TSDL_WindowFlags; - TSDL_WindowFlags = type cuint; - -const - SDL_WINDOW_FULLSCREEN = TSDL_WindowFlags($00000001); {**< fullscreen window *} - SDL_WINDOW_OPENGL = TSDL_WindowFlags($00000002); {**< window usable with OpenGL context *} - SDL_WINDOW_SHOWN = TSDL_WindowFlags($00000004); {**< window is visible *} - SDL_WINDOW_HIDDEN = TSDL_WindowFlags($00000008); {**< window is not visible *} - SDL_WINDOW_BORDERLESS = TSDL_WindowFlags($00000010); {**< no window decoration *} - SDL_WINDOW_RESIZABLE = TSDL_WindowFlags($00000020); {**< window can be resized *} - SDL_WINDOW_MINIMIZED = TSDL_WindowFlags($00000040); {**< window is minimized *} - SDL_WINDOW_MAXIMIZED = TSDL_WindowFlags($00000080); {**< window is maximized *} - SDL_WINDOW_MOUSE_GRABBED = TSDL_WindowFlags($00000100); {**< window has grabbed mouse input *} - SDL_WINDOW_INPUT_FOCUS = TSDL_WindowFlags($00000200); {**< window has input focus *} - SDL_WINDOW_MOUSE_FOCUS = TSDL_WindowFlags($00000400); {**< window has mouse focus *} - SDL_WINDOW_FULLSCREEN_DESKTOP = TSDL_WindowFlags(SDL_WINDOW_FULLSCREEN or $00001000); - SDL_WINDOW_FOREIGN = TSDL_WindowFlags($00000800); {**< window not created by SDL *} - SDL_WINDOW_ALLOW_HIGHDPI = TSDL_WindowFlags($00002000); {**< window should be created in high-DPI mode if supported. - On macOS NSHighResolutionCapable must be set true in the - application's Info.plist for this to have any effect. *} - SDL_WINDOW_MOUSE_CAPTURE = TSDL_WindowFlags($00004000); {**< window has mouse captured (unrelated to MOUSE_GRABBED) *} - SDL_WINDOW_ALWAYS_ON_TOP = TSDL_WindowFlags($00008000); {**< window should always be above others *} - SDL_WINDOW_SKIP_TASKBAR = TSDL_WindowFlags($00010000); {**< window should not be added to the taskbar *} - SDL_WINDOW_UTILITY = TSDL_WindowFlags($00020000); {**< window should be treated as a utility window *} - SDL_WINDOW_TOOLTIP = TSDL_WindowFlags($00040000); {**< window should be treated as a tooltip *} - SDL_WINDOW_POPUP_MENU = TSDL_WindowFlags($00080000); {**< window should be treated as a popup menu *} - SDL_WINDOW_KEYBOARD_GRABBED = TSDL_WindowFlags($00100000); {**< window has grabbed keyboard input *} - SDL_WINDOW_VULKAN = TSDL_WindowFlags($10000000); {**< window usable for Vulkan surface *} - SDL_WINDOW_METAL = TSDL_WindowFlags($20000000); {**< window usable for Metal view *} - - SDL_WINDOW_INPUT_GRABBED = SDL_WINDOW_MOUSE_GRABBED; {**< equivalent to SDL_WINDOW_MOUSE_GRABBED for compatibility *} - - {** - * Used to indicate that you don't care what the window position is. - *} -const SDL_WINDOWPOS_UNDEFINED_MASK = $1FFF0000; -function SDL_WINDOWPOS_UNDEFINED_DISPLAY(X: Variant): Variant; -const SDL_WINDOWPOS_UNDEFINED = SDL_WINDOWPOS_UNDEFINED_MASK or 0; -function SDL_WINDOWPOS_ISUNDEFINED(X: Variant): Variant; - - - {** - * Used to indicate that the window position should be centered. - *} -const SDL_WINDOWPOS_CENTERED_MASK = $2FFF0000; -function SDL_WINDOWPOS_CENTERED_DISPLAY(X: Variant): Variant; -const SDL_WINDOWPOS_CENTERED = SDL_WINDOWPOS_CENTERED_MASK or 0; -function SDL_WINDOWPOS_ISCENTERED(X: Variant): Variant; - - {** - * Event subtype for window events - *} -type - PPSDL_WindowEventID = ^PSDL_WindowEventID; - PSDL_WindowEventID = ^TSDL_WindowEventID; - TSDL_WindowEventID = type cint; -const - SDL_WINDOWEVENT_NONE = TSDL_WindowEventID(0); {**< Never used *} - SDL_WINDOWEVENT_SHOWN = TSDL_WindowEventID(1); {**< Window has been shown *} - SDL_WINDOWEVENT_HIDDEN = TSDL_WindowEventID(2); {**< Window has been hidden *} - SDL_WINDOWEVENT_EXPOSED = TSDL_WindowEventID(3); {**< Window has been exposed and should be redrawn *} - SDL_WINDOWEVENT_MOVED = TSDL_WindowEventID(4); {**< Window has been moved to data1; data2 *} - SDL_WINDOWEVENT_RESIZED = TSDL_WindowEventID(5); {**< Window has been resized to data1xdata2 *} - SDL_WINDOWEVENT_SIZE_CHANGED = TSDL_WindowEventID(6); {**< The window size has changed; either as a result of an API call or through the system or user changing the window size. *} - SDL_WINDOWEVENT_MINIMIZED = TSDL_WindowEventID(7); {**< Window has been minimized *} - SDL_WINDOWEVENT_MAXIMIZED = TSDL_WindowEventID(8); {**< Window has been maximized *} - SDL_WINDOWEVENT_RESTORED = TSDL_WindowEventID(9); {**< Window has been restored to normal size and position *} - SDL_WINDOWEVENT_ENTER = TSDL_WindowEventID(10); {**< Window has gained mouse focus *} - SDL_WINDOWEVENT_LEAVE = TSDL_WindowEventID(11); {**< Window has lost mouse focus *} - SDL_WINDOWEVENT_FOCUS_GAINED = TSDL_WindowEventID(12); {**< Window has gained keyboard focus *} - SDL_WINDOWEVENT_FOCUS_LOST = TSDL_WindowEventID(13); {**< Window has lost keyboard focus *} - SDL_WINDOWEVENT_CLOSE = TSDL_WindowEventID(14); {**< The window manager requests that the window be closed *} - SDL_WINDOWEVENT_TAKE_FOCUS = TSDL_WindowEventID(15); {**< Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore) *} - SDL_WINDOWEVENT_HIT_TEST = TSDL_WindowEventID(16); {**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. *} - SDL_WINDOWEVENT_ICCPROF_CHANGED = TSDL_WindowEventID(17); {**< The ICC profile of the window's display has changed. *} - SDL_WINDOWEVENT_DISPLAY_CHANGED = TSDL_WindowEventID(18); {**< Window has been moved to display data1. *} - -{** - * \brief Event subtype for display events - *} -type - PPSDL_DisplayEventID = ^PSDL_DisplayEventID; - PSDL_DisplayEventID = ^TSDL_DisplayEventID; - TSDL_DisplayEventID = type Integer; - -const - SDL_DISPLAYEVENT_NONE = TSDL_DisplayEventID(0); {**< Never used *} - SDL_DISPLAYEVENT_ORIENTATION = TSDL_DisplayEventID(1); {**< Display orientation has changed to data1 *} - SDL_DISPLAYEVENT_CONNECTED = TSDL_DisplayEventID(2); {**< Display has been added to the system *} - SDL_DISPLAYEVENT_DISCONNECTED = TSDL_DisplayEventID(3); {**< Display has been removed from the system *} - -type - PPSDL_DisplayOrientation = ^PSDL_DisplayOrientation; - PSDL_DisplayOrientation = ^TSDL_DisplayOrientation; - TSDL_DisplayOrientation = type Integer; - -const - SDL_ORIENTATION_UNKNOWN = TSDL_DisplayOrientation(0); {**< The display orientation can't be determined *} - SDL_ORIENTATION_LANDSCAPE = TSDL_DisplayOrientation(1); {**< The display is in landscape mode, with the right side up, relative to portrait mode *} - SDL_ORIENTATION_LANDSCAPE_FLIPPED = TSDL_DisplayOrientation(2); {**< The display is in landscape mode, with the left side up, relative to portrait mode *} - SDL_ORIENTATION_PORTRAIT = TSDL_DisplayOrientation(3); {**< The display is in portrait mode *} - SDL_ORIENTATION_PORTRAIT_FLIPPED = TSDL_DisplayOrientation(4); {**< The display is in portrait mode, upside down *} - - {** - * \brief Window flash operation - *} -type - PPSDL_FlashOperation = ^PSDL_FlashOperation; - PSDL_FlashOperation = ^TSDL_FlashOperation; - TSDL_FlashOperation = type Integer; - -const - SDL_FLASH_CANCEL = TSDL_FlashOperation(0); {**< Cancel any window flash state *} - SDL_FLASH_BRIEFLY = TSDL_FlashOperation(1); {**< Flash the window briefly to get attention *} - SDL_FLASH_UNTIL_FOCUSED = TSDL_FlashOperation(2); {**< Flash the window until it gets focus *} - - {** - * An opaque handle to an OpenGL context. - *} -type - PPSDL_GLContext = ^PSDL_GLContext; - PSDL_GLContext = ^TSDL_GLContext; - TSDL_GLContext = Pointer; - - {** - * OpenGL configuration attributes - *} -type - PPSDL_GLattr = ^PSDL_GLattr; - PSDL_GLattr = ^TSDL_GLattr; - TSDL_GLattr = type Integer; - -const - SDL_GL_RED_SIZE = TSDL_GLattr(0); - SDL_GL_GREEN_SIZE = TSDL_GLattr(1); - SDL_GL_BLUE_SIZE = TSDL_GLattr(2); - SDL_GL_ALPHA_SIZE = TSDL_GLattr(3); - SDL_GL_BUFFER_SIZE = TSDL_GLattr(4); - SDL_GL_DOUBLEBUFFER = TSDL_GLattr(5); - SDL_GL_DEPTH_SIZE = TSDL_GLattr(6); - SDL_GL_STENCIL_SIZE = TSDL_GLattr(7); - SDL_GL_ACCUM_RED_SIZE = TSDL_GLattr(8); - SDL_GL_ACCUM_GREEN_SIZE = TSDL_GLattr(9); - SDL_GL_ACCUM_BLUE_SIZE = TSDL_GLattr(10); - SDL_GL_ACCUM_ALPHA_SIZE = TSDL_GLattr(11); - SDL_GL_STEREO = TSDL_GLattr(12); - SDL_GL_MULTISAMPLEBUFFERS = TSDL_GLattr(13); - SDL_GL_MULTISAMPLESAMPLES = TSDL_GLattr(14); - SDL_GL_ACCELERATED_VISUAL = TSDL_GLattr(15); - SDL_GL_RETAINED_BACKING = TSDL_GLattr(16); - SDL_GL_CONTEXT_MAJOR_VERSION = TSDL_GLattr(17); - SDL_GL_CONTEXT_MINOR_VERSION = TSDL_GLattr(18); - SDL_GL_CONTEXT_EGL = TSDL_GLattr(19); - SDL_GL_CONTEXT_FLAGS = TSDL_GLattr(20); - SDL_GL_CONTEXT_PROFILE_MASK = TSDL_GLattr(21); - SDL_GL_SHARE_WITH_CURRENT_CONTEXT = TSDL_GLattr(22); - SDL_GL_FRAMEBUFFER_SRGB_CAPABLE = TSDL_GLattr(23); - SDL_GL_CONTEXT_RELEASE_BEHAVIOR = TSDL_GLattr(24); - SDL_GL_CONTEXT_RESET_NOTIFICATION = TSDL_GLattr(25); - SDL_GL_CONTEXT_NO_ERROR = TSDL_GLattr(26); - SDL_GL_FLOATBUFFERS = TSDL_GLattr(27); - -type - PPSDL_GLprofile = ^PSDL_GLprofile; - PSDL_GLprofile = ^TSDL_GLprofile; - TSDL_GLprofile = type Integer; - -const - SDL_GL_CONTEXT_PROFILE_CORE = TSDL_GLprofile($0001); - SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = TSDL_GLprofile($0002); - SDL_GL_CONTEXT_PROFILE_ES = TSDL_GLprofile($0004); - -type - PPSDL_GLcontextFlag = ^PSDL_GLcontextFlag; - PSDL_GLcontextFlag = ^TSDL_GLcontextFlag; - TSDL_GLcontextFlag = type Integer; - -const - SDL_GL_CONTEXT_DEBUG_FLAG = TSDL_GLcontextFlag($0001); - SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = TSDL_GLcontextFlag($0002); - SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = TSDL_GLcontextFlag($0004); - SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = TSDL_GLcontextFlag($0008); - -type - PPSDL_GLcontextReleaseFlag = ^PSDL_GLcontextReleaseFlag; - PSDL_GLcontextReleaseFlag = ^TSDL_GLcontextReleaseFlag; - TSDL_GLcontextReleaseFlag = type Integer; - -const - SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = TSDL_GLcontextReleaseFlag($0000); - SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = TSDL_GLcontextReleaseFlag($0001); - -type - PPSDL_GLContextResetNotification = ^PSDL_GLContextResetNotification; - PSDL_GLContextResetNotification = ^TSDL_GLContextResetNotification; - TSDL_GLContextResetNotification = type Integer; - -const - SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = TSDL_GLContextResetNotification($0000); - SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = TSDL_GLContextResetNotification($0001); - - {* Function prototypes *} - - {** - * Get the number of video drivers compiled into SDL - * - * SDL_GetVideoDriver() - *} - -function SDL_GetNumVideoDrivers: cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumVideoDrivers' {$ENDIF} {$ENDIF}; - - {** - * Get the name of a built in video driver. - * - * The video drivers are presented in the order in which they are - * normally checked during initialization. - * - * SDL_GetNumVideoDrivers() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetVideoDriver_fun = function(index: cint): PAnsiChar; cdecl; -Var - SDL_GetVideoDriver : TSDL_GetVideoDriver_fun = Nil; -{$else} - -function SDL_GetVideoDriver(index: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetVideoDriver' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Initialize the video subsystem, optionally specifying a video driver. - * - * driver_name Initialize a specific driver by name, or nil for the - * default video driver. - * - * 0 on success, -1 on error - * - * This function initializes the video subsystem; setting up a connection - * to the window manager, etc, and determines the available display modes - * and pixel formats, but does not initialize a window or graphics mode. - * - * SDL_VideoQuit() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_VideoInit_fun = function(const driver_name: PAnsiChar): cint; cdecl; -Var - SDL_VideoInit : TSDL_VideoInit_fun = Nil; -{$else} - -function SDL_VideoInit(const driver_name: PAnsiChar): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_VideoInit' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Shuts down the video subsystem. - * - * function closes all windows, and restores the original video mode. - * - * SDL_VideoInit() - *} -procedure SDL_VideoQuit; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_VideoQuit' {$ENDIF} {$ENDIF}; - - {** - * Returns the name of the currently initialized video driver. - * - * The name of the current video driver or nil if no driver - * has been initialized - * - * SDL_GetNumVideoDrivers() - * SDL_GetVideoDriver() - *} - -function SDL_GetCurrentVideoDriver: PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCurrentVideoDriver' {$ENDIF} {$ENDIF}; - - {** - * Returns the number of available video displays. - * - * SDL_GetDisplayBounds() - *} - -function SDL_GetNumVideoDisplays: cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumVideoDisplays' {$ENDIF} {$ENDIF}; - - {** - * Get the name of a display in UTF-8 encoding - * - * The name of a display, or nil for an invalid display index. - * - * SDL_GetNumVideoDisplays() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetDisplayName_fun = function(displayIndex: cint): PAnsiChar; cdecl; -Var - SDL_GetDisplayName : TSDL_GetDisplayName_fun = Nil; -{$else} - -function SDL_GetDisplayName(displayIndex: cint): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayName' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the desktop area represented by a display, with the primary - * display located at 0,0 - * - * 0 on success, or -1 if the index is out of range. - * - * SDL_GetNumVideoDisplays() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetDisplayBounds_fun = function(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; -Var - SDL_GetDisplayBounds : TSDL_GetDisplayBounds_fun = Nil; -{$else} - -function SDL_GetDisplayBounds(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayBounds' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * \brief Get the usable desktop area represented by a display, with the - * primary display located at 0,0 - * - * This is the same area as SDL_GetDisplayBounds() reports, but with portions - * reserved by the system removed. For example, on Mac OS X, this subtracts - * the area occupied by the menu bar and dock. - * - * Setting a window to be fullscreen generally bypasses these unusable areas, - * so these are good guidelines for the maximum space available to a - * non-fullscreen window. - * - * \return 0 on success, or -1 if the index is out of range. - * - * \sa SDL_GetDisplayBounds() - * \sa SDL_GetNumVideoDisplays() - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetDisplayUsableBounds_fun = function(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; -Var - SDL_GetDisplayUsableBounds : TSDL_GetDisplayUsableBounds_fun = Nil; -{$else} - -function SDL_GetDisplayUsableBounds(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayUsableBounds' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * \brief Get the dots/pixels-per-inch for a display - * - * \note Diagonal, horizontal and vertical DPI can all be optionally - * returned if the parameter is non-NULL. - * - * \return 0 on success, or -1 if no DPI information is available or the index is out of range. - * - * \sa SDL_GetNumVideoDisplays() - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetDisplayDPI_fun = function(displayIndex: cint; ddpi, hdpi, vdpi: pcfloat): cint; cdecl; -Var - SDL_GetDisplayDPI : TSDL_GetDisplayDPI_fun = Nil; -{$else} - -function SDL_GetDisplayDPI(displayIndex: cint; ddpi, hdpi, vdpi: pcfloat): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayDPI' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * \brief Get the orientation of a display - * - * \return The orientation of the display, or SDL_ORIENTATION_UNKNOWN if it isn't available. - * - * \sa SDL_GetNumVideoDisplays() - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetDisplayOrientation_fun = function(displayIndex: cint): TSDL_DisplayOrientation; cdecl; -Var - SDL_GetDisplayOrientation : TSDL_GetDisplayOrientation_fun = Nil; -{$else} - -function SDL_GetDisplayOrientation(displayIndex: cint): TSDL_DisplayOrientation; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayOrientation' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Returns the number of available display modes. - * - * SDL_GetDisplayMode() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetNumDisplayModes_fun = function(displayIndex: cint): cint; cdecl; -Var - SDL_GetNumDisplayModes : TSDL_GetNumDisplayModes_fun = Nil; -{$else} - -function SDL_GetNumDisplayModes(displayIndex: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumDisplayModes' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Fill in information about a specific display mode. - * - * The display modes are sorted in this priority: - * bits per pixel -> more colors to fewer colors - * width -> largest to smallest - * height -> largest to smallest - * refresh rate -> highest to lowest - * - * SDL_GetNumDisplayModes() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetDisplayMode_fun = function(displayIndex: cint; modeIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; -Var - SDL_GetDisplayMode : TSDL_GetDisplayMode_fun = Nil; -{$else} - -function SDL_GetDisplayMode(displayIndex: cint; modeIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayMode' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Fill in information about the desktop display mode. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetDesktopDisplayMode_fun = function(displayIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; -Var - SDL_GetDesktopDisplayMode : TSDL_GetDesktopDisplayMode_fun = Nil; -{$else} - -function SDL_GetDesktopDisplayMode(displayIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDesktopDisplayMode' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Fill in information about the current display mode. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetCurrentDisplayMode_fun = function(displayIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; -Var - SDL_GetCurrentDisplayMode : TSDL_GetCurrentDisplayMode_fun = Nil; -{$else} - -function SDL_GetCurrentDisplayMode(displayIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCurrentDisplayIndex' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the closest match to the requested display mode. - * - * mode The desired display mode - * closest A pointer to a display mode to be filled in with the closest - * match of the available display modes. - * - * The passed in value closest, or nil if no matching video mode - * was available. - * - * The available display modes are scanned, and closest is filled in with the - * closest mode matching the requested mode and returned. The mode format and - * refresh_rate default to the desktop mode if they are 0. The modes are - * scanned with size being first priority, format being second priority, and - * finally checking the refresh_rate. If all the available modes are too - * small, then nil is returned. - * - * SDL_GetNumDisplayModes() - * SDL_GetDisplayMode() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetClosestDisplayMode_fun = function(displayIndex: cint; const mode: PSDL_DisplayMode; closest: PSDL_DisplayMode): PSDL_DisplayMode; cdecl; -Var - SDL_GetClosestDisplayMode : TSDL_GetClosestDisplayMode_fun = Nil; -{$else} - -function SDL_GetClosestDisplayMode(displayIndex: cint; const mode: PSDL_DisplayMode; closest: PSDL_DisplayMode): PSDL_DisplayMode; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetClosestDisplayMode' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the index of the display containing a point - * - * \param point the point to query - * \returns the index of the display containing the point or a negative error - * code on failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_GetDisplayBounds - * \sa SDL_GetNumVideoDisplays - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetPointDisplayIndex_fun = function(const point: PSDL_Point): cint; cdecl; -Var - SDL_GetPointDisplayIndex : TSDL_GetPointDisplayIndex_fun = Nil; -{$else} - -function SDL_GetPointDisplayIndex(const point: PSDL_Point): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPointDisplayIndex' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the index of the display primarily containing a rect - * - * \param rect the rect to query - * \returns the index of the display entirely containing the rect or closest - * to the center of the rect on success or a negative error code on - * failure; call SDL_GetError() for more information. - * - * \since This function is available since SDL 2.24.0. - * - * \sa SDL_GetDisplayBounds - * \sa SDL_GetNumVideoDisplays - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetRectDisplayIndex_fun = function(const rect: PSDL_Rect): cint; cdecl; -Var - SDL_GetRectDisplayIndex : TSDL_GetRectDisplayIndex_fun = Nil; -{$else} - -function SDL_GetRectDisplayIndex(const rect: PSDL_Rect): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRectDisplayIndex' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the display index associated with a window. - * - * the display index of the display containing the center of the - * window, or -1 on error. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowDisplayIndex_fun = function(window: PSDL_Window): cint; cdecl; -Var - SDL_GetWindowDisplayIndex : TSDL_GetWindowDisplayIndex_fun = Nil; -{$else} - -function SDL_GetWindowDisplayIndex(window: PSDL_Window): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowDisplayIndex' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Set the display mode used when a fullscreen window is visible. - * - * By default the window's dimensions and the desktop format and refresh rate - * are used. - * - * mode The mode to use, or nil for the default mode. - * - * 0 on success, or -1 if setting the display mode failed. - * - * SDL_GetWindowDisplayMode() - * SDL_SetWindowFullscreen() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowDisplayMode_fun = function(window: PSDL_Window; const mode: PSDL_DisplayMode): cint; cdecl; -Var - SDL_SetWindowDisplayMode : TSDL_SetWindowDisplayMode_fun = Nil; -{$else} - -function SDL_SetWindowDisplayMode(window: PSDL_Window; const mode: PSDL_DisplayMode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowDisplayMode' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Fill in information about the display mode used when a fullscreen - * window is visible. - * - * SDL_SetWindowDisplayMode() - * SDL_SetWindowFullscreen() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowDisplayMode_fun = function(window: PSDL_Window; mode: PSDL_DisplayMode): cint; cdecl; -Var - SDL_GetWindowDisplayMode : TSDL_GetWindowDisplayMode_fun = Nil; -{$else} - -function SDL_GetWindowDisplayMode(window: PSDL_Window; mode: PSDL_DisplayMode): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowDisplayMode' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Get the raw ICC profile data for the screen the window is currently on. - * - * Data returned should be freed with SDL_free(). - * - * \param window the window to query - * \param size the size of the ICC profile - * \returns the raw ICC profile data on success or NIL on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.18. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowICCProfile_fun = function(window: PSDL_Window; size: pcsize_t): Pointer; cdecl; -Var - SDL_GetWindowICCProfile : TSDL_GetWindowICCProfile_fun = Nil; -{$else} - -function SDL_GetWindowICCProfile(window: PSDL_Window; size: pcsize_t): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowICCProfile' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the pixel format associated with the window. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowPixelFormat_fun = function(window: PSDL_Window): cuint32; cdecl; -Var - SDL_GetWindowPixelFormat : TSDL_GetWindowPixelFormat_fun = Nil; -{$else} - -function SDL_GetWindowPixelFormat(window: PSDL_Window): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowPixelFormat' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * \brief Create a window with the specified position, dimensions, and flags. - * - * \param title The title of the window, in UTF-8 encoding. - * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or - * ::SDL_WINDOWPOS_UNDEFINED. - * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or - * ::SDL_WINDOWPOS_UNDEFINED. - * \param w The width of the window, in screen coordinates. - * \param h The height of the window, in screen coordinates. - * \param flags The flags for the window, a mask of any of the following: - * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL, - * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS, - * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED, - * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED, - * ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN. - * - * \return The created window, or NULL if window creation failed. - * - * If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size - * in pixels may differ from its size in screen coordinates on platforms with - * high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query - * the client area's size in screen coordinates, and SDL_GL_GetDrawableSize(), - * SDL_Vulkan_GetDrawableSize(), or SDL_GetRendererOutputSize() to query the - * drawable size in pixels. - * - * If the window is created with any of the SDL_WINDOW_OPENGL or - * SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function - * (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the - * corresponding UnloadLibrary function is called by SDL_DestroyWindow(). - * - * If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver, - * SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail. - * - * \note On non-Apple devices, SDL requires you to either not link to the - * Vulkan loader or link to a dynamic library version. This limitation - * may be removed in a future version of SDL. - * - * \sa SDL_DestroyWindow() - * \sa SDL_GL_LoadLibrary() - * \sa SDL_Vulkan_LoadLibrary() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_CreateWindow_fun = function(const title: PAnsiChar; x: cint; y: cint; w: cint; h: cint; flags: TSDL_WindowFlags): PSDL_Window; cdecl; -Var - SDL_CreateWindow : TSDL_CreateWindow_fun = Nil; -{$else} - -function SDL_CreateWindow(const title: PAnsiChar; x: cint; y: cint; w: cint; h: cint; flags: TSDL_WindowFlags): PSDL_Window; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateWindow' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Create an SDL window from an existing native window. - * - * data A pointer to driver-dependent window creation data - * - * The id of the window created, or zero if window creation failed. - * - * SDL_DestroyWindow() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_CreateWindowFrom_fun = function(const data: Pointer): PSDL_Window; cdecl; -Var - SDL_CreateWindowFrom : TSDL_CreateWindowFrom_fun = Nil; -{$else} - -function SDL_CreateWindowFrom(const data: Pointer): PSDL_Window; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateWindowFrom' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the numeric ID of a window, for logging purposes. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowID_fun = function(window: PSDL_Window): cuint32; cdecl; -Var - SDL_GetWindowID : TSDL_GetWindowID_fun = Nil; -{$else} - -function SDL_GetWindowID(window: PSDL_Window): cuint32; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowID' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get a window from a stored ID, or nil if it doesn't exist. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowFromID_fun = function(id: cuint32): PSDL_Window; cdecl; -Var - SDL_GetWindowFromID : TSDL_GetWindowFromID_fun = Nil; -{$else} - -function SDL_GetWindowFromID(id: cuint32): PSDL_Window; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowFromID' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the window flags. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowFlags_fun = function(window: PSDL_Window): TSDL_WindowFlags; cdecl; -Var - SDL_GetWindowFlags : TSDL_GetWindowFlags_fun = Nil; -{$else} - -function SDL_GetWindowFlags(window: PSDL_Window): TSDL_WindowFlags; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowFlags' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Set the title of a window, in UTF-8 format. - * - * SDL_GetWindowTitle() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowTitle_proc = procedure(window: PSDL_Window; const title: PAnsiChar); cdecl; -Var - SDL_SetWindowTitle : TSDL_SetWindowTitle_proc = Nil; -{$else} - -procedure SDL_SetWindowTitle(window: PSDL_Window; const title: PAnsiChar); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowTitle' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the title of a window, in UTF-8 format. - * - * SDL_SetWindowTitle() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowTitle_fun = function(window: PSDL_Window): PAnsiChar; cdecl; -Var - SDL_GetWindowTitle : TSDL_GetWindowTitle_fun = Nil; -{$else} - -function SDL_GetWindowTitle(window: PSDL_Window): PAnsiChar; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowTitle' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Set the icon for a window. - * - * icon The icon for the window. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowIcon_proc = procedure(window: PSDL_Window; icon: PSDL_Surface); cdecl; -Var - SDL_SetWindowIcon : TSDL_SetWindowIcon_proc = Nil; -{$else} - -procedure SDL_SetWindowIcon(window: PSDL_Window; icon: PSDL_Surface); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowIcon' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Associate an arbitrary named pointer with a window. - * - * window The window to associate with the pointer. - * name The name of the pointer. - * userdata The associated pointer. - * - * The previous value associated with 'name' - * - * The name is case-sensitive. - * - * SDL_GetWindowData() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowData_fun = function(window: PSDL_Window; const name: PAnsiChar; userdata: Pointer): Pointer; cdecl; -Var - SDL_SetWindowData : TSDL_SetWindowData_fun = Nil; -{$else} - -function SDL_SetWindowData(window: PSDL_Window; const name: PAnsiChar; userdata: Pointer): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowData' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Retrieve the data pointer associated with a window. - * - * window The window to query. - * name The name of the pointer. - * - * The value associated with 'name' - * - * SDL_SetWindowData() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowData_fun = function(window: PSDL_Window; const name: PAnsiChar): Pointer; cdecl; -Var - SDL_GetWindowData : TSDL_GetWindowData_fun = Nil; -{$else} - -function SDL_GetWindowData(window: PSDL_Window; const name: PAnsiChar): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowData' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Set the position of a window. - * - * window The window to reposition. - * x The x coordinate of the window, SDL_WINDOWPOS_CENTERED, or - * SDL_WINDOWPOS_UNDEFINED. - * y The y coordinate of the window, SDL_WINDOWPOS_CENTERED, or - * SDL_WINDOWPOS_UNDEFINED. - * - * The window coordinate origin is the upper left of the display. - * - * SDL_GetWindowPosition() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowPosition_proc = procedure(window: PSDL_Window; x: cint; y: cint); cdecl; -Var - SDL_SetWindowPosition : TSDL_SetWindowPosition_proc = Nil; -{$else} - -procedure SDL_SetWindowPosition(window: PSDL_Window; x: cint; y: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowPosition' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the position of a window. - * - * x Pointer to variable for storing the x position, may be nil - * y Pointer to variable for storing the y position, may be nil - * - * SDL_SetWindowPosition() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowPosition_proc = procedure(window: PSDL_Window; x: pcint; y: pcint); cdecl; -Var - SDL_GetWindowPosition : TSDL_GetWindowPosition_proc = Nil; -{$else} - -procedure SDL_GetWindowPosition(window: PSDL_Window; x: pcint; y: pcint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowPosition' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Set the size of a window's client area. - * - * w The width of the window, must be >0 - * h The height of the window, must be >0 - * - * You can't change the size of a fullscreen window, it automatically - * matches the size of the display mode. - * - * SDL_GetWindowSize() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowSize_proc = procedure(window: PSDL_Window; w: cint; h: cint); cdecl; -Var - SDL_SetWindowSize : TSDL_SetWindowSize_proc = Nil; -{$else} - -procedure SDL_SetWindowSize(window: PSDL_Window; w: cint; h: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowSize' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the size of a window's client area. - * - * w Pointer to variable for storing the width, may be nil - * h Pointer to variable for storing the height, may be nil - * - * SDL_SetWindowSize() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowSize_proc = procedure(window: PSDL_Window; w: pcint; h: pcint); cdecl; -Var - SDL_GetWindowSize : TSDL_GetWindowSize_proc = Nil; -{$else} - -procedure SDL_GetWindowSize(window: PSDL_Window; w: pcint; h: pcint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowSize' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * \brief Get the size of a window's borders (decorations) around the client area. - * - * \param window The window to query. - * \param top Pointer to variable for storing the size of the top border. NULL is permitted. - * \param left Pointer to variable for storing the size of the left border. NULL is permitted. - * \param bottom Pointer to variable for storing the size of the bottom border. NULL is permitted. - * \param right Pointer to variable for storing the size of the right border. NULL is permitted. - * - * \return 0 on success, or -1 if getting this information is not supported. - * - * \note if this function fails (returns -1), the size values will be - * initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as - * if the window in question was borderless. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowBordersSize_fun = function(window: PSDL_Window; top, left, bottom, right: pcint): cint; cdecl; -Var - SDL_GetWindowBordersSize : TSDL_GetWindowBordersSize_fun = Nil; -{$else} - -function SDL_GetWindowBordersSize(window: PSDL_Window; top, left, bottom, right: pcint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowBordersSize' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the size of a window in pixels. - * - * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI - * drawable, i.e. the window was created with `SDL_WINDOW_ALLOW_HIGHDPI` on a - * platform with high-DPI support (Apple calls this "Retina"), and not - * disabled by the `SDL_HINT_VIDEO_HIGHDPI_DISABLED` hint. - * - * \param window the window from which the drawable size should be queried - * \param w a pointer to variable for storing the width in pixels, may be NIL - * \param h a pointer to variable for storing the height in pixels, may be - * NIL - * - * \since This function is available since SDL 2.26.0. - * - * \sa SDL_CreateWindow - * \sa SDL_GetWindowSize - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowSizeInPixels_proc = procedure(window: PSDL_Window; w, h: pcuint); cdecl; -Var - SDL_GetWindowSizeInPixels : TSDL_GetWindowSizeInPixels_proc = Nil; -{$else} - -procedure SDL_GetWindowSizeInPixels(window: PSDL_Window; w, h: pcuint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowSizeInPixels' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Set the minimum size of a window's client area. - * - * min_w The minimum width of the window, must be >0 - * min_h The minimum height of the window, must be >0 - * - * You can't change the minimum size of a fullscreen window, it - * automatically matches the size of the display mode. - * - * SDL_GetWindowMinimumSize() - * SDL_SetWindowMaximumSize() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowMinimumSize_proc = procedure(window: PSDL_Window; min_w: cint; min_h: cint); cdecl; -Var - SDL_SetWindowMinimumSize : TSDL_SetWindowMinimumSize_proc = Nil; -{$else} - -procedure SDL_SetWindowMinimumSize(window: PSDL_Window; min_w: cint; min_h: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowMinimumSize' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the minimum size of a window's client area. - * - * w Pointer to variable for storing the minimum width, may be nil - * h Pointer to variable for storing the minimum height, may be nil - * - * SDL_GetWindowMaximumSize() - * SDL_SetWindowMinimumSize() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowMinimumSize_proc = procedure(window: PSDL_Window; w: pcint; h: pcint); cdecl; -Var - SDL_GetWindowMinimumSize : TSDL_GetWindowMinimumSize_proc = Nil; -{$else} - -procedure SDL_GetWindowMinimumSize(window: PSDL_Window; w: pcint; h: pcint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowMinimumSize' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Set the maximum size of a window's client area. - * - * max_w The maximum width of the window, must be >0 - * max_h The maximum height of the window, must be >0 - * - * You can't change the maximum size of a fullscreen window, it - * automatically matches the size of the display mode. - * - * SDL_GetWindowMaximumSize() - * SDL_SetWindowMinimumSize() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowMaximumSize_proc = procedure(window: PSDL_Window; max_w: cint; max_h: cint); cdecl; -Var - SDL_SetWindowMaximumSize : TSDL_SetWindowMaximumSize_proc = Nil; -{$else} - -procedure SDL_SetWindowMaximumSize(window: PSDL_Window; max_w: cint; max_h: cint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowMaximumSize' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the maximum size of a window's client area. - * - * w Pointer to variable for storing the maximum width, may be nil - * h Pointer to variable for storing the maximum height, may be nil - * - * SDL_GetWindowMinimumSize() - * SDL_SetWindowMaximumSize() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowMaximumSize_proc = procedure(window: PSDL_Window; w: pcint; h: pcint); cdecl; -Var - SDL_GetWindowMaximumSize : TSDL_GetWindowMaximumSize_proc = Nil; -{$else} - -procedure SDL_GetWindowMaximumSize(window: PSDL_Window; w: pcint; h: pcint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowMaximumSize' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Set the border state of a window. - * - * This will add or remove the window's SDL_WINDOW_BORDERLESS flag and - * add or remove the border from the actual window. This is a no-op if the - * window's border already matches the requested state. - * - * window The window of which to change the border state. - * bordered SDL_FALSE to remove border, SDL_TRUE to add border. - * - * You can't change the border state of a fullscreen window. - * - * SDL_GetWindowFlags() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowBordered_proc = procedure(window: PSDL_Window; bordered: TSDL_Bool); cdecl; -Var - SDL_SetWindowBordered : TSDL_SetWindowBordered_proc = Nil; -{$else} - -procedure SDL_SetWindowBordered(window: PSDL_Window; bordered: TSDL_Bool); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowBordered' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * \brief Set the user-resizable state of a window. - * - * This will add or remove the window's SDL_WINDOW_RESIZABLE flag and - * allow/disallow user resizing of the window. This is a no-op if the - * window's resizable state already matches the requested state. - * - * \param window The window of which to change the resizable state. - * \param resizable SDL_TRUE to allow resizing, SDL_FALSE to disallow. - * - * \note You can't change the resizable state of a fullscreen window. - * - * \sa SDL_GetWindowFlags() - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowResizable_proc = procedure(window: PSDL_Window; resizable: TSDL_Bool); cdecl; -Var - SDL_SetWindowResizable : TSDL_SetWindowResizable_proc = Nil; -{$else} - -procedure SDL_SetWindowResizable(window: PSDL_Window; resizable: TSDL_Bool); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowResizable' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Set the window to always be above the others. - * - * This will add or remove the window's `SDL_WINDOW_ALWAYS_ON_TOP` flag. This - * will bring the window to the front and keep the window above the rest. - * - * \param window The window of which to change the always on top state - * \param on_top SDL_TRUE to set the window always on top, SDL_FALSE to - * disable - * - * \since This function is available since SDL 2.0.16. - * - * \sa SDL_GetWindowFlags - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowAlwaysOnTop_proc = procedure(window: PSDL_Window; on_top: TSDL_Bool); cdecl; -Var - SDL_SetWindowAlwaysOnTop : TSDL_SetWindowAlwaysOnTop_proc = Nil; -{$else} - -procedure SDL_SetWindowAlwaysOnTop(window: PSDL_Window; on_top: TSDL_Bool); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowAlwaysOnTop' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Show a window. - * - * SDL_HideWindow() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_ShowWindow_proc = procedure(window: PSDL_Window); cdecl; -Var - SDL_ShowWindow : TSDL_ShowWindow_proc = Nil; -{$else} - -procedure SDL_ShowWindow(window: PSDL_Window); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ShowWindow' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Hide a window. - * - * SDL_ShowWindow() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HideWindow_proc = procedure(window: PSDL_Window); cdecl; -Var - SDL_HideWindow : TSDL_HideWindow_proc = Nil; -{$else} - -procedure SDL_HideWindow(window: PSDL_Window); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HideWindow' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Raise a window above other windows and set the input focus. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RaiseWindow_proc = procedure(window: PSDL_Window); cdecl; -Var - SDL_RaiseWindow : TSDL_RaiseWindow_proc = Nil; -{$else} - -procedure SDL_RaiseWindow(window: PSDL_Window); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RaiseWindow' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Make a window as large as possible. - * - * SDL_RestoreWindow() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_MaximizeWindow_proc = procedure(window: PSDL_Window); cdecl; -Var - SDL_MaximizeWindow : TSDL_MaximizeWindow_proc = Nil; -{$else} - -procedure SDL_MaximizeWindow(window: PSDL_Window); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MaximizeWindow' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Minimize a window to an iconic representation. - * - * SDL_RestoreWindow() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_MinimizeWindow_proc = procedure(window: PSDL_Window); cdecl; -Var - SDL_MinimizeWindow : TSDL_MinimizeWindow_proc = Nil; -{$else} - -procedure SDL_MinimizeWindow(window: PSDL_Window); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MinimizeWindow' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Restore the size and position of a minimized or maximized window. - * - * SDL_MaximizeWindow() - * SDL_MinimizeWindow() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_RestoreWindow_proc = procedure(window: PSDL_Window); cdecl; -Var - SDL_RestoreWindow : TSDL_RestoreWindow_proc = Nil; -{$else} - -procedure SDL_RestoreWindow(window: PSDL_Window); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RestoreWindow' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Set a window's fullscreen state. - * - * 0 on success, or -1 if setting the display mode failed. - * - * SDL_SetWindowDisplayMode() - * SDL_GetWindowDisplayMode() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowFullscreen_fun = function(window: PSDL_Window; flags: TSDL_WindowFlags): cint; cdecl; -Var - SDL_SetWindowFullscreen : TSDL_SetWindowFullscreen_fun = Nil; -{$else} - -function SDL_SetWindowFullscreen(window: PSDL_Window; flags: TSDL_WindowFlags): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowFullscreen' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Return whether the window has a surface associated with it. - * - * \returns SDL_TRUE if there is a surface associated with the window, or - * SDL_FALSE otherwise. - * - * \since This function is available since SDL 2.28.0. - * - * \sa SDL_GetWindowSurface - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_HasWindowSurface_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; -Var - SDL_HasWindowSurface : TSDL_HasWindowSurface_fun = Nil; -{$else} - -function SDL_HasWindowSurface(window: PSDL_Window): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasWindowSurface' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the SDL surface associated with the window. - * - * The window's framebuffer surface, or nil on error. - * - * A new surface will be created with the optimal format for the window, - * if necessary. This surface will be freed when the window is destroyed. - * - * You may not combine this with 3D or the rendering API on this window. - * - * SDL_UpdateWindowSurface() - * SDL_UpdateWindowSurfaceRects() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowSurface_fun = function(window: PSDL_Window): PSDL_Surface; cdecl; -Var - SDL_GetWindowSurface : TSDL_GetWindowSurface_fun = Nil; -{$else} - -function SDL_GetWindowSurface(window: PSDL_Window): PSDL_Surface; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowSurface' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Copy the window surface to the screen. - * - * 0 on success, or -1 on error. - * - * SDL_GetWindowSurface() - * SDL_UpdateWindowSurfaceRects() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_UpdateWindowSurface_fun = function(window: PSDL_Window): cint; cdecl; -Var - SDL_UpdateWindowSurface : TSDL_UpdateWindowSurface_fun = Nil; -{$else} - -function SDL_UpdateWindowSurface(window: PSDL_Window): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateWindowSurface' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Copy a number of rectangles on the window surface to the screen. - * - * 0 on success, or -1 on error. - * - * SDL_GetWindowSurface() - * SDL_UpdateWindowSurfaceRect() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_UpdateWindowSurfaceRects_fun = function(window: PSDL_Window; rects: PSDL_Rect; numrects: cint): cint; cdecl; -Var - SDL_UpdateWindowSurfaceRects : TSDL_UpdateWindowSurfaceRects_fun = Nil; -{$else} - -function SDL_UpdateWindowSurfaceRects(window: PSDL_Window; rects: PSDL_Rect; numrects: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateWindowSurfaceRects' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Destroy the surface associated with the window. - * - * \param window the window to update - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.28.0. - * - * \sa SDL_GetWindowSurface - * \sa SDL_HasWindowSurface - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_DestroyWindowSurface_fun = function(window: PSDL_Window): cint; cdecl; -Var - SDL_DestroyWindowSurface : TSDL_DestroyWindowSurface_fun = Nil; -{$else} - -function SDL_DestroyWindowSurface(window: PSDL_Window): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyWindowSurface' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Set a window's input grab mode. - * - * grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input. - * - * SDL_GetWindowGrab() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowGrab_proc = procedure(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; -Var - SDL_SetWindowGrab : TSDL_SetWindowGrab_proc = Nil; -{$else} - -procedure SDL_SetWindowGrab(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowGrab' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get a window's input grab mode. - * - * This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise. - * - * SDL_SetWindowGrab() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowGrab_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; -Var - SDL_GetWindowGrab : TSDL_GetWindowGrab_fun = Nil; -{$else} - -function SDL_GetWindowGrab(window: PSDL_Window): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowGrab' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * Set a window's keyboard grab mode. - * - * Keyboard grab enables capture of system keyboard shortcuts like Alt+Tab or - * the Meta/Super key. Note that not all system keyboard shortcuts can be - * captured by applications (one example is Ctrl+Alt+Del on Windows). - * - * This is primarily intended for specialized applications such as VNC clients - * or VM frontends. Normal games should not use keyboard grab. - * - * When keyboard grab is enabled, SDL will continue to handle Alt+Tab when the - * window is full-screen to ensure the user is not trapped in your - * application. If you have a custom keyboard shortcut to exit fullscreen - * mode, you may suppress this behavior with - * `SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED`. - * - * If the caller enables a grab while another window is currently grabbed, the - * other window loses its grab in favor of the caller's window. - * - * \param window The window for which the keyboard grab mode should be set. - * \param grabbed This is SDL_TRUE to grab keyboard, and SDL_FALSE to release. - * - * \since This function is available since SDL 2.0.16. - * - * \sa SDL_GetWindowKeyboardGrab - * \sa SDL_SetWindowMouseGrab - * \sa SDL_SetWindowGrab - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowKeyboardGrab_proc = procedure(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; -Var - SDL_SetWindowKeyboardGrab : TSDL_SetWindowKeyboardGrab_proc = Nil; -{$else} - -procedure SDL_SetWindowKeyboardGrab(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowKeyboardGrab' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get a window's keyboard grab mode. - * - * Returns SDL_TRUE if keyboard is grabbed, and SDL_FALSE otherwise. - * - * SDL_SetWindowKeyboardGrab() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowKeyboardGrab_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; -Var - SDL_GetWindowKeyboardGrab : TSDL_GetWindowKeyboardGrab_fun = Nil; -{$else} - -function SDL_GetWindowKeyboardGrab(window: PSDL_Window): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowKeyboardGrab' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Set a window's mouse grab mode. - * - * window The window for which the mouse grab mode should be set. - * grabbed This is SDL_TRUE to grab mouse, and SDL_FALSE to release. - * - * SDL_GetWindowMouseGrab() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowMouseGrab_proc = procedure(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; -Var - SDL_SetWindowMouseGrab : TSDL_SetWindowMouseGrab_proc = Nil; -{$else} - -procedure SDL_SetWindowMouseGrab(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowMouseGrab' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get a window's mouse grab mode. - * - * Returns SDL_TRUE if mouse is grabbed, and SDL_FALSE otherwise. - * - * SDL_SetWindowMouseGrab() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowMouseGrab_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; -Var - SDL_GetWindowMouseGrab : TSDL_GetWindowMouseGrab_fun = Nil; -{$else} - -function SDL_GetWindowMouseGrab(window: PSDL_Window): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowMouseGrab' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Confines the cursor to the specified area of a window. - * - * window The window that will be associated with the barrier. - * rect A rectangle area in window-relative coordinates. If NULL the barrier for the specified window will be destroyed. - * - * SDL_GetWindowMouseRect() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowMouseRect_proc = procedure(window: PSDL_Window; rect: PSDL_Rect); cdecl; -Var - SDL_SetWindowMouseRect : TSDL_SetWindowMouseRect_proc = Nil; -{$else} - -procedure SDL_SetWindowMouseRect(window: PSDL_Window; rect: PSDL_Rect); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowMouseRect' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the mouse confinement rectangle of a window. - * - * Returns A pointer to the mouse confinement rectangle of a window, or NULL if there isn't one. - * - * SDL_SetWindowMouseRect() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowMouseRect_fun = function(window: PSDL_Window): PSDL_Rect; cdecl; -Var - SDL_GetWindowMouseRect : TSDL_GetWindowMouseRect_fun = Nil; -{$else} - -function SDL_GetWindowMouseRect(window: PSDL_Window): PSDL_Rect; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowMouseRect' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * \brief Get the window that currently has an input grab enabled. - * - * \return This returns the window if input is grabbed, and NULL otherwise. - * - * \sa SDL_SetWindowGrab() - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetGrabbedWindow_fun = function(): PSDL_Window; cdecl; -Var - SDL_GetGrabbedWindow : TSDL_GetGrabbedWindow_fun = Nil; -{$else} - -function SDL_GetGrabbedWindow(): PSDL_Window; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetGrabbedWindow' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Set the brightness (gamma correction) for a window. - * - * 0 on success, or -1 if setting the brightness isn't supported. - * - * SDL_GetWindowBrightness() - * SDL_SetWindowGammaRamp() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowBrightness_fun = function(window: PSDL_Window; brightness: cfloat): cint; cdecl; -Var - SDL_SetWindowBrightness : TSDL_SetWindowBrightness_fun = Nil; -{$else} - -function SDL_SetWindowBrightness(window: PSDL_Window; brightness: cfloat): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowBrightness' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the brightness (gamma correction) for a window. - * - * The last brightness value passed to SDL_SetWindowBrightness() - * - * SDL_SetWindowBrightness() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowBrightness_fun = function(window: PSDL_Window): cfloat; cdecl; -Var - SDL_GetWindowBrightness : TSDL_GetWindowBrightness_fun = Nil; -{$else} - -function SDL_GetWindowBrightness(window: PSDL_Window): cfloat; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowBrightness' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * \brief Set the opacity for a window - * - * \param window The window which will be made transparent or opaque - * \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be - * clamped internally between 0.0f and 1.0f. - * - * \return 0 on success, or -1 if setting the opacity isn't supported. - * - * \sa SDL_GetWindowOpacity() - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowOpacity_fun = function(window: PSDL_Window; opacity: cfloat): cint; cdecl; -Var - SDL_SetWindowOpacity : TSDL_SetWindowOpacity_fun = Nil; -{$else} - -function SDL_SetWindowOpacity(window: PSDL_Window; opacity: cfloat): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowOpacity' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * \brief Get the opacity of a window. - * - * If transparency isn't supported on this platform, opacity will be reported - * as 1.0f without error. - * - * \param window The window in question. - * \param out_opacity Opacity (0.0f - transparent, 1.0f - opaque) - * - * \return 0 on success, or -1 on error (invalid window, etc). - * - * \sa SDL_SetWindowOpacity() - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowOpacity_fun = function(window: PSDL_Window; out_opacity: pcfloat): cint; cdecl; -Var - SDL_GetWindowOpacity : TSDL_GetWindowOpacity_fun = Nil; -{$else} - -function SDL_GetWindowOpacity(window: PSDL_Window; out_opacity: pcfloat): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowOpacity' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * \brief Sets the window as a modal for another window - * - * \param modal_window The window that should be modal - * \param parent_window The parent window - * - * \return 0 on success, or -1 otherwise. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowModalFor_fun = function(modal_window, parent_window: PSDL_Window): cint; cdecl; -Var - SDL_SetWindowModalFor : TSDL_SetWindowModalFor_fun = Nil; -{$else} - -function SDL_SetWindowModalFor(modal_window, parent_window: PSDL_Window): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowModalFor' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * \brief Explicitly sets input focus to the window. - * - * You almost certainly want SDL_RaiseWindow() instead of this function. Use - * this with caution, as you might give focus to a window that's completely - * obscured by other windows. - * - * \param window The window that should get the input focus - * - * \return 0 on success, or -1 otherwise. - * \sa SDL_RaiseWindow() - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowInputFocus_fun = function(window: PSDL_Window): cint; cdecl; -Var - SDL_SetWindowInputFocus : TSDL_SetWindowInputFocus_fun = Nil; -{$else} - -function SDL_SetWindowInputFocus(window: PSDL_Window): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowInputFocus' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Set the gamma ramp for a window. - * - * red The translation table for the red channel, or nil. - * green The translation table for the green channel, or nil. - * blue The translation table for the blue channel, or nil. - * - * 0 on success, or -1 if gamma ramps are unsupported. - * - * Set the gamma translation table for the red, green, and blue channels - * of the video hardware. Each table is an array of 256 16-bit quantities, - * representing a mapping between the input and output for that channel. - * The input is the index into the array, and the output is the 16-bit - * gamma value at that index, scaled to the output color precision. - * - * SDL_GetWindowGammaRamp() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowGammaRamp_fun = function(window: PSDL_Window; const red: pcuint16; const green: pcuint16; const blue: pcuint16): cint; cdecl; -Var - SDL_SetWindowGammaRamp : TSDL_SetWindowGammaRamp_fun = Nil; -{$else} - -function SDL_SetWindowGammaRamp(window: PSDL_Window; const red: pcuint16; const green: pcuint16; const blue: pcuint16): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowGammaRamp' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the gamma ramp for a window. - * - * red A pointer to a 256 element array of 16-bit quantities to hold - * the translation table for the red channel, or nil. - * green A pointer to a 256 element array of 16-bit quantities to hold - * the translation table for the green channel, or nil. - * blue A pointer to a 256 element array of 16-bit quantities to hold - * the translation table for the blue channel, or nil. - * - * 0 on success, or -1 if gamma ramps are unsupported. - * - * SDL_SetWindowGammaRamp() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GetWindowGammaRamp_fun = function(window: PSDL_Window; red: pcuint16; green: pcuint16; blue: pcuint16): cint; cdecl; -Var - SDL_GetWindowGammaRamp : TSDL_GetWindowGammaRamp_fun = Nil; -{$else} - -function SDL_GetWindowGammaRamp(window: PSDL_Window; red: pcuint16; green: pcuint16; blue: pcuint16): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowGammaRamp' {$ENDIF} {$ENDIF}; -{$endif} - -{** - * \brief Possible return values from the SDL_HitTest callback. - * - * \sa SDL_HitTest - *} -type - PPSDL_HitTestResult = ^PSDL_HitTestResult; - PSDL_HitTestResult = ^TSDL_HitTestResult; - TSDL_HitTestResult = type Integer; - -const - SDL_HITTEST_NORMAL = TSDL_HitTestResult(0); {**< Region is normal. No special properties. *} - SDL_HITTEST_DRAGGABLE = TSDL_HitTestResult(1); {**< Region can drag entire window. *} - SDL_HITTEST_RESIZE_TOPLEFT = TSDL_HitTestResult(2); - SDL_HITTEST_RESIZE_TOP = TSDL_HitTestResult(3); - SDL_HITTEST_RESIZE_TOPRIGHT = TSDL_HitTestResult(4); - SDL_HITTEST_RESIZE_RIGHT = TSDL_HitTestResult(5); - SDL_HITTEST_RESIZE_BOTTOMRIGHT = TSDL_HitTestResult(6); - SDL_HITTEST_RESIZE_BOTTOM = TSDL_HitTestResult(7); - SDL_HITTEST_RESIZE_BOTTOMLEFT = TSDL_HitTestResult(8); - SDL_HITTEST_RESIZE_LEFT = TSDL_HitTestResult(9); - - {** - * \brief Callback used for hit-testing. - * - * \sa SDL_SetWindowHitTest - *} -type - PPSDL_HitTest = ^PSDL_HitTest; - PSDL_HitTest = ^TSDL_HitTest; - TSDL_HitTest = function(win: PSDL_Window; const area: PSDL_Point; data: Pointer): TSDL_HitTestResult; cdecl; - - {** - * \brief Provide a callback that decides if a window region has special properties. - * - * Normally windows are dragged and resized by decorations provided by the - * system window manager (a title bar, borders, etc), but for some apps, it - * makes sense to drag them from somewhere else inside the window itself; for - * example, one might have a borderless window that wants to be draggable - * from any part, or simulate its own title bar, etc. - * - * This function lets the app provide a callback that designates pieces of - * a given window as special. This callback is run during event processing - * if we need to tell the OS to treat a region of the window specially; the - * use of this callback is known as "hit testing." - * - * Mouse input may not be delivered to your application if it is within - * a special area; the OS will often apply that input to moving the window or - * resizing the window and not deliver it to the application. - * - * Specifying NULL for a callback disables hit-testing. Hit-testing is - * disabled by default. - * - * Platforms that don't support this functionality will return -1 - * unconditionally, even if you're attempting to disable hit-testing. - * - * Your callback may fire at any time, and its firing does not indicate any - * specific behavior (for example, on Windows, this certainly might fire - * when the OS is deciding whether to drag your window, but it fires for lots - * of other reasons, too, some unrelated to anything you probably care about - * _and when the mouse isn't actually at the location it is testing_). - * Since this can fire at any time, you should try to keep your callback - * efficient, devoid of allocations, etc. - * - * \param window The window to set hit-testing on. - * \param callback The callback to call when doing a hit-test. - * \param callback_data An app-defined void pointer passed to the callback. - * \return 0 on success, -1 on error (including unsupported). - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_SetWindowHitTest_fun = function(window: PSDL_Window; callback: TSDL_HitTest; callback_data: Pointer): cint; cdecl; -Var - SDL_SetWindowHitTest : TSDL_SetWindowHitTest_fun = Nil; -{$else} - -function SDL_SetWindowHitTest(window: PSDL_Window; callback: TSDL_HitTest; callback_data: Pointer): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowHitTest' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Request a window to demand attention from the user. - * - * \param window the window to be flashed - * \param operation the flash operation - * \returns 0 on success or a negative error code on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 2.0.16. - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_FlashWindow_fun = function(window: PSDL_Window; operation: TSDL_FlashOperation): cint; cdecl; -Var - SDL_FlashWindow : TSDL_FlashWindow_fun = Nil; -{$else} - -function SDL_FlashWindow(window: PSDL_Window; operation: TSDL_FlashOperation): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FlashWindow' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Destroy a window. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_DestroyWindow_proc = procedure(window: PSDL_Window); cdecl; -Var - SDL_DestroyWindow : TSDL_DestroyWindow_proc = Nil; -{$else} - -procedure SDL_DestroyWindow(window: PSDL_Window); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyWindow' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Returns whether the screensaver is currently enabled (default on). - * - * SDL_EnableScreenSaver() - * SDL_DisableScreenSaver() - *} - -function SDL_IsScreenSaverEnabled: TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsScreenSaverEnabled' {$ENDIF} {$ENDIF}; - - {** - * Allow the screen to be blanked by a screensaver - * - * SDL_IsScreenSaverEnabled() - * SDL_DisableScreenSaver() - *} - -procedure SDL_EnableScreenSaver; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EnableScreenSaver' {$ENDIF} {$ENDIF}; - - {** - * Prevent the screen from being blanked by a screensaver - * - * SDL_IsScreenSaverEnabled() - * SDL_EnableScreenSaver() - *} - -procedure SDL_DisableScreenSaver; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DisableScreenSaver' {$ENDIF} {$ENDIF}; - - {** - * OpenGL support functions - *} - - {** - * Dynamically load an OpenGL library. - * - * path The platform dependent OpenGL library name, or nil to open the - * default OpenGL library. - * - * 0 on success, or -1 if the library couldn't be loaded. - * - * This should be done after initializing the video driver, but before - * creating any OpenGL windows. If no OpenGL library is loaded, the default - * library will be loaded upon creation of the first OpenGL window. - * - * If you do this, you need to retrieve all of the GL functions used in - * your program from the dynamic library using SDL_GL_GetProcAddress(). - * - * SDL_GL_GetProcAddress() - * SDL_GL_UnloadLibrary() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GL_LoadLibrary_fun = function(const path: PAnsiChar): cint; cdecl; -Var - SDL_GL_LoadLibrary : TSDL_GL_LoadLibrary_fun = Nil; -{$else} - -function SDL_GL_LoadLibrary(const path: PAnsiChar): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_LoadLibrary' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the address of an OpenGL function. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GL_GetProcAddress_fun = function(const proc: PAnsiChar): Pointer; cdecl; -Var - SDL_GL_GetProcAddress : TSDL_GL_GetProcAddress_fun = Nil; -{$else} - -function SDL_GL_GetProcAddress(const proc: PAnsiChar): Pointer; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetProcAddress' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary(). - * - * SDL_GL_LoadLibrary() - *} - -procedure SDL_GL_UnloadLibrary; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_UnloadLibrary' {$ENDIF} {$ENDIF}; - - {** - * Return true if an OpenGL extension is supported for the current - * context. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GL_ExtensionSupported_fun = function(const extension: PAnsiChar): TSDL_Bool; cdecl; -Var - SDL_GL_ExtensionSupported : TSDL_GL_ExtensionSupported_fun = Nil; -{$else} - -function SDL_GL_ExtensionSupported(const extension: PAnsiChar): TSDL_Bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_ExtensionSupported' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Reset all previously set OpenGL context attributes to their default values - *} -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GL_ResetAttributes_proc = procedure(); cdecl; -Var - SDL_GL_ResetAttributes : TSDL_GL_ResetAttributes_proc = Nil; -{$else} - -procedure SDL_GL_ResetAttributes(); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_ResetAttributes' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Set an OpenGL window attribute before window creation. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GL_SetAttribute_fun = function(attr: TSDL_GLattr; value: cint): cint; cdecl; -Var - SDL_GL_SetAttribute : TSDL_GL_SetAttribute_fun = Nil; -{$else} - -function SDL_GL_SetAttribute(attr: TSDL_GLattr; value: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_SetAttribute' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the actual value for an attribute from the current context. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GL_GetAttribute_fun = function(attr: TSDL_GLattr; value: pcint): cint; cdecl; -Var - SDL_GL_GetAttribute : TSDL_GL_GetAttribute_fun = Nil; -{$else} - -function SDL_GL_GetAttribute(attr: TSDL_GLattr; value: pcint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetAttribute' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Create an OpenGL context for use with an OpenGL window, and make it - * current. - * - * SDL_GL_DeleteContext() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GL_CreateContext_fun = function(window: PSDL_Window): TSDL_GLContext; cdecl; -Var - SDL_GL_CreateContext : TSDL_GL_CreateContext_fun = Nil; -{$else} - -function SDL_GL_CreateContext(window: PSDL_Window): TSDL_GLContext; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_CreateContext' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Set up an OpenGL context for rendering into an OpenGL window. - * - * The context must have been created with a compatible window. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GL_MakeCurrent_fun = function(window: PSDL_Window; context: TSDL_GLContext): cint; cdecl; -Var - SDL_GL_MakeCurrent : TSDL_GL_MakeCurrent_fun = Nil; -{$else} - -function SDL_GL_MakeCurrent(window: PSDL_Window; context: TSDL_GLContext): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_MakeCurrent' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the currently active OpenGL window. - *} -function SDL_GL_GetCurrentWindow: PSDL_Window; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetCurrentWindow' {$ENDIF} {$ENDIF}; - - {** - * Get the currently active OpenGL context. - *} -function SDL_GL_GetCurrentContext: TSDL_GLContext; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetCurrentContext' {$ENDIF} {$ENDIF}; - - {** - * Get the size of a window's underlying drawable in pixels (for use - * with glViewport). - * - * window Window from which the drawable size should be queried - * w Pointer to variable for storing the width in pixels, may be NULL - * h Pointer to variable for storing the height in pixels, may be NULL - * - * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI - * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a - * platform with high-DPI support (Apple calls this "Retina"), and not disabled - * by the SDL_HINT_VIDEO_HIGHDPI_DISABLED hint. - * - * SDL_GetWindowSize() - * SDL_CreateWindow() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GL_GetDrawableSize_proc = procedure(window: PSDL_Window; w: pcint; h: pcint); cdecl; -Var - SDL_GL_GetDrawableSize : TSDL_GL_GetDrawableSize_proc = Nil; -{$else} - -procedure SDL_GL_GetDrawableSize(window: PSDL_Window; w: pcint; h: pcint); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetDrawableSize' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Set the swap interval for the current OpenGL context. - * - * interval 0 for immediate updates, 1 for updates synchronized with the - * vertical retrace. If the system supports it, you may - * specify -1 to allow late swaps to happen immediately - * instead of waiting for the next retrace. - * - * 0 on success, or -1 if setting the swap interval is not supported. - * - * SDL_GL_GetSwapInterval() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GL_SetSwapInterval_fun = function(interval: cint): cint; cdecl; -Var - SDL_GL_SetSwapInterval : TSDL_GL_SetSwapInterval_fun = Nil; -{$else} - -function SDL_GL_SetSwapInterval(interval: cint): cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_SetSwapInterval' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Get the swap interval for the current OpenGL context. - * - * 0 if there is no vertical retrace synchronization, 1 if the buffer - * swap is synchronized with the vertical retrace, and -1 if late - * swaps happen immediately instead of waiting for the next retrace. - * If the system can't determine the swap interval, or there isn't a - * valid current context, this will return 0 as a safe default. - * - * SDL_GL_SetSwapInterval() - *} - -function SDL_GL_GetSwapInterval: cint; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetSwapInterval' {$ENDIF} {$ENDIF}; - - {** - * Swap the OpenGL buffers for a window, if double-buffering is - * supported. - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GL_SwapWindow_proc = procedure(window: PSDL_Window); cdecl; -Var - SDL_GL_SwapWindow : TSDL_GL_SwapWindow_proc = Nil; -{$else} - -procedure SDL_GL_SwapWindow(window: PSDL_Window); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_SwapWindow' {$ENDIF} {$ENDIF}; -{$endif} - - {** - * Delete an OpenGL context. - * - * SDL_GL_CreateContext() - *} - -{$ifdef SDL_DYNAMIC_LINKING} -Type - TSDL_GL_DeleteContext_proc = procedure(context: TSDL_GLContext); cdecl; -Var - SDL_GL_DeleteContext : TSDL_GL_DeleteContext_proc = Nil; -{$else} - -procedure SDL_GL_DeleteContext(context: TSDL_GLContext); cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_DeleteContext' {$ENDIF} {$ENDIF}; -{$endif} - - {*OpenGL support functions*} +// from "sdl_video.h" + + +type + PPSDL_Window = ^PSDL_Window; + PSDL_Window = type Pointer; + + {** + * The structure that defines a display mode + * + * SDL_GetNumDisplayModes() + * SDL_GetDisplayMode() + * SDL_GetDesktopDisplayMode() + * SDL_GetCurrentDisplayMode() + * SDL_GetClosestDisplayMode() + * SDL_SetWindowDisplayMode() + * SDL_GetWindowDisplayMode() + *} + PPSDL_DisplayMode = ^PSDL_DisplayMode; + PSDL_DisplayMode = ^TSDL_DisplayMode; + TSDL_DisplayMode = record + format: cuint32; {**< pixel format *} + w: cint; {**< width *} + h: cint; {**< height *} + refresh_rate: cint; {**< refresh rate (or zero for unspecified) *} + driverdata: Pointer; {**< driver-specific data, initialize to 0 *} + end; + +{** + * The flags on a window + * + * SDL_GetWindowFlags() + *} +type + PPSDL_WindowFlags = ^PSDL_WindowFlags; + PSDL_WindowFlags = ^TSDL_WindowFlags; + TSDL_WindowFlags = type cuint; + +const + SDL_WINDOW_FULLSCREEN = TSDL_WindowFlags($00000001); {**< fullscreen window *} + SDL_WINDOW_OPENGL = TSDL_WindowFlags($00000002); {**< window usable with OpenGL context *} + SDL_WINDOW_SHOWN = TSDL_WindowFlags($00000004); {**< window is visible *} + SDL_WINDOW_HIDDEN = TSDL_WindowFlags($00000008); {**< window is not visible *} + SDL_WINDOW_BORDERLESS = TSDL_WindowFlags($00000010); {**< no window decoration *} + SDL_WINDOW_RESIZABLE = TSDL_WindowFlags($00000020); {**< window can be resized *} + SDL_WINDOW_MINIMIZED = TSDL_WindowFlags($00000040); {**< window is minimized *} + SDL_WINDOW_MAXIMIZED = TSDL_WindowFlags($00000080); {**< window is maximized *} + SDL_WINDOW_MOUSE_GRABBED = TSDL_WindowFlags($00000100); {**< window has grabbed mouse input *} + SDL_WINDOW_INPUT_FOCUS = TSDL_WindowFlags($00000200); {**< window has input focus *} + SDL_WINDOW_MOUSE_FOCUS = TSDL_WindowFlags($00000400); {**< window has mouse focus *} + SDL_WINDOW_FULLSCREEN_DESKTOP = TSDL_WindowFlags(SDL_WINDOW_FULLSCREEN or $00001000); + SDL_WINDOW_FOREIGN = TSDL_WindowFlags($00000800); {**< window not created by SDL *} + SDL_WINDOW_ALLOW_HIGHDPI = TSDL_WindowFlags($00002000); {**< window should be created in high-DPI mode if supported. + On macOS NSHighResolutionCapable must be set true in the + application's Info.plist for this to have any effect. *} + SDL_WINDOW_MOUSE_CAPTURE = TSDL_WindowFlags($00004000); {**< window has mouse captured (unrelated to MOUSE_GRABBED) *} + SDL_WINDOW_ALWAYS_ON_TOP = TSDL_WindowFlags($00008000); {**< window should always be above others *} + SDL_WINDOW_SKIP_TASKBAR = TSDL_WindowFlags($00010000); {**< window should not be added to the taskbar *} + SDL_WINDOW_UTILITY = TSDL_WindowFlags($00020000); {**< window should be treated as a utility window *} + SDL_WINDOW_TOOLTIP = TSDL_WindowFlags($00040000); {**< window should be treated as a tooltip *} + SDL_WINDOW_POPUP_MENU = TSDL_WindowFlags($00080000); {**< window should be treated as a popup menu *} + SDL_WINDOW_KEYBOARD_GRABBED = TSDL_WindowFlags($00100000); {**< window has grabbed keyboard input *} + SDL_WINDOW_VULKAN = TSDL_WindowFlags($10000000); {**< window usable for Vulkan surface *} + SDL_WINDOW_METAL = TSDL_WindowFlags($20000000); {**< window usable for Metal view *} + + SDL_WINDOW_INPUT_GRABBED = SDL_WINDOW_MOUSE_GRABBED; {**< equivalent to SDL_WINDOW_MOUSE_GRABBED for compatibility *} + + {** + * Used to indicate that you don't care what the window position is. + *} +const SDL_WINDOWPOS_UNDEFINED_MASK = $1FFF0000; +function SDL_WINDOWPOS_UNDEFINED_DISPLAY(X: Variant): Variant; +const SDL_WINDOWPOS_UNDEFINED = SDL_WINDOWPOS_UNDEFINED_MASK or 0; +function SDL_WINDOWPOS_ISUNDEFINED(X: Variant): Variant; + + + {** + * Used to indicate that the window position should be centered. + *} +const SDL_WINDOWPOS_CENTERED_MASK = $2FFF0000; +function SDL_WINDOWPOS_CENTERED_DISPLAY(X: Variant): Variant; +const SDL_WINDOWPOS_CENTERED = SDL_WINDOWPOS_CENTERED_MASK or 0; +function SDL_WINDOWPOS_ISCENTERED(X: Variant): Variant; + + {** + * Event subtype for window events + *} +type + PPSDL_WindowEventID = ^PSDL_WindowEventID; + PSDL_WindowEventID = ^TSDL_WindowEventID; + TSDL_WindowEventID = type cint; +const + SDL_WINDOWEVENT_NONE = TSDL_WindowEventID(0); {**< Never used *} + SDL_WINDOWEVENT_SHOWN = TSDL_WindowEventID(1); {**< Window has been shown *} + SDL_WINDOWEVENT_HIDDEN = TSDL_WindowEventID(2); {**< Window has been hidden *} + SDL_WINDOWEVENT_EXPOSED = TSDL_WindowEventID(3); {**< Window has been exposed and should be redrawn *} + SDL_WINDOWEVENT_MOVED = TSDL_WindowEventID(4); {**< Window has been moved to data1; data2 *} + SDL_WINDOWEVENT_RESIZED = TSDL_WindowEventID(5); {**< Window has been resized to data1xdata2 *} + SDL_WINDOWEVENT_SIZE_CHANGED = TSDL_WindowEventID(6); {**< The window size has changed; either as a result of an API call or through the system or user changing the window size. *} + SDL_WINDOWEVENT_MINIMIZED = TSDL_WindowEventID(7); {**< Window has been minimized *} + SDL_WINDOWEVENT_MAXIMIZED = TSDL_WindowEventID(8); {**< Window has been maximized *} + SDL_WINDOWEVENT_RESTORED = TSDL_WindowEventID(9); {**< Window has been restored to normal size and position *} + SDL_WINDOWEVENT_ENTER = TSDL_WindowEventID(10); {**< Window has gained mouse focus *} + SDL_WINDOWEVENT_LEAVE = TSDL_WindowEventID(11); {**< Window has lost mouse focus *} + SDL_WINDOWEVENT_FOCUS_GAINED = TSDL_WindowEventID(12); {**< Window has gained keyboard focus *} + SDL_WINDOWEVENT_FOCUS_LOST = TSDL_WindowEventID(13); {**< Window has lost keyboard focus *} + SDL_WINDOWEVENT_CLOSE = TSDL_WindowEventID(14); {**< The window manager requests that the window be closed *} + SDL_WINDOWEVENT_TAKE_FOCUS = TSDL_WindowEventID(15); {**< Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore) *} + SDL_WINDOWEVENT_HIT_TEST = TSDL_WindowEventID(16); {**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. *} + SDL_WINDOWEVENT_ICCPROF_CHANGED = TSDL_WindowEventID(17); {**< The ICC profile of the window's display has changed. *} + SDL_WINDOWEVENT_DISPLAY_CHANGED = TSDL_WindowEventID(18); {**< Window has been moved to display data1. *} + +{** + * \brief Event subtype for display events + *} +type + PPSDL_DisplayEventID = ^PSDL_DisplayEventID; + PSDL_DisplayEventID = ^TSDL_DisplayEventID; + TSDL_DisplayEventID = type Integer; + +const + SDL_DISPLAYEVENT_NONE = TSDL_DisplayEventID(0); {**< Never used *} + SDL_DISPLAYEVENT_ORIENTATION = TSDL_DisplayEventID(1); {**< Display orientation has changed to data1 *} + SDL_DISPLAYEVENT_CONNECTED = TSDL_DisplayEventID(2); {**< Display has been added to the system *} + SDL_DISPLAYEVENT_DISCONNECTED = TSDL_DisplayEventID(3); {**< Display has been removed from the system *} + +type + PPSDL_DisplayOrientation = ^PSDL_DisplayOrientation; + PSDL_DisplayOrientation = ^TSDL_DisplayOrientation; + TSDL_DisplayOrientation = type Integer; + +const + SDL_ORIENTATION_UNKNOWN = TSDL_DisplayOrientation(0); {**< The display orientation can't be determined *} + SDL_ORIENTATION_LANDSCAPE = TSDL_DisplayOrientation(1); {**< The display is in landscape mode, with the right side up, relative to portrait mode *} + SDL_ORIENTATION_LANDSCAPE_FLIPPED = TSDL_DisplayOrientation(2); {**< The display is in landscape mode, with the left side up, relative to portrait mode *} + SDL_ORIENTATION_PORTRAIT = TSDL_DisplayOrientation(3); {**< The display is in portrait mode *} + SDL_ORIENTATION_PORTRAIT_FLIPPED = TSDL_DisplayOrientation(4); {**< The display is in portrait mode, upside down *} + + {** + * \brief Window flash operation + *} +type + PPSDL_FlashOperation = ^PSDL_FlashOperation; + PSDL_FlashOperation = ^TSDL_FlashOperation; + TSDL_FlashOperation = type Integer; + +const + SDL_FLASH_CANCEL = TSDL_FlashOperation(0); {**< Cancel any window flash state *} + SDL_FLASH_BRIEFLY = TSDL_FlashOperation(1); {**< Flash the window briefly to get attention *} + SDL_FLASH_UNTIL_FOCUSED = TSDL_FlashOperation(2); {**< Flash the window until it gets focus *} + + {** + * An opaque handle to an OpenGL context. + *} +type + PPSDL_GLContext = ^PSDL_GLContext; + PSDL_GLContext = ^TSDL_GLContext; + TSDL_GLContext = Pointer; + + {** + * OpenGL configuration attributes + *} +type + PPSDL_GLattr = ^PSDL_GLattr; + PSDL_GLattr = ^TSDL_GLattr; + TSDL_GLattr = type Integer; + +const + SDL_GL_RED_SIZE = TSDL_GLattr(0); + SDL_GL_GREEN_SIZE = TSDL_GLattr(1); + SDL_GL_BLUE_SIZE = TSDL_GLattr(2); + SDL_GL_ALPHA_SIZE = TSDL_GLattr(3); + SDL_GL_BUFFER_SIZE = TSDL_GLattr(4); + SDL_GL_DOUBLEBUFFER = TSDL_GLattr(5); + SDL_GL_DEPTH_SIZE = TSDL_GLattr(6); + SDL_GL_STENCIL_SIZE = TSDL_GLattr(7); + SDL_GL_ACCUM_RED_SIZE = TSDL_GLattr(8); + SDL_GL_ACCUM_GREEN_SIZE = TSDL_GLattr(9); + SDL_GL_ACCUM_BLUE_SIZE = TSDL_GLattr(10); + SDL_GL_ACCUM_ALPHA_SIZE = TSDL_GLattr(11); + SDL_GL_STEREO = TSDL_GLattr(12); + SDL_GL_MULTISAMPLEBUFFERS = TSDL_GLattr(13); + SDL_GL_MULTISAMPLESAMPLES = TSDL_GLattr(14); + SDL_GL_ACCELERATED_VISUAL = TSDL_GLattr(15); + SDL_GL_RETAINED_BACKING = TSDL_GLattr(16); + SDL_GL_CONTEXT_MAJOR_VERSION = TSDL_GLattr(17); + SDL_GL_CONTEXT_MINOR_VERSION = TSDL_GLattr(18); + SDL_GL_CONTEXT_EGL = TSDL_GLattr(19); + SDL_GL_CONTEXT_FLAGS = TSDL_GLattr(20); + SDL_GL_CONTEXT_PROFILE_MASK = TSDL_GLattr(21); + SDL_GL_SHARE_WITH_CURRENT_CONTEXT = TSDL_GLattr(22); + SDL_GL_FRAMEBUFFER_SRGB_CAPABLE = TSDL_GLattr(23); + SDL_GL_CONTEXT_RELEASE_BEHAVIOR = TSDL_GLattr(24); + SDL_GL_CONTEXT_RESET_NOTIFICATION = TSDL_GLattr(25); + SDL_GL_CONTEXT_NO_ERROR = TSDL_GLattr(26); + SDL_GL_FLOATBUFFERS = TSDL_GLattr(27); + +type + PPSDL_GLprofile = ^PSDL_GLprofile; + PSDL_GLprofile = ^TSDL_GLprofile; + TSDL_GLprofile = type Integer; + +const + SDL_GL_CONTEXT_PROFILE_CORE = TSDL_GLprofile($0001); + SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = TSDL_GLprofile($0002); + SDL_GL_CONTEXT_PROFILE_ES = TSDL_GLprofile($0004); + +type + PPSDL_GLcontextFlag = ^PSDL_GLcontextFlag; + PSDL_GLcontextFlag = ^TSDL_GLcontextFlag; + TSDL_GLcontextFlag = type Integer; + +const + SDL_GL_CONTEXT_DEBUG_FLAG = TSDL_GLcontextFlag($0001); + SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = TSDL_GLcontextFlag($0002); + SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = TSDL_GLcontextFlag($0004); + SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = TSDL_GLcontextFlag($0008); + +type + PPSDL_GLcontextReleaseFlag = ^PSDL_GLcontextReleaseFlag; + PSDL_GLcontextReleaseFlag = ^TSDL_GLcontextReleaseFlag; + TSDL_GLcontextReleaseFlag = type Integer; + +const + SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = TSDL_GLcontextReleaseFlag($0000); + SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = TSDL_GLcontextReleaseFlag($0001); + +type + PPSDL_GLContextResetNotification = ^PSDL_GLContextResetNotification; + PSDL_GLContextResetNotification = ^TSDL_GLContextResetNotification; + TSDL_GLContextResetNotification = type Integer; + +const + SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = TSDL_GLContextResetNotification($0000); + SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = TSDL_GLContextResetNotification($0001); + + {* Function prototypes *} + + {** + * Get the number of video drivers compiled into SDL + * + * SDL_GetVideoDriver() + *} + +function SDL_GetNumVideoDrivers: cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumVideoDrivers' {$ENDIF} {$ENDIF}; + + {** + * Get the name of a built in video driver. + * + * The video drivers are presented in the order in which they are + * normally checked during initialization. + * + * SDL_GetNumVideoDrivers() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetVideoDriver_fun = function(index: cint): PAnsiChar; cdecl; +Var + SDL_GetVideoDriver : TSDL_GetVideoDriver_fun = Nil; +{$else} + +function SDL_GetVideoDriver(index: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetVideoDriver' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Initialize the video subsystem, optionally specifying a video driver. + * + * driver_name Initialize a specific driver by name, or nil for the + * default video driver. + * + * 0 on success, -1 on error + * + * This function initializes the video subsystem; setting up a connection + * to the window manager, etc, and determines the available display modes + * and pixel formats, but does not initialize a window or graphics mode. + * + * SDL_VideoQuit() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_VideoInit_fun = function(const driver_name: PAnsiChar): cint; cdecl; +Var + SDL_VideoInit : TSDL_VideoInit_fun = Nil; +{$else} + +function SDL_VideoInit(const driver_name: PAnsiChar): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_VideoInit' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Shuts down the video subsystem. + * + * function closes all windows, and restores the original video mode. + * + * SDL_VideoInit() + *} +procedure SDL_VideoQuit; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_VideoQuit' {$ENDIF} {$ENDIF}; + + {** + * Returns the name of the currently initialized video driver. + * + * The name of the current video driver or nil if no driver + * has been initialized + * + * SDL_GetNumVideoDrivers() + * SDL_GetVideoDriver() + *} + +function SDL_GetCurrentVideoDriver: PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCurrentVideoDriver' {$ENDIF} {$ENDIF}; + + {** + * Returns the number of available video displays. + * + * SDL_GetDisplayBounds() + *} + +function SDL_GetNumVideoDisplays: cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumVideoDisplays' {$ENDIF} {$ENDIF}; + + {** + * Get the name of a display in UTF-8 encoding + * + * The name of a display, or nil for an invalid display index. + * + * SDL_GetNumVideoDisplays() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetDisplayName_fun = function(displayIndex: cint): PAnsiChar; cdecl; +Var + SDL_GetDisplayName : TSDL_GetDisplayName_fun = Nil; +{$else} + +function SDL_GetDisplayName(displayIndex: cint): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayName' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the desktop area represented by a display, with the primary + * display located at 0,0 + * + * 0 on success, or -1 if the index is out of range. + * + * SDL_GetNumVideoDisplays() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetDisplayBounds_fun = function(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; +Var + SDL_GetDisplayBounds : TSDL_GetDisplayBounds_fun = Nil; +{$else} + +function SDL_GetDisplayBounds(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayBounds' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Get the usable desktop area represented by a display, with the + * primary display located at 0,0 + * + * This is the same area as SDL_GetDisplayBounds() reports, but with portions + * reserved by the system removed. For example, on Mac OS X, this subtracts + * the area occupied by the menu bar and dock. + * + * Setting a window to be fullscreen generally bypasses these unusable areas, + * so these are good guidelines for the maximum space available to a + * non-fullscreen window. + * + * \return 0 on success, or -1 if the index is out of range. + * + * \sa SDL_GetDisplayBounds() + * \sa SDL_GetNumVideoDisplays() + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetDisplayUsableBounds_fun = function(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; +Var + SDL_GetDisplayUsableBounds : TSDL_GetDisplayUsableBounds_fun = Nil; +{$else} + +function SDL_GetDisplayUsableBounds(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayUsableBounds' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * \brief Get the dots/pixels-per-inch for a display + * + * \note Diagonal, horizontal and vertical DPI can all be optionally + * returned if the parameter is non-NULL. + * + * \return 0 on success, or -1 if no DPI information is available or the index is out of range. + * + * \sa SDL_GetNumVideoDisplays() + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetDisplayDPI_fun = function(displayIndex: cint; ddpi, hdpi, vdpi: pcfloat): cint; cdecl; +Var + SDL_GetDisplayDPI : TSDL_GetDisplayDPI_fun = Nil; +{$else} + +function SDL_GetDisplayDPI(displayIndex: cint; ddpi, hdpi, vdpi: pcfloat): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayDPI' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Get the orientation of a display + * + * \return The orientation of the display, or SDL_ORIENTATION_UNKNOWN if it isn't available. + * + * \sa SDL_GetNumVideoDisplays() + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetDisplayOrientation_fun = function(displayIndex: cint): TSDL_DisplayOrientation; cdecl; +Var + SDL_GetDisplayOrientation : TSDL_GetDisplayOrientation_fun = Nil; +{$else} + +function SDL_GetDisplayOrientation(displayIndex: cint): TSDL_DisplayOrientation; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayOrientation' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Returns the number of available display modes. + * + * SDL_GetDisplayMode() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetNumDisplayModes_fun = function(displayIndex: cint): cint; cdecl; +Var + SDL_GetNumDisplayModes : TSDL_GetNumDisplayModes_fun = Nil; +{$else} + +function SDL_GetNumDisplayModes(displayIndex: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumDisplayModes' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Fill in information about a specific display mode. + * + * The display modes are sorted in this priority: + * bits per pixel -> more colors to fewer colors + * width -> largest to smallest + * height -> largest to smallest + * refresh rate -> highest to lowest + * + * SDL_GetNumDisplayModes() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetDisplayMode_fun = function(displayIndex: cint; modeIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; +Var + SDL_GetDisplayMode : TSDL_GetDisplayMode_fun = Nil; +{$else} + +function SDL_GetDisplayMode(displayIndex: cint; modeIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDisplayMode' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Fill in information about the desktop display mode. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetDesktopDisplayMode_fun = function(displayIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; +Var + SDL_GetDesktopDisplayMode : TSDL_GetDesktopDisplayMode_fun = Nil; +{$else} + +function SDL_GetDesktopDisplayMode(displayIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDesktopDisplayMode' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Fill in information about the current display mode. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetCurrentDisplayMode_fun = function(displayIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; +Var + SDL_GetCurrentDisplayMode : TSDL_GetCurrentDisplayMode_fun = Nil; +{$else} + +function SDL_GetCurrentDisplayMode(displayIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCurrentDisplayIndex' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the closest match to the requested display mode. + * + * mode The desired display mode + * closest A pointer to a display mode to be filled in with the closest + * match of the available display modes. + * + * The passed in value closest, or nil if no matching video mode + * was available. + * + * The available display modes are scanned, and closest is filled in with the + * closest mode matching the requested mode and returned. The mode format and + * refresh_rate default to the desktop mode if they are 0. The modes are + * scanned with size being first priority, format being second priority, and + * finally checking the refresh_rate. If all the available modes are too + * small, then nil is returned. + * + * SDL_GetNumDisplayModes() + * SDL_GetDisplayMode() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetClosestDisplayMode_fun = function(displayIndex: cint; const mode: PSDL_DisplayMode; closest: PSDL_DisplayMode): PSDL_DisplayMode; cdecl; +Var + SDL_GetClosestDisplayMode : TSDL_GetClosestDisplayMode_fun = Nil; +{$else} + +function SDL_GetClosestDisplayMode(displayIndex: cint; const mode: PSDL_DisplayMode; closest: PSDL_DisplayMode): PSDL_DisplayMode; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetClosestDisplayMode' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the index of the display containing a point + * + * \param point the point to query + * \returns the index of the display containing the point or a negative error + * code on failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GetDisplayBounds + * \sa SDL_GetNumVideoDisplays + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetPointDisplayIndex_fun = function(const point: PSDL_Point): cint; cdecl; +Var + SDL_GetPointDisplayIndex : TSDL_GetPointDisplayIndex_fun = Nil; +{$else} + +function SDL_GetPointDisplayIndex(const point: PSDL_Point): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPointDisplayIndex' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the index of the display primarily containing a rect + * + * \param rect the rect to query + * \returns the index of the display entirely containing the rect or closest + * to the center of the rect on success or a negative error code on + * failure; call SDL_GetError() for more information. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GetDisplayBounds + * \sa SDL_GetNumVideoDisplays + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetRectDisplayIndex_fun = function(const rect: PSDL_Rect): cint; cdecl; +Var + SDL_GetRectDisplayIndex : TSDL_GetRectDisplayIndex_fun = Nil; +{$else} + +function SDL_GetRectDisplayIndex(const rect: PSDL_Rect): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRectDisplayIndex' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the display index associated with a window. + * + * the display index of the display containing the center of the + * window, or -1 on error. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowDisplayIndex_fun = function(window: PSDL_Window): cint; cdecl; +Var + SDL_GetWindowDisplayIndex : TSDL_GetWindowDisplayIndex_fun = Nil; +{$else} + +function SDL_GetWindowDisplayIndex(window: PSDL_Window): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowDisplayIndex' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the display mode used when a fullscreen window is visible. + * + * By default the window's dimensions and the desktop format and refresh rate + * are used. + * + * mode The mode to use, or nil for the default mode. + * + * 0 on success, or -1 if setting the display mode failed. + * + * SDL_GetWindowDisplayMode() + * SDL_SetWindowFullscreen() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowDisplayMode_fun = function(window: PSDL_Window; const mode: PSDL_DisplayMode): cint; cdecl; +Var + SDL_SetWindowDisplayMode : TSDL_SetWindowDisplayMode_fun = Nil; +{$else} + +function SDL_SetWindowDisplayMode(window: PSDL_Window; const mode: PSDL_DisplayMode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowDisplayMode' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Fill in information about the display mode used when a fullscreen + * window is visible. + * + * SDL_SetWindowDisplayMode() + * SDL_SetWindowFullscreen() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowDisplayMode_fun = function(window: PSDL_Window; mode: PSDL_DisplayMode): cint; cdecl; +Var + SDL_GetWindowDisplayMode : TSDL_GetWindowDisplayMode_fun = Nil; +{$else} + +function SDL_GetWindowDisplayMode(window: PSDL_Window; mode: PSDL_DisplayMode): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowDisplayMode' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Get the raw ICC profile data for the screen the window is currently on. + * + * Data returned should be freed with SDL_free(). + * + * \param window the window to query + * \param size the size of the ICC profile + * \returns the raw ICC profile data on success or NIL on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.18. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowICCProfile_fun = function(window: PSDL_Window; size: pcsize_t): Pointer; cdecl; +Var + SDL_GetWindowICCProfile : TSDL_GetWindowICCProfile_fun = Nil; +{$else} + +function SDL_GetWindowICCProfile(window: PSDL_Window; size: pcsize_t): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowICCProfile' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the pixel format associated with the window. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowPixelFormat_fun = function(window: PSDL_Window): cuint32; cdecl; +Var + SDL_GetWindowPixelFormat : TSDL_GetWindowPixelFormat_fun = Nil; +{$else} + +function SDL_GetWindowPixelFormat(window: PSDL_Window): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowPixelFormat' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * \brief Create a window with the specified position, dimensions, and flags. + * + * \param title The title of the window, in UTF-8 encoding. + * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or + * ::SDL_WINDOWPOS_UNDEFINED. + * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or + * ::SDL_WINDOWPOS_UNDEFINED. + * \param w The width of the window, in screen coordinates. + * \param h The height of the window, in screen coordinates. + * \param flags The flags for the window, a mask of any of the following: + * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL, + * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS, + * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED, + * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED, + * ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN. + * + * \return The created window, or NULL if window creation failed. + * + * If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size + * in pixels may differ from its size in screen coordinates on platforms with + * high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query + * the client area's size in screen coordinates, and SDL_GL_GetDrawableSize(), + * SDL_Vulkan_GetDrawableSize(), or SDL_GetRendererOutputSize() to query the + * drawable size in pixels. + * + * If the window is created with any of the SDL_WINDOW_OPENGL or + * SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function + * (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the + * corresponding UnloadLibrary function is called by SDL_DestroyWindow(). + * + * If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver, + * SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail. + * + * \note On non-Apple devices, SDL requires you to either not link to the + * Vulkan loader or link to a dynamic library version. This limitation + * may be removed in a future version of SDL. + * + * \sa SDL_DestroyWindow() + * \sa SDL_GL_LoadLibrary() + * \sa SDL_Vulkan_LoadLibrary() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateWindow_fun = function(const title: PAnsiChar; x: cint; y: cint; w: cint; h: cint; flags: TSDL_WindowFlags): PSDL_Window; cdecl; +Var + SDL_CreateWindow : TSDL_CreateWindow_fun = Nil; +{$else} + +function SDL_CreateWindow(const title: PAnsiChar; x: cint; y: cint; w: cint; h: cint; flags: TSDL_WindowFlags): PSDL_Window; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateWindow' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Create an SDL window from an existing native window. + * + * data A pointer to driver-dependent window creation data + * + * The id of the window created, or zero if window creation failed. + * + * SDL_DestroyWindow() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_CreateWindowFrom_fun = function(const data: Pointer): PSDL_Window; cdecl; +Var + SDL_CreateWindowFrom : TSDL_CreateWindowFrom_fun = Nil; +{$else} + +function SDL_CreateWindowFrom(const data: Pointer): PSDL_Window; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateWindowFrom' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the numeric ID of a window, for logging purposes. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowID_fun = function(window: PSDL_Window): cuint32; cdecl; +Var + SDL_GetWindowID : TSDL_GetWindowID_fun = Nil; +{$else} + +function SDL_GetWindowID(window: PSDL_Window): cuint32; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowID' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get a window from a stored ID, or nil if it doesn't exist. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowFromID_fun = function(id: cuint32): PSDL_Window; cdecl; +Var + SDL_GetWindowFromID : TSDL_GetWindowFromID_fun = Nil; +{$else} + +function SDL_GetWindowFromID(id: cuint32): PSDL_Window; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowFromID' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the window flags. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowFlags_fun = function(window: PSDL_Window): TSDL_WindowFlags; cdecl; +Var + SDL_GetWindowFlags : TSDL_GetWindowFlags_fun = Nil; +{$else} + +function SDL_GetWindowFlags(window: PSDL_Window): TSDL_WindowFlags; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowFlags' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the title of a window, in UTF-8 format. + * + * SDL_GetWindowTitle() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowTitle_proc = procedure(window: PSDL_Window; const title: PAnsiChar); cdecl; +Var + SDL_SetWindowTitle : TSDL_SetWindowTitle_proc = Nil; +{$else} + +procedure SDL_SetWindowTitle(window: PSDL_Window; const title: PAnsiChar); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowTitle' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the title of a window, in UTF-8 format. + * + * SDL_SetWindowTitle() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowTitle_fun = function(window: PSDL_Window): PAnsiChar; cdecl; +Var + SDL_GetWindowTitle : TSDL_GetWindowTitle_fun = Nil; +{$else} + +function SDL_GetWindowTitle(window: PSDL_Window): PAnsiChar; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowTitle' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the icon for a window. + * + * icon The icon for the window. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowIcon_proc = procedure(window: PSDL_Window; icon: PSDL_Surface); cdecl; +Var + SDL_SetWindowIcon : TSDL_SetWindowIcon_proc = Nil; +{$else} + +procedure SDL_SetWindowIcon(window: PSDL_Window; icon: PSDL_Surface); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowIcon' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Associate an arbitrary named pointer with a window. + * + * window The window to associate with the pointer. + * name The name of the pointer. + * userdata The associated pointer. + * + * The previous value associated with 'name' + * + * The name is case-sensitive. + * + * SDL_GetWindowData() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowData_fun = function(window: PSDL_Window; const name: PAnsiChar; userdata: Pointer): Pointer; cdecl; +Var + SDL_SetWindowData : TSDL_SetWindowData_fun = Nil; +{$else} + +function SDL_SetWindowData(window: PSDL_Window; const name: PAnsiChar; userdata: Pointer): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowData' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Retrieve the data pointer associated with a window. + * + * window The window to query. + * name The name of the pointer. + * + * The value associated with 'name' + * + * SDL_SetWindowData() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowData_fun = function(window: PSDL_Window; const name: PAnsiChar): Pointer; cdecl; +Var + SDL_GetWindowData : TSDL_GetWindowData_fun = Nil; +{$else} + +function SDL_GetWindowData(window: PSDL_Window; const name: PAnsiChar): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowData' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the position of a window. + * + * window The window to reposition. + * x The x coordinate of the window, SDL_WINDOWPOS_CENTERED, or + * SDL_WINDOWPOS_UNDEFINED. + * y The y coordinate of the window, SDL_WINDOWPOS_CENTERED, or + * SDL_WINDOWPOS_UNDEFINED. + * + * The window coordinate origin is the upper left of the display. + * + * SDL_GetWindowPosition() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowPosition_proc = procedure(window: PSDL_Window; x: cint; y: cint); cdecl; +Var + SDL_SetWindowPosition : TSDL_SetWindowPosition_proc = Nil; +{$else} + +procedure SDL_SetWindowPosition(window: PSDL_Window; x: cint; y: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowPosition' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the position of a window. + * + * x Pointer to variable for storing the x position, may be nil + * y Pointer to variable for storing the y position, may be nil + * + * SDL_SetWindowPosition() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowPosition_proc = procedure(window: PSDL_Window; x: pcint; y: pcint); cdecl; +Var + SDL_GetWindowPosition : TSDL_GetWindowPosition_proc = Nil; +{$else} + +procedure SDL_GetWindowPosition(window: PSDL_Window; x: pcint; y: pcint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowPosition' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the size of a window's client area. + * + * w The width of the window, must be >0 + * h The height of the window, must be >0 + * + * You can't change the size of a fullscreen window, it automatically + * matches the size of the display mode. + * + * SDL_GetWindowSize() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowSize_proc = procedure(window: PSDL_Window; w: cint; h: cint); cdecl; +Var + SDL_SetWindowSize : TSDL_SetWindowSize_proc = Nil; +{$else} + +procedure SDL_SetWindowSize(window: PSDL_Window; w: cint; h: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowSize' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the size of a window's client area. + * + * w Pointer to variable for storing the width, may be nil + * h Pointer to variable for storing the height, may be nil + * + * SDL_SetWindowSize() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowSize_proc = procedure(window: PSDL_Window; w: pcint; h: pcint); cdecl; +Var + SDL_GetWindowSize : TSDL_GetWindowSize_proc = Nil; +{$else} + +procedure SDL_GetWindowSize(window: PSDL_Window; w: pcint; h: pcint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowSize' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * \brief Get the size of a window's borders (decorations) around the client area. + * + * \param window The window to query. + * \param top Pointer to variable for storing the size of the top border. NULL is permitted. + * \param left Pointer to variable for storing the size of the left border. NULL is permitted. + * \param bottom Pointer to variable for storing the size of the bottom border. NULL is permitted. + * \param right Pointer to variable for storing the size of the right border. NULL is permitted. + * + * \return 0 on success, or -1 if getting this information is not supported. + * + * \note if this function fails (returns -1), the size values will be + * initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as + * if the window in question was borderless. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowBordersSize_fun = function(window: PSDL_Window; top, left, bottom, right: pcint): cint; cdecl; +Var + SDL_GetWindowBordersSize : TSDL_GetWindowBordersSize_fun = Nil; +{$else} + +function SDL_GetWindowBordersSize(window: PSDL_Window; top, left, bottom, right: pcint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowBordersSize' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the size of a window in pixels. + * + * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI + * drawable, i.e. the window was created with `SDL_WINDOW_ALLOW_HIGHDPI` on a + * platform with high-DPI support (Apple calls this "Retina"), and not + * disabled by the `SDL_HINT_VIDEO_HIGHDPI_DISABLED` hint. + * + * \param window the window from which the drawable size should be queried + * \param w a pointer to variable for storing the width in pixels, may be NIL + * \param h a pointer to variable for storing the height in pixels, may be + * NIL + * + * \since This function is available since SDL 2.26.0. + * + * \sa SDL_CreateWindow + * \sa SDL_GetWindowSize + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowSizeInPixels_proc = procedure(window: PSDL_Window; w, h: pcuint); cdecl; +Var + SDL_GetWindowSizeInPixels : TSDL_GetWindowSizeInPixels_proc = Nil; +{$else} + +procedure SDL_GetWindowSizeInPixels(window: PSDL_Window; w, h: pcuint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowSizeInPixels' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the minimum size of a window's client area. + * + * min_w The minimum width of the window, must be >0 + * min_h The minimum height of the window, must be >0 + * + * You can't change the minimum size of a fullscreen window, it + * automatically matches the size of the display mode. + * + * SDL_GetWindowMinimumSize() + * SDL_SetWindowMaximumSize() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowMinimumSize_proc = procedure(window: PSDL_Window; min_w: cint; min_h: cint); cdecl; +Var + SDL_SetWindowMinimumSize : TSDL_SetWindowMinimumSize_proc = Nil; +{$else} + +procedure SDL_SetWindowMinimumSize(window: PSDL_Window; min_w: cint; min_h: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowMinimumSize' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the minimum size of a window's client area. + * + * w Pointer to variable for storing the minimum width, may be nil + * h Pointer to variable for storing the minimum height, may be nil + * + * SDL_GetWindowMaximumSize() + * SDL_SetWindowMinimumSize() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowMinimumSize_proc = procedure(window: PSDL_Window; w: pcint; h: pcint); cdecl; +Var + SDL_GetWindowMinimumSize : TSDL_GetWindowMinimumSize_proc = Nil; +{$else} + +procedure SDL_GetWindowMinimumSize(window: PSDL_Window; w: pcint; h: pcint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowMinimumSize' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the maximum size of a window's client area. + * + * max_w The maximum width of the window, must be >0 + * max_h The maximum height of the window, must be >0 + * + * You can't change the maximum size of a fullscreen window, it + * automatically matches the size of the display mode. + * + * SDL_GetWindowMaximumSize() + * SDL_SetWindowMinimumSize() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowMaximumSize_proc = procedure(window: PSDL_Window; max_w: cint; max_h: cint); cdecl; +Var + SDL_SetWindowMaximumSize : TSDL_SetWindowMaximumSize_proc = Nil; +{$else} + +procedure SDL_SetWindowMaximumSize(window: PSDL_Window; max_w: cint; max_h: cint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowMaximumSize' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the maximum size of a window's client area. + * + * w Pointer to variable for storing the maximum width, may be nil + * h Pointer to variable for storing the maximum height, may be nil + * + * SDL_GetWindowMinimumSize() + * SDL_SetWindowMaximumSize() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowMaximumSize_proc = procedure(window: PSDL_Window; w: pcint; h: pcint); cdecl; +Var + SDL_GetWindowMaximumSize : TSDL_GetWindowMaximumSize_proc = Nil; +{$else} + +procedure SDL_GetWindowMaximumSize(window: PSDL_Window; w: pcint; h: pcint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowMaximumSize' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the border state of a window. + * + * This will add or remove the window's SDL_WINDOW_BORDERLESS flag and + * add or remove the border from the actual window. This is a no-op if the + * window's border already matches the requested state. + * + * window The window of which to change the border state. + * bordered SDL_FALSE to remove border, SDL_TRUE to add border. + * + * You can't change the border state of a fullscreen window. + * + * SDL_GetWindowFlags() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowBordered_proc = procedure(window: PSDL_Window; bordered: TSDL_Bool); cdecl; +Var + SDL_SetWindowBordered : TSDL_SetWindowBordered_proc = Nil; +{$else} + +procedure SDL_SetWindowBordered(window: PSDL_Window; bordered: TSDL_Bool); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowBordered' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * \brief Set the user-resizable state of a window. + * + * This will add or remove the window's SDL_WINDOW_RESIZABLE flag and + * allow/disallow user resizing of the window. This is a no-op if the + * window's resizable state already matches the requested state. + * + * \param window The window of which to change the resizable state. + * \param resizable SDL_TRUE to allow resizing, SDL_FALSE to disallow. + * + * \note You can't change the resizable state of a fullscreen window. + * + * \sa SDL_GetWindowFlags() + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowResizable_proc = procedure(window: PSDL_Window; resizable: TSDL_Bool); cdecl; +Var + SDL_SetWindowResizable : TSDL_SetWindowResizable_proc = Nil; +{$else} + +procedure SDL_SetWindowResizable(window: PSDL_Window; resizable: TSDL_Bool); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowResizable' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Set the window to always be above the others. + * + * This will add or remove the window's `SDL_WINDOW_ALWAYS_ON_TOP` flag. This + * will bring the window to the front and keep the window above the rest. + * + * \param window The window of which to change the always on top state + * \param on_top SDL_TRUE to set the window always on top, SDL_FALSE to + * disable + * + * \since This function is available since SDL 2.0.16. + * + * \sa SDL_GetWindowFlags + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowAlwaysOnTop_proc = procedure(window: PSDL_Window; on_top: TSDL_Bool); cdecl; +Var + SDL_SetWindowAlwaysOnTop : TSDL_SetWindowAlwaysOnTop_proc = Nil; +{$else} + +procedure SDL_SetWindowAlwaysOnTop(window: PSDL_Window; on_top: TSDL_Bool); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowAlwaysOnTop' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Show a window. + * + * SDL_HideWindow() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_ShowWindow_proc = procedure(window: PSDL_Window); cdecl; +Var + SDL_ShowWindow : TSDL_ShowWindow_proc = Nil; +{$else} + +procedure SDL_ShowWindow(window: PSDL_Window); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ShowWindow' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Hide a window. + * + * SDL_ShowWindow() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HideWindow_proc = procedure(window: PSDL_Window); cdecl; +Var + SDL_HideWindow : TSDL_HideWindow_proc = Nil; +{$else} + +procedure SDL_HideWindow(window: PSDL_Window); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HideWindow' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Raise a window above other windows and set the input focus. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RaiseWindow_proc = procedure(window: PSDL_Window); cdecl; +Var + SDL_RaiseWindow : TSDL_RaiseWindow_proc = Nil; +{$else} + +procedure SDL_RaiseWindow(window: PSDL_Window); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RaiseWindow' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Make a window as large as possible. + * + * SDL_RestoreWindow() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_MaximizeWindow_proc = procedure(window: PSDL_Window); cdecl; +Var + SDL_MaximizeWindow : TSDL_MaximizeWindow_proc = Nil; +{$else} + +procedure SDL_MaximizeWindow(window: PSDL_Window); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MaximizeWindow' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Minimize a window to an iconic representation. + * + * SDL_RestoreWindow() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_MinimizeWindow_proc = procedure(window: PSDL_Window); cdecl; +Var + SDL_MinimizeWindow : TSDL_MinimizeWindow_proc = Nil; +{$else} + +procedure SDL_MinimizeWindow(window: PSDL_Window); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MinimizeWindow' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Restore the size and position of a minimized or maximized window. + * + * SDL_MaximizeWindow() + * SDL_MinimizeWindow() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_RestoreWindow_proc = procedure(window: PSDL_Window); cdecl; +Var + SDL_RestoreWindow : TSDL_RestoreWindow_proc = Nil; +{$else} + +procedure SDL_RestoreWindow(window: PSDL_Window); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RestoreWindow' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set a window's fullscreen state. + * + * 0 on success, or -1 if setting the display mode failed. + * + * SDL_SetWindowDisplayMode() + * SDL_GetWindowDisplayMode() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowFullscreen_fun = function(window: PSDL_Window; flags: TSDL_WindowFlags): cint; cdecl; +Var + SDL_SetWindowFullscreen : TSDL_SetWindowFullscreen_fun = Nil; +{$else} + +function SDL_SetWindowFullscreen(window: PSDL_Window; flags: TSDL_WindowFlags): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowFullscreen' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Return whether the window has a surface associated with it. + * + * \returns SDL_TRUE if there is a surface associated with the window, or + * SDL_FALSE otherwise. + * + * \since This function is available since SDL 2.28.0. + * + * \sa SDL_GetWindowSurface + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_HasWindowSurface_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; +Var + SDL_HasWindowSurface : TSDL_HasWindowSurface_fun = Nil; +{$else} + +function SDL_HasWindowSurface(window: PSDL_Window): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasWindowSurface' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the SDL surface associated with the window. + * + * The window's framebuffer surface, or nil on error. + * + * A new surface will be created with the optimal format for the window, + * if necessary. This surface will be freed when the window is destroyed. + * + * You may not combine this with 3D or the rendering API on this window. + * + * SDL_UpdateWindowSurface() + * SDL_UpdateWindowSurfaceRects() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowSurface_fun = function(window: PSDL_Window): PSDL_Surface; cdecl; +Var + SDL_GetWindowSurface : TSDL_GetWindowSurface_fun = Nil; +{$else} + +function SDL_GetWindowSurface(window: PSDL_Window): PSDL_Surface; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowSurface' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Copy the window surface to the screen. + * + * 0 on success, or -1 on error. + * + * SDL_GetWindowSurface() + * SDL_UpdateWindowSurfaceRects() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UpdateWindowSurface_fun = function(window: PSDL_Window): cint; cdecl; +Var + SDL_UpdateWindowSurface : TSDL_UpdateWindowSurface_fun = Nil; +{$else} + +function SDL_UpdateWindowSurface(window: PSDL_Window): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateWindowSurface' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Copy a number of rectangles on the window surface to the screen. + * + * 0 on success, or -1 on error. + * + * SDL_GetWindowSurface() + * SDL_UpdateWindowSurfaceRect() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_UpdateWindowSurfaceRects_fun = function(window: PSDL_Window; rects: PSDL_Rect; numrects: cint): cint; cdecl; +Var + SDL_UpdateWindowSurfaceRects : TSDL_UpdateWindowSurfaceRects_fun = Nil; +{$else} + +function SDL_UpdateWindowSurfaceRects(window: PSDL_Window; rects: PSDL_Rect; numrects: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateWindowSurfaceRects' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Destroy the surface associated with the window. + * + * \param window the window to update + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.28.0. + * + * \sa SDL_GetWindowSurface + * \sa SDL_HasWindowSurface + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_DestroyWindowSurface_fun = function(window: PSDL_Window): cint; cdecl; +Var + SDL_DestroyWindowSurface : TSDL_DestroyWindowSurface_fun = Nil; +{$else} + +function SDL_DestroyWindowSurface(window: PSDL_Window): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyWindowSurface' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set a window's input grab mode. + * + * grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input. + * + * SDL_GetWindowGrab() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowGrab_proc = procedure(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; +Var + SDL_SetWindowGrab : TSDL_SetWindowGrab_proc = Nil; +{$else} + +procedure SDL_SetWindowGrab(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowGrab' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get a window's input grab mode. + * + * This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise. + * + * SDL_SetWindowGrab() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowGrab_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; +Var + SDL_GetWindowGrab : TSDL_GetWindowGrab_fun = Nil; +{$else} + +function SDL_GetWindowGrab(window: PSDL_Window): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowGrab' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * Set a window's keyboard grab mode. + * + * Keyboard grab enables capture of system keyboard shortcuts like Alt+Tab or + * the Meta/Super key. Note that not all system keyboard shortcuts can be + * captured by applications (one example is Ctrl+Alt+Del on Windows). + * + * This is primarily intended for specialized applications such as VNC clients + * or VM frontends. Normal games should not use keyboard grab. + * + * When keyboard grab is enabled, SDL will continue to handle Alt+Tab when the + * window is full-screen to ensure the user is not trapped in your + * application. If you have a custom keyboard shortcut to exit fullscreen + * mode, you may suppress this behavior with + * `SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED`. + * + * If the caller enables a grab while another window is currently grabbed, the + * other window loses its grab in favor of the caller's window. + * + * \param window The window for which the keyboard grab mode should be set. + * \param grabbed This is SDL_TRUE to grab keyboard, and SDL_FALSE to release. + * + * \since This function is available since SDL 2.0.16. + * + * \sa SDL_GetWindowKeyboardGrab + * \sa SDL_SetWindowMouseGrab + * \sa SDL_SetWindowGrab + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowKeyboardGrab_proc = procedure(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; +Var + SDL_SetWindowKeyboardGrab : TSDL_SetWindowKeyboardGrab_proc = Nil; +{$else} + +procedure SDL_SetWindowKeyboardGrab(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowKeyboardGrab' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get a window's keyboard grab mode. + * + * Returns SDL_TRUE if keyboard is grabbed, and SDL_FALSE otherwise. + * + * SDL_SetWindowKeyboardGrab() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowKeyboardGrab_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; +Var + SDL_GetWindowKeyboardGrab : TSDL_GetWindowKeyboardGrab_fun = Nil; +{$else} + +function SDL_GetWindowKeyboardGrab(window: PSDL_Window): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowKeyboardGrab' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set a window's mouse grab mode. + * + * window The window for which the mouse grab mode should be set. + * grabbed This is SDL_TRUE to grab mouse, and SDL_FALSE to release. + * + * SDL_GetWindowMouseGrab() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowMouseGrab_proc = procedure(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; +Var + SDL_SetWindowMouseGrab : TSDL_SetWindowMouseGrab_proc = Nil; +{$else} + +procedure SDL_SetWindowMouseGrab(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowMouseGrab' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get a window's mouse grab mode. + * + * Returns SDL_TRUE if mouse is grabbed, and SDL_FALSE otherwise. + * + * SDL_SetWindowMouseGrab() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowMouseGrab_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; +Var + SDL_GetWindowMouseGrab : TSDL_GetWindowMouseGrab_fun = Nil; +{$else} + +function SDL_GetWindowMouseGrab(window: PSDL_Window): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowMouseGrab' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Confines the cursor to the specified area of a window. + * + * window The window that will be associated with the barrier. + * rect A rectangle area in window-relative coordinates. If NULL the barrier for the specified window will be destroyed. + * + * SDL_GetWindowMouseRect() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowMouseRect_proc = procedure(window: PSDL_Window; rect: PSDL_Rect); cdecl; +Var + SDL_SetWindowMouseRect : TSDL_SetWindowMouseRect_proc = Nil; +{$else} + +procedure SDL_SetWindowMouseRect(window: PSDL_Window; rect: PSDL_Rect); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowMouseRect' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the mouse confinement rectangle of a window. + * + * Returns A pointer to the mouse confinement rectangle of a window, or NULL if there isn't one. + * + * SDL_SetWindowMouseRect() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowMouseRect_fun = function(window: PSDL_Window): PSDL_Rect; cdecl; +Var + SDL_GetWindowMouseRect : TSDL_GetWindowMouseRect_fun = Nil; +{$else} + +function SDL_GetWindowMouseRect(window: PSDL_Window): PSDL_Rect; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowMouseRect' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * \brief Get the window that currently has an input grab enabled. + * + * \return This returns the window if input is grabbed, and NULL otherwise. + * + * \sa SDL_SetWindowGrab() + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetGrabbedWindow_fun = function(): PSDL_Window; cdecl; +Var + SDL_GetGrabbedWindow : TSDL_GetGrabbedWindow_fun = Nil; +{$else} + +function SDL_GetGrabbedWindow(): PSDL_Window; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetGrabbedWindow' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the brightness (gamma correction) for a window. + * + * 0 on success, or -1 if setting the brightness isn't supported. + * + * SDL_GetWindowBrightness() + * SDL_SetWindowGammaRamp() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowBrightness_fun = function(window: PSDL_Window; brightness: cfloat): cint; cdecl; +Var + SDL_SetWindowBrightness : TSDL_SetWindowBrightness_fun = Nil; +{$else} + +function SDL_SetWindowBrightness(window: PSDL_Window; brightness: cfloat): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowBrightness' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the brightness (gamma correction) for a window. + * + * The last brightness value passed to SDL_SetWindowBrightness() + * + * SDL_SetWindowBrightness() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowBrightness_fun = function(window: PSDL_Window): cfloat; cdecl; +Var + SDL_GetWindowBrightness : TSDL_GetWindowBrightness_fun = Nil; +{$else} + +function SDL_GetWindowBrightness(window: PSDL_Window): cfloat; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowBrightness' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * \brief Set the opacity for a window + * + * \param window The window which will be made transparent or opaque + * \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be + * clamped internally between 0.0f and 1.0f. + * + * \return 0 on success, or -1 if setting the opacity isn't supported. + * + * \sa SDL_GetWindowOpacity() + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowOpacity_fun = function(window: PSDL_Window; opacity: cfloat): cint; cdecl; +Var + SDL_SetWindowOpacity : TSDL_SetWindowOpacity_fun = Nil; +{$else} + +function SDL_SetWindowOpacity(window: PSDL_Window; opacity: cfloat): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowOpacity' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * \brief Get the opacity of a window. + * + * If transparency isn't supported on this platform, opacity will be reported + * as 1.0f without error. + * + * \param window The window in question. + * \param out_opacity Opacity (0.0f - transparent, 1.0f - opaque) + * + * \return 0 on success, or -1 on error (invalid window, etc). + * + * \sa SDL_SetWindowOpacity() + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowOpacity_fun = function(window: PSDL_Window; out_opacity: pcfloat): cint; cdecl; +Var + SDL_GetWindowOpacity : TSDL_GetWindowOpacity_fun = Nil; +{$else} + +function SDL_GetWindowOpacity(window: PSDL_Window; out_opacity: pcfloat): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowOpacity' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * \brief Sets the window as a modal for another window + * + * \param modal_window The window that should be modal + * \param parent_window The parent window + * + * \return 0 on success, or -1 otherwise. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowModalFor_fun = function(modal_window, parent_window: PSDL_Window): cint; cdecl; +Var + SDL_SetWindowModalFor : TSDL_SetWindowModalFor_fun = Nil; +{$else} + +function SDL_SetWindowModalFor(modal_window, parent_window: PSDL_Window): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowModalFor' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * \brief Explicitly sets input focus to the window. + * + * You almost certainly want SDL_RaiseWindow() instead of this function. Use + * this with caution, as you might give focus to a window that's completely + * obscured by other windows. + * + * \param window The window that should get the input focus + * + * \return 0 on success, or -1 otherwise. + * \sa SDL_RaiseWindow() + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowInputFocus_fun = function(window: PSDL_Window): cint; cdecl; +Var + SDL_SetWindowInputFocus : TSDL_SetWindowInputFocus_fun = Nil; +{$else} + +function SDL_SetWindowInputFocus(window: PSDL_Window): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowInputFocus' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the gamma ramp for a window. + * + * red The translation table for the red channel, or nil. + * green The translation table for the green channel, or nil. + * blue The translation table for the blue channel, or nil. + * + * 0 on success, or -1 if gamma ramps are unsupported. + * + * Set the gamma translation table for the red, green, and blue channels + * of the video hardware. Each table is an array of 256 16-bit quantities, + * representing a mapping between the input and output for that channel. + * The input is the index into the array, and the output is the 16-bit + * gamma value at that index, scaled to the output color precision. + * + * SDL_GetWindowGammaRamp() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowGammaRamp_fun = function(window: PSDL_Window; const red: pcuint16; const green: pcuint16; const blue: pcuint16): cint; cdecl; +Var + SDL_SetWindowGammaRamp : TSDL_SetWindowGammaRamp_fun = Nil; +{$else} + +function SDL_SetWindowGammaRamp(window: PSDL_Window; const red: pcuint16; const green: pcuint16; const blue: pcuint16): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowGammaRamp' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the gamma ramp for a window. + * + * red A pointer to a 256 element array of 16-bit quantities to hold + * the translation table for the red channel, or nil. + * green A pointer to a 256 element array of 16-bit quantities to hold + * the translation table for the green channel, or nil. + * blue A pointer to a 256 element array of 16-bit quantities to hold + * the translation table for the blue channel, or nil. + * + * 0 on success, or -1 if gamma ramps are unsupported. + * + * SDL_SetWindowGammaRamp() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GetWindowGammaRamp_fun = function(window: PSDL_Window; red: pcuint16; green: pcuint16; blue: pcuint16): cint; cdecl; +Var + SDL_GetWindowGammaRamp : TSDL_GetWindowGammaRamp_fun = Nil; +{$else} + +function SDL_GetWindowGammaRamp(window: PSDL_Window; red: pcuint16; green: pcuint16; blue: pcuint16): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowGammaRamp' {$ENDIF} {$ENDIF}; +{$endif} + +{** + * \brief Possible return values from the SDL_HitTest callback. + * + * \sa SDL_HitTest + *} +type + PPSDL_HitTestResult = ^PSDL_HitTestResult; + PSDL_HitTestResult = ^TSDL_HitTestResult; + TSDL_HitTestResult = type Integer; + +const + SDL_HITTEST_NORMAL = TSDL_HitTestResult(0); {**< Region is normal. No special properties. *} + SDL_HITTEST_DRAGGABLE = TSDL_HitTestResult(1); {**< Region can drag entire window. *} + SDL_HITTEST_RESIZE_TOPLEFT = TSDL_HitTestResult(2); + SDL_HITTEST_RESIZE_TOP = TSDL_HitTestResult(3); + SDL_HITTEST_RESIZE_TOPRIGHT = TSDL_HitTestResult(4); + SDL_HITTEST_RESIZE_RIGHT = TSDL_HitTestResult(5); + SDL_HITTEST_RESIZE_BOTTOMRIGHT = TSDL_HitTestResult(6); + SDL_HITTEST_RESIZE_BOTTOM = TSDL_HitTestResult(7); + SDL_HITTEST_RESIZE_BOTTOMLEFT = TSDL_HitTestResult(8); + SDL_HITTEST_RESIZE_LEFT = TSDL_HitTestResult(9); + + {** + * \brief Callback used for hit-testing. + * + * \sa SDL_SetWindowHitTest + *} +type + PPSDL_HitTest = ^PSDL_HitTest; + PSDL_HitTest = ^TSDL_HitTest; + TSDL_HitTest = function(win: PSDL_Window; const area: PSDL_Point; data: Pointer): TSDL_HitTestResult; cdecl; + + {** + * \brief Provide a callback that decides if a window region has special properties. + * + * Normally windows are dragged and resized by decorations provided by the + * system window manager (a title bar, borders, etc), but for some apps, it + * makes sense to drag them from somewhere else inside the window itself; for + * example, one might have a borderless window that wants to be draggable + * from any part, or simulate its own title bar, etc. + * + * This function lets the app provide a callback that designates pieces of + * a given window as special. This callback is run during event processing + * if we need to tell the OS to treat a region of the window specially; the + * use of this callback is known as "hit testing." + * + * Mouse input may not be delivered to your application if it is within + * a special area; the OS will often apply that input to moving the window or + * resizing the window and not deliver it to the application. + * + * Specifying NULL for a callback disables hit-testing. Hit-testing is + * disabled by default. + * + * Platforms that don't support this functionality will return -1 + * unconditionally, even if you're attempting to disable hit-testing. + * + * Your callback may fire at any time, and its firing does not indicate any + * specific behavior (for example, on Windows, this certainly might fire + * when the OS is deciding whether to drag your window, but it fires for lots + * of other reasons, too, some unrelated to anything you probably care about + * _and when the mouse isn't actually at the location it is testing_). + * Since this can fire at any time, you should try to keep your callback + * efficient, devoid of allocations, etc. + * + * \param window The window to set hit-testing on. + * \param callback The callback to call when doing a hit-test. + * \param callback_data An app-defined void pointer passed to the callback. + * \return 0 on success, -1 on error (including unsupported). + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_SetWindowHitTest_fun = function(window: PSDL_Window; callback: TSDL_HitTest; callback_data: Pointer): cint; cdecl; +Var + SDL_SetWindowHitTest : TSDL_SetWindowHitTest_fun = Nil; +{$else} + +function SDL_SetWindowHitTest(window: PSDL_Window; callback: TSDL_HitTest; callback_data: Pointer): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetWindowHitTest' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Request a window to demand attention from the user. + * + * \param window the window to be flashed + * \param operation the flash operation + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. + * + * \since This function is available since SDL 2.0.16. + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_FlashWindow_fun = function(window: PSDL_Window; operation: TSDL_FlashOperation): cint; cdecl; +Var + SDL_FlashWindow : TSDL_FlashWindow_fun = Nil; +{$else} + +function SDL_FlashWindow(window: PSDL_Window; operation: TSDL_FlashOperation): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FlashWindow' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Destroy a window. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_DestroyWindow_proc = procedure(window: PSDL_Window); cdecl; +Var + SDL_DestroyWindow : TSDL_DestroyWindow_proc = Nil; +{$else} + +procedure SDL_DestroyWindow(window: PSDL_Window); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyWindow' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Returns whether the screensaver is currently enabled (default on). + * + * SDL_EnableScreenSaver() + * SDL_DisableScreenSaver() + *} + +function SDL_IsScreenSaverEnabled: TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsScreenSaverEnabled' {$ENDIF} {$ENDIF}; + + {** + * Allow the screen to be blanked by a screensaver + * + * SDL_IsScreenSaverEnabled() + * SDL_DisableScreenSaver() + *} + +procedure SDL_EnableScreenSaver; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EnableScreenSaver' {$ENDIF} {$ENDIF}; + + {** + * Prevent the screen from being blanked by a screensaver + * + * SDL_IsScreenSaverEnabled() + * SDL_EnableScreenSaver() + *} + +procedure SDL_DisableScreenSaver; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DisableScreenSaver' {$ENDIF} {$ENDIF}; + + {** + * OpenGL support functions + *} + + {** + * Dynamically load an OpenGL library. + * + * path The platform dependent OpenGL library name, or nil to open the + * default OpenGL library. + * + * 0 on success, or -1 if the library couldn't be loaded. + * + * This should be done after initializing the video driver, but before + * creating any OpenGL windows. If no OpenGL library is loaded, the default + * library will be loaded upon creation of the first OpenGL window. + * + * If you do this, you need to retrieve all of the GL functions used in + * your program from the dynamic library using SDL_GL_GetProcAddress(). + * + * SDL_GL_GetProcAddress() + * SDL_GL_UnloadLibrary() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_LoadLibrary_fun = function(const path: PAnsiChar): cint; cdecl; +Var + SDL_GL_LoadLibrary : TSDL_GL_LoadLibrary_fun = Nil; +{$else} + +function SDL_GL_LoadLibrary(const path: PAnsiChar): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_LoadLibrary' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the address of an OpenGL function. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_GetProcAddress_fun = function(const proc: PAnsiChar): Pointer; cdecl; +Var + SDL_GL_GetProcAddress : TSDL_GL_GetProcAddress_fun = Nil; +{$else} + +function SDL_GL_GetProcAddress(const proc: PAnsiChar): Pointer; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetProcAddress' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary(). + * + * SDL_GL_LoadLibrary() + *} + +procedure SDL_GL_UnloadLibrary; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_UnloadLibrary' {$ENDIF} {$ENDIF}; + + {** + * Return true if an OpenGL extension is supported for the current + * context. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_ExtensionSupported_fun = function(const extension: PAnsiChar): TSDL_Bool; cdecl; +Var + SDL_GL_ExtensionSupported : TSDL_GL_ExtensionSupported_fun = Nil; +{$else} + +function SDL_GL_ExtensionSupported(const extension: PAnsiChar): TSDL_Bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_ExtensionSupported' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Reset all previously set OpenGL context attributes to their default values + *} +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_ResetAttributes_proc = procedure(); cdecl; +Var + SDL_GL_ResetAttributes : TSDL_GL_ResetAttributes_proc = Nil; +{$else} + +procedure SDL_GL_ResetAttributes(); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_ResetAttributes' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set an OpenGL window attribute before window creation. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_SetAttribute_fun = function(attr: TSDL_GLattr; value: cint): cint; cdecl; +Var + SDL_GL_SetAttribute : TSDL_GL_SetAttribute_fun = Nil; +{$else} + +function SDL_GL_SetAttribute(attr: TSDL_GLattr; value: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_SetAttribute' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the actual value for an attribute from the current context. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_GetAttribute_fun = function(attr: TSDL_GLattr; value: pcint): cint; cdecl; +Var + SDL_GL_GetAttribute : TSDL_GL_GetAttribute_fun = Nil; +{$else} + +function SDL_GL_GetAttribute(attr: TSDL_GLattr; value: pcint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetAttribute' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Create an OpenGL context for use with an OpenGL window, and make it + * current. + * + * SDL_GL_DeleteContext() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_CreateContext_fun = function(window: PSDL_Window): TSDL_GLContext; cdecl; +Var + SDL_GL_CreateContext : TSDL_GL_CreateContext_fun = Nil; +{$else} + +function SDL_GL_CreateContext(window: PSDL_Window): TSDL_GLContext; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_CreateContext' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set up an OpenGL context for rendering into an OpenGL window. + * + * The context must have been created with a compatible window. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_MakeCurrent_fun = function(window: PSDL_Window; context: TSDL_GLContext): cint; cdecl; +Var + SDL_GL_MakeCurrent : TSDL_GL_MakeCurrent_fun = Nil; +{$else} + +function SDL_GL_MakeCurrent(window: PSDL_Window; context: TSDL_GLContext): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_MakeCurrent' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the currently active OpenGL window. + *} +function SDL_GL_GetCurrentWindow: PSDL_Window; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetCurrentWindow' {$ENDIF} {$ENDIF}; + + {** + * Get the currently active OpenGL context. + *} +function SDL_GL_GetCurrentContext: TSDL_GLContext; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetCurrentContext' {$ENDIF} {$ENDIF}; + + {** + * Get the size of a window's underlying drawable in pixels (for use + * with glViewport). + * + * window Window from which the drawable size should be queried + * w Pointer to variable for storing the width in pixels, may be NULL + * h Pointer to variable for storing the height in pixels, may be NULL + * + * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI + * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a + * platform with high-DPI support (Apple calls this "Retina"), and not disabled + * by the SDL_HINT_VIDEO_HIGHDPI_DISABLED hint. + * + * SDL_GetWindowSize() + * SDL_CreateWindow() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_GetDrawableSize_proc = procedure(window: PSDL_Window; w: pcint; h: pcint); cdecl; +Var + SDL_GL_GetDrawableSize : TSDL_GL_GetDrawableSize_proc = Nil; +{$else} + +procedure SDL_GL_GetDrawableSize(window: PSDL_Window; w: pcint; h: pcint); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetDrawableSize' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Set the swap interval for the current OpenGL context. + * + * interval 0 for immediate updates, 1 for updates synchronized with the + * vertical retrace. If the system supports it, you may + * specify -1 to allow late swaps to happen immediately + * instead of waiting for the next retrace. + * + * 0 on success, or -1 if setting the swap interval is not supported. + * + * SDL_GL_GetSwapInterval() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_SetSwapInterval_fun = function(interval: cint): cint; cdecl; +Var + SDL_GL_SetSwapInterval : TSDL_GL_SetSwapInterval_fun = Nil; +{$else} + +function SDL_GL_SetSwapInterval(interval: cint): cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_SetSwapInterval' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Get the swap interval for the current OpenGL context. + * + * 0 if there is no vertical retrace synchronization, 1 if the buffer + * swap is synchronized with the vertical retrace, and -1 if late + * swaps happen immediately instead of waiting for the next retrace. + * If the system can't determine the swap interval, or there isn't a + * valid current context, this will return 0 as a safe default. + * + * SDL_GL_SetSwapInterval() + *} + +function SDL_GL_GetSwapInterval: cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetSwapInterval' {$ENDIF} {$ENDIF}; + + {** + * Swap the OpenGL buffers for a window, if double-buffering is + * supported. + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_SwapWindow_proc = procedure(window: PSDL_Window); cdecl; +Var + SDL_GL_SwapWindow : TSDL_GL_SwapWindow_proc = Nil; +{$else} + +procedure SDL_GL_SwapWindow(window: PSDL_Window); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_SwapWindow' {$ENDIF} {$ENDIF}; +{$endif} + + {** + * Delete an OpenGL context. + * + * SDL_GL_CreateContext() + *} + +{$ifdef SDL_DYNAMIC_LINKING} +Type + TSDL_GL_DeleteContext_proc = procedure(context: TSDL_GLContext); cdecl; +Var + SDL_GL_DeleteContext : TSDL_GL_DeleteContext_proc = Nil; +{$else} + +procedure SDL_GL_DeleteContext(context: TSDL_GLContext); cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_DeleteContext' {$ENDIF} {$ENDIF}; +{$endif} + + {*OpenGL support functions*} From 047221cc4cab1d4fda4d92bf3fd4d320608f7d59 Mon Sep 17 00:00:00 2001 From: PascalCorpsman Date: Thu, 21 Nov 2024 10:57:46 +0100 Subject: [PATCH 3/8] FIX: SDL_DYNAMIC_LINKING -> SDL_RUNTIME_LOADING --- units/sdl.inc | 10 +- units/sdl2.pas | 8 +- units/sdl_dnymic_linking.inc | 2 +- units/sdlaudio.inc | 62 ++++++------- units/sdlblendmode.inc | 2 +- units/sdlclipboard.inc | 12 +-- units/sdlcpuinfo.inc | 2 +- units/sdlerror.inc | 6 +- units/sdlfilesystem.inc | 4 +- units/sdlgamecontroller.inc | 76 ++++++++-------- units/sdlgesture.inc | 8 +- units/sdlguid.inc | 4 +- units/sdlhaptic.inc | 54 +++++------ units/sdlhints.inc | 18 ++-- units/sdljoystick.inc | 116 +++++++++++------------ units/sdlkeyboard.inc | 20 ++-- units/sdlloadso.inc | 4 +- units/sdllog.inc | 26 +++--- units/sdlmessagebox.inc | 4 +- units/sdlmouse.inc | 26 +++--- units/sdlmutex.inc | 32 +++---- units/sdlpixels.inc | 28 +++--- units/sdlpower.inc | 2 +- units/sdlrect.inc | 20 ++-- units/sdlrenderer.inc | 32 +++---- units/sdlrwops.inc | 54 +++++------ units/sdlshape.inc | 8 +- units/sdlstdinc.inc | 130 +++++++++++++------------- units/sdlsurface.inc | 76 ++++++++-------- units/sdlsystem.inc | 54 +++++------ units/sdlsyswm.inc | 2 +- units/sdlthread.inc | 22 ++--- units/sdltimer.inc | 6 +- units/sdltouch.inc | 12 +-- units/sdlversion.inc | 2 +- units/sdlvideo.inc | 172 +++++++++++++++++------------------ 36 files changed, 558 insertions(+), 558 deletions(-) diff --git a/units/sdl.inc b/units/sdl.inc index b6e110ff..d5a272f5 100644 --- a/units/sdl.inc +++ b/units/sdl.inc @@ -41,7 +41,7 @@ const * Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup * signal handlers for some commonly ignored fatal signals (like SIGSEGV). *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_Init_fun = function(flags: TSDL_Init): cint; cdecl; Var @@ -55,7 +55,7 @@ function SDL_Init(flags: TSDL_Init): cint; cdecl; {** * This function initializes specific SDL subsystems *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_InitSubSystem_fun = function(flags: TSDL_Init): cint; cdecl; Var @@ -69,7 +69,7 @@ function SDL_InitSubSystem(flags: TSDL_Init): cint; cdecl; {** * This function cleans up specific SDL subsystems *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_QuitSubSystem_proc = procedure(flags: TSDL_Init); cdecl; Var @@ -86,7 +86,7 @@ procedure SDL_QuitSubSystem(flags: TSDL_Init); cdecl; * * If flags is 0, it returns a mask of all initialized subsystems. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_WasInit_fun = function(flags: TSDL_Init): cuint32; cdecl; Var @@ -101,7 +101,7 @@ function SDL_WasInit(flags: TSDL_Init): cuint32; cdecl; * This function cleans up all initialized subsystems. You should * call it upon all exit conditions. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_Quit_proc = procedure(); cdecl; Var diff --git a/units/sdl2.pas b/units/sdl2.pas index 10f68b22..c52cb788 100644 --- a/units/sdl2.pas +++ b/units/sdl2.pas @@ -74,7 +74,7 @@ * Not all functions are "ported" yet, so use is on own risk * port missing functions. *} - {.$DEFINE SDL_DYNAMIC_LINKING} + {.$DEFINE SDL_RUNTIME_LOADING} * ---------- End content of file ---------- * @@ -193,7 +193,7 @@ interface {$I sdlsystem.inc} // 2.24.0 {$I sdl.inc} // 2.0.14 -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Function SDL_LoadLib(LibFilename: String): Boolean; Procedure SDL_UnLoadLib(); {$endif} @@ -212,7 +212,7 @@ implementation {$ELSE} AnsiStrings {$ENDIF} - {$ifdef SDL_DYNAMIC_LINKING} + {$ifdef SDL_RUNTIME_LOADING} , dynlibs {$endif} ; @@ -515,7 +515,7 @@ function SDL_GameControllerAddMappingsFromFile(const FilePath: PAnsiChar end; -{$IFDEF SDL_DYNAMIC_LINKING} +{$IFDEF SDL_RUNTIME_LOADING} Finalization SDL_UnLoadLib(); diff --git a/units/sdl_dnymic_linking.inc b/units/sdl_dnymic_linking.inc index 207b26c2..2239956e 100644 --- a/units/sdl_dnymic_linking.inc +++ b/units/sdl_dnymic_linking.inc @@ -1,5 +1,5 @@ -{$IFDEF SDL_DYNAMIC_LINKING} +{$IFDEF SDL_RUNTIME_LOADING} Var LibHandle: TLibHandle = 0; diff --git a/units/sdlaudio.inc b/units/sdlaudio.inc index d30626dc..7ababe1d 100644 --- a/units/sdlaudio.inc +++ b/units/sdlaudio.inc @@ -242,7 +242,7 @@ function SDL_GetNumAudioDrivers: cint; cdecl; * * \sa SDL_GetNumAudioDrivers *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetAudioDriver_fun = function(index: cint): PAnsiChar; cdecl; Var @@ -276,7 +276,7 @@ function SDL_GetAudioDriver(index: cint): PAnsiChar; cdecl; * * \sa SDL_AudioQuit *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_AudioInit_fun = function(driver_name: PAnsiChar): cint; cdecl; Var @@ -368,7 +368,7 @@ function SDL_GetCurrentAudioDriver: PAnsiChar; cdecl; * \sa SDL_PauseAudio * \sa SDL_UnlockAudio *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_OpenAudio_fun = function(desired: PSDL_AudioSpec; obtained: PSDL_AudioSpec): cint; cdecl; Var @@ -437,7 +437,7 @@ type * \sa SDL_GetAudioDeviceName * \sa SDL_OpenAudioDevice *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetNumAudioDevices_fun = function(iscapture: cint): cint; cdecl; Var @@ -473,7 +473,7 @@ function SDL_GetNumAudioDevices(iscapture: cint): cint; cdecl; * \sa SDL_GetNumAudioDevices * \sa SDL_GetDefaultAudioInfo *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetAudioDeviceName_fun = function(index: cint; iscapture: cint): PAnsiChar; cdecl; Var @@ -507,7 +507,7 @@ function SDL_GetAudioDeviceName(index: cint; iscapture: cint): PAnsiChar; cdecl; * \sa SDL_GetNumAudioDevices * \sa SDL_GetDefaultAudioInfo } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetAudioDeviceSpec_fun = function(index: cint; iscapture: cint; spec: PSDL_AudioSpec): cint; cdecl; Var @@ -548,7 +548,7 @@ function SDL_GetAudioDeviceSpec(index: cint; iscapture: cint; spec: PSDL_AudioSp * \sa SDL_GetAudioDeviceSpec * \sa SDL_OpenAudioDevice } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetDefaultAudioInfo_fun = function(name: PPAnsiChar; spec: PSDL_AudioSpec; iscapture: cint): cint; cdecl; Var @@ -670,7 +670,7 @@ function SDL_GetDefaultAudioInfo(name: PPAnsiChar; spec: PSDL_AudioSpec; iscaptu * \sa SDL_PauseAudioDevice * \sa SDL_UnlockAudioDevice *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_OpenAudioDevice_fun = function(device: PAnsiChar; iscapture: cint; @@ -737,7 +737,7 @@ function SDL_GetAudioStatus: TSDL_AudioStatus; cdecl; * * \sa SDL_PauseAudioDevice *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetAudioDeviceStatus_fun = function(dev: TSDL_AudioDeviceID): TSDL_AudioStatus; cdecl; Var @@ -779,7 +779,7 @@ function SDL_GetAudioDeviceStatus(dev: TSDL_AudioDeviceID): TSDL_AudioStatus; cd * \sa SDL_GetAudioStatus * \sa SDL_PauseAudioDevice *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_PauseAudio_proc = procedure(pause_on: cint); cdecl; Var @@ -818,7 +818,7 @@ procedure SDL_PauseAudio(pause_on: cint); cdecl; * * \sa SDL_LockAudioDevice *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_PauseAudioDevice_proc = procedure(dev: TSDL_AudioDeviceID; pause_on: cint); cdecl; Var @@ -912,7 +912,7 @@ procedure SDL_PauseAudioDevice(dev: TSDL_AudioDeviceID; pause_on: cint); cdecl; * \sa SDL_FreeWAV * \sa SDL_LoadWAV *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LoadWAV_RW_fun = function(src: PSDL_RWops; freesrc: cint; @@ -952,7 +952,7 @@ function SDL_LoadWAV(file_: PAnsiChar; spec: PSDL_AudioSpec; audio_buf: ppcuint8 * \sa SDL_LoadWAV * \sa SDL_LoadWAV_RW *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_FreeWAV_proc = procedure(audio_buf: pcuint8); cdecl; Var @@ -995,7 +995,7 @@ procedure SDL_FreeWAV(audio_buf: pcuint8); cdecl; * * \sa SDL_ConvertAudio *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_BuildAudioCVT_fun = function(cvt: PSDL_AudioCVT; src_format: TSDL_AudioFormat; @@ -1056,7 +1056,7 @@ function SDL_BuildAudioCVT(cvt: PSDL_AudioCVT; * * \sa SDL_BuildAudioCVT *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_ConvertAudio_fun = function(cvt: PSDL_AudioCVT): cint; cdecl; Var @@ -1098,7 +1098,7 @@ type * \sa SDL_AudioStreamClear * \sa SDL_FreeAudioStream } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_NewAudioStream_fun = function(src_format: TSDL_AudioFormat; src_channels: cuint8; src_rate: cint; dst_format: TSDL_AudioFormat; dst_channels: cuint8; dst_rate: cint): PSDL_AudioStream; cdecl; @@ -1128,7 +1128,7 @@ function SDL_NewAudioStream(src_format: TSDL_AudioFormat; src_channels: cuint8; * \sa SDL_AudioStreamClear * \sa SDL_FreeAudioStream } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_AudioStreamPut_fun = function(stream: PSDL_AudioStream; buf: pointer; len: cint): cint; cdecl; Var @@ -1156,7 +1156,7 @@ function SDL_AudioStreamPut(stream: PSDL_AudioStream; buf: pointer; len: cint): * \sa SDL_AudioStreamClear * \sa SDL_FreeAudioStream } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_AudioStreamGet_fun = function(stream: PSDL_AudioStream; buf: pointer; len: cint): cint; cdecl; Var @@ -1183,7 +1183,7 @@ function SDL_AudioStreamGet(stream: PSDL_AudioStream; buf: pointer; len: cint): * \sa SDL_AudioStreamClear * \sa SDL_FreeAudioStream } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_AudioStreamAvailable_fun = function(stream: PSDL_AudioStream): cint; cdecl; Var @@ -1211,7 +1211,7 @@ function SDL_AudioStreamAvailable(stream: PSDL_AudioStream): cint; cdecl; * \sa SDL_AudioStreamClear * \sa SDL_FreeAudioStream } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_AudioStreamFlush_fun = function(stream: PSDL_AudioStream): cint; cdecl; Var @@ -1234,7 +1234,7 @@ function SDL_AudioStreamFlush(stream: PSDL_AudioStream): cint; cdecl; * \sa SDL_AudioStreamFlush * \sa SDL_FreeAudioStream } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_AudioStreamClear_proc = procedure(stream: PSDL_AudioStream); cdecl; Var @@ -1257,7 +1257,7 @@ procedure SDL_AudioStreamClear(stream: PSDL_AudioStream); cdecl; * \sa SDL_AudioStreamFlush * \sa SDL_AudioStreamClear } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_FreeAudioStream_proc = procedure(stream: PSDL_AudioStream); cdecl; Var @@ -1293,7 +1293,7 @@ const * * \sa SDL_MixAudioFormat *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_MixAudio_proc = procedure(dst: pcuint8; src: pcuint8; len: cuint32; volume: cint); cdecl; Var @@ -1334,7 +1334,7 @@ procedure SDL_MixAudio(dst: pcuint8; src: pcuint8; len: cuint32; volume: cint); * * \since This function is available since SDL 2.0.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_MixAudioFormat_proc = procedure(dst: pcuint8; src: pcuint8; format: TSDL_AudioFormat; len: cuint32; volume: cint); cdecl; Var @@ -1391,7 +1391,7 @@ procedure SDL_MixAudioFormat(dst: pcuint8; src: pcuint8; format: TSDL_AudioForma * \sa SDL_ClearQueuedAudio * \sa SDL_GetQueuedAudioSize *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_QueueAudio_fun = function(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): cint; cdecl; Var @@ -1448,7 +1448,7 @@ function SDL_QueueAudio(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): c * \sa SDL_ClearQueuedAudio * \sa SDL_GetQueuedAudioSize *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_DequeueAudio_fun = function(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): cuint32; cdecl; Var @@ -1491,7 +1491,7 @@ function SDL_DequeueAudio(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): * \sa SDL_QueueAudio * \sa SDL_DequeueAudio *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetQueuedAudioSize_fun = function(dev: TSDL_AudioDeviceID): cuint32; cdecl; Var @@ -1534,7 +1534,7 @@ function SDL_GetQueuedAudioSize(dev: TSDL_AudioDeviceID): cuint32; cdecl; * \sa SDL_QueueAudio * \sa SDL_DequeueAudio *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_ClearQueuedAudio_proc = procedure(dev: TSDL_AudioDeviceID); cdecl; Var @@ -1612,7 +1612,7 @@ procedure SDL_LockAudio; cdecl; * * \sa SDL_UnlockAudioDevice *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LockAudioDevice_proc = procedure(dev: TSDL_AudioDeviceID); cdecl; Var @@ -1655,7 +1655,7 @@ procedure SDL_UnlockAudio; cdecl; * * \sa SDL_LockAudioDevice *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_UnlockAudioDevice_proc = procedure(dev: TSDL_AudioDeviceID); cdecl; Var @@ -1708,7 +1708,7 @@ procedure SDL_CloseAudio; cdecl; * * \sa SDL_OpenAudioDevice *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_CloseAudioDevice_proc = procedure(dev: TSDL_AudioDeviceID); cdecl; Var diff --git a/units/sdlblendmode.inc b/units/sdlblendmode.inc index 9129c804..4c02df15 100644 --- a/units/sdlblendmode.inc +++ b/units/sdlblendmode.inc @@ -78,7 +78,7 @@ const * and * dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_ComposeCustomBlendMode_fun = function(srcColorFactor, dstColorFactor: TSDL_BlendFactor; colorOperation: TSDL_BlendOperation; srcAlphaFactor, dstAlphaFactor: TSDL_BlendFactor; alphaOperation: TSDL_BlendOperation): TSDL_BlendMode; cdecl; Var diff --git a/units/sdlclipboard.inc b/units/sdlclipboard.inc index 470d9837..db270916 100644 --- a/units/sdlclipboard.inc +++ b/units/sdlclipboard.inc @@ -19,7 +19,7 @@ * \sa SDL_GetClipboardText * \sa SDL_HasClipboardText } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetClipboardText_fun = function(text: PAnsiChar): cint; cdecl; Var @@ -46,7 +46,7 @@ function SDL_SetClipboardText(text: PAnsiChar): cint; cdecl; * \sa SDL_HasClipboardText * \sa SDL_SetClipboardText } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetClipboardText_fun = function(): PAnsiChar; cdecl; Var @@ -67,7 +67,7 @@ function SDL_GetClipboardText(): PAnsiChar; cdecl; * \sa SDL_GetClipboardText * \sa SDL_SetClipboardText } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HasClipboardText_fun = function(): TSDL_bool; cdecl; Var @@ -90,7 +90,7 @@ function SDL_HasClipboardText(): TSDL_bool; cdecl; * \sa SDL_GetPrimarySelectionText * \sa SDL_HasPrimarySelectionText } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetPrimarySelectionText_fun = function(text: PAnsiChar): cint; cdecl; Var @@ -118,7 +118,7 @@ function SDL_SetPrimarySelectionText(text: PAnsiChar): cint; cdecl; * \sa SDL_HasPrimarySelectionText * \sa SDL_SetPrimarySelectionText } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetPrimarySelectionText_fun = function(): PAnsiChar; cdecl; Var @@ -141,7 +141,7 @@ function SDL_GetPrimarySelectionText(): PAnsiChar; cdecl; * \sa SDL_GetPrimarySelectionText * \sa SDL_SetPrimarySelectionText } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HasPrimarySelectionText_fun = function(): TSDL_bool; cdecl; Var diff --git a/units/sdlcpuinfo.inc b/units/sdlcpuinfo.inc index f2c158dd..afc8ba25 100644 --- a/units/sdlcpuinfo.inc +++ b/units/sdlcpuinfo.inc @@ -11,7 +11,7 @@ const {** * This function returns the number of CPU cores available. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetCPUCount_fun = function(): cint; cdecl; Var diff --git a/units/sdlerror.inc b/units/sdlerror.inc index 0ae79c00..74e38a6b 100644 --- a/units/sdlerror.inc +++ b/units/sdlerror.inc @@ -13,7 +13,7 @@ * * \return -1, there is no error handling for this function *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetError_fun = function(const fmt: PAnsiChar; args: array of const): cint; cdecl; Var @@ -50,7 +50,7 @@ function SDL_GetError: PAnsiChar; cdecl; * * \return errstr *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetErrorMsg_fun = function(const errstr: PAnsiChar; maxlen: cint): PAnsiChar; cdecl; Var @@ -90,7 +90,7 @@ type SDL_LASTERROR); {* SDL_Error() unconditionally returns -1. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_Error_fun = function(code: TSDL_ErrorCode): cint; cdecl; Var diff --git a/units/sdlfilesystem.inc b/units/sdlfilesystem.inc index 039f6da9..62d1baba 100644 --- a/units/sdlfilesystem.inc +++ b/units/sdlfilesystem.inc @@ -42,7 +42,7 @@ * * \sa SDL_GetPrefPath } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetBasePath_fun = function(): PAnsiChar; cdecl; Var @@ -108,7 +108,7 @@ function SDL_GetBasePath(): PAnsiChar; cdecl; * * \sa SDL_GetBasePath } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetPrefPath_fun = function(org: PAnsiChar; app: PAnsiChar): PAnsiChar; cdecl; Var diff --git a/units/sdlgamecontroller.inc b/units/sdlgamecontroller.inc index b5ee6abb..e861a785 100644 --- a/units/sdlgamecontroller.inc +++ b/units/sdlgamecontroller.inc @@ -107,7 +107,7 @@ function SDL_GameControllerAddMapping( mappingString: PAnsiChar ): cint cdecl; e * * Returns number of mappings added, -1 on error *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerAddMappingsFromRW_fun = function(rw: PSDL_RWops; freerw: cint32):cint32; cdecl; @@ -122,7 +122,7 @@ function SDL_GameControllerAddMappingsFromRW(rw: PSDL_RWops; freerw: cint32):cin {** * Get the number of mappings installed. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerNumMappings_fun = function():cint; cdecl; Var @@ -146,7 +146,7 @@ function SDL_GameControllerMappingForGUID( guid: TSDL_JoystickGUID ): PAnsiChar * Returns the mapping string. Must be freed with SDL_free(). * Returns NIL if the index is out of range. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerMappingForIndex_fun = function(mapping_index: cint): PAnsiChar; cdecl; Var @@ -193,7 +193,7 @@ function SDL_GameControllerNameForIndex(joystick_index: cint): PAnsiChar cdecl; * * \sa SDL_GameControllerPath *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerPathForIndex_fun = function(joystick_index: cint): PAnsiChar; cdecl; Var @@ -208,7 +208,7 @@ function SDL_GameControllerPathForIndex(joystick_index: cint): PAnsiChar; cdecl; * Get the type of a game controller. * This can be called before any controllers are opened. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerTypeForIndex_fun = function(joystick_index: cint): TSDL_GameControllerType; cdecl; Var @@ -226,7 +226,7 @@ function SDL_GameControllerTypeForIndex(joystick_index: cint): TSDL_GameControll * Returns the mapping string. Must be freed with SDL_free(). * Returns NIL if no mapping is available. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerMappingForDeviceIndex_fun = function(joystick_index: cint): PAnsiChar; cdecl; Var @@ -250,7 +250,7 @@ function SDL_GameControllerOpen(joystick_index: cint): PSDL_GameController cdecl {** * Return the SDL_GameController associated with an instance id. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerFromInstanceID_fun = function(joyid: TSDL_JoystickID): PSDL_GameController; cdecl; Var @@ -268,7 +268,7 @@ function SDL_GameControllerFromInstanceID(joyid: TSDL_JoystickID): PSDL_GameCont * instance id! * *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerFromPlayerIndex_fun = function(player_index: cint): PSDL_GameController; cdecl; Var @@ -299,7 +299,7 @@ function SDL_GameControllerName(gamecontroller: PSDL_GameController): PAnsiChar * * \sa SDL_GameControllerPathForIndex *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerPath_fun = function(gamecontroller: PSDL_GameController): PAnsiChar; cdecl; Var @@ -316,7 +316,7 @@ function SDL_GameControllerPath(gamecontroller: PSDL_GameController): PAnsiChar; * This is the same name as returned by SDL_GameControllerTypeForIndex(), but * it takes a controller identifier instead of the (unstable) device index. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerGetType_fun = function(gamecontroller: PSDL_GameController): TSDL_GameControllerType; cdecl; Var @@ -333,7 +333,7 @@ function SDL_GameControllerGetType(gamecontroller: PSDL_GameController): TSDL_Ga * * Returns the player index for controller, or -1 if it's not available. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerGetPlayerIndex_fun = function(gamecontroller: PSDL_GameController): cint; cdecl; Var @@ -347,7 +347,7 @@ function SDL_GameControllerGetPlayerIndex(gamecontroller: PSDL_GameController): {** * Set the player index of an opened game controller. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerSetPlayerIndex_proc = procedure(gamecontroller: PSDL_GameController; player_index: cint); cdecl; Var @@ -368,7 +368,7 @@ procedure SDL_GameControllerSetPlayerIndex(gamecontroller: PSDL_GameController; * * \since This function is available since SDL 2.0.6. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerGetVendor_fun = function(gamecontroller: PSDL_GameController): cuint16; cdecl; Var @@ -383,7 +383,7 @@ function SDL_GameControllerGetVendor(gamecontroller: PSDL_GameController): cuint * Get the USB product ID of an opened controller, if available. * If the product ID isn't available, this function returns 0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerGetProduct_fun = function(gamecontroller: PSDL_GameController): cuint16; cdecl; Var @@ -398,7 +398,7 @@ function SDL_GameControllerGetProduct(gamecontroller: PSDL_GameController): cuin * Get the product version of an opened controller, if available. * If the product version isn't available, this function returns 0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerGetProductVersion_fun = function(gamecontroller: PSDL_GameController): cuint16; cdecl; Var @@ -419,7 +419,7 @@ function SDL_GameControllerGetProductVersion(gamecontroller: PSDL_GameController * * \since This function is available since SDL 2.24.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerGetFirmwareVersion_fun = function(gamecontroller: PSDL_GameController): cuint16; cdecl; Var @@ -436,7 +436,7 @@ function SDL_GameControllerGetFirmwareVersion(gamecontroller: PSDL_GameControlle * Returns a string containing the serial number of the controller, * or NIL if it is not available. Do _not_ free the string with SDL_free(). *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerGetSerial_fun = function(gamecontroller: PSDL_GameController): PAnsiChar; cdecl; Var @@ -458,7 +458,7 @@ function SDL_GameControllerGetSerial(gamecontroller: PSDL_GameController): PAnsi * * \since This function is available since SDL 2.30.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerGetSteamHandle_fun = function(gamecontroller: PSDL_GameController): cuint64; cdecl; Var @@ -538,7 +538,7 @@ function SDL_GameControllerGetBindForAxis(gamecontroller: PSDL_GameController; a * This merely reports whether the controller's mapping defined this axis, * as that is all the information SDL has about the physical device. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerHasAxis_fun = function(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): TSDL_Bool; cdecl; Var @@ -611,7 +611,7 @@ function SDL_GameControllerGetBindForButton(gamecontroller: PSDL_GameController; * This merely reports whether the controller's mapping defined this button, * as that is all the information SDL has about the physical device. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerHasButton_fun = function(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): TSDL_Bool; cdecl; Var @@ -632,7 +632,7 @@ function SDL_GameControllerGetButton(gamecontroller: PSDL_GameController; button {** * Get the number of touchpads on a game controller. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerGetNumTouchpads_fun = function(gamecontroller: PSDL_GameController): cint; cdecl; Var @@ -646,7 +646,7 @@ function SDL_GameControllerGetNumTouchpads(gamecontroller: PSDL_GameController): {** * Get the number of supported simultaneous fingers on a touchpad on a game controller. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerGetNumTouchpadFingers_fun = function(gamecontroller: PSDL_GameController; touchpad: cint): cint; cdecl; Var @@ -660,7 +660,7 @@ function SDL_GameControllerGetNumTouchpadFingers(gamecontroller: PSDL_GameContro {** * Get the current state of a finger on a touchpad on a game controller. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerGetTouchpadFinger_fun = function( gamecontroller: PSDL_GameController; @@ -684,7 +684,7 @@ function SDL_GameControllerGetTouchpadFinger( {** * Return whether a game controller has a particular sensor. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerHasSensor_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): TSDL_Bool; cdecl; Var @@ -698,7 +698,7 @@ function SDL_GameControllerHasSensor(gamecontroller: PSDL_GameController; sensty {** * Set whether data reporting for a game controller sensor is enabled. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerSetSensorEnabled_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; enabled: TSDL_bool): cint; cdecl; Var @@ -712,7 +712,7 @@ function SDL_GameControllerSetSensorEnabled(gamecontroller: PSDL_GameController; {** * Query whether sensor data reporting is enabled for a game controller. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerIsSensorEnabled_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): TSDL_Bool; cdecl; Var @@ -729,7 +729,7 @@ function SDL_GameControllerIsSensorEnabled(gamecontroller: PSDL_GameController; * * Returns the data rate, or 0.0 if the data rate is not available. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerGetSensorDataRate_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): cfloat; cdecl; Var @@ -746,7 +746,7 @@ function SDL_GameControllerGetSensorDataRate(gamecontroller: PSDL_GameController * The number of values and interpretation of the data is sensor dependent. * See sdlsensor.inc for the details for each type of sensor. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerGetSensorData_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; data: pcfloat; num_values: cint): cint; cdecl; Var @@ -774,7 +774,7 @@ function SDL_GameControllerGetSensorData(gamecontroller: PSDL_GameController; se * * \since This function is available since SDL 2.26.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerGetSensorDataWithTimestamp_fun = function( gamecontroller: PSDL_GameController; @@ -800,7 +800,7 @@ function SDL_GameControllerGetSensorDataWithTimestamp( {** * Query whether a game controller has rumble support. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerHasRumble_fun = function(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; Var @@ -819,7 +819,7 @@ function SDL_GameControllerHasRumble(gamecontroller: PSDL_GameController): TSDL_ * * Returns 0, or -1 if rumble isn't supported on this controller. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerRumble_fun = function( gamecontroller: PSDL_GameController; @@ -842,7 +842,7 @@ function SDL_GameControllerRumble( {** * Query whether a game controller has rumble support on triggers. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerHasRumbleTriggers_fun = function(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; Var @@ -866,7 +866,7 @@ function SDL_GameControllerHasRumbleTriggers(gamecontroller: PSDL_GameController * * Returns 0, or -1 if trigger rumble isn't supported on this controller *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerRumbleTriggers_fun = function( gamecontroller: PSDL_GameController; @@ -889,7 +889,7 @@ function SDL_GameControllerRumbleTriggers( {** * Query whether a game controller has an LED. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerHasLED_fun = function(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; Var @@ -905,7 +905,7 @@ function SDL_GameControllerHasLED(gamecontroller: PSDL_GameController): TSDL_Boo * * Returns 0, or -1 if this controller does not have a modifiable LED. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerSetLED_fun = function(gamecontroller: PSDL_GameController; red, green, blue: cuint8): cint; cdecl; Var @@ -922,7 +922,7 @@ function SDL_GameControllerSetLED(gamecontroller: PSDL_GameController; red, gree * Returns 0, or -1 if this controller or driver does not * support effect packets. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerSendEffect_fun = function(gamecontroller: PSDL_GameController; data: Pointer; size: cint): cint; cdecl; Var @@ -945,7 +945,7 @@ procedure SDL_GameControllerClose(gamecontroller: PSDL_GameController) cdecl; ex * Returns the sfSymbolsName, or NIL if the name can't be found. * Do _not_ pass this string to SDL_free(). *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerGetAppleSFSymbolsNameForAxis_fun = function(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): PAnsiChar; cdecl; Var @@ -963,7 +963,7 @@ function SDL_GameControllerGetAppleSFSymbolsNameForAxis(gamecontroller: PSDL_Gam * Returns the sfSymbolsName, or NIL if the name can't be found. * Do _not_ pass this string to SDL_free(). *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GameControllerGetAppleSFSymbolsNameForButton_fun = function(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): PAnsiChar; cdecl; Var diff --git a/units/sdlgesture.inc b/units/sdlgesture.inc index 5b21c6d6..0244efe1 100644 --- a/units/sdlgesture.inc +++ b/units/sdlgesture.inc @@ -20,7 +20,7 @@ type * * \sa SDL_GetTouchDevice *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RecordGesture_fun = function(touchId: TSDL_TouchID): cint; cdecl; Var @@ -43,7 +43,7 @@ function SDL_RecordGesture(touchId: TSDL_TouchID): cint; cdecl; * \sa SDL_LoadDollarTemplates * \sa SDL_SaveDollarTemplate *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SaveAllDollarTemplates_fun = function(dst: PSDL_RWops): cint; cdecl; Var @@ -67,7 +67,7 @@ function SDL_SaveAllDollarTemplates(dst: PSDL_RWops): cint; cdecl; * \sa SDL_LoadDollarTemplates * \sa SDL_SaveAllDollarTemplates *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SaveDollarTemplate_fun = function(gestureId: TSDL_GestureID; dst: PSDL_RWops): cint; cdecl; Var @@ -92,7 +92,7 @@ function SDL_SaveDollarTemplate(gestureId: TSDL_GestureID; dst: PSDL_RWops): cin * \sa SDL_SaveAllDollarTemplates * \sa SDL_SaveDollarTemplate *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LoadDollarTemplates_fun = function(touchId: TSDL_TouchID; src: PSDL_RWops): cint; cdecl; Var diff --git a/units/sdlguid.inc b/units/sdlguid.inc index 5441834b..1174eeb3 100644 --- a/units/sdlguid.inc +++ b/units/sdlguid.inc @@ -39,7 +39,7 @@ type * * \sa SDL_GUIDFromString *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GUIDToString_proc = procedure(guid: TSDL_GUID; pszGUID: PAnsiChar; cbGUID: cint); cdecl; Var @@ -64,7 +64,7 @@ procedure SDL_GUIDToString(guid: TSDL_GUID; pszGUID: PAnsiChar; cbGUID: cint); c * * \sa SDL_GUIDToString *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GUIDFromString_fun = function(const pchGUID: PAnsiChar): TSDL_GUID; cdecl; Var diff --git a/units/sdlhaptic.inc b/units/sdlhaptic.inc index 88aaa9e3..94c3dba2 100644 --- a/units/sdlhaptic.inc +++ b/units/sdlhaptic.inc @@ -819,7 +819,7 @@ function SDL_NumHaptics: cint; cdecl; * * \sa SDL_NumHaptics *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticName_fun = function(device_index: cint): PAnsiChar; cdecl; Var @@ -855,7 +855,7 @@ function SDL_HapticName(device_index: cint): PAnsiChar; cdecl; * \sa SDL_HapticSetGain * \sa SDL_HapticStopAll *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticOpen_fun = function(device_index: cint): PSDL_Haptic; cdecl; Var @@ -878,7 +878,7 @@ function SDL_HapticOpen(device_index: cint): PSDL_Haptic; cdecl; * \sa SDL_HapticIndex * \sa SDL_HapticOpen *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticOpened_fun = function(device_index: cint): cint; cdecl; Var @@ -901,7 +901,7 @@ function SDL_HapticOpened(device_index: cint): cint; cdecl; * \sa SDL_HapticOpen * \sa SDL_HapticOpened *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticIndex_fun = function(haptic: PSDL_Haptic): cint; cdecl; Var @@ -950,7 +950,7 @@ function SDL_HapticOpenFromMouse: PSDL_Haptic; cdecl; * * \sa SDL_HapticOpenFromJoystick *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickIsHaptic_fun = function(joystick: PSDL_Joystick): cint; cdecl; Var @@ -982,7 +982,7 @@ function SDL_JoystickIsHaptic(joystick: PSDL_Joystick): cint; cdecl; * \sa SDL_HapticOpen * \sa SDL_JoystickIsHaptic *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticOpenFromJoystick_fun = function(joystick: PSDL_Joystick): PSDL_Haptic; cdecl; Var @@ -1002,7 +1002,7 @@ function SDL_HapticOpenFromJoystick(joystick: PSDL_Joystick): PSDL_Haptic; cdecl * * \sa SDL_HapticOpen *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticClose_proc = procedure(haptic: PSDL_Haptic); cdecl; Var @@ -1029,7 +1029,7 @@ procedure SDL_HapticClose(haptic: PSDL_Haptic); cdecl; * \sa SDL_HapticNumEffectsPlaying * \sa SDL_HapticQuery *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticNumEffects_fun = function(haptic: PSDL_Haptic): cint; cdecl; Var @@ -1055,7 +1055,7 @@ function SDL_HapticNumEffects(haptic: PSDL_Haptic): cint; cdecl; * \sa SDL_HapticNumEffects * \sa SDL_HapticQuery *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticNumEffectsPlaying_fun = function(haptic: PSDL_Haptic): cint; cdecl; Var @@ -1078,7 +1078,7 @@ function SDL_HapticNumEffectsPlaying(haptic: PSDL_Haptic): cint; cdecl; * \sa SDL_HapticEffectSupported * \sa SDL_HapticNumEffects *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticQuery_fun = function(haptic: PSDL_Haptic): cint; cdecl; Var @@ -1101,7 +1101,7 @@ function SDL_HapticQuery(haptic: PSDL_Haptic): cint; cdecl; * * \since This function is available since SDL 2.0.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticNumAxes_fun = function(haptic: PSDL_Haptic): cint; cdecl; Var @@ -1126,7 +1126,7 @@ function SDL_HapticNumAxes(haptic: PSDL_Haptic): cint; cdecl; * \sa SDL_HapticNewEffect * \sa SDL_HapticQuery *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticEffectSupported_fun = function(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): cint; cdecl; Var @@ -1152,7 +1152,7 @@ function SDL_HapticEffectSupported(haptic: PSDL_Haptic; effect: PSDL_HapticEffec * \sa SDL_HapticRunEffect * \sa SDL_HapticUpdateEffect *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticNewEffect_fun = function(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): cint; cdecl; Var @@ -1184,7 +1184,7 @@ function SDL_HapticNewEffect(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): ci * \sa SDL_HapticNewEffect * \sa SDL_HapticRunEffect *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticUpdateEffect_fun = function(haptic: PSDL_Haptic; effect: cint; data: PSDL_HapticEffect): cint; cdecl; Var @@ -1217,7 +1217,7 @@ function SDL_HapticUpdateEffect(haptic: PSDL_Haptic; effect: cint; data: PSDL_Ha * \sa SDL_HapticGetEffectStatus * \sa SDL_HapticStopEffect *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticRunEffect_fun = function(haptic: PSDL_Haptic; effect: cint; iterations: cuint32): cint; cdecl; Var @@ -1243,7 +1243,7 @@ function SDL_HapticRunEffect(haptic: PSDL_Haptic; effect: cint; iterations: cuin * \sa SDL_HapticDestroyEffect * \sa SDL_HapticRunEffect *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticStopEffect_fun = function(haptic: PSDL_Haptic; effect: cint): cint; cdecl; Var @@ -1267,7 +1267,7 @@ function SDL_HapticStopEffect(haptic: PSDL_Haptic; effect: cint): cint; cdecl; * * \sa SDL_HapticNewEffect *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticDestroyEffect_proc = procedure(haptic: PSDL_Haptic; effect: cint); cdecl; Var @@ -1293,7 +1293,7 @@ procedure SDL_HapticDestroyEffect(haptic: PSDL_Haptic; effect: cint); cdecl; * \sa SDL_HapticRunEffect * \sa SDL_HapticStopEffect *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticGetEffectStatus_fun = function(haptic: PSDL_Haptic; effect: cint): cint; cdecl; Var @@ -1323,7 +1323,7 @@ function SDL_HapticGetEffectStatus(haptic: PSDL_Haptic; effect: cint): cint; cde * * \sa SDL_HapticQuery *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticSetGain_fun = function(haptic: PSDL_Haptic; gain: cint): cint; cdecl; Var @@ -1351,7 +1351,7 @@ function SDL_HapticSetGain(haptic: PSDL_Haptic; gain: cint): cint; cdecl; * * \sa SDL_HapticQuery *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticSetAutocenter_fun = function(haptic: PSDL_Haptic; autocenter: cint): cint; cdecl; Var @@ -1379,7 +1379,7 @@ function SDL_HapticSetAutocenter(haptic: PSDL_Haptic; autocenter: cint): cint; c * * \sa SDL_HapticUnpause *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticPause_fun = function(haptic: PSDL_Haptic): cint; cdecl; Var @@ -1403,7 +1403,7 @@ function SDL_HapticPause(haptic: PSDL_Haptic): cint; cdecl; * * \sa SDL_HapticPause *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticUnpause_fun = function(haptic: PSDL_Haptic): cint; cdecl; Var @@ -1423,7 +1423,7 @@ function SDL_HapticUnpause(haptic: PSDL_Haptic): cint; cdecl; * * \since This function is available since SDL 2.0.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticStopAll_fun = function(haptic: PSDL_Haptic): cint; cdecl; Var @@ -1448,7 +1448,7 @@ function SDL_HapticStopAll(haptic: PSDL_Haptic): cint; cdecl; * \sa SDL_HapticRumblePlay * \sa SDL_HapticRumbleStop *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticRumbleSupported_fun = function(haptic: PSDL_Haptic): cint; cdecl; Var @@ -1473,7 +1473,7 @@ function SDL_HapticRumbleSupported(haptic: PSDL_Haptic): cint; cdecl; * \sa SDL_HapticRumbleStop * \sa SDL_HapticRumbleSupported *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticRumbleInit_fun = function(haptic: PSDL_Haptic): cint; cdecl; Var @@ -1499,7 +1499,7 @@ function SDL_HapticRumbleInit(haptic: PSDL_Haptic): cint; cdecl; * \sa SDL_HapticRumbleStop * \sa SDL_HapticRumbleSupported *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticRumblePlay_fun = function(haptic: PSDL_Haptic; strength: cfloat; length: cuint32): cint; cdecl; Var @@ -1523,7 +1523,7 @@ function SDL_HapticRumblePlay(haptic: PSDL_Haptic; strength: cfloat; length: cui * \sa SDL_HapticRumblePlay * \sa SDL_HapticRumbleSupported *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HapticRumbleStop_fun = function(haptic: PSDL_Haptic): cint; cdecl; Var diff --git a/units/sdlhints.inc b/units/sdlhints.inc index c15cfa84..6955eaf3 100644 --- a/units/sdlhints.inc +++ b/units/sdlhints.inc @@ -2415,7 +2415,7 @@ const * * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise */} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetHintWithPriority_fun = function(const name: PAnsiChar; const value: PAnsiChar; priority: TSDL_HintPriority): TSDL_Bool; cdecl; Var @@ -2431,7 +2431,7 @@ function SDL_SetHintWithPriority(const name: PAnsiChar; const value: PAnsiChar; * * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise */} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetHint_fun = function(const name: PAnsiChar; const value: PAnsiChar): TSDL_Bool; cdecl; Var @@ -2454,7 +2454,7 @@ function SDL_SetHint(const name: PAnsiChar; const value: PAnsiChar): TSDL_Bool; * * \since This function is available since SDL 2.24.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_ResetHint_fun = function(const name: PAnsiChar): TSDL_Bool; cdecl; Var @@ -2478,7 +2478,7 @@ function SDL_ResetHint(const name: PAnsiChar): TSDL_Bool; cdecl; * \sa SDL_SetHint * \sa SDL_ResetHint *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_ResetHints_proc = procedure(); cdecl; Var @@ -2494,7 +2494,7 @@ procedure SDL_ResetHints(); cdecl; * * \return The string value of a hint variable. */} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetHint_fun = function(const name: PAnsiChar): PAnsiChar; cdecl; Var @@ -2510,7 +2510,7 @@ function SDL_GetHint(const name: PAnsiChar): PAnsiChar; cdecl; * * \return The boolean value of a hint variable. */} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetHintBoolean_fun = function(const name: PAnsiChar; default_value: TSDL_Bool): TSDL_Bool; cdecl; Var @@ -2533,7 +2533,7 @@ type PSDL_HintCallback = ^TSDL_HintCallback; TSDL_HintCallback = procedure(userdata: Pointer; const name: PAnsiChar; const oldValue: PAnsiChar; const newValue: PAnsiChar); cdecl; -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_AddHintCallback_proc = procedure(const name: PAnsiChar; callback: TSDL_HintCallback; userdata: Pointer); cdecl; Var @@ -2551,7 +2551,7 @@ procedure SDL_AddHintCallback(const name: PAnsiChar; callback: TSDL_HintCallback * \param callback The function being called when the hint value changes * \param userdata A pointer being passed to the callback function */} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_DelHintCallback_proc = procedure(const name: PAnsiChar; callback: TSDL_HintCallback; userdata: Pointer); cdecl; Var @@ -2576,7 +2576,7 @@ procedure SDL_DelHintCallback(const name: PAnsiChar; callback: TSDL_HintCallback * * \sa SDL_ResetHints *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_ClearHints_proc = procedure(); cdecl; Var diff --git a/units/sdljoystick.inc b/units/sdljoystick.inc index 1cd679dc..0e19c1ea 100644 --- a/units/sdljoystick.inc +++ b/units/sdljoystick.inc @@ -104,7 +104,7 @@ const * * \since This function is available since SDL 2.0.7. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LockJoysticks_proc = procedure(); cdecl; Var @@ -127,7 +127,7 @@ procedure SDL_LockJoysticks(); cdecl; * * \since This function is available since SDL 2.0.7. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_UnlockJoysticks_proc = procedure(); cdecl; Var @@ -150,7 +150,7 @@ procedure SDL_UnlockJoysticks(); cdecl; * \sa SDL_JoystickPath * \sa SDL_JoystickOpen *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_NumJoysticks_fun = function(): cint; cdecl; Var @@ -176,7 +176,7 @@ function SDL_NumJoysticks(): cint; cdecl; * \sa SDL_JoystickName * \sa SDL_JoystickOpen *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickNameForIndex_fun = function(device_index: cint): PAnsiChar; cdecl; Var @@ -202,7 +202,7 @@ function SDL_JoystickNameForIndex(device_index: cint): PAnsiChar; cdecl; * \sa SDL_JoystickPath * \sa SDL_JoystickOpen *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickPathForIndex_fun = function(device_index: cint): PAnsiChar; cdecl; Var @@ -219,7 +219,7 @@ function SDL_JoystickPathForIndex(device_index: cint): PAnsiChar; cdecl; * * \since This function is available since SDL 2.0.9. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickGetDevicePlayerIndex_fun = function(device_index: cint): cint; cdecl; Var @@ -234,7 +234,7 @@ function SDL_JoystickGetDevicePlayerIndex(device_index: cint): cint; cdecl; * Return the GUID for the joystick at this index * This can be called before any joysticks are opened. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickGetDeviceGUID_fun = function(device_index: cint): TSDL_JoystickGUID; cdecl; Var @@ -258,7 +258,7 @@ function SDL_JoystickGetDeviceGUID(device_index: cint): TSDL_JoystickGUID; cdecl * * \since This function is available since SDL 2.0.6. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickGetDeviceVendor_fun = function(device_index: cint): cuint16; cdecl; Var @@ -282,7 +282,7 @@ function SDL_JoystickGetDeviceVendor(device_index: cint): cuint16; cdecl; * * \since This function is available since SDL 2.0.6. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickGetDeviceProduct_fun = function(device_index: cint): cuint16; cdecl; Var @@ -306,7 +306,7 @@ function SDL_JoystickGetDeviceProduct(device_index: cint): cuint16; cdecl; * * \since This function is available since SDL 2.0.6. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickGetDeviceProductVersion_fun = function(device_index: cint): cuint16; cdecl; Var @@ -329,7 +329,7 @@ function SDL_JoystickGetDeviceProductVersion(device_index: cint): cuint16; cdecl * * \since This function is available since SDL 2.0.6. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickGetDeviceType_fun = function(device_index: cint): TSDL_JoystickType; cdecl; Var @@ -353,7 +353,7 @@ function SDL_JoystickGetDeviceType(device_index: cint): TSDL_JoystickType; cdecl * * \since This function is available since SDL 2.0.6. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickGetDeviceInstanceID_fun = function(device_index: cint): TSDL_JoystickID; cdecl; Var @@ -384,7 +384,7 @@ function SDL_JoystickGetDeviceInstanceID(device_index: cint): TSDL_JoystickID; c * \sa SDL_JoystickClose * \sa SDL_JoystickInstanceID *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickOpen_fun = function(device_index: cint): PSDL_Joystick; cdecl; @@ -405,7 +405,7 @@ function SDL_JoystickOpen(device_index: cint): PSDL_Joystick; cdecl; * * \since This function is available since SDL 2.0.4. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickFromInstanceID_fun = function(instance_id: TSDL_JoystickID): PSDL_Joystick; cdecl; Var @@ -425,7 +425,7 @@ function SDL_JoystickFromInstanceID(instance_id: TSDL_JoystickID): PSDL_Joystick * * \since This function is available since SDL 2.0.12. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickFromPlayerIndex_fun = function(player_index: cint): PSDL_Joystick; cdecl; Var @@ -443,7 +443,7 @@ function SDL_JoystickFromPlayerIndex(player_index: cint): PSDL_Joystick; cdecl; * * \since This function is available since SDL 2.0.14. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickAttachVirtual_fun = function(type_: TSDL_JoystickType; naxes: cint; nbuttons: cint; nhats: cint): cint; cdecl; Var @@ -509,7 +509,7 @@ const * * \since This function is available since SDL 2.24.0. */} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickAttachVirtualEx_fun = function(const desc: PSDL_VirtualJoystickDesc): cint; cdecl; Var @@ -529,7 +529,7 @@ function SDL_JoystickAttachVirtualEx(const desc: PSDL_VirtualJoystickDesc): cint * * \since This function is available since SDL 2.0.14. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickDetachVirtual_fun = function(device_index: cint): cint; cdecl; Var @@ -548,7 +548,7 @@ function SDL_JoystickDetachVirtual(device_index: cint): cint; cdecl; * * \since This function is available since SDL 2.0.14. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickIsVirtual_fun = function(device_index: cint): TSDL_Bool; cdecl; Var @@ -579,7 +579,7 @@ function SDL_JoystickIsVirtual(device_index: cint): TSDL_Bool; cdecl; * * \since This function is available since SDL 2.0.14. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickSetVirtualAxis_fun = function(joystick: PSDL_Joystick; axis: cint; value: cint16): cint; cdecl; Var @@ -606,7 +606,7 @@ function SDL_JoystickSetVirtualAxis(joystick: PSDL_Joystick; axis: cint; value: * * \since This function is available since SDL 2.0.14. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickSetVirtualButton_fun = function(joystick: PSDL_Joystick; button: cint; value: cuint8): cint; cdecl; Var @@ -633,7 +633,7 @@ function SDL_JoystickSetVirtualButton(joystick: PSDL_Joystick; button: cint; val * * \since This function is available since SDL 2.0.14. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickSetVirtualHat_fun = function(joystick: PSDL_Joystick; hat: cint; value: cuint8): cint; cdecl; Var @@ -656,7 +656,7 @@ function SDL_JoystickSetVirtualHat(joystick: PSDL_Joystick; hat: cint; value: cu * \sa SDL_JoystickNameForIndex * \sa SDL_JoystickOpen *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickName_fun = function(joystick: PSDL_Joystick): PAnsiChar; cdecl; Var @@ -678,7 +678,7 @@ function SDL_JoystickName(joystick: PSDL_Joystick): PAnsiChar; cdecl; * * \sa SDL_JoystickPathForIndex *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickPath_fun = function(joystick: PSDL_Joystick): PAnsiChar; cdecl; Var @@ -700,7 +700,7 @@ function SDL_JoystickPath(joystick: PSDL_Joystick): PAnsiChar; cdecl; * * \since This function is available since SDL 2.0.9. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickGetPlayerIndex_fun = function(joystick: PSDL_Joystick): cint; cdecl; Var @@ -720,7 +720,7 @@ function SDL_JoystickGetPlayerIndex(joystick: PSDL_Joystick): cint; cdecl; * * \since This function is available since SDL 2.0.12. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickSetPlayerIndex_proc = procedure(joystick: PSDL_Joystick; player_index: cint); cdecl; Var @@ -746,7 +746,7 @@ procedure SDL_JoystickSetPlayerIndex(joystick: PSDL_Joystick; player_index: cint * \sa SDL_JoystickGetDeviceGUID * \sa SDL_JoystickGetGUIDString *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickGetGUID_fun = function(joystick: PSDL_Joystick): TSDL_JoystickGUID; cdecl; Var @@ -767,7 +767,7 @@ function SDL_JoystickGetGUID(joystick: PSDL_Joystick): TSDL_JoystickGUID; cdecl; * * \since This function is available since SDL 2.0.6. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickGetVendor_fun = function(joystick: PSDL_Joystick): cuint16; cdecl; Var @@ -788,7 +788,7 @@ function SDL_JoystickGetVendor(joystick: PSDL_Joystick): cuint16; cdecl; * * \since This function is available since SDL 2.0.6. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickGetProduct_fun = function(joystick: PSDL_Joystick): cuint16; cdecl; Var @@ -809,7 +809,7 @@ function SDL_JoystickGetProduct(joystick: PSDL_Joystick): cuint16; cdecl; * * \since This function is available since SDL 2.0.6. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickGetProductVersion_fun = function(joystick: PSDL_Joystick): cuint16; cdecl; Var @@ -831,7 +831,7 @@ function SDL_JoystickGetProductVersion(joystick: PSDL_Joystick): cuint16; cdecl; * * \since This function is available since SDL 2.24.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickGetFirmwareVersion_fun = function(joystick: PSDL_Joystick): cuint16; cdecl; Var @@ -853,7 +853,7 @@ function SDL_JoystickGetFirmwareVersion(joystick: PSDL_Joystick): cuint16; cdecl * * \since This function is available since SDL 2.0.14. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickGetSerial_fun = function(joystick: PSDL_Joystick): PAnsiChar; cdecl; Var @@ -872,7 +872,7 @@ function SDL_JoystickGetSerial(joystick: PSDL_Joystick): PAnsiChar; cdecl; * * \since This function is available since SDL 2.0.6. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickGetType_fun = function(joystick: PSDL_Joystick): TSDL_JoystickType; cdecl; Var @@ -898,7 +898,7 @@ function SDL_JoystickGetType(joystick: PSDL_Joystick): TSDL_JoystickType; cdecl; * \sa SDL_JoystickGetGUID * \sa SDL_JoystickGetGUIDFromString *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickGetGUIDString_proc = procedure(guid: TSDL_JoystickGUID; pszGUID: PAnsiChar; cbGUID: cint); cdecl; Var @@ -923,7 +923,7 @@ procedure SDL_JoystickGetGUIDString(guid: TSDL_JoystickGUID; pszGUID: PAnsiChar; * * \sa SDL_JoystickGetGUIDString *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickGetGUIDFromString_fun = function(const pchGUID: PAnsiChar): TSDL_JoystickGUID; cdecl; Var @@ -951,7 +951,7 @@ function SDL_JoystickGetGUIDFromString(const pchGUID: PAnsiChar): TSDL_JoystickG * * \sa SDL_JoystickGetDeviceGUID *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetJoystickGUIDInfo_proc = procedure(guid: TSDL_JoystickGUID; vendor: pcuint16; product: pcuint16; version: pcuint16; crc16: pcuint16); cdecl; Var @@ -974,7 +974,7 @@ procedure SDL_GetJoystickGUIDInfo(guid: TSDL_JoystickGUID; vendor: pcuint16; pro * \sa SDL_JoystickClose * \sa SDL_JoystickOpen *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickGetAttached_fun = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; Var @@ -996,7 +996,7 @@ function SDL_JoystickGetAttached(joystick: PSDL_Joystick): TSDL_Bool; cdecl; * * \sa SDL_JoystickOpen *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickInstanceID_fun = function(joystick: PSDL_Joystick): TSDL_JoystickID; cdecl; Var @@ -1024,7 +1024,7 @@ function SDL_JoystickInstanceID(joystick: PSDL_Joystick): TSDL_JoystickID; cdecl * \sa SDL_JoystickGetAxis * \sa SDL_JoystickOpen *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickNumAxes_fun = function(joystick: PSDL_Joystick): cint; cdecl; Var @@ -1051,7 +1051,7 @@ function SDL_JoystickNumAxes(joystick: PSDL_Joystick): cint; cdecl; * * \sa SDL_JoystickGetBall *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickNumBalls_fun = function(joystick: PSDL_Joystick): cint; cdecl; Var @@ -1074,7 +1074,7 @@ function SDL_JoystickNumBalls(joystick: PSDL_Joystick): cint; cdecl; * \sa SDL_JoystickGetHat * \sa SDL_JoystickOpen *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickNumHats_fun = function(joystick: PSDL_Joystick): cint; cdecl; Var @@ -1097,7 +1097,7 @@ function SDL_JoystickNumHats(joystick: PSDL_Joystick): cint; cdecl; * \sa SDL_JoystickGetButton * \sa SDL_JoystickOpen *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickNumButtons_fun = function(joystick: PSDL_Joystick): cint; cdecl; Var @@ -1118,7 +1118,7 @@ function SDL_JoystickNumButtons(joystick: PSDL_Joystick): cint; cdecl; * * \sa SDL_JoystickEventState *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickUpdate_proc = procedure(); cdecl; Var @@ -1152,7 +1152,7 @@ procedure SDL_JoystickUpdate(); cdecl; * * \sa SDL_GameControllerEventState *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickEventState_fun = function(state: cint): cint; cdecl; Var @@ -1189,7 +1189,7 @@ const * * \sa SDL_JoystickNumAxes *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickGetAxis_fun = function(joystick: PSDL_Joystick; axis: cint): cint16; cdecl; Var @@ -1214,7 +1214,7 @@ function SDL_JoystickGetAxis(joystick: PSDL_Joystick; axis: cint): cint16; cdecl * * \since This function is available since SDL 2.0.6. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickGetAxisInitialState_fun = function(joystick: PSDL_Joystick; axis: cint; state: pcint16): TSDL_Bool; cdecl; Var @@ -1262,7 +1262,7 @@ const * * \sa SDL_JoystickNumHats *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickGetHat_fun = function(joystick: PSDL_Joystick; hat: cint): cuint8; cdecl; Var @@ -1292,7 +1292,7 @@ function SDL_JoystickGetHat(joystick: PSDL_Joystick; hat: cint): cuint8; cdecl; * * \sa SDL_JoystickNumBalls *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickGetBall_fun = function(joystick: PSDL_Joystick; ball: cint; dx: pcint; dy: pcint): cint; cdecl; Var @@ -1315,7 +1315,7 @@ function SDL_JoystickGetBall(joystick: PSDL_Joystick; ball: cint; dx: pcint; dy: * * \sa SDL_JoystickNumButtons *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickGetButton_fun = function(joystick: PSDL_Joystick; button: cint): cuint8; cdecl; Var @@ -1344,7 +1344,7 @@ function SDL_JoystickGetButton(joystick: PSDL_Joystick; button: cint): cuint8; c * * \sa SDL_JoystickHasRumble *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickRumble_fun = function(joystick: PSDL_Joystick; low_frequency_rumble: cuint16; high_frequency_rumble: cuint16; duration_ms: cuint32): cint; cdecl; Var @@ -1378,7 +1378,7 @@ function SDL_JoystickRumble(joystick: PSDL_Joystick; low_frequency_rumble: cuint * * \sa SDL_JoystickHasRumbleTriggers *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickRumbleTriggers_fun = function(joystick: PSDL_Joystick; left_rumble: cuint16; right_rumble: cuint16; duration_ms: cuint32): cint; cdecl; Var @@ -1400,7 +1400,7 @@ function SDL_JoystickRumbleTriggers(joystick: PSDL_Joystick; left_rumble: cuint1 * * \since This function is available since SDL 2.0.14. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickHasLED_fun = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; Var @@ -1421,7 +1421,7 @@ function SDL_JoystickHasLED(joystick: PSDL_Joystick): TSDL_Bool; cdecl; * * \sa SDL_JoystickRumble *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickHasRumble_fun = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; Var @@ -1442,7 +1442,7 @@ function SDL_JoystickHasRumble(joystick: PSDL_Joystick): TSDL_Bool; cdecl; * * \sa SDL_JoystickRumbleTriggers *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickHasRumbleTriggers_fun = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; Var @@ -1468,7 +1468,7 @@ function SDL_JoystickHasRumbleTriggers(joystick: PSDL_Joystick): TSDL_Bool; cdec * * \since This function is available since SDL 2.0.14. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickSetLED_fun = function(joystick: PSDL_Joystick; red: cuint8; green: cuint8; blue: cuint8): cint; cdecl; Var @@ -1489,7 +1489,7 @@ function SDL_JoystickSetLED(joystick: PSDL_Joystick; red: cuint8; green: cuint8; * * \since This function is available since SDL 2.0.16. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickSendEffect_fun = function(joystick: PSDL_Joystick; const data: Pointer; size: cint): cint; cdecl; Var @@ -1509,7 +1509,7 @@ function SDL_JoystickSendEffect(joystick: PSDL_Joystick; const data: Pointer; si * * \sa SDL_JoystickOpen *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickClose_proc = procedure(joystick: PSDL_Joystick); cdecl; Var @@ -1529,7 +1529,7 @@ procedure SDL_JoystickClose(joystick: PSDL_Joystick); cdecl; * * \since This function is available since SDL 2.0.4. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_JoystickCurrentPowerLevel_fun = function(joystick: PSDL_Joystick): TSDL_JoystickPowerLevel; cdecl; Var diff --git a/units/sdlkeyboard.inc b/units/sdlkeyboard.inc index 87b21dec..a44dbaa2 100644 --- a/units/sdlkeyboard.inc +++ b/units/sdlkeyboard.inc @@ -70,7 +70,7 @@ function SDL_GetKeyboardFocus: PSDL_Window; cdecl; * \sa SDL_PumpEvents * \sa SDL_ResetKeyboard } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetKeyboardState_fun = function(numkeys: pcint): pcuint8; cdecl; Var @@ -124,7 +124,7 @@ function SDL_GetModState: TSDL_Keymod; cdecl; * * \sa SDL_GetModState } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetModState_proc = procedure(modstate: TSDL_Keymod); cdecl; Var @@ -149,7 +149,7 @@ procedure SDL_SetModState(modstate: TSDL_Keymod); cdecl; * \sa SDL_GetKeyName * \sa SDL_GetScancodeFromKey } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetKeyFromScancode_fun = function(scancode: TSDL_Scancode): TSDL_Keycode; cdecl; Var @@ -174,7 +174,7 @@ function SDL_GetKeyFromScancode(scancode: TSDL_Scancode): TSDL_Keycode; cdecl; * \sa SDL_GetKeyFromScancode * \sa SDL_GetScancodeName } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetScancodeFromKey_fun = function(key: TSDL_Keycode): TSDL_Scancode; cdecl; Var @@ -208,7 +208,7 @@ function SDL_GetScancodeFromKey(key: TSDL_Keycode): TSDL_Scancode; cdecl; * \sa SDL_GetScancodeFromKey * \sa SDL_GetScancodeFromName } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetScancodeName_fun = function(scancode: TSDL_Scancode): PAnsiChar; cdecl; Var @@ -232,7 +232,7 @@ function SDL_GetScancodeName(scancode: TSDL_Scancode): PAnsiChar; cdecl; * \sa SDL_GetScancodeFromKey * \sa SDL_GetScancodeName } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetScancodeFromName_fun = function(name: PAnsiChar): TSDL_Scancode; cdecl; Var @@ -260,7 +260,7 @@ function SDL_GetScancodeFromName(name: PAnsiChar): TSDL_Scancode; cdecl; * \sa SDL_GetKeyFromScancode * \sa SDL_GetScancodeFromKey } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetKeyName_fun = function(key: TSDL_Keycode): PAnsiChar; cdecl; Var @@ -284,7 +284,7 @@ function SDL_GetKeyName(key: TSDL_Keycode): PAnsiChar; cdecl; * \sa SDL_GetKeyName * \sa SDL_GetScancodeFromName } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetKeyFromName_fun = function(name: PAnsiChar): TSDL_Keycode; cdecl; Var @@ -372,7 +372,7 @@ function SDL_IsTextInputShown: TSDL_bool; cdecl; * * \sa SDL_StartTextInput } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetTextInputRect_proc = procedure(rect: PSDL_Rect); cdecl; Var @@ -407,7 +407,7 @@ function SDL_HasScreenKeyboardSupport: TSDL_bool; cdecl; * * \sa SDL_HasScreenKeyboardSupport } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_IsScreenKeyboardShown_fun = function(window: PSDL_Window): TSDL_bool; cdecl; Var diff --git a/units/sdlloadso.inc b/units/sdlloadso.inc index 5bd41f80..b9ace4f1 100644 --- a/units/sdlloadso.inc +++ b/units/sdlloadso.inc @@ -31,7 +31,7 @@ * \sa SDL_LoadFunction * \sa SDL_UnloadObject } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LoadObject_fun = function(sofile: PAnsiChar): Pointer; cdecl; Var @@ -80,7 +80,7 @@ function SDL_LoadFunction(handle: Pointer; name: PAnsiChar): Pointer; cdecl; * \sa SDL_LoadFunction * \sa SDL_LoadObject } -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_UnloadObject_proc = procedure(handle: Pointer); cdecl; Var diff --git a/units/sdllog.inc b/units/sdllog.inc index 353c2b3f..7e8bef9d 100644 --- a/units/sdllog.inc +++ b/units/sdllog.inc @@ -68,7 +68,7 @@ const {** * \brief Set the priority of all log categories *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LogSetAllPriority_proc = procedure(priority: TSDL_LogPriority); cdecl; Var @@ -82,7 +82,7 @@ procedure SDL_LogSetAllPriority(priority: TSDL_LogPriority); cdecl; {** * \brief Set the priority of a particular log category *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LogSetPriority_proc = procedure(category: TSDL_LogCategory; priority: TSDL_LogPriority); cdecl; Var @@ -96,7 +96,7 @@ procedure SDL_LogSetPriority(category: TSDL_LogCategory; priority: TSDL_LogPrior {** * \brief Get the priority of a particular log category *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LogGetPriority_fun = function(category: TSDL_LogCategory): TSDL_LogPriority; cdecl; Var @@ -112,7 +112,7 @@ function SDL_LogGetPriority(category: TSDL_LogCategory): TSDL_LogPriority; cdecl * * \note This is called in SDL_Quit(). *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LogResetPriorities_proc = procedure(); cdecl; Var @@ -126,7 +126,7 @@ procedure SDL_LogResetPriorities(); cdecl; {** * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_Log_proc = procedure(const fmt: PAnsiChar; pars: array of const); cdecl; Var @@ -140,7 +140,7 @@ procedure SDL_Log(const fmt: PAnsiChar; pars: array of const); cdecl; {** * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LogVerbose_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; Var @@ -154,7 +154,7 @@ procedure SDL_LogVerbose(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: {** * \brief Log a message with SDL_LOG_PRIORITY_DEBUG *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LogDebug_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; Var @@ -168,7 +168,7 @@ procedure SDL_LogDebug(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: a {** * \brief Log a message with SDL_LOG_PRIORITY_INFO *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LogInfo_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; Var @@ -182,7 +182,7 @@ procedure SDL_LogInfo(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: ar {** * \brief Log a message with SDL_LOG_PRIORITY_WARN *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LogWarn_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; Var @@ -196,7 +196,7 @@ procedure SDL_LogWarn(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: ar {** * \brief Log a message with SDL_LOG_PRIORITY_ERROR *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LogError_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; Var @@ -210,7 +210,7 @@ procedure SDL_LogError(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: a {** * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LogCritical_proc = procedure(category: TSDL_LogCategory; const fmt: PAnsiChar; pars: array of const); cdecl; Var @@ -224,7 +224,7 @@ procedure SDL_LogCritical(category: TSDL_LogCategory; const fmt: PAnsiChar; pars {** * \brief Log a message with the specified category and priority. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LogMessage_proc = procedure(category: TSDL_LogCategory; priority: TSDL_LogPriority; const fmt: PAnsiChar; pars: array of const); cdecl; Var @@ -238,7 +238,7 @@ procedure SDL_LogMessage(category: TSDL_LogCategory; priority: TSDL_LogPriority; {** * \brief Log a message with the specified category and priority. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LogMessageV_proc = procedure(category: TSDL_LogCategory; priority: TSDL_LogPriority; const fmt: PAnsiChar; ap: array of const); cdecl; Var diff --git a/units/sdlmessagebox.inc b/units/sdlmessagebox.inc index 238cda6a..04d6c8e1 100644 --- a/units/sdlmessagebox.inc +++ b/units/sdlmessagebox.inc @@ -104,7 +104,7 @@ type * block execution of that thread until the user clicks a button or * closes the messagebox. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_ShowMessageBox_fun = function(messageboxdata: PSDL_MessageBoxData; buttonid: pcint): cint; cdecl; Var @@ -127,7 +127,7 @@ function SDL_ShowMessageBox(messageboxdata: PSDL_MessageBoxData; buttonid: pcint * * SDL_ShowMessageBox *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_ShowSimpleMessageBox_fun = function(flags: TSDL_MessageBoxFlags; title: PAnsiChar; _message: PAnsiChar; window: PSDL_Window): cint; cdecl; Var diff --git a/units/sdlmouse.inc b/units/sdlmouse.inc index c4ed4507..405d9890 100644 --- a/units/sdlmouse.inc +++ b/units/sdlmouse.inc @@ -69,7 +69,7 @@ function SDL_GetMouseFocus: PSDL_Window; cdecl; * \sa SDL_GetRelativeMouseState * \sa SDL_PumpEvents *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetMouseState_fun = function(x: pcint; y: pcint): cuint32; cdecl; Var @@ -108,7 +108,7 @@ function SDL_GetMouseState(x: pcint; y: pcint): cuint32; cdecl; * * \sa SDL_CaptureMouse *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetGlobalMouseState_fun = function(x, y: pcint32): cuint32; cdecl; Var @@ -136,7 +136,7 @@ function SDL_GetGlobalMouseState(x, y: pcint32): cuint32; cdecl; * * \sa SDL_GetMouseState *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetRelativeMouseState_fun = function(x: pcint; y: pcint): cuint32; cdecl; Var @@ -166,7 +166,7 @@ function SDL_GetRelativeMouseState(x: pcint; y: pcint): cuint32; cdecl; * * \sa SDL_WarpMouseGlobal *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_WarpMouseInWindow_proc = procedure(window: PSDL_Window; x: cint; y: cint); cdecl; Var @@ -197,7 +197,7 @@ procedure SDL_WarpMouseInWindow(window: PSDL_Window; x: cint; y: cint); cdecl; * * \sa SDL_WarpMouseInWindow *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_WarpMouseGlobal_fun = function(x, y: cint): cint; cdecl; Var @@ -231,7 +231,7 @@ function SDL_WarpMouseGlobal(x, y: cint): cint; cdecl; * * \sa SDL_GetRelativeMouseMode *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetRelativeMouseMode_fun = function(enabled: TSDL_Bool): cint; cdecl; Var @@ -286,7 +286,7 @@ function SDL_SetRelativeMouseMode(enabled: TSDL_Bool): cint; cdecl; * * \sa SDL_GetGlobalMouseState *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_CaptureMouse_fun = function(enabled: TSDL_Bool): cint; cdecl; Var @@ -350,7 +350,7 @@ function SDL_GetRelativeMouseMode: TSDL_Bool; cdecl; * \sa SDL_SetCursor * \sa SDL_ShowCursor *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_CreateCursor_fun = function( const data: pcuint8; @@ -383,7 +383,7 @@ function SDL_CreateCursor( * \sa SDL_CreateCursor * \sa SDL_FreeCursor *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_CreateColorCursor_fun = function( surface: PSDL_Surface; @@ -411,7 +411,7 @@ function SDL_CreateColorCursor( * * \sa SDL_FreeCursor *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_CreateSystemCursor_fun = function(id: TSDL_SystemCursor): PSDL_Cursor; cdecl; Var @@ -438,7 +438,7 @@ function SDL_CreateSystemCursor(id: TSDL_SystemCursor): PSDL_Cursor; cdecl; * \sa SDL_GetCursor * \sa SDL_ShowCursor *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetCursor_proc = procedure(cursor: PSDL_Cursor); cdecl; Var @@ -490,7 +490,7 @@ function SDL_GetDefaultCursor: PSDL_Cursor; cdecl; * \sa SDL_CreateCursor * \sa SDL_CreateSystemCursor *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_FreeCursor_proc = procedure(cursor: PSDL_Cursor); cdecl; Var @@ -521,7 +521,7 @@ procedure SDL_FreeCursor(cursor: PSDL_Cursor); cdecl; * \sa SDL_CreateCursor * \sa SDL_SetCursor *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_ShowCursor_fun = function(toggle: cint): cint; cdecl; Var diff --git a/units/sdlmutex.inc b/units/sdlmutex.inc index a0e95757..b629173a 100644 --- a/units/sdlmutex.inc +++ b/units/sdlmutex.inc @@ -52,7 +52,7 @@ function SDL_CreateMutex: PSDL_Mutex; cdecl; * * \since This function is available since SDL 2.0.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LockMutex_fun = function(mutex: PSDL_Mutex): cint; cdecl; Var @@ -81,7 +81,7 @@ function SDL_LockMutex(mutex: PSDL_Mutex): cint; cdecl; * * \since This function is available since SDL 2.0.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_TryLockMutex_fun = function(mutex: PSDL_Mutex): cint; cdecl; Var @@ -109,7 +109,7 @@ function SDL_TryLockMutex(mutex: PSDL_Mutex): cint; cdecl; * * \since This function is available since SDL 2.0.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_UnlockMutex_fun = function(mutex: PSDL_Mutex): cint; cdecl; Var @@ -136,7 +136,7 @@ function SDL_UnlockMutex(mutex: PSDL_Mutex): cint; cdecl; * * \since This function is available since SDL 2.0.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_DestroyMutex_proc = procedure(mutex: PSDL_Mutex); cdecl; Var @@ -168,7 +168,7 @@ type * * \since This function is available since SDL 2.0.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_CreateSemaphore_fun = function(initial_value: cuint32): PSDL_sem; cdecl; Var @@ -189,7 +189,7 @@ function SDL_CreateSemaphore(initial_value: cuint32): PSDL_sem; cdecl; * * \since This function is available since SDL 2.0.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_DestroySemaphore_proc = procedure(sem: PSDL_Sem); cdecl; Var @@ -217,7 +217,7 @@ procedure SDL_DestroySemaphore(sem: PSDL_Sem); cdecl; * * \since This function is available since SDL 2.0.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SemWait_fun = function(sem: PSDL_Sem): cint; cdecl; Var @@ -243,7 +243,7 @@ function SDL_SemWait(sem: PSDL_Sem): cint; cdecl; * * \since This function is available since SDL 2.0.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SemTryWait_fun = function(sem: PSDL_Sem): cint; cdecl; Var @@ -270,7 +270,7 @@ function SDL_SemTryWait(sem: PSDL_Sem): cint; cdecl; * * \since This function is available since SDL 2.0.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SemWaitTimeout_fun = function(sem: PSDL_Sem; ms: cuint32): cint; cdecl; Var @@ -290,7 +290,7 @@ function SDL_SemWaitTimeout(sem: PSDL_Sem; ms: cuint32): cint; cdecl; * * \since This function is available since SDL 2.0.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SemPost_fun = function(sem: PSDL_Sem): cint; cdecl; Var @@ -309,7 +309,7 @@ function SDL_SemPost(sem: PSDL_Sem): cint; cdecl; * * \since This function is available since SDL 2.0.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SemValue_fun = function(sem: PSDL_Sem): cuint32; cdecl; Var @@ -374,7 +374,7 @@ function SDL_CreateCond: PSDL_Cond; cdecl; * * \since This function is available since SDL 2.0.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_DestroyCond_proc = procedure(cond: PSDL_Cond); cdecl; Var @@ -394,7 +394,7 @@ procedure SDL_DestroyCond(cond: PSDL_Cond); cdecl; * * \since This function is available since SDL 2.0.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_CondSignal_fun = function(cond: PSDL_Cond): cint; cdecl; Var @@ -414,7 +414,7 @@ function SDL_CondSignal(cond: PSDL_Cond): cint; cdecl; * * \since This function is available since SDL 2.0.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_CondBroadcast_fun = function(cond: PSDL_Cond): cint; cdecl; Var @@ -445,7 +445,7 @@ function SDL_CondBroadcast(cond: PSDL_Cond): cint; cdecl; * * \since This function is available since SDL 2.0.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_CondWait_fun = function(cond: PSDL_Cond; mutex: PSDL_Mutex): cint; cdecl; Var @@ -477,7 +477,7 @@ function SDL_CondWait(cond: PSDL_Cond; mutex: PSDL_Mutex): cint; cdecl; * * \since This function is available since SDL 2.0.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_CondWaitTimeout_fun = function(cond: PSDL_Cond; mutex: PSDL_Mutex; ms: cuint32): cint; cdecl; Var diff --git a/units/sdlpixels.inc b/units/sdlpixels.inc index 8f79d0d9..8f583416 100644 --- a/units/sdlpixels.inc +++ b/units/sdlpixels.inc @@ -536,7 +536,7 @@ type * * \since This function is available since SDL 2.0.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetPixelFormatName_fun = function(format: cuint32): PAnsiChar; cdecl; Var @@ -563,7 +563,7 @@ function SDL_GetPixelFormatName(format: cuint32): PAnsiChar; cdecl; * * \sa SDL_MasksToPixelFormatEnum *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_PixelFormatEnumToMasks_fun = function(format: cuint32; bpp: pcint; Rmask: pcuint32; Gmask: pcuint32; Bmask: pcuint32; Amask: pcuint32): TSDL_Bool; cdecl; @@ -593,7 +593,7 @@ function SDL_PixelFormatEnumToMasks(format: cuint32; bpp: pcint; * * \sa SDL_PixelFormatEnumToMasks *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_MasksToPixelFormatEnum_fun = function(bpp: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): cuint32; cdecl; Var @@ -619,7 +619,7 @@ function SDL_MasksToPixelFormatEnum(bpp: cint; Rmask: cuint32; Gmask: cuint32; B * * \sa SDL_FreeFormat *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_AllocFormat_fun = function(pixel_format: cuint32): PSDL_PixelFormat; cdecl; Var @@ -639,7 +639,7 @@ function SDL_AllocFormat(pixel_format: cuint32): PSDL_PixelFormat; cdecl; * * \sa SDL_AllocFormat *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_FreeFormat_proc = procedure(format: PSDL_PixelFormat); cdecl; Var @@ -664,7 +664,7 @@ procedure SDL_FreeFormat(format: PSDL_PixelFormat); cdecl; * * \sa SDL_FreePalette *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_AllocPalette_fun = function(ncolors: cint): PSDL_Palette; cdecl; Var @@ -688,7 +688,7 @@ function SDL_AllocPalette(ncolors: cint): PSDL_Palette; cdecl; * \sa SDL_AllocPalette * \sa SDL_FreePalette *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetPixelFormatPalette_fun = function(format: PSDL_PixelFormat; palette: PSDL_Palette): cint; cdecl; Var @@ -714,7 +714,7 @@ function SDL_SetPixelFormatPalette(format: PSDL_PixelFormat; palette: PSDL_Palet * \sa SDL_AllocPalette * \sa SDL_CreateRGBSurface *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetPaletteColors_fun = function(palette: PSDL_Palette; const colors: PSDL_Color; firstcolor: cint; ncolors: cint): cint; cdecl; Var @@ -734,7 +734,7 @@ function SDL_SetPaletteColors(palette: PSDL_Palette; const colors: PSDL_Color; f * * \sa SDL_AllocPalette *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_FreePalette_proc = procedure(palette: PSDL_Palette); cdecl; Var @@ -775,7 +775,7 @@ procedure SDL_FreePalette(palette: PSDL_Palette); cdecl; * \sa SDL_GetRGBA * \sa SDL_MapRGBA *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_MapRGB_fun = function(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cuint8): cuint32; cdecl; Var @@ -818,7 +818,7 @@ function SDL_MapRGB(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cui * \sa SDL_GetRGBA * \sa SDL_MapRGB *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_MapRGBA_fun = function(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cuint8; a: cuint8): cuint32; cdecl; Var @@ -850,7 +850,7 @@ function SDL_MapRGBA(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cu * \sa SDL_MapRGB * \sa SDL_MapRGBA *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetRGB_proc = procedure(pixel: cuint32; const format: PSDL_PixelFormat; r: pcuint8; g: pcuint8; b: pcuint8); cdecl; Var @@ -886,7 +886,7 @@ procedure SDL_GetRGB(pixel: cuint32; const format: PSDL_PixelFormat; r: pcuint8; * \sa SDL_MapRGB * \sa SDL_MapRGBA *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetRGBA_proc = procedure(pixel: cuint32; const format: PSDL_PixelFormat; r: pcuint8; g: pcuint8; b: pcuint8; a: pcuint8); cdecl; Var @@ -907,7 +907,7 @@ procedure SDL_GetRGBA(pixel: cuint32; const format: PSDL_PixelFormat; r: pcuint8 * * \sa SDL_SetWindowGammaRamp *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_CalculateGammaRamp_proc = procedure(gamma: cfloat; ramp: pcuint16); cdecl; Var diff --git a/units/sdlpower.inc b/units/sdlpower.inc index 59910ebf..4651f491 100644 --- a/units/sdlpower.inc +++ b/units/sdlpower.inc @@ -31,7 +31,7 @@ type * * \return The state of the battery (if any). *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetPowerInfo_fun = function(secs: pcint; pct: pcint): TSDL_PowerState; cdecl; Var diff --git a/units/sdlrect.inc b/units/sdlrect.inc index 5e4deaaa..063ceb0b 100644 --- a/units/sdlrect.inc +++ b/units/sdlrect.inc @@ -80,7 +80,7 @@ function SDL_RectEquals(const a, b: PSDL_Rect): Boolean; inline; * * SDL_TRUE if there is an intersection, SDL_FALSE otherwise. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HasIntersection_fun = function(const a, b: PSDL_Rect): TSDL_Bool; cdecl; Var @@ -96,7 +96,7 @@ function SDL_HasIntersection(const a, b: PSDL_Rect): TSDL_Bool; cdecl; * * SDL_TRUE if there is an intersection, SDL_FALSE otherwise. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_IntersectRect_fun = function(const A, B: PSDL_Rect; result: PSDL_Rect): TSDL_Bool; cdecl; Var @@ -110,7 +110,7 @@ function SDL_IntersectRect(const A, B: PSDL_Rect; result: PSDL_Rect): TSDL_Bool; {** * Calculate the union of two rectangles. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_UnionRect_proc = procedure(const A, B: PSDL_Rect; result: PSDL_Rect); cdecl; Var @@ -126,7 +126,7 @@ procedure SDL_UnionRect(const A, B: PSDL_Rect; result: PSDL_Rect); cdecl; * * SDL_TRUE if any points were within the clipping rect *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_EnclosePoints_fun = function(const points: PSDL_Point; count: cint; const clip: PSDL_Rect; result: PSDL_Rect): TSDL_Bool; cdecl; Var @@ -142,7 +142,7 @@ function SDL_EnclosePoints(const points: PSDL_Point; count: cint; const clip: PS * * SDL_TRUE if there is an intersection, SDL_FALSE otherwise. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_IntersectRectAndLine_fun = function(const rect: PSDL_Rect; X1, Y1, X2, Y2: pcint): TSDL_Bool; cdecl; Var @@ -190,7 +190,7 @@ function SDL_FRectEquals(const a, b: PSDL_FRect): Boolean; Inline; * * \sa SDL_IntersectRect *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HasIntersectionF_fun = function(const a, b: PSDL_FRect): TSDL_Bool; cdecl; Var @@ -216,7 +216,7 @@ function SDL_HasIntersectionF(const a, b: PSDL_FRect): TSDL_Bool; cdecl; * * \sa SDL_HasIntersectionF *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_IntersectFRect_fun = function(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; Var @@ -237,7 +237,7 @@ function SDL_IntersectFRect(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bo * * \since This function is available since SDL 2.0.22. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_UnionFRect_fun = function(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; Var @@ -266,7 +266,7 @@ function SDL_UnionFRect(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; * * \since This function is available since SDL 2.0.22. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_EncloseFPoints_fun = function(const points: PSDL_FPoint; count: cint; const clip: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; Var @@ -296,7 +296,7 @@ function SDL_EncloseFPoints(const points: PSDL_FPoint; count: cint; const clip: * * \since This function is available since SDL 2.0.22. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_IntersectFRectAndLine_fun = function(const rect: PSDL_FRect; X1, Y1, X2, Y2: pcfloat): TSDL_Bool; cdecl; Var diff --git a/units/sdlrenderer.inc b/units/sdlrenderer.inc index 7e962120..cf5586c8 100644 --- a/units/sdlrenderer.inc +++ b/units/sdlrenderer.inc @@ -381,7 +381,7 @@ function SDL_UpdateTexture(texture: PSDL_Texture; rect: PSDL_Rect; pixels: Point * * SDL_UnlockTexture() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LockTexture_fun = function(texture: PSDL_Texture; const rect: PSDL_Rect; pixels: PPointer; pitch: pcint): cint; cdecl; Var @@ -407,7 +407,7 @@ function SDL_LockTexture(texture: PSDL_Texture; const rect: PSDL_Rect; pixels: P * * \sa SDL_UnlockTexture() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LockTextureToSurface_fun = function(texture: PSDL_Texture; const rect: PSDL_Rect; surface: PPSDL_Surface): cint; cdecl; Var @@ -569,7 +569,7 @@ procedure SDL_RenderGetClipRect(renderer: PSDL_Renderer; rect: PSDL_Rect) cdecl; * * \sa SDL_RenderGetClipRect() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RenderIsClipEnabled_fun = function(renderer: PSDL_Renderer): TSDL_Bool; cdecl; Var @@ -711,7 +711,7 @@ function SDL_RenderDrawPoint(renderer: PSDL_Renderer; x: cint32; y: cint32): cin * * 0 on success, or -1 on error *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RenderDrawPointF_fun = function(renderer: PSDL_Renderer; x, y: single): cint32 cdecl; Var @@ -742,7 +742,7 @@ function SDL_RenderDrawPoints(renderer: PSDL_Renderer; points: PSDL_Point; count * * 0 on success, or -1 on error *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RenderDrawPointsF_fun = function(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl; Var @@ -777,7 +777,7 @@ function SDL_RenderDrawLine(renderer: PSDL_Renderer; x1: cint32; y1: cint32; x2: * * 0 on success, or -1 on error *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RenderDrawLineF_fun = function(renderer: PSDL_Renderer; x1, y1, x2, y2: single): cint32 cdecl; Var @@ -808,7 +808,7 @@ function SDL_RenderDrawLines(renderer: PSDL_Renderer; points: PSDL_Point; count: * * 0 on success, or -1 on error *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RenderDrawLinesF_fun = function(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl; Var @@ -837,7 +837,7 @@ function SDL_RenderDrawRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cd * * 0 on success, or -1 on error *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RenderDrawRectF_fun = function(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl; Var @@ -868,7 +868,7 @@ function SDL_RenderDrawRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: c * * 0 on success, or -1 on error *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RenderDrawRectsF_fun = function(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl; Var @@ -898,7 +898,7 @@ function SDL_RenderFillRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cd * * 0 on success, or -1 on error *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RenderFillRectF_fun = function(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl; Var @@ -929,7 +929,7 @@ function SDL_RenderFillRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: c * * 0 on success, or -1 on error *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RenderFillRectsF_fun = function(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl; Var @@ -964,7 +964,7 @@ function SDL_RenderCopy(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: * * 0 on success, or -1 on error *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RenderCopyF_fun = function(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: PSDL_Rect; dstrect: PSDL_FRect): cint32 cdecl; Var @@ -1005,7 +1005,7 @@ function SDL_RenderCopyEx(renderer: PSDL_Renderer; texture: PSDL_Texture; const * * 0 on success, or -1 on error *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RenderCopyExF_fun = function(renderer: PSDL_Renderer; texture: PSDL_Texture; const srcrect: PSDL_Rect; dstrect: PSDL_FRect; angle: cdouble; center: PSDL_FPoint; flip: TSDL_RenderFlip): cint32 cdecl; Var @@ -1137,7 +1137,7 @@ function SDL_GL_UnbindTexture(texture: PSDL_Texture): cint32 cdecl; external SDL * but it can be safely cast to a pointer to `CAMetalLayer`. * *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RenderGetMetalLayer_fun = function(renderer: PSDL_Renderer): Pointer; cdecl; Var @@ -1159,7 +1159,7 @@ function SDL_RenderGetMetalLayer(renderer: PSDL_Renderer): Pointer; cdecl; * hidden/minimized/offscreen. This doesn't apply to command encoders for * render targets, just the window's backbacker. Check your return values! *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RenderGetMetalCommandEncoder_fun = function(renderer: PSDL_Renderer): Pointer; cdecl; Var @@ -1194,7 +1194,7 @@ function SDL_RenderSetVSync(renderer: PSDL_Renderer; vsync: cint): cint; cdecl; * a contiguous block of Y and U/V planes in the proper order, but * this function is available if your pixel data is not contiguous. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_UpdateYUVTexture_fun = function(texture: PSDL_Texture; rect: PSDL_Rect; Yplane: pcuint8; Ypitch: cint32; Uplane: pcuint8; UPitch: cint32; Vplane: pcuint8; VPitch: cint32):cint32; cdecl; diff --git a/units/sdlrwops.inc b/units/sdlrwops.inc index 8f07ea0a..0e319be0 100644 --- a/units/sdlrwops.inc +++ b/units/sdlrwops.inc @@ -131,7 +131,7 @@ type * * Functions to create SDL_RWops structures from various data streams. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RWFromFile_fun = function(const _file: PAnsiChar; const mode: PAnsiChar): PSDL_RWops; cdecl; Var @@ -145,7 +145,7 @@ function SDL_RWFromFile(const _file: PAnsiChar; const mode: PAnsiChar): PSDL_RWo {function SDL_RWFromFP(fp: file; autoclose: TSDL_Bool): PSDL_RWops; cdecl; external SDL_LibName;} //don't know if this works -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RWFromFP_fun = function(fp: Pointer; autoclose: TSDL_Bool): PSDL_RWops; cdecl; Var @@ -156,7 +156,7 @@ function SDL_RWFromFP(fp: Pointer; autoclose: TSDL_Bool): PSDL_RWops; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWFromFP' {$ENDIF} {$ENDIF}; {$endif} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RWFromMem_fun = function(mem: Pointer; size: cint): PSDL_RWops; cdecl; Var @@ -167,7 +167,7 @@ function SDL_RWFromMem(mem: Pointer; size: cint): PSDL_RWops; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RWFromMem' {$ENDIF} {$ENDIF}; {$endif} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RWFromConstMem_fun = function(const mem: Pointer; size: cint): PSDL_RWops; cdecl; Var @@ -182,7 +182,7 @@ function SDL_RWFromConstMem(const mem: Pointer; size: cint): PSDL_RWops; cdecl; function SDL_AllocRW: PSDL_RWops; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AllocRW' {$ENDIF} {$ENDIF}; -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_FreeRW_proc = procedure(area: PSDL_RWops); cdecl; Var @@ -201,7 +201,7 @@ const {** * Return the size of the file in this rwops, or -1 if unknown *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RWsize_fun = function(context: PSDL_RWops): cint64; cdecl; Var @@ -218,7 +218,7 @@ function SDL_RWsize(context: PSDL_RWops): cint64; cdecl; * * \return the final offset in the data stream, or -1 on error. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RWseek_fun = function(context: PSDL_RWops; offset: cint64; whence: cint): cint64; cdecl; Var @@ -232,7 +232,7 @@ function SDL_RWseek(context: PSDL_RWops; offset: cint64; whence: cint): cint64; {** * Return the current offset in the data stream, or -1 on error. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RWtell_fun = function(context: PSDL_RWops): cint64; cdecl; Var @@ -249,7 +249,7 @@ function SDL_RWtell(context: PSDL_RWops): cint64; cdecl; * * \return the number of objects read, or 0 at error or end of file. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RWread_fun = function(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t): csize_t; cdecl; Var @@ -266,7 +266,7 @@ function SDL_RWread(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t * * \return the number of objects written, or 0 at error or end of file. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RWwrite_fun = function(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t): csize_t; cdecl; Var @@ -282,7 +282,7 @@ function SDL_RWwrite(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_ * * \return 0 if successful or -1 on write error when flushing data. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RWclose_fun = function(context: PSDL_RWops): cint; cdecl; Var @@ -306,7 +306,7 @@ function SDL_RWclose(context: PSDL_RWops): cint; cdecl; * * \return the data, or NULL if there was an error. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LoadFile_RW_fun = function(src: PSDL_RWops; datasize: pcsize_t; freesrc: cint): Pointer; cdecl; Var @@ -330,7 +330,7 @@ function SDL_LoadFile_RW(src: PSDL_RWops; datasize: pcsize_t; freesrc: cint): Po * * \return the data, or NULL if there was an error. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LoadFile_fun = function(file_: PAnsiChar; datasize: pcsize_t): Pointer; cdecl; Var @@ -346,7 +346,7 @@ function SDL_LoadFile(file_: PAnsiChar; datasize: pcsize_t): Pointer; cdecl; * * Read an item of the specified endianness and return in native format. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_ReadU8_fun = function(src: PSDL_RWops): cuint8; cdecl; Var @@ -356,7 +356,7 @@ Var function SDL_ReadU8(src: PSDL_RWops): cuint8; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadU8' {$ENDIF} {$ENDIF}; {$endif} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_ReadLE16_fun = function(src: PSDL_RWops): cuint16; cdecl; Var @@ -366,7 +366,7 @@ Var function SDL_ReadLE16(src: PSDL_RWops): cuint16; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadLE16' {$ENDIF} {$ENDIF}; {$endif} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_ReadBE16_fun = function(src: PSDL_RWops): cuint16; cdecl; Var @@ -376,7 +376,7 @@ Var function SDL_ReadBE16(src: PSDL_RWops): cuint16; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadBE16' {$ENDIF} {$ENDIF}; {$endif} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_ReadLE32_fun = function(src: PSDL_RWops): cuint32; cdecl; Var @@ -386,7 +386,7 @@ Var function SDL_ReadLE32(src: PSDL_RWops): cuint32; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadLE32' {$ENDIF} {$ENDIF}; {$endif} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_ReadBE32_fun = function(src: PSDL_RWops): cuint32; cdecl; Var @@ -396,7 +396,7 @@ Var function SDL_ReadBE32(src: PSDL_RWops): cuint32; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadBE32' {$ENDIF} {$ENDIF}; {$endif} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_ReadLE64_fun = function(src: PSDL_RWops): cuint64; cdecl; Var @@ -406,7 +406,7 @@ Var function SDL_ReadLE64(src: PSDL_RWops): cuint64; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ReadLE64' {$ENDIF} {$ENDIF}; {$endif} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_ReadBE64_fun = function(src: PSDL_RWops): cuint64; cdecl; Var @@ -423,7 +423,7 @@ function SDL_ReadBE64(src: PSDL_RWops): cuint64; cdecl; * * Write an item of native format to the specified endianness. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_WriteU8_fun = function(dst: PSDL_RWops; value: cuint8): csize_t; cdecl; Var @@ -433,7 +433,7 @@ Var function SDL_WriteU8(dst: PSDL_RWops; value: cuint8): csize_t; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteU8' {$ENDIF} {$ENDIF}; {$endif} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_WriteLE16_fun = function(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; Var @@ -443,7 +443,7 @@ Var function SDL_WriteLE16(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteLE16' {$ENDIF} {$ENDIF}; {$endif} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_WriteBE16_fun = function(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; Var @@ -453,7 +453,7 @@ Var function SDL_WriteBE16(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteBE16' {$ENDIF} {$ENDIF}; {$endif} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_WriteLE32_fun = function(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; Var @@ -463,7 +463,7 @@ Var function SDL_WriteLE32(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteLE32' {$ENDIF} {$ENDIF}; {$endif} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_WriteBE32_fun = function(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; Var @@ -473,7 +473,7 @@ Var function SDL_WriteBE32(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteBE32' {$ENDIF} {$ENDIF}; {$endif} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_WriteLE64_fun = function(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; Var @@ -483,7 +483,7 @@ Var function SDL_WriteLE64(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WriteLE64' {$ENDIF} {$ENDIF}; {$endif} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_WriteBE64_fun = function(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; Var diff --git a/units/sdlshape.inc b/units/sdlshape.inc index 0237146e..ab5434c7 100644 --- a/units/sdlshape.inc +++ b/units/sdlshape.inc @@ -33,7 +33,7 @@ const * * \sa SDL_DestroyWindow *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_CreateShapedWindow_fun = function(title: PAnsiChar; x: cuint; y: cuint; w: cuint; h: cuint; flags: cuint32): PSDL_Window; cdecl; Var @@ -55,7 +55,7 @@ function SDL_CreateShapedWindow(title: PAnsiChar; x: cuint; y: cuint; w: cuint; * * \sa SDL_CreateShapedWindow *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_IsShapedWindow_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; Var @@ -121,7 +121,7 @@ type * \sa SDL_WindowShapeMode * \sa SDL_GetShapedWindowMode *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowShape_fun = function(window: PSDL_Window; shape: PSDL_Surface; shape_mode: PSDL_WindowShapeMode): cint; cdecl; Var @@ -149,7 +149,7 @@ function SDL_SetWindowShape(window: PSDL_Window; shape: PSDL_Surface; shape_mode * \sa SDL_WindowShapeMode * \sa SDL_SetWindowShape *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetShapedWindowMode_fun = function(window: PSDL_Window; shape_mode: PSDL_WindowShapeMode): cint; cdecl; Var diff --git a/units/sdlstdinc.inc b/units/sdlstdinc.inc index 48310dae..109c6757 100644 --- a/units/sdlstdinc.inc +++ b/units/sdlstdinc.inc @@ -110,7 +110,7 @@ function SDL_SetMemoryFunctions( * * \since This function is available since SDL 2.0.7. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetNumAllocations_fun = function(): cint; cdecl; Var @@ -124,7 +124,7 @@ function SDL_GetNumAllocations(): cint; cdecl; (** * Allocate a block of memory. The memory is *not* initialized. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_malloc_fun = function(size: csize_t): Pointer; cdecl; Var @@ -139,7 +139,7 @@ function SDL_malloc(size: csize_t): Pointer; cdecl; * Allocate a block of memory that can fit an array of nmemb elements, each of given size. * The memory is initialized by setting every byte to 0. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_calloc_fun = function(nmemb, size: csize_t): Pointer; cdecl; Var @@ -156,7 +156,7 @@ function SDL_calloc(nmemb, size: csize_t): Pointer; cdecl; * The returned pointer may or may not be the same as the original pointer. * If the new size is larger than the old size, any new memory will *not* be initialized. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_realloc_fun = function(mem: Pointer; size: csize_t): Pointer; cdecl; Var @@ -173,7 +173,7 @@ function SDL_realloc(mem: Pointer; size: csize_t): Pointer; cdecl; * Calling SDL_free() on the same pointer twice is undefined behaviour and may cause * your program to crash or behave in unexpected ways. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_free_proc = procedure(mem: Pointer); cdecl; Var @@ -198,7 +198,7 @@ SDL2-for-Pascal: All comments are added by us and not found in the include file. * * \since This function is available since SDL 2.0.16. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_isalpha_fun = function(x: cint):cint; cdecl; Var @@ -216,7 +216,7 @@ function SDL_isalpha(x: cint):cint; cdecl; * * \since This function is available since SDL 2.0.16. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_isalnum_fun = function(x: cint):cint; cdecl; Var @@ -234,7 +234,7 @@ function SDL_isalnum(x: cint):cint; cdecl; * * \since This function is available since SDL 2.0.16. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_isblank_fun = function(x: cint):cint; cdecl; Var @@ -252,7 +252,7 @@ function SDL_isblank(x: cint):cint; cdecl; * * \since This function is available since SDL 2.0.16. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_iscntrl_fun = function(x: cint):cint; cdecl; Var @@ -270,7 +270,7 @@ function SDL_iscntrl(x: cint):cint; cdecl; * * \since This function is available since SDL 2.0.4. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_isdigit_fun = function(x: cint):cint; cdecl; Var @@ -288,7 +288,7 @@ function SDL_isdigit(x: cint):cint; cdecl; * * \since This function is available since SDL 2.0.16. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_isxdigit_fun = function(x: cint):cint; cdecl; Var @@ -307,7 +307,7 @@ function SDL_isxdigit(x: cint):cint; cdecl; * * \since This function is available since SDL 2.0.16. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_ispunct_fun = function(x: cint):cint; cdecl; Var @@ -328,7 +328,7 @@ function SDL_ispunct(x: cint):cint; cdecl; * * \since This function is available since SDL 2.0.4. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_isspace_fun = function(x: cint):cint; cdecl; Var @@ -346,7 +346,7 @@ function SDL_isspace(x: cint):cint; cdecl; * * \since This function is available since SDL 2.0.12. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_isupper_fun = function(x: cint):cint; cdecl; Var @@ -364,7 +364,7 @@ function SDL_isupper(x: cint):cint; cdecl; * * \since This function is available since SDL 2.0.12. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_islower_fun = function(x: cint):cint; cdecl; Var @@ -382,7 +382,7 @@ function SDL_islower(x: cint):cint; cdecl; * * \since This function is available since SDL 2.0.16. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_isprint_fun = function(x: cint):cint; cdecl; Var @@ -400,7 +400,7 @@ function SDL_isprint(x: cint):cint; cdecl; * * \since This function is available since SDL 2.0.16. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_isgraph_fun = function(x: cint):cint; cdecl; Var @@ -417,7 +417,7 @@ function SDL_isgraph(x: cint):cint; cdecl; * * \since This function is available since SDL 2.0.4. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_toupper_fun = function(x: cint):cint; cdecl; Var @@ -434,7 +434,7 @@ function SDL_toupper(x: cint):cint; cdecl; * * \since This function is available since SDL 2.0.4. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_tolower_fun = function(x: cint):cint; cdecl; Var @@ -456,7 +456,7 @@ function SDL_tolower(x: cint):cint; cdecl; * * \since This function is available since SDL 2.0.4. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_acos_fun = function(x: cdouble): cdouble; cdecl; Var @@ -473,7 +473,7 @@ function SDL_acos(x: cdouble): cdouble; cdecl; * * \since This function is available since SDL 2.0.8. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_acosf_fun = function(x: cfloat): cfloat; cdecl; Var @@ -490,7 +490,7 @@ function SDL_acosf(x: cfloat): cfloat; cdecl; * * \since This function is available since SDL 2.0.4. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_asin_fun = function(x: cdouble): cdouble; cdecl; Var @@ -507,7 +507,7 @@ function SDL_asin(x: cdouble): cdouble; cdecl; * * \since This function is available since SDL 2.0.8. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_asinf_fun = function(x: cfloat): cfloat; cdecl; Var @@ -524,7 +524,7 @@ function SDL_asinf(x: cfloat): cfloat; cdecl; * * \since This function is available since SDL 2.0.4. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_atan_fun = function(x: cdouble): cdouble; cdecl; Var @@ -541,7 +541,7 @@ function SDL_atan(x: cdouble): cdouble; cdecl; * * \since This function is available since SDL 2.0.8. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_atanf_fun = function(x: cfloat): cfloat; cdecl; Var @@ -558,7 +558,7 @@ function SDL_atanf(x: cfloat): cfloat; cdecl; * * \since This function is available since SDL 2.0.4. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_atan2_fun = function(y, x: cdouble): cdouble; cdecl; Var @@ -575,7 +575,7 @@ function SDL_atan2(y, x: cdouble): cdouble; cdecl; * * \since This function is available since SDL 2.0.8. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_atan2f_fun = function(y, x: cfloat): cfloat; cdecl; Var @@ -591,7 +591,7 @@ function SDL_atan2f(y, x: cfloat): cfloat; cdecl; * * \since This function is available since SDL 2.0.4. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_ceil_fun = function(x: cdouble): cdouble; cdecl; Var @@ -607,7 +607,7 @@ function SDL_ceil(x: cdouble): cdouble; cdecl; * * \since This function is available since SDL 2.0.8. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_ceilf_fun = function(x: cfloat): cfloat; cdecl; Var @@ -624,7 +624,7 @@ function SDL_ceilf(x: cfloat): cfloat; cdecl; * * \since This function is available since SDL 2.0.4. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_copysign_fun = function(x, y: cdouble): cdouble; cdecl; Var @@ -641,7 +641,7 @@ function SDL_copysign(x, y: cdouble): cdouble; cdecl; * * \since This function is available since SDL 2.0.8. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_copysignf_fun = function(x, y: cfloat): cfloat; cdecl; Var @@ -657,7 +657,7 @@ function SDL_copysignf(x, y: cfloat): cfloat; cdecl; * * \since This function is available since SDL 2.0.4. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_cos_fun = function(x: cdouble): cdouble; cdecl; Var @@ -673,7 +673,7 @@ function SDL_cos(x: cdouble): cdouble; cdecl; * * \since This function is available since SDL 2.0.4. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_cosf_fun = function(x: cfloat): cfloat; cdecl; Var @@ -690,7 +690,7 @@ function SDL_cosf(x: cfloat): cfloat; cdecl; * * \since This function is available since SDL 2.0.9. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_exp_fun = function(x: cdouble): cdouble; cdecl; Var @@ -707,7 +707,7 @@ function SDL_exp(x: cdouble): cdouble; cdecl; * * \since This function is available since SDL 2.0.9. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_expf_fun = function(x: cfloat): cfloat; cdecl; Var @@ -723,7 +723,7 @@ function SDL_expf(x: cfloat): cfloat; cdecl; * * \since This function is available since SDL 2.0.4. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_fabs_fun = function(x: cdouble): cdouble; cdecl; Var @@ -739,7 +739,7 @@ function SDL_fabs(x: cdouble): cdouble; cdecl; * * \since This function is available since SDL 2.0.8. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_fabsf_fun = function(x: cfloat): cfloat; cdecl; Var @@ -755,7 +755,7 @@ function SDL_fabsf(x: cfloat): cfloat; cdecl; * * \since This function is available since SDL 2.0.4. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_floor_fun = function(x: cdouble): cdouble; cdecl; Var @@ -771,7 +771,7 @@ function SDL_floor(x: cdouble): cdouble; cdecl; * * \since This function is available since SDL 2.0.8. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_floorf_fun = function(x: cfloat): cfloat; cdecl; Var @@ -787,7 +787,7 @@ function SDL_floorf(x: cfloat): cfloat; cdecl; * * \since This function is available since SDL 2.0.8. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_fmod_fun = function(x, y: cdouble): cdouble; cdecl; Var @@ -803,7 +803,7 @@ function SDL_fmod(x, y: cdouble): cdouble; cdecl; * * \since This function is available since SDL 2.0.8. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_fmodf_fun = function(x, y: cfloat): cfloat; cdecl; Var @@ -823,7 +823,7 @@ function SDL_fmodf(x, y: cfloat): cfloat; cdecl; but since Pascal names are case-insensitive, it is in conflict with SDL_Log (logging function). Hence we decided to rename it. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_nlog_fun = function(x: cdouble): cdouble; cdecl; Var @@ -844,7 +844,7 @@ function SDL_nlog(x: cdouble): cdouble; cdecl; but to be consistent with the renamed SDL_log function (see comment of SDL_nlog for details), we decided to rename it. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_nlogf_fun = function(x: cfloat): cfloat; cdecl; Var @@ -861,7 +861,7 @@ function SDL_nlogf(x: cfloat): cfloat; cdecl; * * \since This function is available since SDL 2.0.8. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_log10_fun = function(x: cdouble): cdouble; cdecl; Var @@ -877,7 +877,7 @@ function SDL_log10(x: cdouble): cdouble; cdecl; * * \since This function is available since SDL 2.0.8. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_log10f_fun = function(x: cfloat): cfloat; cdecl; Var @@ -893,7 +893,7 @@ function SDL_log10f(x: cfloat): cfloat; cdecl; * * \since This function is available since SDL 2.0.16. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_lround_fun = function(x: cdouble): clong; cdecl; Var @@ -909,7 +909,7 @@ function SDL_lround(x: cdouble): clong; cdecl; * * \since This function is available since SDL 2.0.16. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_lroundf_fun = function(x: cfloat): clong; cdecl; Var @@ -925,7 +925,7 @@ function SDL_lroundf(x: cfloat): clong; cdecl; * * \since This function is available since SDL 2.0.4. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_pow_fun = function(x, y: cdouble): cdouble; cdecl; Var @@ -941,7 +941,7 @@ function SDL_pow(x, y: cdouble): cdouble; cdecl; * * \since This function is available since SDL 2.0.8. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_powf_fun = function(x, y: cfloat): cfloat; cdecl; Var @@ -957,7 +957,7 @@ function SDL_powf(x, y: cfloat): cfloat; cdecl; * * \since This function is available since SDL 2.0.16. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_round_fun = function(x: cdouble): cdouble; cdecl; Var @@ -973,7 +973,7 @@ function SDL_round(x: cdouble): cdouble; cdecl; * * \since This function is available since SDL 2.0.16. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_roundf_fun = function(x: cfloat): cfloat; cdecl; Var @@ -990,7 +990,7 @@ function SDL_roundf(x: cfloat): cfloat; cdecl; * * \since This function is available since SDL 2.0.4. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_scalbn_fun = function(x: cdouble; n: cint): cdouble; cdecl; Var @@ -1007,7 +1007,7 @@ function SDL_scalbn(x: cdouble; n: cint): cdouble; cdecl; * * \since This function is available since SDL 2.0.8. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_scalbnf_fun = function(x: cfloat; n: cint): cfloat; cdecl; Var @@ -1023,7 +1023,7 @@ function SDL_scalbnf(x: cfloat; n: cint): cfloat; cdecl; * * \since This function is available since SDL 2.0.4. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_sin_fun = function(x: cdouble): cdouble; cdecl; Var @@ -1039,7 +1039,7 @@ function SDL_sin(x: cdouble): cdouble; cdecl; * * \since This function is available since SDL 2.0.4. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_sinf_fun = function(x: cfloat): cfloat; cdecl; Var @@ -1055,7 +1055,7 @@ function SDL_sinf(x: cfloat): cfloat; cdecl; * * \since This function is available since SDL 2.0.4. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_sqrt_fun = function(x: cdouble): cdouble; cdecl; Var @@ -1071,7 +1071,7 @@ function SDL_sqrt(x: cdouble): cdouble; cdecl; * * \since This function is available since SDL 2.0.4. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_sqrtf_fun = function(x: cfloat): cfloat; cdecl; Var @@ -1087,7 +1087,7 @@ function SDL_sqrtf(x: cfloat): cfloat; cdecl; * * \since This function is available since SDL 2.0.4. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_tan_fun = function(x: cdouble): cdouble; cdecl; Var @@ -1103,7 +1103,7 @@ function SDL_tan(x: cdouble): cdouble; cdecl; * * \since This function is available since SDL 2.0.4. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_tanf_fun = function(x: cfloat): cfloat; cdecl; Var @@ -1119,7 +1119,7 @@ function SDL_tanf(x: cfloat): cfloat; cdecl; * * \since This function is available since SDL 2.0.14. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_trunc_fun = function(x: cdouble): cdouble; cdecl; Var @@ -1135,7 +1135,7 @@ function SDL_trunc(x: cdouble): cdouble; cdecl; * * \since This function is available since SDL 2.0.14. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_truncf_fun = function(x: cfloat): cfloat; cdecl; Var @@ -1157,7 +1157,7 @@ function SDL_truncf(x: cfloat): cfloat; cdecl; * * \since This function is available since SDL 2.0.0. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_iconv_string_fun = function(Const tocode, fromcode, inbuf: PAnsiChar; inbytesleft: csize_t): PAnsiChar; cdecl; Var @@ -1183,7 +1183,7 @@ const type PSDL_iconv = type Pointer; -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_iconv_open_fun = function(Const tocode, fromcode: PAnsiChar): PSDL_iconv; cdecl; Var @@ -1194,7 +1194,7 @@ function SDL_iconv_open(Const tocode, fromcode: PAnsiChar): PSDL_iconv; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iconv_open' {$ENDIF} {$ENDIF}; {$endif} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_iconv_close_fun = function(cd: PSDL_iconv): cint; cdecl; Var @@ -1205,7 +1205,7 @@ function SDL_iconv_close(cd: PSDL_iconv): cint; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iconv_close' {$ENDIF} {$ENDIF}; {$endif} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_iconv_fun = function(cd: PSDL_iconv; Const inbuf: PPAnsiChar; inbytesleft: pcsize_t; outbuf: PPAnsiChar; outbytesleft: pcsize_t): csize_t; cdecl; Var diff --git a/units/sdlsurface.inc b/units/sdlsurface.inc index 98a505df..18657dd0 100644 --- a/units/sdlsurface.inc +++ b/units/sdlsurface.inc @@ -96,7 +96,7 @@ const * \param Amask The alpha mask of the surface to create. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_CreateRGBSurface_fun = function(flags: cuint32; width: cint; height: cint; depth: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl; Var @@ -107,7 +107,7 @@ function SDL_CreateRGBSurface(flags: cuint32; width: cint; height: cint; depth: external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurface' {$ENDIF} {$ENDIF}; {$endif} {* !!! FIXME for 2.1: why does this ask for depth? Format provides that. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_CreateRGBSurfaceWithFormat_fun = function(flags: cuint32; width, height, depth: cint; format: cuint32):PSDL_Surface; cdecl; Var @@ -117,7 +117,7 @@ Var function SDL_CreateRGBSurfaceWithFormat(flags: cuint32; width, height, depth: cint; format: cuint32):PSDL_Surface; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurfaceWithFormat' {$ENDIF} {$ENDIF}; {$endif} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_CreateRGBSurfaceFrom_fun = function(pixels: Pointer; width: cint; height: cint; depth: cint; pitch: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl; Var @@ -127,7 +127,7 @@ Var function SDL_CreateRGBSurfaceFrom(pixels: Pointer; width: cint; height: cint; depth: cint; pitch: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurfaceFrom' {$ENDIF} {$ENDIF}; {$endif} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_CreateRGBSurfaceWithFormatFrom_fun = function(pixels: Pointer; width, height, depth, pitch: cint; format: cuint32):PSDL_Surface; cdecl; Var @@ -137,7 +137,7 @@ Var function SDL_CreateRGBSurfaceWithFormatFrom(pixels: Pointer; width, height, depth, pitch: cint; format: cuint32):PSDL_Surface; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRGBSurfaceWithFormatFrom' {$ENDIF} {$ENDIF}; {$endif} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_FreeSurface_proc = procedure(surface: PSDL_Surface); cdecl; Var @@ -156,7 +156,7 @@ procedure SDL_FreeSurface(surface: PSDL_Surface); cdecl; * A single palette can be shared with many surfaces. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetSurfacePalette_fun = function(surface: PSDL_Surface; palette: PSDL_Palette): cint; cdecl; Var @@ -187,7 +187,7 @@ function SDL_SetSurfacePalette(surface: PSDL_Surface; palette: PSDL_Palette): ci * SDL_UnlockSurface() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LockSurface_fun = function(surface: PSDL_Surface): cint; cdecl; Var @@ -200,7 +200,7 @@ function SDL_LockSurface(surface: PSDL_Surface): cint; cdecl; {** SDL_LockSurface() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_UnlockSurface_proc = procedure(surface: PSDL_Surface); cdecl; Var @@ -221,7 +221,7 @@ procedure SDL_UnlockSurface(surface: PSDL_Surface); cdecl; * the new surface, or NULL if there was an error. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LoadBMP_RW_fun = function(src: PSDL_RWops; freesrc: cint): PSDL_Surface; cdecl; Var @@ -254,7 +254,7 @@ function SDL_LoadBMP(_file: PAnsiChar): PSDL_Surface; * \return 0 if successful or -1 if there was an error. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SaveBMP_RW_fun = function(surface: PSDL_Surface; dst: PSDL_RWops; freedst: cint): cint; cdecl; Var @@ -282,7 +282,7 @@ function SDL_SaveBMP(const surface: PSDL_Surface; const filename:AnsiString): ci * but the surface must be locked before directly accessing the pixels. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetSurfaceRLE_fun = function(surface: PSDL_Surface; flag: cint): cint; cdecl; Var @@ -298,7 +298,7 @@ function SDL_SetSurfaceRLE(surface: PSDL_Surface; flag: cint): cint; cdecl; * * \return SDL_TRUE if the surface is RLE enabled, or SDL_FALSE if the surface is NULL or not RLE enabled *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HasSurfaceRLE_fun = function(surface: PSDL_Surface): TSDL_Bool; cdecl; Var @@ -321,7 +321,7 @@ Var * You can pass SDL_RLEACCEL to enable RLE accelerated blits. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetColorKey_fun = function(surface: PSDL_Surface; flag: cint; key: cuint32): cint; cdecl; Var @@ -337,7 +337,7 @@ function SDL_SetColorKey(surface: PSDL_Surface; flag: cint; key: cuint32): cint; * * \return SDL_TRUE if the surface has a color key, or SDL_FALSE if the surface is NULL or has no color key *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HasColorKey_fun = function(surface: PSDL_Surface): TSDL_Bool; cdecl; Var @@ -359,7 +359,7 @@ function SDL_HasColorKey(surface: PSDL_Surface): TSDL_Bool; cdecl; * enabled. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetColorKey_fun = function(surface: PSDL_Surface; key: pcuint32): cint; cdecl; Var @@ -383,7 +383,7 @@ function SDL_GetColorKey(surface: PSDL_Surface; key: pcuint32): cint; cdecl; * SDL_GetSurfaceColorMod() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetSurfaceColorMod_fun = function(surface: PSDL_Surface; r: cuint8; g: cuint8; b: cuint8): cint; cdecl; Var @@ -407,7 +407,7 @@ function SDL_SetSurfaceColorMod(surface: PSDL_Surface; r: cuint8; g: cuint8; b: * SDL_SetSurfaceColorMod() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetSurfaceColorMod_fun = function(surface: PSDL_Surface; r: pcuint8; g: pcuint8; b: pcuint8): cint; cdecl; Var @@ -429,7 +429,7 @@ function SDL_GetSurfaceColorMod(surface: PSDL_Surface; r: pcuint8; g: pcuint8; b * SDL_GetSurfaceAlphaMod() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetSurfaceAlphaMod_fun = function(surface: PSDL_Surface; alpha: cuint8): cint; cdecl; Var @@ -451,7 +451,7 @@ function SDL_SetSurfaceAlphaMod(surface: PSDL_Surface; alpha: cuint8): cint; cde * SDL_SetSurfaceAlphaMod() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetSurfaceAlphaMod_fun = function(surface: PSDL_Surface; alpha: pcuint8): cint; cdecl; Var @@ -473,7 +473,7 @@ function SDL_GetSurfaceAlphaMod(surface: PSDL_Surface; alpha: pcuint8): cint; cd * SDL_GetSurfaceBlendMode() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetSurfaceBlendMode_fun = function(surface: PSDL_Surface; blendMode: TSDL_BlendMode): cint; cdecl; Var @@ -495,7 +495,7 @@ function SDL_SetSurfaceBlendMode(surface: PSDL_Surface; blendMode: TSDL_BlendMod * SDL_SetSurfaceBlendMode() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetSurfaceBlendMode_fun = function(surface: PSDL_Surface; blendMode: PSDL_BlendMode): cint; cdecl; Var @@ -520,7 +520,7 @@ function SDL_GetSurfaceBlendMode(surface: PSDL_Surface; blendMode: PSDL_BlendMod * and destination surfaces. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetClipRect_fun = function(surface: PSDL_Surface; const rect: PSDL_Rect): TSDL_Bool; cdecl; Var @@ -538,7 +538,7 @@ function SDL_SetClipRect(surface: PSDL_Surface; const rect: PSDL_Rect): TSDL_Boo * with the correct values. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetClipRect_proc = procedure(surface: PSDL_Surface; rect: PSDL_Rect); cdecl; Var @@ -552,7 +552,7 @@ procedure SDL_GetClipRect(surface: PSDL_Surface; rect: PSDL_Rect); cdecl; {* * Creates a new surface identical to the existing surface *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_DuplicateSurface_fun = function(surface: PSDL_Surface): PSDL_Surface; cdecl; Var @@ -574,7 +574,7 @@ function SDL_DuplicateSurface(surface: PSDL_Surface): PSDL_Surface; cdecl; * surface. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_ConvertSurface_fun = function(src: PSDL_Surface; const fmt: PSDL_PixelFormat; flags: cuint32): PSDL_Surface; cdecl; Var @@ -584,7 +584,7 @@ Var function SDL_ConvertSurface(src: PSDL_Surface; const fmt: PSDL_PixelFormat; flags: cuint32): PSDL_Surface; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ConvertSurface' {$ENDIF} {$ENDIF}; {$endif} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_ConvertSurfaceFormat_fun = function(src: PSDL_Surface; pixel_format: cuint32; flags: cuint32): PSDL_Surface; cdecl; Var @@ -601,7 +601,7 @@ function SDL_ConvertSurfaceFormat(src: PSDL_Surface; pixel_format: cuint32; flag * 0 on success, or -1 if there was an error *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_ConvertPixels_fun = function(width: cint; height: cint; src_format: cuint32; const src: Pointer; src_pitch: cint; dst_format: cuint32; dst: Pointer; dst_pitch: cint): cint; cdecl; Var @@ -623,7 +623,7 @@ function SDL_ConvertPixels(width: cint; height: cint; src_format: cuint32; const * 0 on success, or -1 on error. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_FillRect_fun = function(dst: PSDL_Surface; const rect: PSDL_Rect; color: cuint32): cint; cdecl; Var @@ -633,7 +633,7 @@ Var function SDL_FillRect(dst: PSDL_Surface; const rect: PSDL_Rect; color: cuint32): cint; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FillRect' {$ENDIF} {$ENDIF}; {$endif} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_FillRects_fun = function(dst: PSDL_Surface; const rects: PSDL_Rect; count: cint; color: cuint32): cint; cdecl; Var @@ -705,7 +705,7 @@ function SDL_FillRects(dst: PSDL_Surface; const rects: PSDL_Rect; count: cint; c (* SDL_surface.h uses #define to change all SDL_BlitSurface() calls into SDL_UpperBlit() calls. * * Since Pascal macro support is very limited, we workaround by outright pointing SDL_BlitSurface() to SDL_UpperBlit(). *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_BlitSurface_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; Var @@ -722,7 +722,7 @@ function SDL_BlitSurface(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_ * rectangle validation and clipping before passing it to SDL_LowerBlit() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_UpperBlit_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; Var @@ -738,7 +738,7 @@ function SDL_UpperBlit(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Su * blitting only. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LowerBlit_fun = function(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; Var @@ -756,7 +756,7 @@ function SDL_LowerBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; * This function uses a static buffer, and is not thread-safe. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SoftStretch_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; const dstrect: PSDL_Surface): cint; cdecl; Var @@ -769,7 +769,7 @@ function SDL_SoftStretch(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_ (* SDL_surface.h uses #define to change all SDL_BlitSurfaceScaled() calls into SDL_UpperBlitScaled() calls. * * Since Pascal macro support is very limited, we workaround by outright pointing SDL_BlitSurfaceScaled() to SDL_UpperBlitScaled(). *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_BlitSurfaceScaled_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; Var @@ -785,7 +785,7 @@ function SDL_BlitSurfaceScaled(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: * rectangle validation and clipping before passing it to SDL_LowerBlitScaled() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_UpperBlitScaled_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; Var @@ -801,7 +801,7 @@ function SDL_UpperBlitScaled(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: P * scaled blitting only. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LowerBlitScaled_fun = function(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; Var @@ -815,7 +815,7 @@ function SDL_LowerBlitScaled(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Su {** * \brief Set the YUV conversion mode *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetYUVConversionMode_proc = procedure(mode: TSDL_YUV_CONVERSION_MODE); cdecl; Var @@ -835,7 +835,7 @@ function SDL_GetYUVConversionMode: TSDL_YUV_CONVERSION_MODE; cdecl; {** * \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetYUVConversionModeForResolution_fun = function(width: cint; height: cint): TSDL_YUV_CONVERSION_MODE; cdecl; Var diff --git a/units/sdlsystem.inc b/units/sdlsystem.inc index c5252e1c..583ea203 100644 --- a/units/sdlsystem.inc +++ b/units/sdlsystem.inc @@ -15,7 +15,7 @@ type * * \since This function is available since SDL 2.0.4. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowsMessageHook_proc = procedure(callback: TSDL_WindowsMessageHook; userdata: Pointer); cdecl; Var @@ -39,7 +39,7 @@ procedure SDL_SetWindowsMessageHook(callback: TSDL_WindowsMessageHook; userdata: * * \since This function is available since SDL 2.0.1. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_Direct3D9GetAdapterIndex_fun = function(displayIndex:cint):cint; cdecl; Var @@ -67,7 +67,7 @@ type * * \since This function is available since SDL 2.0.1. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RenderGetD3D9Device_fun = function(renderer:PSDL_Renderer):PIDirect3DDevice9; cdecl; Var @@ -90,7 +90,7 @@ function SDL_RenderGetD3D9Device(renderer:PSDL_Renderer):PIDirect3DDevice9; cdec * * \since This function is available since SDL 2.0.16. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RenderGetD3D11Device_fun = function(renderer:PSDL_Renderer):PID3D11Device; cdecl; Var @@ -113,7 +113,7 @@ function SDL_RenderGetD3D11Device(renderer:PSDL_Renderer):PID3D11Device; cdecl; * * \since This function is available since SDL 2.24.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RenderGetD3D12Device_fun = function(renderer:PSDL_Renderer):PID3D12Device; cdecl; Var @@ -142,7 +142,7 @@ function SDL_RenderGetD3D12Device(renderer:PSDL_Renderer):PID3D12Device; cdecl; * * \since This function is available since SDL 2.0.2. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_DXGIGetOutputInfo_fun = function(displayIndex: cint; adapterIndex, outputIndex: pcint): TSDL_Bool; cdecl; Var @@ -168,7 +168,7 @@ function SDL_DXGIGetOutputInfo(displayIndex: cint; adapterIndex, outputIndex: pc * * \since This function is available since SDL 2.0.9. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LinuxSetThreadPriority_fun = function(threadID: cint64; priority: cint): cint; cdecl; Var @@ -192,7 +192,7 @@ function SDL_LinuxSetThreadPriority(threadID: cint64; priority: cint): cint; cde * * \since This function is available since SDL 2.0.18. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_LinuxSetThreadPriorityAndPolicy_fun = function(threadID: cint64; sdlPriority, schedPolicy: cint): cint; cdecl; Var @@ -232,7 +232,7 @@ type * * \sa SDL_iPhoneSetEventPump *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_iPhoneSetAnimationCallback_fun = function(window: PSDL_Window; interval: cint; callback: TSDL_iPhoneAnimationCallback; callbackParam: Pointer); cdecl; Var @@ -254,7 +254,7 @@ function SDL_iPhoneSetAnimationCallback(window: PSDL_Window; interval: cint; cal * * \sa SDL_iPhoneSetAnimationCallback *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_iPhoneSetEventPump_proc = procedure(enabled: TSDL_Bool); cdecl; Var @@ -287,7 +287,7 @@ procedure SDL_iPhoneSetEventPump(enabled: TSDL_Bool); cdecl; * * \sa SDL_AndroidGetActivity *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_AndroidGetJNIEnv_fun = function(): Pointer; cdecl; Var @@ -318,7 +318,7 @@ function SDL_AndroidGetJNIEnv(): Pointer; cdecl; * * \sa SDL_AndroidGetJNIEnv *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_AndroidGetActivity_fun = function(): Pointer; cdecl; Var @@ -362,7 +362,7 @@ function SDL_AndroidGetActivity(): Pointer; cdecl; * * \since This function is available since SDL 2.0.12. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetAndroidSDKVersion_fun = function(): cint; cdecl; Var @@ -380,7 +380,7 @@ function SDL_GetAndroidSDKVersion(): cint; cdecl; * * \since This function is available since SDL 2.0.8. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_IsAndroidTV_fun = function(): TSDL_Bool; cdecl; Var @@ -398,7 +398,7 @@ function SDL_IsAndroidTV(): TSDL_Bool; cdecl; * * \since This function is available since SDL 2.0.9. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_IsChromebook_fun = function(): TSDL_Bool; cdecl; Var @@ -416,7 +416,7 @@ function SDL_IsChromebook(): TSDL_Bool; cdecl; * * \since This function is available since SDL 2.0.9. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_IsDeXMode_fun = function(): TSDL_Bool; cdecl; Var @@ -432,7 +432,7 @@ function SDL_IsDeXMode(): TSDL_Bool; cdecl; * * \since This function is available since SDL 2.0.9. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_AndroidBackButton_proc = procedure(); cdecl; Var @@ -467,7 +467,7 @@ const * * \sa SDL_AndroidGetExternalStorageState *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_AndroidGetInternalStoragePath_fun = function(): PAnsiChar; cdecl; Var @@ -493,7 +493,7 @@ function SDL_AndroidGetInternalStoragePath(): PAnsiChar; cdecl; * * \sa SDL_AndroidGetExternalStoragePath *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_AndroidGetExternalStorageState_fun = function(): cint; cdecl; Var @@ -520,7 +520,7 @@ function SDL_AndroidGetExternalStorageState(): cint; cdecl; * * \sa SDL_AndroidGetExternalStorageState *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_AndroidGetExternalStoragePath_fun = function(): PAnsiChar; cdecl; Var @@ -544,7 +544,7 @@ function SDL_AndroidGetExternalStoragePath(): PAnsiChar; cdecl; * * \since This function is available since SDL 2.0.14. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_AndroidRequestPermission_fun = function(const permission: PAnsiChar): TSDL_Bool; cdecl; Var @@ -578,7 +578,7 @@ function SDL_AndroidRequestPermission(const permission: PAnsiChar): TSDL_Bool; c * * \since This function is available since SDL 2.0.16. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_AndroidShowToast_fun = function(const message: PAnsiChar; duration, gravity, xoffset, yoffset: cint): cint; cdecl; Var @@ -599,7 +599,7 @@ function SDL_AndroidShowToast(const message: PAnsiChar; duration, gravity, xoffs * * \since This function is available since SDL 2.0.22. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_AndroidSendMessage_fun = function(command: cUint32; param: cint): cint; cdecl; Var @@ -661,7 +661,7 @@ Type * SDL_WinRT_Path for more information on which path types are * supported where. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_WinRTGetFSPathUNICODE_fun = function(pathT Var @@ -688,7 +688,7 @@ function SDL_WinRTGetFSPathUNICODE(pathType :TSDL_WinRT_Path):PWideChar; * SDL_WinRT_Path for more information on which path types are * supported where. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_WinRTGetFSPathUTF8_fun = function(pathT Var @@ -707,7 +707,7 @@ function SDL_WinRTGetFSPathUTF8(pathType :TSDL_WinRT_Path):PChar; * * \since This function is available since SDL 2.0.8. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_WinRTGetDeviceFamily_fun = function(): TS Var @@ -729,7 +729,7 @@ function SDL_WinRTGetDeviceFamily(): TSDL_WinRT_DeviceFamily; * * \since This function is available since SDL 2.0.9. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_IsTablet_fun = function(): TSDL_Bool; cdecl; Var diff --git a/units/sdlsyswm.inc b/units/sdlsyswm.inc index 166626d5..b3d36375 100644 --- a/units/sdlsyswm.inc +++ b/units/sdlsyswm.inc @@ -357,7 +357,7 @@ type * * \since This function is available since SDL 2.0.0. *) -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowWMInfo_fun = function(window: PSDL_Window; info: PSDL_SysWMinfo): TSDL_bool; cdecl; Var diff --git a/units/sdlthread.inc b/units/sdlthread.inc index b8f8f73a..60aa20ec 100644 --- a/units/sdlthread.inc +++ b/units/sdlthread.inc @@ -91,7 +91,7 @@ type TpfnSDL_CurrentEndThread = procedure(code: cuint); cdecl; -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_CreateThread_fun = function(fn: TSDL_ThreadFunction; name: PAnsiChar; data: Pointer; @@ -108,7 +108,7 @@ function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PAnsiChar; external SDL_LibName; {$endif} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_CreateThreadWithStackSize_fun = function(fn: TSDL_ThreadFunction; name: PAnsiChar; const stacksize: csize_t; data: Pointer; @@ -167,7 +167,7 @@ function SDL_CreateThreadWithStackSize2(fn: TSDL_ThreadFunction; name: PAnsiChar * it (truncate, etc), but the original string contents will be available * from SDL_GetThreadName(). *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_CreateThread_fun = function(fn: TSDL_ThreadFunction; name: PAnsiChar; data: Pointer): PSDL_Thread; cdecl; @@ -223,7 +223,7 @@ function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PAnsiChar; * * \sa SDL_WaitThread *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_CreateThreadWithStackSize_fun = function(fn: TSDL_ThreadFunction; name: PAnsiChar; stacksize: csize_t; data: Pointer): PSDL_Thread; cdecl; @@ -253,7 +253,7 @@ function SDL_CreateThreadWithStackSize(fn: TSDL_ThreadFunction; name: PAnsiChar; * * \sa SDL_CreateThread *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetThreadName_fun = function(thread: PSDL_Thread): PAnsiChar; cdecl; Var @@ -298,7 +298,7 @@ function SDL_ThreadID: TSDL_ThreadID; cdecl; * * \sa SDL_ThreadID *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetThreadID_fun = function(thread: PSDL_Thread): TSDL_ThreadID; cdecl; Var @@ -322,7 +322,7 @@ function SDL_GetThreadID(thread: PSDL_Thread): TSDL_ThreadID; cdecl; * * \since This function is available since SDL 2.0.0. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetThreadPriority_fun = function(priority: TSDL_ThreadPriority): cint; cdecl; Var @@ -366,7 +366,7 @@ function SDL_SetThreadPriority(priority: TSDL_ThreadPriority): cint; cdecl; * \sa SDL_CreateThread * \sa SDL_DetachThread *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_WaitThread_proc = procedure(thread: PSDL_Thread; status: pcint); cdecl; Var @@ -411,7 +411,7 @@ procedure SDL_WaitThread(thread: PSDL_Thread; status: pcint); cdecl; * \sa SDL_CreateThread * \sa SDL_WaitThread *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_DetachThread_proc = procedure(thread:PSDL_Thread); cdecl; Var @@ -450,7 +450,7 @@ function SDL_TLSCreate: TSDL_TLSID; cdecl; * \sa SDL_TLSCreate * \sa SDL_TLSSet *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_TLSGet_fun = function(id: TSDL_TLSID): Pointer; cdecl; Var @@ -493,7 +493,7 @@ type * \sa SDL_TLSCreate * \sa SDL_TLSGet *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_TLSSet_fun = function(id: TSDL_TLSID; const value: Pointer; destructor_: TTLSDestructor): cint; cdecl; Var diff --git a/units/sdltimer.inc b/units/sdltimer.inc index b4502603..57c22703 100644 --- a/units/sdltimer.inc +++ b/units/sdltimer.inc @@ -47,7 +47,7 @@ function SDL_GetPerformanceFrequency: cuint64; cdecl; {** * Wait a specified number of milliseconds before returning. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_Delay_proc = procedure(ms: cuint32); cdecl; Var @@ -83,7 +83,7 @@ type * * A timer ID, or NULL when an error occurs. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_AddTimer_fun = function(interval: cuint32; callback: TSDL_TimerCallback; param: Pointer): TSDL_TimerID; cdecl; Var @@ -101,7 +101,7 @@ function SDL_AddTimer(interval: cuint32; callback: TSDL_TimerCallback; param: Po * * It is not safe to remove a timer multiple times. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RemoveTimer_fun = function(id: TSDL_TimerID): Boolean; cdecl; Var diff --git a/units/sdltouch.inc b/units/sdltouch.inc index 94db4b9e..beea612c 100644 --- a/units/sdltouch.inc +++ b/units/sdltouch.inc @@ -40,7 +40,7 @@ const {** * Get the number of registered touch devices. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetNumTouchDevices_fun = function(): cint; cdecl; Var @@ -54,7 +54,7 @@ function SDL_GetNumTouchDevices(): cint; cdecl; {** * Get the touch ID with the given index, or 0 if the index is invalid. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetTouchDevice_fun = function(index: cint): TSDL_TouchID; cdecl; Var @@ -71,7 +71,7 @@ function SDL_GetTouchDevice(index: cint): TSDL_TouchID; cdecl; * * \since This function is available since SDL 2.0.22. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetTouchName_fun = function(index: cint): PAnsiChar; cdecl; Var @@ -87,7 +87,7 @@ function SDL_GetTouchName(index: cint): PAnsiChar; cdecl; * * \since This function is available since SDL 2.0.10. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetTouchDeviceType_fun = function(touchID: TSDL_TouchID): TSDL_TouchDeviceType; cdecl; Var @@ -101,7 +101,7 @@ function SDL_GetTouchDeviceType(touchID: TSDL_TouchID): TSDL_TouchDeviceType; cd {** * Get the number of active fingers for a given touch device. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetNumTouchFingers_fun = function(touchID: TSDL_TouchID): cint; cdecl; Var @@ -115,7 +115,7 @@ function SDL_GetNumTouchFingers(touchID: TSDL_TouchID): cint; cdecl; {** * Get the finger object of the given touch, with the given index. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetTouchFinger_fun = function(touchID: TSDL_TouchID; index: cint): PSDL_Finger; cdecl; Var diff --git a/units/sdlversion.inc b/units/sdlversion.inc index e0ec8b0a..084078fa 100644 --- a/units/sdlversion.inc +++ b/units/sdlversion.inc @@ -102,7 +102,7 @@ function SDL_VERSION_ATLEAST(X,Y,Z: cuint8): Boolean; * * SDL_VERSION *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetVersion_proc = procedure(ver: PSDL_Version); cdecl; Var diff --git a/units/sdlvideo.inc b/units/sdlvideo.inc index 3e006f0f..98a2fd76 100644 --- a/units/sdlvideo.inc +++ b/units/sdlvideo.inc @@ -254,7 +254,7 @@ function SDL_GetNumVideoDrivers: cint; cdecl; * SDL_GetNumVideoDrivers() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetVideoDriver_fun = function(index: cint): PAnsiChar; cdecl; Var @@ -280,7 +280,7 @@ function SDL_GetVideoDriver(index: cint): PAnsiChar; cdecl; * SDL_VideoQuit() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_VideoInit_fun = function(const driver_name: PAnsiChar): cint; cdecl; Var @@ -331,7 +331,7 @@ function SDL_GetNumVideoDisplays: cint; cdecl; * SDL_GetNumVideoDisplays() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetDisplayName_fun = function(displayIndex: cint): PAnsiChar; cdecl; Var @@ -351,7 +351,7 @@ function SDL_GetDisplayName(displayIndex: cint): PAnsiChar; cdecl; * SDL_GetNumVideoDisplays() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetDisplayBounds_fun = function(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; Var @@ -379,7 +379,7 @@ function SDL_GetDisplayBounds(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; * \sa SDL_GetDisplayBounds() * \sa SDL_GetNumVideoDisplays() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetDisplayUsableBounds_fun = function(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; Var @@ -400,7 +400,7 @@ function SDL_GetDisplayUsableBounds(displayIndex: cint; rect: PSDL_Rect): cint; * * \sa SDL_GetNumVideoDisplays() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetDisplayDPI_fun = function(displayIndex: cint; ddpi, hdpi, vdpi: pcfloat): cint; cdecl; Var @@ -418,7 +418,7 @@ function SDL_GetDisplayDPI(displayIndex: cint; ddpi, hdpi, vdpi: pcfloat): cint; * * \sa SDL_GetNumVideoDisplays() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetDisplayOrientation_fun = function(displayIndex: cint): TSDL_DisplayOrientation; cdecl; Var @@ -435,7 +435,7 @@ function SDL_GetDisplayOrientation(displayIndex: cint): TSDL_DisplayOrientation; * SDL_GetDisplayMode() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetNumDisplayModes_fun = function(displayIndex: cint): cint; cdecl; Var @@ -458,7 +458,7 @@ function SDL_GetNumDisplayModes(displayIndex: cint): cint; cdecl; * SDL_GetNumDisplayModes() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetDisplayMode_fun = function(displayIndex: cint; modeIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; Var @@ -473,7 +473,7 @@ function SDL_GetDisplayMode(displayIndex: cint; modeIndex: cint; mode: PSDL_Disp * Fill in information about the desktop display mode. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetDesktopDisplayMode_fun = function(displayIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; Var @@ -488,7 +488,7 @@ function SDL_GetDesktopDisplayMode(displayIndex: cint; mode: PSDL_DisplayMode): * Fill in information about the current display mode. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetCurrentDisplayMode_fun = function(displayIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; Var @@ -520,7 +520,7 @@ function SDL_GetCurrentDisplayMode(displayIndex: cint; mode: PSDL_DisplayMode): * SDL_GetDisplayMode() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetClosestDisplayMode_fun = function(displayIndex: cint; const mode: PSDL_DisplayMode; closest: PSDL_DisplayMode): PSDL_DisplayMode; cdecl; Var @@ -543,7 +543,7 @@ function SDL_GetClosestDisplayMode(displayIndex: cint; const mode: PSDL_DisplayM * \sa SDL_GetDisplayBounds * \sa SDL_GetNumVideoDisplays *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetPointDisplayIndex_fun = function(const point: PSDL_Point): cint; cdecl; Var @@ -567,7 +567,7 @@ function SDL_GetPointDisplayIndex(const point: PSDL_Point): cint; cdecl; * \sa SDL_GetDisplayBounds * \sa SDL_GetNumVideoDisplays *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetRectDisplayIndex_fun = function(const rect: PSDL_Rect): cint; cdecl; Var @@ -585,7 +585,7 @@ function SDL_GetRectDisplayIndex(const rect: PSDL_Rect): cint; cdecl; * window, or -1 on error. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowDisplayIndex_fun = function(window: PSDL_Window): cint; cdecl; Var @@ -610,7 +610,7 @@ function SDL_GetWindowDisplayIndex(window: PSDL_Window): cint; cdecl; * SDL_SetWindowFullscreen() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowDisplayMode_fun = function(window: PSDL_Window; const mode: PSDL_DisplayMode): cint; cdecl; Var @@ -629,7 +629,7 @@ function SDL_SetWindowDisplayMode(window: PSDL_Window; const mode: PSDL_DisplayM * SDL_SetWindowFullscreen() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowDisplayMode_fun = function(window: PSDL_Window; mode: PSDL_DisplayMode): cint; cdecl; Var @@ -652,7 +652,7 @@ function SDL_GetWindowDisplayMode(window: PSDL_Window; mode: PSDL_DisplayMode): * * \since This function is available since SDL 2.0.18. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowICCProfile_fun = function(window: PSDL_Window; size: pcsize_t): Pointer; cdecl; Var @@ -667,7 +667,7 @@ function SDL_GetWindowICCProfile(window: PSDL_Window; size: pcsize_t): Pointer; * Get the pixel format associated with the window. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowPixelFormat_fun = function(window: PSDL_Window): cuint32; cdecl; Var @@ -721,7 +721,7 @@ function SDL_GetWindowPixelFormat(window: PSDL_Window): cuint32; cdecl; * \sa SDL_Vulkan_LoadLibrary() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_CreateWindow_fun = function(const title: PAnsiChar; x: cint; y: cint; w: cint; h: cint; flags: TSDL_WindowFlags): PSDL_Window; cdecl; Var @@ -742,7 +742,7 @@ function SDL_CreateWindow(const title: PAnsiChar; x: cint; y: cint; w: cint; h: * SDL_DestroyWindow() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_CreateWindowFrom_fun = function(const data: Pointer): PSDL_Window; cdecl; Var @@ -757,7 +757,7 @@ function SDL_CreateWindowFrom(const data: Pointer): PSDL_Window; cdecl; * Get the numeric ID of a window, for logging purposes. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowID_fun = function(window: PSDL_Window): cuint32; cdecl; Var @@ -772,7 +772,7 @@ function SDL_GetWindowID(window: PSDL_Window): cuint32; cdecl; * Get a window from a stored ID, or nil if it doesn't exist. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowFromID_fun = function(id: cuint32): PSDL_Window; cdecl; Var @@ -787,7 +787,7 @@ function SDL_GetWindowFromID(id: cuint32): PSDL_Window; cdecl; * Get the window flags. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowFlags_fun = function(window: PSDL_Window): TSDL_WindowFlags; cdecl; Var @@ -804,7 +804,7 @@ function SDL_GetWindowFlags(window: PSDL_Window): TSDL_WindowFlags; cdecl; * SDL_GetWindowTitle() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowTitle_proc = procedure(window: PSDL_Window; const title: PAnsiChar); cdecl; Var @@ -821,7 +821,7 @@ procedure SDL_SetWindowTitle(window: PSDL_Window; const title: PAnsiChar); cdecl * SDL_SetWindowTitle() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowTitle_fun = function(window: PSDL_Window): PAnsiChar; cdecl; Var @@ -838,7 +838,7 @@ function SDL_GetWindowTitle(window: PSDL_Window): PAnsiChar; cdecl; * icon The icon for the window. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowIcon_proc = procedure(window: PSDL_Window; icon: PSDL_Surface); cdecl; Var @@ -863,7 +863,7 @@ procedure SDL_SetWindowIcon(window: PSDL_Window; icon: PSDL_Surface); cdecl; * SDL_GetWindowData() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowData_fun = function(window: PSDL_Window; const name: PAnsiChar; userdata: Pointer): Pointer; cdecl; Var @@ -885,7 +885,7 @@ function SDL_SetWindowData(window: PSDL_Window; const name: PAnsiChar; userdata: * SDL_SetWindowData() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowData_fun = function(window: PSDL_Window; const name: PAnsiChar): Pointer; cdecl; Var @@ -910,7 +910,7 @@ function SDL_GetWindowData(window: PSDL_Window; const name: PAnsiChar): Pointer; * SDL_GetWindowPosition() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowPosition_proc = procedure(window: PSDL_Window; x: cint; y: cint); cdecl; Var @@ -930,7 +930,7 @@ procedure SDL_SetWindowPosition(window: PSDL_Window; x: cint; y: cint); cdecl; * SDL_SetWindowPosition() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowPosition_proc = procedure(window: PSDL_Window; x: pcint; y: pcint); cdecl; Var @@ -953,7 +953,7 @@ procedure SDL_GetWindowPosition(window: PSDL_Window; x: pcint; y: pcint); cdecl; * SDL_GetWindowSize() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowSize_proc = procedure(window: PSDL_Window; w: cint; h: cint); cdecl; Var @@ -973,7 +973,7 @@ procedure SDL_SetWindowSize(window: PSDL_Window; w: cint; h: cint); cdecl; * SDL_SetWindowSize() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowSize_proc = procedure(window: PSDL_Window; w: pcint; h: pcint); cdecl; Var @@ -999,7 +999,7 @@ procedure SDL_GetWindowSize(window: PSDL_Window; w: pcint; h: pcint); cdecl; * initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as * if the window in question was borderless. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowBordersSize_fun = function(window: PSDL_Window; top, left, bottom, right: pcint): cint; cdecl; Var @@ -1028,7 +1028,7 @@ function SDL_GetWindowBordersSize(window: PSDL_Window; top, left, bottom, right: * \sa SDL_CreateWindow * \sa SDL_GetWindowSize *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowSizeInPixels_proc = procedure(window: PSDL_Window; w, h: pcuint); cdecl; Var @@ -1052,7 +1052,7 @@ procedure SDL_GetWindowSizeInPixels(window: PSDL_Window; w, h: pcuint); cdecl; * SDL_SetWindowMaximumSize() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowMinimumSize_proc = procedure(window: PSDL_Window; min_w: cint; min_h: cint); cdecl; Var @@ -1073,7 +1073,7 @@ procedure SDL_SetWindowMinimumSize(window: PSDL_Window; min_w: cint; min_h: cint * SDL_SetWindowMinimumSize() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowMinimumSize_proc = procedure(window: PSDL_Window; w: pcint; h: pcint); cdecl; Var @@ -1097,7 +1097,7 @@ procedure SDL_GetWindowMinimumSize(window: PSDL_Window; w: pcint; h: pcint); cde * SDL_SetWindowMinimumSize() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowMaximumSize_proc = procedure(window: PSDL_Window; max_w: cint; max_h: cint); cdecl; Var @@ -1118,7 +1118,7 @@ procedure SDL_SetWindowMaximumSize(window: PSDL_Window; max_w: cint; max_h: cint * SDL_SetWindowMaximumSize() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowMaximumSize_proc = procedure(window: PSDL_Window; w: pcint; h: pcint); cdecl; Var @@ -1144,7 +1144,7 @@ procedure SDL_GetWindowMaximumSize(window: PSDL_Window; w: pcint; h: pcint); cde * SDL_GetWindowFlags() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowBordered_proc = procedure(window: PSDL_Window; bordered: TSDL_Bool); cdecl; Var @@ -1169,7 +1169,7 @@ procedure SDL_SetWindowBordered(window: PSDL_Window; bordered: TSDL_Bool); cdecl * * \sa SDL_GetWindowFlags() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowResizable_proc = procedure(window: PSDL_Window; resizable: TSDL_Bool); cdecl; Var @@ -1194,7 +1194,7 @@ procedure SDL_SetWindowResizable(window: PSDL_Window; resizable: TSDL_Bool); cde * * \sa SDL_GetWindowFlags *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowAlwaysOnTop_proc = procedure(window: PSDL_Window; on_top: TSDL_Bool); cdecl; Var @@ -1211,7 +1211,7 @@ procedure SDL_SetWindowAlwaysOnTop(window: PSDL_Window; on_top: TSDL_Bool); cdec * SDL_HideWindow() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_ShowWindow_proc = procedure(window: PSDL_Window); cdecl; Var @@ -1228,7 +1228,7 @@ procedure SDL_ShowWindow(window: PSDL_Window); cdecl; * SDL_ShowWindow() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HideWindow_proc = procedure(window: PSDL_Window); cdecl; Var @@ -1243,7 +1243,7 @@ procedure SDL_HideWindow(window: PSDL_Window); cdecl; * Raise a window above other windows and set the input focus. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RaiseWindow_proc = procedure(window: PSDL_Window); cdecl; Var @@ -1260,7 +1260,7 @@ procedure SDL_RaiseWindow(window: PSDL_Window); cdecl; * SDL_RestoreWindow() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_MaximizeWindow_proc = procedure(window: PSDL_Window); cdecl; Var @@ -1277,7 +1277,7 @@ procedure SDL_MaximizeWindow(window: PSDL_Window); cdecl; * SDL_RestoreWindow() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_MinimizeWindow_proc = procedure(window: PSDL_Window); cdecl; Var @@ -1295,7 +1295,7 @@ procedure SDL_MinimizeWindow(window: PSDL_Window); cdecl; * SDL_MinimizeWindow() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_RestoreWindow_proc = procedure(window: PSDL_Window); cdecl; Var @@ -1315,7 +1315,7 @@ procedure SDL_RestoreWindow(window: PSDL_Window); cdecl; * SDL_GetWindowDisplayMode() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowFullscreen_fun = function(window: PSDL_Window; flags: TSDL_WindowFlags): cint; cdecl; Var @@ -1336,7 +1336,7 @@ function SDL_SetWindowFullscreen(window: PSDL_Window; flags: TSDL_WindowFlags): * * \sa SDL_GetWindowSurface *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_HasWindowSurface_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; Var @@ -1361,7 +1361,7 @@ function SDL_HasWindowSurface(window: PSDL_Window): TSDL_Bool; cdecl; * SDL_UpdateWindowSurfaceRects() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowSurface_fun = function(window: PSDL_Window): PSDL_Surface; cdecl; Var @@ -1381,7 +1381,7 @@ function SDL_GetWindowSurface(window: PSDL_Window): PSDL_Surface; cdecl; * SDL_UpdateWindowSurfaceRects() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_UpdateWindowSurface_fun = function(window: PSDL_Window): cint; cdecl; Var @@ -1401,7 +1401,7 @@ function SDL_UpdateWindowSurface(window: PSDL_Window): cint; cdecl; * SDL_UpdateWindowSurfaceRect() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_UpdateWindowSurfaceRects_fun = function(window: PSDL_Window; rects: PSDL_Rect; numrects: cint): cint; cdecl; Var @@ -1424,7 +1424,7 @@ function SDL_UpdateWindowSurfaceRects(window: PSDL_Window; rects: PSDL_Rect; num * \sa SDL_GetWindowSurface * \sa SDL_HasWindowSurface *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_DestroyWindowSurface_fun = function(window: PSDL_Window): cint; cdecl; Var @@ -1443,7 +1443,7 @@ function SDL_DestroyWindowSurface(window: PSDL_Window): cint; cdecl; * SDL_GetWindowGrab() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowGrab_proc = procedure(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; Var @@ -1462,7 +1462,7 @@ procedure SDL_SetWindowGrab(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; * SDL_SetWindowGrab() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowGrab_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; Var @@ -1501,7 +1501,7 @@ function SDL_GetWindowGrab(window: PSDL_Window): TSDL_Bool; cdecl; * \sa SDL_SetWindowMouseGrab * \sa SDL_SetWindowGrab *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowKeyboardGrab_proc = procedure(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; Var @@ -1520,7 +1520,7 @@ procedure SDL_SetWindowKeyboardGrab(window: PSDL_Window; grabbed: TSDL_Bool); cd * SDL_SetWindowKeyboardGrab() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowKeyboardGrab_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; Var @@ -1540,7 +1540,7 @@ function SDL_GetWindowKeyboardGrab(window: PSDL_Window): TSDL_Bool; cdecl; * SDL_GetWindowMouseGrab() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowMouseGrab_proc = procedure(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; Var @@ -1559,7 +1559,7 @@ procedure SDL_SetWindowMouseGrab(window: PSDL_Window; grabbed: TSDL_Bool); cdecl * SDL_SetWindowMouseGrab() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowMouseGrab_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; Var @@ -1579,7 +1579,7 @@ function SDL_GetWindowMouseGrab(window: PSDL_Window): TSDL_Bool; cdecl; * SDL_GetWindowMouseRect() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowMouseRect_proc = procedure(window: PSDL_Window; rect: PSDL_Rect); cdecl; Var @@ -1598,7 +1598,7 @@ procedure SDL_SetWindowMouseRect(window: PSDL_Window; rect: PSDL_Rect); cdecl; * SDL_SetWindowMouseRect() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowMouseRect_fun = function(window: PSDL_Window): PSDL_Rect; cdecl; Var @@ -1616,7 +1616,7 @@ function SDL_GetWindowMouseRect(window: PSDL_Window): PSDL_Rect; cdecl; * * \sa SDL_SetWindowGrab() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetGrabbedWindow_fun = function(): PSDL_Window; cdecl; Var @@ -1636,7 +1636,7 @@ function SDL_GetGrabbedWindow(): PSDL_Window; cdecl; * SDL_SetWindowGammaRamp() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowBrightness_fun = function(window: PSDL_Window; brightness: cfloat): cint; cdecl; Var @@ -1655,7 +1655,7 @@ function SDL_SetWindowBrightness(window: PSDL_Window; brightness: cfloat): cint; * SDL_SetWindowBrightness() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowBrightness_fun = function(window: PSDL_Window): cfloat; cdecl; Var @@ -1677,7 +1677,7 @@ function SDL_GetWindowBrightness(window: PSDL_Window): cfloat; cdecl; * * \sa SDL_GetWindowOpacity() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowOpacity_fun = function(window: PSDL_Window; opacity: cfloat): cint; cdecl; Var @@ -1701,7 +1701,7 @@ function SDL_SetWindowOpacity(window: PSDL_Window; opacity: cfloat): cint; cdecl * * \sa SDL_SetWindowOpacity() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowOpacity_fun = function(window: PSDL_Window; out_opacity: pcfloat): cint; cdecl; Var @@ -1720,7 +1720,7 @@ function SDL_GetWindowOpacity(window: PSDL_Window; out_opacity: pcfloat): cint; * * \return 0 on success, or -1 otherwise. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowModalFor_fun = function(modal_window, parent_window: PSDL_Window): cint; cdecl; Var @@ -1743,7 +1743,7 @@ function SDL_SetWindowModalFor(modal_window, parent_window: PSDL_Window): cint; * \return 0 on success, or -1 otherwise. * \sa SDL_RaiseWindow() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowInputFocus_fun = function(window: PSDL_Window): cint; cdecl; Var @@ -1772,7 +1772,7 @@ function SDL_SetWindowInputFocus(window: PSDL_Window): cint; cdecl; * SDL_GetWindowGammaRamp() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowGammaRamp_fun = function(window: PSDL_Window; const red: pcuint16; const green: pcuint16; const blue: pcuint16): cint; cdecl; Var @@ -1798,7 +1798,7 @@ function SDL_SetWindowGammaRamp(window: PSDL_Window; const red: pcuint16; const * SDL_SetWindowGammaRamp() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GetWindowGammaRamp_fun = function(window: PSDL_Window; red: pcuint16; green: pcuint16; blue: pcuint16): cint; cdecl; Var @@ -1878,7 +1878,7 @@ type * \param callback_data An app-defined void pointer passed to the callback. * \return 0 on success, -1 on error (including unsupported). *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_SetWindowHitTest_fun = function(window: PSDL_Window; callback: TSDL_HitTest; callback_data: Pointer): cint; cdecl; Var @@ -1899,7 +1899,7 @@ function SDL_SetWindowHitTest(window: PSDL_Window; callback: TSDL_HitTest; callb * * \since This function is available since SDL 2.0.16. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_FlashWindow_fun = function(window: PSDL_Window; operation: TSDL_FlashOperation): cint; cdecl; Var @@ -1914,7 +1914,7 @@ function SDL_FlashWindow(window: PSDL_Window; operation: TSDL_FlashOperation): c * Destroy a window. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_DestroyWindow_proc = procedure(window: PSDL_Window); cdecl; Var @@ -1978,7 +1978,7 @@ procedure SDL_DisableScreenSaver; cdecl; * SDL_GL_UnloadLibrary() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GL_LoadLibrary_fun = function(const path: PAnsiChar): cint; cdecl; Var @@ -1993,7 +1993,7 @@ function SDL_GL_LoadLibrary(const path: PAnsiChar): cint; cdecl; * Get the address of an OpenGL function. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GL_GetProcAddress_fun = function(const proc: PAnsiChar): Pointer; cdecl; Var @@ -2018,7 +2018,7 @@ procedure SDL_GL_UnloadLibrary; cdecl; * context. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GL_ExtensionSupported_fun = function(const extension: PAnsiChar): TSDL_Bool; cdecl; Var @@ -2032,7 +2032,7 @@ function SDL_GL_ExtensionSupported(const extension: PAnsiChar): TSDL_Bool; cdecl {** * Reset all previously set OpenGL context attributes to their default values *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GL_ResetAttributes_proc = procedure(); cdecl; Var @@ -2047,7 +2047,7 @@ procedure SDL_GL_ResetAttributes(); cdecl; * Set an OpenGL window attribute before window creation. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GL_SetAttribute_fun = function(attr: TSDL_GLattr; value: cint): cint; cdecl; Var @@ -2062,7 +2062,7 @@ function SDL_GL_SetAttribute(attr: TSDL_GLattr; value: cint): cint; cdecl; * Get the actual value for an attribute from the current context. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GL_GetAttribute_fun = function(attr: TSDL_GLattr; value: pcint): cint; cdecl; Var @@ -2080,7 +2080,7 @@ function SDL_GL_GetAttribute(attr: TSDL_GLattr; value: pcint): cint; cdecl; * SDL_GL_DeleteContext() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GL_CreateContext_fun = function(window: PSDL_Window): TSDL_GLContext; cdecl; Var @@ -2097,7 +2097,7 @@ function SDL_GL_CreateContext(window: PSDL_Window): TSDL_GLContext; cdecl; * The context must have been created with a compatible window. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GL_MakeCurrent_fun = function(window: PSDL_Window; context: TSDL_GLContext): cint; cdecl; Var @@ -2137,7 +2137,7 @@ function SDL_GL_GetCurrentContext: TSDL_GLContext; cdecl; * SDL_CreateWindow() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GL_GetDrawableSize_proc = procedure(window: PSDL_Window; w: pcint; h: pcint); cdecl; Var @@ -2161,7 +2161,7 @@ procedure SDL_GL_GetDrawableSize(window: PSDL_Window; w: pcint; h: pcint); cdecl * SDL_GL_GetSwapInterval() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GL_SetSwapInterval_fun = function(interval: cint): cint; cdecl; Var @@ -2192,7 +2192,7 @@ function SDL_GL_GetSwapInterval: cint; cdecl; * supported. *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GL_SwapWindow_proc = procedure(window: PSDL_Window); cdecl; Var @@ -2209,7 +2209,7 @@ procedure SDL_GL_SwapWindow(window: PSDL_Window); cdecl; * SDL_GL_CreateContext() *} -{$ifdef SDL_DYNAMIC_LINKING} +{$ifdef SDL_RUNTIME_LOADING} Type TSDL_GL_DeleteContext_proc = procedure(context: TSDL_GLContext); cdecl; Var From 07c02d999c0f6c20fba5aedfdb44a832b5152010 Mon Sep 17 00:00:00 2001 From: PascalCorpsman Date: Thu, 21 Nov 2024 10:59:34 +0100 Subject: [PATCH 4/8] FIX: invalid description --- units/sdl2.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/units/sdl2.pas b/units/sdl2.pas index c52cb788..72ea649c 100644 --- a/units/sdl2.pas +++ b/units/sdl2.pas @@ -69,7 +69,7 @@ * ---------- Content of file ---------- {* - * set this define if you want to use dynamic linking instead of static linking + * set this define if you want to use runtime loading instead of static linking * ! Attention ! * Not all functions are "ported" yet, so use is on own risk * port missing functions. @@ -79,7 +79,7 @@ * ---------- End content of file ---------- * * ! Attention ! - * If you use the dynamic link feature, don't forget to call the SDL_LoadLib + * If you use the runtime loading feature, don't forget to call the SDL_LoadLib * function. *) From 15ffe2d09db2b7acfb6c8e56c4234bfc22cc6575 Mon Sep 17 00:00:00 2001 From: PascalCorpsman Date: Fri, 22 Nov 2024 06:13:58 +0100 Subject: [PATCH 5/8] FIX: filename for runtime linking --- units/sdl2.pas | 2 +- units/{sdl_dnymic_linking.inc => sdl_runtime_linking.inc} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename units/{sdl_dnymic_linking.inc => sdl_runtime_linking.inc} (100%) diff --git a/units/sdl2.pas b/units/sdl2.pas index 72ea649c..ddb31448 100644 --- a/units/sdl2.pas +++ b/units/sdl2.pas @@ -217,7 +217,7 @@ implementation {$endif} ; -{$I sdl_dnymic_linking.inc} +{$I sdl_runtime_linking.inc} // Macros from "sdl_version.h" procedure SDL_VERSION(out x: TSDL_Version); diff --git a/units/sdl_dnymic_linking.inc b/units/sdl_runtime_linking.inc similarity index 100% rename from units/sdl_dnymic_linking.inc rename to units/sdl_runtime_linking.inc From 0d89f01a482755cd0a7f22f8b8a721b6fb17bb53 Mon Sep 17 00:00:00 2001 From: PascalCorpsman Date: Mon, 25 Nov 2024 07:04:35 +0100 Subject: [PATCH 6/8] FIX: rename _fun -> _func like requested --- units/sdl.inc | 12 +- units/sdl_runtime_linking.inc | 912 +++++++++++++++++----------------- units/sdlaudio.inc | 80 +-- units/sdlblendmode.inc | 4 +- units/sdlclipboard.inc | 24 +- units/sdlcpuinfo.inc | 4 +- units/sdlerror.inc | 12 +- units/sdlfilesystem.inc | 8 +- units/sdlgamecontroller.inc | 148 +++--- units/sdlgesture.inc | 16 +- units/sdlguid.inc | 4 +- units/sdlhaptic.inc | 100 ++-- units/sdlhints.inc | 20 +- units/sdljoystick.inc | 204 ++++---- units/sdlkeyboard.inc | 32 +- units/sdlloadso.inc | 4 +- units/sdllog.inc | 4 +- units/sdlmessagebox.inc | 8 +- units/sdlmouse.inc | 40 +- units/sdlmutex.inc | 52 +- units/sdlpixels.inc | 36 +- units/sdlpower.inc | 4 +- units/sdlrect.inc | 36 +- units/sdlrenderer.inc | 64 +-- units/sdlrwops.inc | 104 ++-- units/sdlshape.inc | 16 +- units/sdlstdinc.inc | 256 +++++----- units/sdlsurface.inc | 136 ++--- units/sdlsystem.inc | 96 ++-- units/sdlsyswm.inc | 4 +- units/sdlthread.inc | 36 +- units/sdltimer.inc | 8 +- units/sdltouch.inc | 24 +- units/sdlvideo.inc | 228 ++++----- 34 files changed, 1365 insertions(+), 1371 deletions(-) diff --git a/units/sdl.inc b/units/sdl.inc index d5a272f5..af51ffac 100644 --- a/units/sdl.inc +++ b/units/sdl.inc @@ -43,9 +43,9 @@ const *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_Init_fun = function(flags: TSDL_Init): cint; cdecl; + TSDL_Init_func = function(flags: TSDL_Init): cint; cdecl; Var - SDL_Init : TSDL_Init_fun = Nil; + SDL_Init : TSDL_Init_func = Nil; {$else} function SDL_Init(flags: TSDL_Init): cint; cdecl; @@ -57,9 +57,9 @@ function SDL_Init(flags: TSDL_Init): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_InitSubSystem_fun = function(flags: TSDL_Init): cint; cdecl; + TSDL_InitSubSystem_func = function(flags: TSDL_Init): cint; cdecl; Var - SDL_InitSubSystem : TSDL_InitSubSystem_fun = Nil; + SDL_InitSubSystem : TSDL_InitSubSystem_func = Nil; {$else} function SDL_InitSubSystem(flags: TSDL_Init): cint; cdecl; @@ -88,9 +88,9 @@ procedure SDL_QuitSubSystem(flags: TSDL_Init); cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_WasInit_fun = function(flags: TSDL_Init): cuint32; cdecl; + TSDL_WasInit_func = function(flags: TSDL_Init): cuint32; cdecl; Var - SDL_WasInit : TSDL_WasInit_fun = Nil; + SDL_WasInit : TSDL_WasInit_func = Nil; {$else} function SDL_WasInit(flags: TSDL_Init): cuint32; cdecl; diff --git a/units/sdl_runtime_linking.inc b/units/sdl_runtime_linking.inc index 2239956e..fa628e28 100644 --- a/units/sdl_runtime_linking.inc +++ b/units/sdl_runtime_linking.inc @@ -17,55 +17,55 @@ Begin *) result := true; - SDL_Init := TSDL_Init_fun(GetProcAddress(LibHandle, 'SDL_Init')); + SDL_Init := TSDL_Init_func(GetProcAddress(LibHandle, 'SDL_Init')); If Not assigned(SDL_Init) Then result := false; - SDL_InitSubSystem := TSDL_InitSubSystem_fun(GetProcAddress(LibHandle, 'SDL_InitSubSystem')); + SDL_InitSubSystem := TSDL_InitSubSystem_func(GetProcAddress(LibHandle, 'SDL_InitSubSystem')); If Not assigned(SDL_InitSubSystem) Then result := false; SDL_QuitSubSystem := TSDL_QuitSubSystem_proc(GetProcAddress(LibHandle, 'SDL_QuitSubSystem')); If Not assigned(SDL_QuitSubSystem) Then result := false; - SDL_WasInit := TSDL_WasInit_fun(GetProcAddress(LibHandle, 'SDL_WasInit')); + SDL_WasInit := TSDL_WasInit_func(GetProcAddress(LibHandle, 'SDL_WasInit')); If Not assigned(SDL_WasInit) Then result := false; SDL_Quit := TSDL_Quit_proc(GetProcAddress(LibHandle, 'SDL_Quit')); If Not assigned(SDL_Quit) Then result := false; - SDL_GetAudioDriver := TSDL_GetAudioDriver_fun(GetProcAddress(LibHandle, 'SDL_GetAudioDriver')); + SDL_GetAudioDriver := TSDL_GetAudioDriver_func(GetProcAddress(LibHandle, 'SDL_GetAudioDriver')); If Not assigned(SDL_GetAudioDriver) Then result := false; - SDL_AudioInit := TSDL_AudioInit_fun(GetProcAddress(LibHandle, 'SDL_AudioInit')); + SDL_AudioInit := TSDL_AudioInit_func(GetProcAddress(LibHandle, 'SDL_AudioInit')); If Not assigned(SDL_AudioInit) Then result := false; - SDL_OpenAudio := TSDL_OpenAudio_fun(GetProcAddress(LibHandle, 'SDL_OpenAudio')); + SDL_OpenAudio := TSDL_OpenAudio_func(GetProcAddress(LibHandle, 'SDL_OpenAudio')); If Not assigned(SDL_OpenAudio) Then result := false; - SDL_GetNumAudioDevices := TSDL_GetNumAudioDevices_fun(GetProcAddress(LibHandle, 'SDL_GetNumAudioDevices')); + SDL_GetNumAudioDevices := TSDL_GetNumAudioDevices_func(GetProcAddress(LibHandle, 'SDL_GetNumAudioDevices')); If Not assigned(SDL_GetNumAudioDevices) Then result := false; - SDL_GetAudioDeviceName := TSDL_GetAudioDeviceName_fun(GetProcAddress(LibHandle, 'SDL_GetAudioDeviceName')); + SDL_GetAudioDeviceName := TSDL_GetAudioDeviceName_func(GetProcAddress(LibHandle, 'SDL_GetAudioDeviceName')); If Not assigned(SDL_GetAudioDeviceName) Then result := false; - //SDL_GetAudioDeviceSpec := TSDL_GetAudioDeviceSpec_fun(GetProcAddress(LibHandle, 'SDL_GetAudioDeviceSpec')); // TODO: Das geht nicht, warum ? + //SDL_GetAudioDeviceSpec := TSDL_GetAudioDeviceSpec_func(GetProcAddress(LibHandle, 'SDL_GetAudioDeviceSpec')); // TODO: Das geht nicht, warum ? //If Not assigned(SDL_GetAudioDeviceSpec) Then result := false; - //SDL_GetDefaultAudioInfo := TSDL_GetDefaultAudioInfo_fun(GetProcAddress(LibHandle, 'SDL_GetDefaultAudioInfo')); // TODO: Das geht nicht, warum ? + //SDL_GetDefaultAudioInfo := TSDL_GetDefaultAudioInfo_func(GetProcAddress(LibHandle, 'SDL_GetDefaultAudioInfo')); // TODO: Das geht nicht, warum ? //If Not assigned(SDL_GetDefaultAudioInfo) Then result := false; - SDL_OpenAudioDevice := TSDL_OpenAudioDevice_fun(GetProcAddress(LibHandle, 'SDL_OpenAudioDevice')); + SDL_OpenAudioDevice := TSDL_OpenAudioDevice_func(GetProcAddress(LibHandle, 'SDL_OpenAudioDevice')); If Not assigned(SDL_OpenAudioDevice) Then result := false; - SDL_GetAudioDeviceStatus := TSDL_GetAudioDeviceStatus_fun(GetProcAddress(LibHandle, 'SDL_GetAudioDeviceStatus')); + SDL_GetAudioDeviceStatus := TSDL_GetAudioDeviceStatus_func(GetProcAddress(LibHandle, 'SDL_GetAudioDeviceStatus')); If Not assigned(SDL_GetAudioDeviceStatus) Then result := false; SDL_PauseAudio := TSDL_PauseAudio_proc(GetProcAddress(LibHandle, 'SDL_PauseAudio')); If Not assigned(SDL_PauseAudio) Then result := false; SDL_PauseAudioDevice := TSDL_PauseAudioDevice_proc(GetProcAddress(LibHandle, 'SDL_PauseAudioDevice')); If Not assigned(SDL_PauseAudioDevice) Then result := false; - SDL_LoadWAV_RW := TSDL_LoadWAV_RW_fun(GetProcAddress(LibHandle, 'SDL_LoadWAV_RW')); + SDL_LoadWAV_RW := TSDL_LoadWAV_RW_func(GetProcAddress(LibHandle, 'SDL_LoadWAV_RW')); If Not assigned(SDL_LoadWAV_RW) Then result := false; SDL_FreeWAV := TSDL_FreeWAV_proc(GetProcAddress(LibHandle, 'SDL_FreeWAV')); If Not assigned(SDL_FreeWAV) Then result := false; - SDL_BuildAudioCVT := TSDL_BuildAudioCVT_fun(GetProcAddress(LibHandle, 'SDL_BuildAudioCVT')); + SDL_BuildAudioCVT := TSDL_BuildAudioCVT_func(GetProcAddress(LibHandle, 'SDL_BuildAudioCVT')); If Not assigned(SDL_BuildAudioCVT) Then result := false; - SDL_ConvertAudio := TSDL_ConvertAudio_fun(GetProcAddress(LibHandle, 'SDL_ConvertAudio')); + SDL_ConvertAudio := TSDL_ConvertAudio_func(GetProcAddress(LibHandle, 'SDL_ConvertAudio')); If Not assigned(SDL_ConvertAudio) Then result := false; - SDL_NewAudioStream := TSDL_NewAudioStream_fun(GetProcAddress(LibHandle, 'SDL_NewAudioStream')); + SDL_NewAudioStream := TSDL_NewAudioStream_func(GetProcAddress(LibHandle, 'SDL_NewAudioStream')); If Not assigned(SDL_NewAudioStream) Then result := false; - SDL_AudioStreamPut := TSDL_AudioStreamPut_fun(GetProcAddress(LibHandle, 'SDL_AudioStreamPut')); + SDL_AudioStreamPut := TSDL_AudioStreamPut_func(GetProcAddress(LibHandle, 'SDL_AudioStreamPut')); If Not assigned(SDL_AudioStreamPut) Then result := false; - SDL_AudioStreamGet := TSDL_AudioStreamGet_fun(GetProcAddress(LibHandle, 'SDL_AudioStreamGet')); + SDL_AudioStreamGet := TSDL_AudioStreamGet_func(GetProcAddress(LibHandle, 'SDL_AudioStreamGet')); If Not assigned(SDL_AudioStreamGet) Then result := false; - SDL_AudioStreamAvailable := TSDL_AudioStreamAvailable_fun(GetProcAddress(LibHandle, 'SDL_AudioStreamAvailable')); + SDL_AudioStreamAvailable := TSDL_AudioStreamAvailable_func(GetProcAddress(LibHandle, 'SDL_AudioStreamAvailable')); If Not assigned(SDL_AudioStreamAvailable) Then result := false; - SDL_AudioStreamFlush := TSDL_AudioStreamFlush_fun(GetProcAddress(LibHandle, 'SDL_AudioStreamFlush')); + SDL_AudioStreamFlush := TSDL_AudioStreamFlush_func(GetProcAddress(LibHandle, 'SDL_AudioStreamFlush')); If Not assigned(SDL_AudioStreamFlush) Then result := false; SDL_AudioStreamClear := TSDL_AudioStreamClear_proc(GetProcAddress(LibHandle, 'SDL_AudioStreamClear')); If Not assigned(SDL_AudioStreamClear) Then result := false; @@ -75,11 +75,11 @@ Begin If Not assigned(SDL_MixAudio) Then result := false; SDL_MixAudioFormat := TSDL_MixAudioFormat_proc(GetProcAddress(LibHandle, 'SDL_MixAudioFormat')); If Not assigned(SDL_MixAudioFormat) Then result := false; - SDL_QueueAudio := TSDL_QueueAudio_fun(GetProcAddress(LibHandle, 'SDL_QueueAudio')); + SDL_QueueAudio := TSDL_QueueAudio_func(GetProcAddress(LibHandle, 'SDL_QueueAudio')); If Not assigned(SDL_QueueAudio) Then result := false; - SDL_DequeueAudio := TSDL_DequeueAudio_fun(GetProcAddress(LibHandle, 'SDL_DequeueAudio')); + SDL_DequeueAudio := TSDL_DequeueAudio_func(GetProcAddress(LibHandle, 'SDL_DequeueAudio')); If Not assigned(SDL_DequeueAudio) Then result := false; - SDL_GetQueuedAudioSize := TSDL_GetQueuedAudioSize_fun(GetProcAddress(LibHandle, 'SDL_GetQueuedAudioSize')); + SDL_GetQueuedAudioSize := TSDL_GetQueuedAudioSize_func(GetProcAddress(LibHandle, 'SDL_GetQueuedAudioSize')); If Not assigned(SDL_GetQueuedAudioSize) Then result := false; SDL_ClearQueuedAudio := TSDL_ClearQueuedAudio_proc(GetProcAddress(LibHandle, 'SDL_ClearQueuedAudio')); If Not assigned(SDL_ClearQueuedAudio) Then result := false; @@ -89,185 +89,185 @@ Begin If Not assigned(SDL_UnlockAudioDevice) Then result := false; SDL_CloseAudioDevice := TSDL_CloseAudioDevice_proc(GetProcAddress(LibHandle, 'SDL_CloseAudioDevice')); If Not assigned(SDL_CloseAudioDevice) Then result := false; - SDL_ComposeCustomBlendMode := TSDL_ComposeCustomBlendMode_fun(GetProcAddress(LibHandle, 'SDL_ComposeCustomBlendMode')); + SDL_ComposeCustomBlendMode := TSDL_ComposeCustomBlendMode_func(GetProcAddress(LibHandle, 'SDL_ComposeCustomBlendMode')); If Not assigned(SDL_ComposeCustomBlendMode) Then result := false; - SDL_SetClipboardText := TSDL_SetClipboardText_fun(GetProcAddress(LibHandle, 'SDL_SetClipboardText')); + SDL_SetClipboardText := TSDL_SetClipboardText_func(GetProcAddress(LibHandle, 'SDL_SetClipboardText')); If Not assigned(SDL_SetClipboardText) Then result := false; - SDL_GetClipboardText := TSDL_GetClipboardText_fun(GetProcAddress(LibHandle, 'SDL_GetClipboardText')); + SDL_GetClipboardText := TSDL_GetClipboardText_func(GetProcAddress(LibHandle, 'SDL_GetClipboardText')); If Not assigned(SDL_GetClipboardText) Then result := false; - SDL_HasClipboardText := TSDL_HasClipboardText_fun(GetProcAddress(LibHandle, 'SDL_HasClipboardText')); + SDL_HasClipboardText := TSDL_HasClipboardText_func(GetProcAddress(LibHandle, 'SDL_HasClipboardText')); If Not assigned(SDL_HasClipboardText) Then result := false; - //SDL_SetPrimarySelectionText := TSDL_SetPrimarySelectionText_fun(GetProcAddress(LibHandle, 'SDL_SetPrimarySelectionText')); // TODO: Das geht nicht, warum ? + //SDL_SetPrimarySelectionText := TSDL_SetPrimarySelectionText_func(GetProcAddress(LibHandle, 'SDL_SetPrimarySelectionText')); // TODO: Das geht nicht, warum ? //If Not assigned(SDL_SetPrimarySelectionText) Then result := false; - //SDL_GetPrimarySelectionText := TSDL_GetPrimarySelectionText_fun(GetProcAddress(LibHandle, 'SDL_GetPrimarySelectionText')); + //SDL_GetPrimarySelectionText := TSDL_GetPrimarySelectionText_func(GetProcAddress(LibHandle, 'SDL_GetPrimarySelectionText')); //If Not assigned(SDL_GetPrimarySelectionText) Then result := false; - //SDL_HasPrimarySelectionText := TSDL_HasPrimarySelectionText_fun(GetProcAddress(LibHandle, 'SDL_HasPrimarySelectionText')); + //SDL_HasPrimarySelectionText := TSDL_HasPrimarySelectionText_func(GetProcAddress(LibHandle, 'SDL_HasPrimarySelectionText')); //If Not assigned(SDL_HasPrimarySelectionText) Then result := false; - SDL_GetCPUCount := TSDL_GetCPUCount_fun(GetProcAddress(LibHandle, 'SDL_GetCPUCount')); + SDL_GetCPUCount := TSDL_GetCPUCount_func(GetProcAddress(LibHandle, 'SDL_GetCPUCount')); If Not assigned(SDL_GetCPUCount) Then result := false; - SDL_SetError := TSDL_SetError_fun(GetProcAddress(LibHandle, 'SDL_SetError')); + SDL_SetError := TSDL_SetError_func(GetProcAddress(LibHandle, 'SDL_SetError')); If Not assigned(SDL_SetError) Then result := false; - //SDL_GetErrorMsg := TSDL_GetErrorMsg_fun(GetProcAddress(LibHandle, 'SDL_GetErrorMsg')); + //SDL_GetErrorMsg := TSDL_GetErrorMsg_func(GetProcAddress(LibHandle, 'SDL_GetErrorMsg')); //If Not assigned(SDL_GetErrorMsg) Then result := false; - SDL_Error := TSDL_Error_fun(GetProcAddress(LibHandle, 'SDL_Error')); + SDL_Error := TSDL_Error_func(GetProcAddress(LibHandle, 'SDL_Error')); If Not assigned(SDL_Error) Then result := false; - SDL_GetBasePath := TSDL_GetBasePath_fun(GetProcAddress(LibHandle, 'SDL_GetBasePath')); + SDL_GetBasePath := TSDL_GetBasePath_func(GetProcAddress(LibHandle, 'SDL_GetBasePath')); If Not assigned(SDL_GetBasePath) Then result := false; - SDL_GetPrefPath := TSDL_GetPrefPath_fun(GetProcAddress(LibHandle, 'SDL_GetPrefPath')); + SDL_GetPrefPath := TSDL_GetPrefPath_func(GetProcAddress(LibHandle, 'SDL_GetPrefPath')); If Not assigned(SDL_GetPrefPath) Then result := false; - SDL_GameControllerAddMappingsFromRW := TSDL_GameControllerAddMappingsFromRW_fun(GetProcAddress(LibHandle, 'SDL_GameControllerAddMappingsFromRW')); + SDL_GameControllerAddMappingsFromRW := TSDL_GameControllerAddMappingsFromRW_func(GetProcAddress(LibHandle, 'SDL_GameControllerAddMappingsFromRW')); If Not assigned(SDL_GameControllerAddMappingsFromRW) Then result := false; - SDL_GameControllerNumMappings := TSDL_GameControllerNumMappings_fun(GetProcAddress(LibHandle, 'SDL_GameControllerNumMappings')); + SDL_GameControllerNumMappings := TSDL_GameControllerNumMappings_func(GetProcAddress(LibHandle, 'SDL_GameControllerNumMappings')); If Not assigned(SDL_GameControllerNumMappings) Then result := false; - SDL_GameControllerMappingForIndex := TSDL_GameControllerMappingForIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerMappingForIndex')); + SDL_GameControllerMappingForIndex := TSDL_GameControllerMappingForIndex_func(GetProcAddress(LibHandle, 'SDL_GameControllerMappingForIndex')); If Not assigned(SDL_GameControllerMappingForIndex) Then result := false; - //SDL_GameControllerPathForIndex := TSDL_GameControllerPathForIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerPathForIndex')); + //SDL_GameControllerPathForIndex := TSDL_GameControllerPathForIndex_func(GetProcAddress(LibHandle, 'SDL_GameControllerPathForIndex')); //If Not assigned(SDL_GameControllerPathForIndex) Then result := false; - SDL_GameControllerTypeForIndex := TSDL_GameControllerTypeForIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerTypeForIndex')); + SDL_GameControllerTypeForIndex := TSDL_GameControllerTypeForIndex_func(GetProcAddress(LibHandle, 'SDL_GameControllerTypeForIndex')); If Not assigned(SDL_GameControllerTypeForIndex) Then result := false; - SDL_GameControllerMappingForDeviceIndex := TSDL_GameControllerMappingForDeviceIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerMappingForDeviceIndex')); + SDL_GameControllerMappingForDeviceIndex := TSDL_GameControllerMappingForDeviceIndex_func(GetProcAddress(LibHandle, 'SDL_GameControllerMappingForDeviceIndex')); If Not assigned(SDL_GameControllerMappingForDeviceIndex) Then result := false; - SDL_GameControllerFromInstanceID := TSDL_GameControllerFromInstanceID_fun(GetProcAddress(LibHandle, 'SDL_GameControllerFromInstanceID')); + SDL_GameControllerFromInstanceID := TSDL_GameControllerFromInstanceID_func(GetProcAddress(LibHandle, 'SDL_GameControllerFromInstanceID')); If Not assigned(SDL_GameControllerFromInstanceID) Then result := false; - SDL_GameControllerFromPlayerIndex := TSDL_GameControllerFromPlayerIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerFromPlayerIndex')); + SDL_GameControllerFromPlayerIndex := TSDL_GameControllerFromPlayerIndex_func(GetProcAddress(LibHandle, 'SDL_GameControllerFromPlayerIndex')); If Not assigned(SDL_GameControllerFromPlayerIndex) Then result := false; - //SDL_GameControllerPath := TSDL_GameControllerPath_fun(GetProcAddress(LibHandle, 'SDL_GameControllerPath')); + //SDL_GameControllerPath := TSDL_GameControllerPath_func(GetProcAddress(LibHandle, 'SDL_GameControllerPath')); //If Not assigned(SDL_GameControllerPath) Then result := false; - SDL_GameControllerGetType := TSDL_GameControllerGetType_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetType')); + SDL_GameControllerGetType := TSDL_GameControllerGetType_func(GetProcAddress(LibHandle, 'SDL_GameControllerGetType')); If Not assigned(SDL_GameControllerGetType) Then result := false; - SDL_GameControllerGetPlayerIndex := TSDL_GameControllerGetPlayerIndex_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetPlayerIndex')); + SDL_GameControllerGetPlayerIndex := TSDL_GameControllerGetPlayerIndex_func(GetProcAddress(LibHandle, 'SDL_GameControllerGetPlayerIndex')); If Not assigned(SDL_GameControllerGetPlayerIndex) Then result := false; SDL_GameControllerSetPlayerIndex := TSDL_GameControllerSetPlayerIndex_proc(GetProcAddress(LibHandle, 'SDL_GameControllerSetPlayerIndex')); If Not assigned(SDL_GameControllerSetPlayerIndex) Then result := false; - SDL_GameControllerGetVendor := TSDL_GameControllerGetVendor_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetVendor')); + SDL_GameControllerGetVendor := TSDL_GameControllerGetVendor_func(GetProcAddress(LibHandle, 'SDL_GameControllerGetVendor')); If Not assigned(SDL_GameControllerGetVendor) Then result := false; - SDL_GameControllerGetProduct := TSDL_GameControllerGetProduct_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetProduct')); + SDL_GameControllerGetProduct := TSDL_GameControllerGetProduct_func(GetProcAddress(LibHandle, 'SDL_GameControllerGetProduct')); If Not assigned(SDL_GameControllerGetProduct) Then result := false; - SDL_GameControllerGetProductVersion := TSDL_GameControllerGetProductVersion_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetProductVersion')); + SDL_GameControllerGetProductVersion := TSDL_GameControllerGetProductVersion_func(GetProcAddress(LibHandle, 'SDL_GameControllerGetProductVersion')); If Not assigned(SDL_GameControllerGetProductVersion) Then result := false; - //SDL_GameControllerGetFirmwareVersion := TSDL_GameControllerGetFirmwareVersion_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetFirmwareVersion')); + //SDL_GameControllerGetFirmwareVersion := TSDL_GameControllerGetFirmwareVersion_func(GetProcAddress(LibHandle, 'SDL_GameControllerGetFirmwareVersion')); //If Not assigned(SDL_GameControllerGetFirmwareVersion) Then result := false; - //SDL_GameControllerGetSerial := TSDL_GameControllerGetSerial_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetSerial')); + //SDL_GameControllerGetSerial := TSDL_GameControllerGetSerial_func(GetProcAddress(LibHandle, 'SDL_GameControllerGetSerial')); //If Not assigned(SDL_GameControllerGetSerial) Then result := false; - //SDL_GameControllerGetSteamHandle := TSDL_GameControllerGetSteamHandle_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetSteamHandle')); + //SDL_GameControllerGetSteamHandle := TSDL_GameControllerGetSteamHandle_func(GetProcAddress(LibHandle, 'SDL_GameControllerGetSteamHandle')); //If Not assigned(SDL_GameControllerGetSteamHandle) Then result := false; - //SDL_GameControllerHasAxis := TSDL_GameControllerHasAxis_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasAxis')); + //SDL_GameControllerHasAxis := TSDL_GameControllerHasAxis_func(GetProcAddress(LibHandle, 'SDL_GameControllerHasAxis')); //If Not assigned(SDL_GameControllerHasAxis) Then result := false; - //SDL_GameControllerHasButton := TSDL_GameControllerHasButton_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasButton')); + //SDL_GameControllerHasButton := TSDL_GameControllerHasButton_func(GetProcAddress(LibHandle, 'SDL_GameControllerHasButton')); //If Not assigned(SDL_GameControllerHasButton) Then result := false; - //SDL_GameControllerGetNumTouchpads := TSDL_GameControllerGetNumTouchpads_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetNumTouchpads')); + //SDL_GameControllerGetNumTouchpads := TSDL_GameControllerGetNumTouchpads_func(GetProcAddress(LibHandle, 'SDL_GameControllerGetNumTouchpads')); //If Not assigned(SDL_GameControllerGetNumTouchpads) Then result := false; - //SDL_GameControllerGetNumTouchpadFingers := TSDL_GameControllerGetNumTouchpadFingers_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetNumTouchpadFingers')); + //SDL_GameControllerGetNumTouchpadFingers := TSDL_GameControllerGetNumTouchpadFingers_func(GetProcAddress(LibHandle, 'SDL_GameControllerGetNumTouchpadFingers')); //If Not assigned(SDL_GameControllerGetNumTouchpadFingers) Then result := false; - //SDL_GameControllerGetTouchpadFinger := TSDL_GameControllerGetTouchpadFinger_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetTouchpadFinger')); + //SDL_GameControllerGetTouchpadFinger := TSDL_GameControllerGetTouchpadFinger_func(GetProcAddress(LibHandle, 'SDL_GameControllerGetTouchpadFinger')); //If Not assigned(SDL_GameControllerGetTouchpadFinger) Then result := false; - //SDL_GameControllerHasSensor := TSDL_GameControllerHasSensor_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasSensor')); + //SDL_GameControllerHasSensor := TSDL_GameControllerHasSensor_func(GetProcAddress(LibHandle, 'SDL_GameControllerHasSensor')); //If Not assigned(SDL_GameControllerHasSensor) Then result := false; - //SDL_GameControllerSetSensorEnabled := TSDL_GameControllerSetSensorEnabled_fun(GetProcAddress(LibHandle, 'SDL_GameControllerSetSensorEnabled')); + //SDL_GameControllerSetSensorEnabled := TSDL_GameControllerSetSensorEnabled_func(GetProcAddress(LibHandle, 'SDL_GameControllerSetSensorEnabled')); //If Not assigned(SDL_GameControllerSetSensorEnabled) Then result := false; - //SDL_GameControllerIsSensorEnabled := TSDL_GameControllerIsSensorEnabled_fun(GetProcAddress(LibHandle, 'SDL_GameControllerIsSensorEnabled')); + //SDL_GameControllerIsSensorEnabled := TSDL_GameControllerIsSensorEnabled_func(GetProcAddress(LibHandle, 'SDL_GameControllerIsSensorEnabled')); //If Not assigned(SDL_GameControllerIsSensorEnabled) Then result := false; - (*SDL_GameControllerGetSensorDataRate := TSDL_GameControllerGetSensorDataRate_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetSensorDataRate')); + (*SDL_GameControllerGetSensorDataRate := TSDL_GameControllerGetSensorDataRate_func(GetProcAddress(LibHandle, 'SDL_GameControllerGetSensorDataRate')); If Not assigned(SDL_GameControllerGetSensorDataRate) Then result := false; - SDL_GameControllerGetSensorData := TSDL_GameControllerGetSensorData_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetSensorData')); + SDL_GameControllerGetSensorData := TSDL_GameControllerGetSensorData_func(GetProcAddress(LibHandle, 'SDL_GameControllerGetSensorData')); If Not assigned(SDL_GameControllerGetSensorData) Then result := false; - SDL_GameControllerGetSensorDataWithTimestamp := TSDL_GameControllerGetSensorDataWithTimestamp_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetSensorDataWithTimestamp')); + SDL_GameControllerGetSensorDataWithTimestamp := TSDL_GameControllerGetSensorDataWithTimestamp_func(GetProcAddress(LibHandle, 'SDL_GameControllerGetSensorDataWithTimestamp')); If Not assigned(SDL_GameControllerGetSensorDataWithTimestamp) Then result := false; - SDL_GameControllerHasRumble := TSDL_GameControllerHasRumble_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasRumble')); + SDL_GameControllerHasRumble := TSDL_GameControllerHasRumble_func(GetProcAddress(LibHandle, 'SDL_GameControllerHasRumble')); If Not assigned(SDL_GameControllerHasRumble) Then result := false; - SDL_GameControllerRumble := TSDL_GameControllerRumble_fun(GetProcAddress(LibHandle, 'SDL_GameControllerRumble')); + SDL_GameControllerRumble := TSDL_GameControllerRumble_func(GetProcAddress(LibHandle, 'SDL_GameControllerRumble')); If Not assigned(SDL_GameControllerRumble) Then result := false; - SDL_GameControllerHasRumbleTriggers := TSDL_GameControllerHasRumbleTriggers_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasRumbleTriggers')); + SDL_GameControllerHasRumbleTriggers := TSDL_GameControllerHasRumbleTriggers_func(GetProcAddress(LibHandle, 'SDL_GameControllerHasRumbleTriggers')); If Not assigned(SDL_GameControllerHasRumbleTriggers) Then result := false; - SDL_GameControllerRumbleTriggers := TSDL_GameControllerRumbleTriggers_fun(GetProcAddress(LibHandle, 'SDL_GameControllerRumbleTriggers')); + SDL_GameControllerRumbleTriggers := TSDL_GameControllerRumbleTriggers_func(GetProcAddress(LibHandle, 'SDL_GameControllerRumbleTriggers')); If Not assigned(SDL_GameControllerRumbleTriggers) Then result := false; - SDL_GameControllerHasLED := TSDL_GameControllerHasLED_fun(GetProcAddress(LibHandle, 'SDL_GameControllerHasLED')); + SDL_GameControllerHasLED := TSDL_GameControllerHasLED_func(GetProcAddress(LibHandle, 'SDL_GameControllerHasLED')); If Not assigned(SDL_GameControllerHasLED) Then result := false; - SDL_GameControllerSetLED := TSDL_GameControllerSetLED_fun(GetProcAddress(LibHandle, 'SDL_GameControllerSetLED')); + SDL_GameControllerSetLED := TSDL_GameControllerSetLED_func(GetProcAddress(LibHandle, 'SDL_GameControllerSetLED')); If Not assigned(SDL_GameControllerSetLED) Then result := false; - SDL_GameControllerSendEffect := TSDL_GameControllerSendEffect_fun(GetProcAddress(LibHandle, 'SDL_GameControllerSendEffect')); + SDL_GameControllerSendEffect := TSDL_GameControllerSendEffect_func(GetProcAddress(LibHandle, 'SDL_GameControllerSendEffect')); If Not assigned(SDL_GameControllerSendEffect) Then result := false; - SDL_GameControllerGetAppleSFSymbolsNameForAxis := TSDL_GameControllerGetAppleSFSymbolsNameForAxis_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetAppleSFSymbolsNameForAxis')); + SDL_GameControllerGetAppleSFSymbolsNameForAxis := TSDL_GameControllerGetAppleSFSymbolsNameForAxis_func(GetProcAddress(LibHandle, 'SDL_GameControllerGetAppleSFSymbolsNameForAxis')); If Not assigned(SDL_GameControllerGetAppleSFSymbolsNameForAxis) Then result := false; - SDL_GameControllerGetAppleSFSymbolsNameForButton := TSDL_GameControllerGetAppleSFSymbolsNameForButton_fun(GetProcAddress(LibHandle, 'SDL_GameControllerGetAppleSFSymbolsNameForButton')); + SDL_GameControllerGetAppleSFSymbolsNameForButton := TSDL_GameControllerGetAppleSFSymbolsNameForButton_func(GetProcAddress(LibHandle, 'SDL_GameControllerGetAppleSFSymbolsNameForButton')); If Not assigned(SDL_GameControllerGetAppleSFSymbolsNameForButton) Then result := false; - SDL_RecordGesture := TSDL_RecordGesture_fun(GetProcAddress(LibHandle, 'SDL_RecordGesture')); + SDL_RecordGesture := TSDL_RecordGesture_func(GetProcAddress(LibHandle, 'SDL_RecordGesture')); If Not assigned(SDL_RecordGesture) Then result := false; - SDL_SaveAllDollarTemplates := TSDL_SaveAllDollarTemplates_fun(GetProcAddress(LibHandle, 'SDL_SaveAllDollarTemplates')); + SDL_SaveAllDollarTemplates := TSDL_SaveAllDollarTemplates_func(GetProcAddress(LibHandle, 'SDL_SaveAllDollarTemplates')); If Not assigned(SDL_SaveAllDollarTemplates) Then result := false; - SDL_SaveDollarTemplate := TSDL_SaveDollarTemplate_fun(GetProcAddress(LibHandle, 'SDL_SaveDollarTemplate')); + SDL_SaveDollarTemplate := TSDL_SaveDollarTemplate_func(GetProcAddress(LibHandle, 'SDL_SaveDollarTemplate')); If Not assigned(SDL_SaveDollarTemplate) Then result := false; - SDL_LoadDollarTemplates := TSDL_LoadDollarTemplates_fun(GetProcAddress(LibHandle, 'SDL_LoadDollarTemplates')); + SDL_LoadDollarTemplates := TSDL_LoadDollarTemplates_func(GetProcAddress(LibHandle, 'SDL_LoadDollarTemplates')); If Not assigned(SDL_LoadDollarTemplates) Then result := false; SDL_GUIDToString := TSDL_GUIDToString_proc(GetProcAddress(LibHandle, 'SDL_GUIDToString')); If Not assigned(SDL_GUIDToString) Then result := false; - SDL_GUIDFromString := TSDL_GUIDFromString_fun(GetProcAddress(LibHandle, 'SDL_GUIDFromString')); + SDL_GUIDFromString := TSDL_GUIDFromString_func(GetProcAddress(LibHandle, 'SDL_GUIDFromString')); If Not assigned(SDL_GUIDFromString) Then result := false; - SDL_HapticName := TSDL_HapticName_fun(GetProcAddress(LibHandle, 'SDL_HapticName')); + SDL_HapticName := TSDL_HapticName_func(GetProcAddress(LibHandle, 'SDL_HapticName')); If Not assigned(SDL_HapticName) Then result := false; - SDL_HapticOpen := TSDL_HapticOpen_fun(GetProcAddress(LibHandle, 'SDL_HapticOpen')); + SDL_HapticOpen := TSDL_HapticOpen_func(GetProcAddress(LibHandle, 'SDL_HapticOpen')); If Not assigned(SDL_HapticOpen) Then result := false; - SDL_HapticOpened := TSDL_HapticOpened_fun(GetProcAddress(LibHandle, 'SDL_HapticOpened')); + SDL_HapticOpened := TSDL_HapticOpened_func(GetProcAddress(LibHandle, 'SDL_HapticOpened')); If Not assigned(SDL_HapticOpened) Then result := false; - SDL_HapticIndex := TSDL_HapticIndex_fun(GetProcAddress(LibHandle, 'SDL_HapticIndex')); + SDL_HapticIndex := TSDL_HapticIndex_func(GetProcAddress(LibHandle, 'SDL_HapticIndex')); If Not assigned(SDL_HapticIndex) Then result := false; - SDL_JoystickIsHaptic := TSDL_JoystickIsHaptic_fun(GetProcAddress(LibHandle, 'SDL_JoystickIsHaptic')); + SDL_JoystickIsHaptic := TSDL_JoystickIsHaptic_func(GetProcAddress(LibHandle, 'SDL_JoystickIsHaptic')); If Not assigned(SDL_JoystickIsHaptic) Then result := false; - SDL_HapticOpenFromJoystick := TSDL_HapticOpenFromJoystick_fun(GetProcAddress(LibHandle, 'SDL_HapticOpenFromJoystick')); + SDL_HapticOpenFromJoystick := TSDL_HapticOpenFromJoystick_func(GetProcAddress(LibHandle, 'SDL_HapticOpenFromJoystick')); If Not assigned(SDL_HapticOpenFromJoystick) Then result := false; SDL_HapticClose := TSDL_HapticClose_proc(GetProcAddress(LibHandle, 'SDL_HapticClose')); If Not assigned(SDL_HapticClose) Then result := false; - SDL_HapticNumEffects := TSDL_HapticNumEffects_fun(GetProcAddress(LibHandle, 'SDL_HapticNumEffects')); + SDL_HapticNumEffects := TSDL_HapticNumEffects_func(GetProcAddress(LibHandle, 'SDL_HapticNumEffects')); If Not assigned(SDL_HapticNumEffects) Then result := false; - SDL_HapticNumEffectsPlaying := TSDL_HapticNumEffectsPlaying_fun(GetProcAddress(LibHandle, 'SDL_HapticNumEffectsPlaying')); + SDL_HapticNumEffectsPlaying := TSDL_HapticNumEffectsPlaying_func(GetProcAddress(LibHandle, 'SDL_HapticNumEffectsPlaying')); If Not assigned(SDL_HapticNumEffectsPlaying) Then result := false; - SDL_HapticQuery := TSDL_HapticQuery_fun(GetProcAddress(LibHandle, 'SDL_HapticQuery')); + SDL_HapticQuery := TSDL_HapticQuery_func(GetProcAddress(LibHandle, 'SDL_HapticQuery')); If Not assigned(SDL_HapticQuery) Then result := false; - SDL_HapticNumAxes := TSDL_HapticNumAxes_fun(GetProcAddress(LibHandle, 'SDL_HapticNumAxes')); + SDL_HapticNumAxes := TSDL_HapticNumAxes_func(GetProcAddress(LibHandle, 'SDL_HapticNumAxes')); If Not assigned(SDL_HapticNumAxes) Then result := false; - SDL_HapticEffectSupported := TSDL_HapticEffectSupported_fun(GetProcAddress(LibHandle, 'SDL_HapticEffectSupported')); + SDL_HapticEffectSupported := TSDL_HapticEffectSupported_func(GetProcAddress(LibHandle, 'SDL_HapticEffectSupported')); If Not assigned(SDL_HapticEffectSupported) Then result := false; - SDL_HapticNewEffect := TSDL_HapticNewEffect_fun(GetProcAddress(LibHandle, 'SDL_HapticNewEffect')); + SDL_HapticNewEffect := TSDL_HapticNewEffect_func(GetProcAddress(LibHandle, 'SDL_HapticNewEffect')); If Not assigned(SDL_HapticNewEffect) Then result := false; - SDL_HapticUpdateEffect := TSDL_HapticUpdateEffect_fun(GetProcAddress(LibHandle, 'SDL_HapticUpdateEffect')); + SDL_HapticUpdateEffect := TSDL_HapticUpdateEffect_func(GetProcAddress(LibHandle, 'SDL_HapticUpdateEffect')); If Not assigned(SDL_HapticUpdateEffect) Then result := false; - SDL_HapticRunEffect := TSDL_HapticRunEffect_fun(GetProcAddress(LibHandle, 'SDL_HapticRunEffect')); + SDL_HapticRunEffect := TSDL_HapticRunEffect_func(GetProcAddress(LibHandle, 'SDL_HapticRunEffect')); If Not assigned(SDL_HapticRunEffect) Then result := false; - SDL_HapticStopEffect := TSDL_HapticStopEffect_fun(GetProcAddress(LibHandle, 'SDL_HapticStopEffect')); + SDL_HapticStopEffect := TSDL_HapticStopEffect_func(GetProcAddress(LibHandle, 'SDL_HapticStopEffect')); If Not assigned(SDL_HapticStopEffect) Then result := false; SDL_HapticDestroyEffect := TSDL_HapticDestroyEffect_proc(GetProcAddress(LibHandle, 'SDL_HapticDestroyEffect')); If Not assigned(SDL_HapticDestroyEffect) Then result := false; - SDL_HapticGetEffectStatus := TSDL_HapticGetEffectStatus_fun(GetProcAddress(LibHandle, 'SDL_HapticGetEffectStatus')); + SDL_HapticGetEffectStatus := TSDL_HapticGetEffectStatus_func(GetProcAddress(LibHandle, 'SDL_HapticGetEffectStatus')); If Not assigned(SDL_HapticGetEffectStatus) Then result := false; - SDL_HapticSetGain := TSDL_HapticSetGain_fun(GetProcAddress(LibHandle, 'SDL_HapticSetGain')); + SDL_HapticSetGain := TSDL_HapticSetGain_func(GetProcAddress(LibHandle, 'SDL_HapticSetGain')); If Not assigned(SDL_HapticSetGain) Then result := false; - SDL_HapticSetAutocenter := TSDL_HapticSetAutocenter_fun(GetProcAddress(LibHandle, 'SDL_HapticSetAutocenter')); + SDL_HapticSetAutocenter := TSDL_HapticSetAutocenter_func(GetProcAddress(LibHandle, 'SDL_HapticSetAutocenter')); If Not assigned(SDL_HapticSetAutocenter) Then result := false; - SDL_HapticPause := TSDL_HapticPause_fun(GetProcAddress(LibHandle, 'SDL_HapticPause')); + SDL_HapticPause := TSDL_HapticPause_func(GetProcAddress(LibHandle, 'SDL_HapticPause')); If Not assigned(SDL_HapticPause) Then result := false; - SDL_HapticUnpause := TSDL_HapticUnpause_fun(GetProcAddress(LibHandle, 'SDL_HapticUnpause')); + SDL_HapticUnpause := TSDL_HapticUnpause_func(GetProcAddress(LibHandle, 'SDL_HapticUnpause')); If Not assigned(SDL_HapticUnpause) Then result := false; - SDL_HapticStopAll := TSDL_HapticStopAll_fun(GetProcAddress(LibHandle, 'SDL_HapticStopAll')); + SDL_HapticStopAll := TSDL_HapticStopAll_func(GetProcAddress(LibHandle, 'SDL_HapticStopAll')); If Not assigned(SDL_HapticStopAll) Then result := false; - SDL_HapticRumbleSupported := TSDL_HapticRumbleSupported_fun(GetProcAddress(LibHandle, 'SDL_HapticRumbleSupported')); + SDL_HapticRumbleSupported := TSDL_HapticRumbleSupported_func(GetProcAddress(LibHandle, 'SDL_HapticRumbleSupported')); If Not assigned(SDL_HapticRumbleSupported) Then result := false; - SDL_HapticRumbleInit := TSDL_HapticRumbleInit_fun(GetProcAddress(LibHandle, 'SDL_HapticRumbleInit')); + SDL_HapticRumbleInit := TSDL_HapticRumbleInit_func(GetProcAddress(LibHandle, 'SDL_HapticRumbleInit')); If Not assigned(SDL_HapticRumbleInit) Then result := false; - SDL_HapticRumblePlay := TSDL_HapticRumblePlay_fun(GetProcAddress(LibHandle, 'SDL_HapticRumblePlay')); + SDL_HapticRumblePlay := TSDL_HapticRumblePlay_func(GetProcAddress(LibHandle, 'SDL_HapticRumblePlay')); If Not assigned(SDL_HapticRumblePlay) Then result := false; - SDL_HapticRumbleStop := TSDL_HapticRumbleStop_fun(GetProcAddress(LibHandle, 'SDL_HapticRumbleStop')); + SDL_HapticRumbleStop := TSDL_HapticRumbleStop_func(GetProcAddress(LibHandle, 'SDL_HapticRumbleStop')); If Not assigned(SDL_HapticRumbleStop) Then result := false; - SDL_SetHintWithPriority := TSDL_SetHintWithPriority_fun(GetProcAddress(LibHandle, 'SDL_SetHintWithPriority')); + SDL_SetHintWithPriority := TSDL_SetHintWithPriority_func(GetProcAddress(LibHandle, 'SDL_SetHintWithPriority')); If Not assigned(SDL_SetHintWithPriority) Then result := false; - SDL_SetHint := TSDL_SetHint_fun(GetProcAddress(LibHandle, 'SDL_SetHint')); + SDL_SetHint := TSDL_SetHint_func(GetProcAddress(LibHandle, 'SDL_SetHint')); If Not assigned(SDL_SetHint) Then result := false; - SDL_ResetHint := TSDL_ResetHint_fun(GetProcAddress(LibHandle, 'SDL_ResetHint')); + SDL_ResetHint := TSDL_ResetHint_func(GetProcAddress(LibHandle, 'SDL_ResetHint')); If Not assigned(SDL_ResetHint) Then result := false; SDL_ResetHints := TSDL_ResetHints_proc(GetProcAddress(LibHandle, 'SDL_ResetHints')); If Not assigned(SDL_ResetHints) Then result := false; - SDL_GetHint := TSDL_GetHint_fun(GetProcAddress(LibHandle, 'SDL_GetHint')); + SDL_GetHint := TSDL_GetHint_func(GetProcAddress(LibHandle, 'SDL_GetHint')); If Not assigned(SDL_GetHint) Then result := false; - SDL_GetHintBoolean := TSDL_GetHintBoolean_fun(GetProcAddress(LibHandle, 'SDL_GetHintBoolean')); + SDL_GetHintBoolean := TSDL_GetHintBoolean_func(GetProcAddress(LibHandle, 'SDL_GetHintBoolean')); If Not assigned(SDL_GetHintBoolean) Then result := false; SDL_AddHintCallback := TSDL_AddHintCallback_proc(GetProcAddress(LibHandle, 'SDL_AddHintCallback')); If Not assigned(SDL_AddHintCallback) Then result := false; @@ -279,139 +279,139 @@ Begin If Not assigned(SDL_LockJoysticks) Then result := false; SDL_UnlockJoysticks := TSDL_UnlockJoysticks_proc(GetProcAddress(LibHandle, 'SDL_UnlockJoysticks')); If Not assigned(SDL_UnlockJoysticks) Then result := false;//*) - SDL_NumJoysticks := TSDL_NumJoysticks_fun(GetProcAddress(LibHandle, 'SDL_NumJoysticks')); + SDL_NumJoysticks := TSDL_NumJoysticks_func(GetProcAddress(LibHandle, 'SDL_NumJoysticks')); If Not assigned(SDL_NumJoysticks) Then result := false; - SDL_JoystickNameForIndex := TSDL_JoystickNameForIndex_fun(GetProcAddress(LibHandle, 'SDL_JoystickNameForIndex')); + SDL_JoystickNameForIndex := TSDL_JoystickNameForIndex_func(GetProcAddress(LibHandle, 'SDL_JoystickNameForIndex')); If Not assigned(SDL_JoystickNameForIndex) Then result := false; - (* SDL_JoystickPathForIndex := TSDL_JoystickPathForIndex_fun(GetProcAddress(LibHandle, 'SDL_JoystickPathForIndex')); + (* SDL_JoystickPathForIndex := TSDL_JoystickPathForIndex_func(GetProcAddress(LibHandle, 'SDL_JoystickPathForIndex')); If Not assigned(SDL_JoystickPathForIndex) Then result := false; - SDL_JoystickGetDevicePlayerIndex := TSDL_JoystickGetDevicePlayerIndex_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDevicePlayerIndex')); + SDL_JoystickGetDevicePlayerIndex := TSDL_JoystickGetDevicePlayerIndex_func(GetProcAddress(LibHandle, 'SDL_JoystickGetDevicePlayerIndex')); If Not assigned(SDL_JoystickGetDevicePlayerIndex) Then result := false; - SDL_JoystickGetDeviceGUID := TSDL_JoystickGetDeviceGUID_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceGUID')); + SDL_JoystickGetDeviceGUID := TSDL_JoystickGetDeviceGUID_func(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceGUID')); If Not assigned(SDL_JoystickGetDeviceGUID) Then result := false; - SDL_JoystickGetDeviceVendor := TSDL_JoystickGetDeviceVendor_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceVendor')); + SDL_JoystickGetDeviceVendor := TSDL_JoystickGetDeviceVendor_func(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceVendor')); If Not assigned(SDL_JoystickGetDeviceVendor) Then result := false; - SDL_JoystickGetDeviceProduct := TSDL_JoystickGetDeviceProduct_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceProduct')); + SDL_JoystickGetDeviceProduct := TSDL_JoystickGetDeviceProduct_func(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceProduct')); If Not assigned(SDL_JoystickGetDeviceProduct) Then result := false; - SDL_JoystickGetDeviceProductVersion := TSDL_JoystickGetDeviceProductVersion_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceProductVersion')); + SDL_JoystickGetDeviceProductVersion := TSDL_JoystickGetDeviceProductVersion_func(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceProductVersion')); If Not assigned(SDL_JoystickGetDeviceProductVersion) Then result := false; - SDL_JoystickGetDeviceType := TSDL_JoystickGetDeviceType_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceType')); + SDL_JoystickGetDeviceType := TSDL_JoystickGetDeviceType_func(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceType')); If Not assigned(SDL_JoystickGetDeviceType) Then result := false; - SDL_JoystickGetDeviceInstanceID := TSDL_JoystickGetDeviceInstanceID_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceInstanceID')); + SDL_JoystickGetDeviceInstanceID := TSDL_JoystickGetDeviceInstanceID_func(GetProcAddress(LibHandle, 'SDL_JoystickGetDeviceInstanceID')); If Not assigned(SDL_JoystickGetDeviceInstanceID) Then result := false;// *) - SDL_JoystickOpen := TSDL_JoystickOpen_fun(GetProcAddress(LibHandle, 'SDL_JoystickOpen')); + SDL_JoystickOpen := TSDL_JoystickOpen_func(GetProcAddress(LibHandle, 'SDL_JoystickOpen')); If Not assigned(SDL_JoystickOpen) Then result := false; - (* SDL_JoystickFromInstanceID := TSDL_JoystickFromInstanceID_fun(GetProcAddress(LibHandle, 'SDL_JoystickFromInstanceID')); + (* SDL_JoystickFromInstanceID := TSDL_JoystickFromInstanceID_func(GetProcAddress(LibHandle, 'SDL_JoystickFromInstanceID')); If Not assigned(SDL_JoystickFromInstanceID) Then result := false; - SDL_JoystickFromPlayerIndex := TSDL_JoystickFromPlayerIndex_fun(GetProcAddress(LibHandle, 'SDL_JoystickFromPlayerIndex')); + SDL_JoystickFromPlayerIndex := TSDL_JoystickFromPlayerIndex_func(GetProcAddress(LibHandle, 'SDL_JoystickFromPlayerIndex')); If Not assigned(SDL_JoystickFromPlayerIndex) Then result := false; - SDL_JoystickAttachVirtual := TSDL_JoystickAttachVirtual_fun(GetProcAddress(LibHandle, 'SDL_JoystickAttachVirtual')); + SDL_JoystickAttachVirtual := TSDL_JoystickAttachVirtual_func(GetProcAddress(LibHandle, 'SDL_JoystickAttachVirtual')); If Not assigned(SDL_JoystickAttachVirtual) Then result := false; - SDL_JoystickAttachVirtualEx := TSDL_JoystickAttachVirtualEx_fun(GetProcAddress(LibHandle, 'SDL_JoystickAttachVirtualEx')); + SDL_JoystickAttachVirtualEx := TSDL_JoystickAttachVirtualEx_func(GetProcAddress(LibHandle, 'SDL_JoystickAttachVirtualEx')); If Not assigned(SDL_JoystickAttachVirtualEx) Then result := false; - SDL_JoystickDetachVirtual := TSDL_JoystickDetachVirtual_fun(GetProcAddress(LibHandle, 'SDL_JoystickDetachVirtual')); + SDL_JoystickDetachVirtual := TSDL_JoystickDetachVirtual_func(GetProcAddress(LibHandle, 'SDL_JoystickDetachVirtual')); If Not assigned(SDL_JoystickDetachVirtual) Then result := false; - SDL_JoystickIsVirtual := TSDL_JoystickIsVirtual_fun(GetProcAddress(LibHandle, 'SDL_JoystickIsVirtual')); + SDL_JoystickIsVirtual := TSDL_JoystickIsVirtual_func(GetProcAddress(LibHandle, 'SDL_JoystickIsVirtual')); If Not assigned(SDL_JoystickIsVirtual) Then result := false; - SDL_JoystickSetVirtualAxis := TSDL_JoystickSetVirtualAxis_fun(GetProcAddress(LibHandle, 'SDL_JoystickSetVirtualAxis')); + SDL_JoystickSetVirtualAxis := TSDL_JoystickSetVirtualAxis_func(GetProcAddress(LibHandle, 'SDL_JoystickSetVirtualAxis')); If Not assigned(SDL_JoystickSetVirtualAxis) Then result := false; - SDL_JoystickSetVirtualButton := TSDL_JoystickSetVirtualButton_fun(GetProcAddress(LibHandle, 'SDL_JoystickSetVirtualButton')); + SDL_JoystickSetVirtualButton := TSDL_JoystickSetVirtualButton_func(GetProcAddress(LibHandle, 'SDL_JoystickSetVirtualButton')); If Not assigned(SDL_JoystickSetVirtualButton) Then result := false; - SDL_JoystickSetVirtualHat := TSDL_JoystickSetVirtualHat_fun(GetProcAddress(LibHandle, 'SDL_JoystickSetVirtualHat')); + SDL_JoystickSetVirtualHat := TSDL_JoystickSetVirtualHat_func(GetProcAddress(LibHandle, 'SDL_JoystickSetVirtualHat')); If Not assigned(SDL_JoystickSetVirtualHat) Then result := false; - SDL_JoystickName := TSDL_JoystickName_fun(GetProcAddress(LibHandle, 'SDL_JoystickName')); + SDL_JoystickName := TSDL_JoystickName_func(GetProcAddress(LibHandle, 'SDL_JoystickName')); If Not assigned(SDL_JoystickName) Then result := false; - SDL_JoystickPath := TSDL_JoystickPath_fun(GetProcAddress(LibHandle, 'SDL_JoystickPath')); + SDL_JoystickPath := TSDL_JoystickPath_func(GetProcAddress(LibHandle, 'SDL_JoystickPath')); If Not assigned(SDL_JoystickPath) Then result := false; - SDL_JoystickGetPlayerIndex := TSDL_JoystickGetPlayerIndex_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetPlayerIndex')); + SDL_JoystickGetPlayerIndex := TSDL_JoystickGetPlayerIndex_func(GetProcAddress(LibHandle, 'SDL_JoystickGetPlayerIndex')); If Not assigned(SDL_JoystickGetPlayerIndex) Then result := false; SDL_JoystickSetPlayerIndex := TSDL_JoystickSetPlayerIndex_proc(GetProcAddress(LibHandle, 'SDL_JoystickSetPlayerIndex')); If Not assigned(SDL_JoystickSetPlayerIndex) Then result := false; - SDL_JoystickGetGUID := TSDL_JoystickGetGUID_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetGUID')); + SDL_JoystickGetGUID := TSDL_JoystickGetGUID_func(GetProcAddress(LibHandle, 'SDL_JoystickGetGUID')); If Not assigned(SDL_JoystickGetGUID) Then result := false; - SDL_JoystickGetVendor := TSDL_JoystickGetVendor_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetVendor')); + SDL_JoystickGetVendor := TSDL_JoystickGetVendor_func(GetProcAddress(LibHandle, 'SDL_JoystickGetVendor')); If Not assigned(SDL_JoystickGetVendor) Then result := false; - SDL_JoystickGetProduct := TSDL_JoystickGetProduct_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetProduct')); + SDL_JoystickGetProduct := TSDL_JoystickGetProduct_func(GetProcAddress(LibHandle, 'SDL_JoystickGetProduct')); If Not assigned(SDL_JoystickGetProduct) Then result := false; - SDL_JoystickGetProductVersion := TSDL_JoystickGetProductVersion_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetProductVersion')); + SDL_JoystickGetProductVersion := TSDL_JoystickGetProductVersion_func(GetProcAddress(LibHandle, 'SDL_JoystickGetProductVersion')); If Not assigned(SDL_JoystickGetProductVersion) Then result := false; - SDL_JoystickGetFirmwareVersion := TSDL_JoystickGetFirmwareVersion_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetFirmwareVersion')); + SDL_JoystickGetFirmwareVersion := TSDL_JoystickGetFirmwareVersion_func(GetProcAddress(LibHandle, 'SDL_JoystickGetFirmwareVersion')); If Not assigned(SDL_JoystickGetFirmwareVersion) Then result := false; - SDL_JoystickGetSerial := TSDL_JoystickGetSerial_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetSerial')); + SDL_JoystickGetSerial := TSDL_JoystickGetSerial_func(GetProcAddress(LibHandle, 'SDL_JoystickGetSerial')); If Not assigned(SDL_JoystickGetSerial) Then result := false; - SDL_JoystickGetType := TSDL_JoystickGetType_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetType')); + SDL_JoystickGetType := TSDL_JoystickGetType_func(GetProcAddress(LibHandle, 'SDL_JoystickGetType')); If Not assigned(SDL_JoystickGetType) Then result := false; SDL_JoystickGetGUIDString := TSDL_JoystickGetGUIDString_proc(GetProcAddress(LibHandle, 'SDL_JoystickGetGUIDString')); If Not assigned(SDL_JoystickGetGUIDString) Then result := false; - SDL_JoystickGetGUIDFromString := TSDL_JoystickGetGUIDFromString_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetGUIDFromString')); + SDL_JoystickGetGUIDFromString := TSDL_JoystickGetGUIDFromString_func(GetProcAddress(LibHandle, 'SDL_JoystickGetGUIDFromString')); If Not assigned(SDL_JoystickGetGUIDFromString) Then result := false; SDL_GetJoystickGUIDInfo := TSDL_GetJoystickGUIDInfo_proc(GetProcAddress(LibHandle, 'SDL_GetJoystickGUIDInfo')); If Not assigned(SDL_GetJoystickGUIDInfo) Then result := false; - SDL_JoystickGetAttached := TSDL_JoystickGetAttached_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetAttached')); + SDL_JoystickGetAttached := TSDL_JoystickGetAttached_func(GetProcAddress(LibHandle, 'SDL_JoystickGetAttached')); If Not assigned(SDL_JoystickGetAttached) Then result := false; - SDL_JoystickInstanceID := TSDL_JoystickInstanceID_fun(GetProcAddress(LibHandle, 'SDL_JoystickInstanceID')); + SDL_JoystickInstanceID := TSDL_JoystickInstanceID_func(GetProcAddress(LibHandle, 'SDL_JoystickInstanceID')); If Not assigned(SDL_JoystickInstanceID) Then result := false;//*) - SDL_JoystickNumAxes := TSDL_JoystickNumAxes_fun(GetProcAddress(LibHandle, 'SDL_JoystickNumAxes')); + SDL_JoystickNumAxes := TSDL_JoystickNumAxes_func(GetProcAddress(LibHandle, 'SDL_JoystickNumAxes')); If Not assigned(SDL_JoystickNumAxes) Then result := false; - (* SDL_JoystickNumBalls := TSDL_JoystickNumBalls_fun(GetProcAddress(LibHandle, 'SDL_JoystickNumBalls')); + (* SDL_JoystickNumBalls := TSDL_JoystickNumBalls_func(GetProcAddress(LibHandle, 'SDL_JoystickNumBalls')); If Not assigned(SDL_JoystickNumBalls) Then result := false; - SDL_JoystickNumHats := TSDL_JoystickNumHats_fun(GetProcAddress(LibHandle, 'SDL_JoystickNumHats')); + SDL_JoystickNumHats := TSDL_JoystickNumHats_func(GetProcAddress(LibHandle, 'SDL_JoystickNumHats')); If Not assigned(SDL_JoystickNumHats) Then result := false; //*) - SDL_JoystickNumButtons := TSDL_JoystickNumButtons_fun(GetProcAddress(LibHandle, 'SDL_JoystickNumButtons')); + SDL_JoystickNumButtons := TSDL_JoystickNumButtons_func(GetProcAddress(LibHandle, 'SDL_JoystickNumButtons')); If Not assigned(SDL_JoystickNumButtons) Then result := false; (* SDL_JoystickUpdate := TSDL_JoystickUpdate_proc(GetProcAddress(LibHandle, 'SDL_JoystickUpdate')); If Not assigned(SDL_JoystickUpdate) Then result := false;// *) - SDL_JoystickEventState := TSDL_JoystickEventState_fun(GetProcAddress(LibHandle, 'SDL_JoystickEventState')); + SDL_JoystickEventState := TSDL_JoystickEventState_func(GetProcAddress(LibHandle, 'SDL_JoystickEventState')); If Not assigned(SDL_JoystickEventState) Then result := false; - SDL_JoystickGetAxis := TSDL_JoystickGetAxis_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetAxis')); + SDL_JoystickGetAxis := TSDL_JoystickGetAxis_func(GetProcAddress(LibHandle, 'SDL_JoystickGetAxis')); If Not assigned(SDL_JoystickGetAxis) Then result := false; - (* SDL_JoystickGetAxisInitialState := TSDL_JoystickGetAxisInitialState_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetAxisInitialState')); + (* SDL_JoystickGetAxisInitialState := TSDL_JoystickGetAxisInitialState_func(GetProcAddress(LibHandle, 'SDL_JoystickGetAxisInitialState')); If Not assigned(SDL_JoystickGetAxisInitialState) Then result := false; - SDL_JoystickGetHat := TSDL_JoystickGetHat_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetHat')); + SDL_JoystickGetHat := TSDL_JoystickGetHat_func(GetProcAddress(LibHandle, 'SDL_JoystickGetHat')); If Not assigned(SDL_JoystickGetHat) Then result := false; - SDL_JoystickGetBall := TSDL_JoystickGetBall_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetBall')); + SDL_JoystickGetBall := TSDL_JoystickGetBall_func(GetProcAddress(LibHandle, 'SDL_JoystickGetBall')); If Not assigned(SDL_JoystickGetBall) Then result := false;// *) - SDL_JoystickGetButton := TSDL_JoystickGetButton_fun(GetProcAddress(LibHandle, 'SDL_JoystickGetButton')); + SDL_JoystickGetButton := TSDL_JoystickGetButton_func(GetProcAddress(LibHandle, 'SDL_JoystickGetButton')); If Not assigned(SDL_JoystickGetButton) Then result := false; - (* SDL_JoystickRumble := TSDL_JoystickRumble_fun(GetProcAddress(LibHandle, 'SDL_JoystickRumble')); + (* SDL_JoystickRumble := TSDL_JoystickRumble_func(GetProcAddress(LibHandle, 'SDL_JoystickRumble')); If Not assigned(SDL_JoystickRumble) Then result := false; - SDL_JoystickRumbleTriggers := TSDL_JoystickRumbleTriggers_fun(GetProcAddress(LibHandle, 'SDL_JoystickRumbleTriggers')); + SDL_JoystickRumbleTriggers := TSDL_JoystickRumbleTriggers_func(GetProcAddress(LibHandle, 'SDL_JoystickRumbleTriggers')); If Not assigned(SDL_JoystickRumbleTriggers) Then result := false; - SDL_JoystickHasLED := TSDL_JoystickHasLED_fun(GetProcAddress(LibHandle, 'SDL_JoystickHasLED')); + SDL_JoystickHasLED := TSDL_JoystickHasLED_func(GetProcAddress(LibHandle, 'SDL_JoystickHasLED')); If Not assigned(SDL_JoystickHasLED) Then result := false; - SDL_JoystickHasRumble := TSDL_JoystickHasRumble_fun(GetProcAddress(LibHandle, 'SDL_JoystickHasRumble')); + SDL_JoystickHasRumble := TSDL_JoystickHasRumble_func(GetProcAddress(LibHandle, 'SDL_JoystickHasRumble')); If Not assigned(SDL_JoystickHasRumble) Then result := false; - SDL_JoystickHasRumbleTriggers := TSDL_JoystickHasRumbleTriggers_fun(GetProcAddress(LibHandle, 'SDL_JoystickHasRumbleTriggers')); + SDL_JoystickHasRumbleTriggers := TSDL_JoystickHasRumbleTriggers_func(GetProcAddress(LibHandle, 'SDL_JoystickHasRumbleTriggers')); If Not assigned(SDL_JoystickHasRumbleTriggers) Then result := false; - SDL_JoystickSetLED := TSDL_JoystickSetLED_fun(GetProcAddress(LibHandle, 'SDL_JoystickSetLED')); + SDL_JoystickSetLED := TSDL_JoystickSetLED_func(GetProcAddress(LibHandle, 'SDL_JoystickSetLED')); If Not assigned(SDL_JoystickSetLED) Then result := false; - SDL_JoystickSendEffect := TSDL_JoystickSendEffect_fun(GetProcAddress(LibHandle, 'SDL_JoystickSendEffect')); + SDL_JoystickSendEffect := TSDL_JoystickSendEffect_func(GetProcAddress(LibHandle, 'SDL_JoystickSendEffect')); If Not assigned(SDL_JoystickSendEffect) Then result := false;*) SDL_JoystickClose := TSDL_JoystickClose_proc(GetProcAddress(LibHandle, 'SDL_JoystickClose')); If Not assigned(SDL_JoystickClose) Then result := false; - (* SDL_JoystickCurrentPowerLevel := TSDL_JoystickCurrentPowerLevel_fun(GetProcAddress(LibHandle, 'SDL_JoystickCurrentPowerLevel')); + (* SDL_JoystickCurrentPowerLevel := TSDL_JoystickCurrentPowerLevel_func(GetProcAddress(LibHandle, 'SDL_JoystickCurrentPowerLevel')); If Not assigned(SDL_JoystickCurrentPowerLevel) Then result := false; - SDL_GetKeyboardState := TSDL_GetKeyboardState_fun(GetProcAddress(LibHandle, 'SDL_GetKeyboardState')); + SDL_GetKeyboardState := TSDL_GetKeyboardState_func(GetProcAddress(LibHandle, 'SDL_GetKeyboardState')); If Not assigned(SDL_GetKeyboardState) Then result := false; SDL_SetModState := TSDL_SetModState_proc(GetProcAddress(LibHandle, 'SDL_SetModState')); If Not assigned(SDL_SetModState) Then result := false; - SDL_GetKeyFromScancode := TSDL_GetKeyFromScancode_fun(GetProcAddress(LibHandle, 'SDL_GetKeyFromScancode')); + SDL_GetKeyFromScancode := TSDL_GetKeyFromScancode_func(GetProcAddress(LibHandle, 'SDL_GetKeyFromScancode')); If Not assigned(SDL_GetKeyFromScancode) Then result := false; - SDL_GetScancodeFromKey := TSDL_GetScancodeFromKey_fun(GetProcAddress(LibHandle, 'SDL_GetScancodeFromKey')); + SDL_GetScancodeFromKey := TSDL_GetScancodeFromKey_func(GetProcAddress(LibHandle, 'SDL_GetScancodeFromKey')); If Not assigned(SDL_GetScancodeFromKey) Then result := false; - SDL_GetScancodeName := TSDL_GetScancodeName_fun(GetProcAddress(LibHandle, 'SDL_GetScancodeName')); + SDL_GetScancodeName := TSDL_GetScancodeName_func(GetProcAddress(LibHandle, 'SDL_GetScancodeName')); If Not assigned(SDL_GetScancodeName) Then result := false; - SDL_GetScancodeFromName := TSDL_GetScancodeFromName_fun(GetProcAddress(LibHandle, 'SDL_GetScancodeFromName')); + SDL_GetScancodeFromName := TSDL_GetScancodeFromName_func(GetProcAddress(LibHandle, 'SDL_GetScancodeFromName')); If Not assigned(SDL_GetScancodeFromName) Then result := false; - SDL_GetKeyName := TSDL_GetKeyName_fun(GetProcAddress(LibHandle, 'SDL_GetKeyName')); + SDL_GetKeyName := TSDL_GetKeyName_func(GetProcAddress(LibHandle, 'SDL_GetKeyName')); If Not assigned(SDL_GetKeyName) Then result := false; - SDL_GetKeyFromName := TSDL_GetKeyFromName_fun(GetProcAddress(LibHandle, 'SDL_GetKeyFromName')); + SDL_GetKeyFromName := TSDL_GetKeyFromName_func(GetProcAddress(LibHandle, 'SDL_GetKeyFromName')); If Not assigned(SDL_GetKeyFromName) Then result := false; SDL_SetTextInputRect := TSDL_SetTextInputRect_proc(GetProcAddress(LibHandle, 'SDL_SetTextInputRect')); If Not assigned(SDL_SetTextInputRect) Then result := false; - SDL_IsScreenKeyboardShown := TSDL_IsScreenKeyboardShown_fun(GetProcAddress(LibHandle, 'SDL_IsScreenKeyboardShown')); + SDL_IsScreenKeyboardShown := TSDL_IsScreenKeyboardShown_func(GetProcAddress(LibHandle, 'SDL_IsScreenKeyboardShown')); If Not assigned(SDL_IsScreenKeyboardShown) Then result := false; - SDL_LoadObject := TSDL_LoadObject_fun(GetProcAddress(LibHandle, 'SDL_LoadObject')); + SDL_LoadObject := TSDL_LoadObject_func(GetProcAddress(LibHandle, 'SDL_LoadObject')); If Not assigned(SDL_LoadObject) Then result := false; SDL_UnloadObject := TSDL_UnloadObject_proc(GetProcAddress(LibHandle, 'SDL_UnloadObject')); If Not assigned(SDL_UnloadObject) Then result := false; @@ -419,7 +419,7 @@ Begin If Not assigned(SDL_LogSetAllPriority) Then result := false; SDL_LogSetPriority := TSDL_LogSetPriority_proc(GetProcAddress(LibHandle, 'SDL_LogSetPriority')); If Not assigned(SDL_LogSetPriority) Then result := false; - SDL_LogGetPriority := TSDL_LogGetPriority_fun(GetProcAddress(LibHandle, 'SDL_LogGetPriority')); + SDL_LogGetPriority := TSDL_LogGetPriority_func(GetProcAddress(LibHandle, 'SDL_LogGetPriority')); If Not assigned(SDL_LogGetPriority) Then result := false; SDL_LogResetPriorities := TSDL_LogResetPriorities_proc(GetProcAddress(LibHandle, 'SDL_LogResetPriorities')); If Not assigned(SDL_LogResetPriorities) Then result := false; @@ -441,89 +441,89 @@ Begin If Not assigned(SDL_LogMessage) Then result := false; SDL_LogMessageV := TSDL_LogMessageV_proc(GetProcAddress(LibHandle, 'SDL_LogMessageV')); If Not assigned(SDL_LogMessageV) Then result := false; - SDL_ShowMessageBox := TSDL_ShowMessageBox_fun(GetProcAddress(LibHandle, 'SDL_ShowMessageBox')); + SDL_ShowMessageBox := TSDL_ShowMessageBox_func(GetProcAddress(LibHandle, 'SDL_ShowMessageBox')); If Not assigned(SDL_ShowMessageBox) Then result := false; - SDL_ShowSimpleMessageBox := TSDL_ShowSimpleMessageBox_fun(GetProcAddress(LibHandle, 'SDL_ShowSimpleMessageBox')); + SDL_ShowSimpleMessageBox := TSDL_ShowSimpleMessageBox_func(GetProcAddress(LibHandle, 'SDL_ShowSimpleMessageBox')); If Not assigned(SDL_ShowSimpleMessageBox) Then result := false; - SDL_GetMouseState := TSDL_GetMouseState_fun(GetProcAddress(LibHandle, 'SDL_GetMouseState')); + SDL_GetMouseState := TSDL_GetMouseState_func(GetProcAddress(LibHandle, 'SDL_GetMouseState')); If Not assigned(SDL_GetMouseState) Then result := false; - SDL_GetGlobalMouseState := TSDL_GetGlobalMouseState_fun(GetProcAddress(LibHandle, 'SDL_GetGlobalMouseState')); + SDL_GetGlobalMouseState := TSDL_GetGlobalMouseState_func(GetProcAddress(LibHandle, 'SDL_GetGlobalMouseState')); If Not assigned(SDL_GetGlobalMouseState) Then result := false; - SDL_GetRelativeMouseState := TSDL_GetRelativeMouseState_fun(GetProcAddress(LibHandle, 'SDL_GetRelativeMouseState')); + SDL_GetRelativeMouseState := TSDL_GetRelativeMouseState_func(GetProcAddress(LibHandle, 'SDL_GetRelativeMouseState')); If Not assigned(SDL_GetRelativeMouseState) Then result := false; SDL_WarpMouseInWindow := TSDL_WarpMouseInWindow_proc(GetProcAddress(LibHandle, 'SDL_WarpMouseInWindow')); If Not assigned(SDL_WarpMouseInWindow) Then result := false; - SDL_WarpMouseGlobal := TSDL_WarpMouseGlobal_fun(GetProcAddress(LibHandle, 'SDL_WarpMouseGlobal')); + SDL_WarpMouseGlobal := TSDL_WarpMouseGlobal_func(GetProcAddress(LibHandle, 'SDL_WarpMouseGlobal')); If Not assigned(SDL_WarpMouseGlobal) Then result := false; - SDL_SetRelativeMouseMode := TSDL_SetRelativeMouseMode_fun(GetProcAddress(LibHandle, 'SDL_SetRelativeMouseMode')); + SDL_SetRelativeMouseMode := TSDL_SetRelativeMouseMode_func(GetProcAddress(LibHandle, 'SDL_SetRelativeMouseMode')); If Not assigned(SDL_SetRelativeMouseMode) Then result := false; - SDL_CaptureMouse := TSDL_CaptureMouse_fun(GetProcAddress(LibHandle, 'SDL_CaptureMouse')); + SDL_CaptureMouse := TSDL_CaptureMouse_func(GetProcAddress(LibHandle, 'SDL_CaptureMouse')); If Not assigned(SDL_CaptureMouse) Then result := false; - SDL_CreateCursor := TSDL_CreateCursor_fun(GetProcAddress(LibHandle, 'SDL_CreateCursor')); + SDL_CreateCursor := TSDL_CreateCursor_func(GetProcAddress(LibHandle, 'SDL_CreateCursor')); If Not assigned(SDL_CreateCursor) Then result := false; - SDL_CreateColorCursor := TSDL_CreateColorCursor_fun(GetProcAddress(LibHandle, 'SDL_CreateColorCursor')); + SDL_CreateColorCursor := TSDL_CreateColorCursor_func(GetProcAddress(LibHandle, 'SDL_CreateColorCursor')); If Not assigned(SDL_CreateColorCursor) Then result := false; - SDL_CreateSystemCursor := TSDL_CreateSystemCursor_fun(GetProcAddress(LibHandle, 'SDL_CreateSystemCursor')); + SDL_CreateSystemCursor := TSDL_CreateSystemCursor_func(GetProcAddress(LibHandle, 'SDL_CreateSystemCursor')); If Not assigned(SDL_CreateSystemCursor) Then result := false; SDL_SetCursor := TSDL_SetCursor_proc(GetProcAddress(LibHandle, 'SDL_SetCursor')); If Not assigned(SDL_SetCursor) Then result := false; SDL_FreeCursor := TSDL_FreeCursor_proc(GetProcAddress(LibHandle, 'SDL_FreeCursor')); If Not assigned(SDL_FreeCursor) Then result := false; - SDL_ShowCursor := TSDL_ShowCursor_fun(GetProcAddress(LibHandle, 'SDL_ShowCursor')); + SDL_ShowCursor := TSDL_ShowCursor_func(GetProcAddress(LibHandle, 'SDL_ShowCursor')); If Not assigned(SDL_ShowCursor) Then result := false; - SDL_LockMutex := TSDL_LockMutex_fun(GetProcAddress(LibHandle, 'SDL_LockMutex')); + SDL_LockMutex := TSDL_LockMutex_func(GetProcAddress(LibHandle, 'SDL_LockMutex')); If Not assigned(SDL_LockMutex) Then result := false; - SDL_TryLockMutex := TSDL_TryLockMutex_fun(GetProcAddress(LibHandle, 'SDL_TryLockMutex')); + SDL_TryLockMutex := TSDL_TryLockMutex_func(GetProcAddress(LibHandle, 'SDL_TryLockMutex')); If Not assigned(SDL_TryLockMutex) Then result := false; - SDL_UnlockMutex := TSDL_UnlockMutex_fun(GetProcAddress(LibHandle, 'SDL_UnlockMutex')); + SDL_UnlockMutex := TSDL_UnlockMutex_func(GetProcAddress(LibHandle, 'SDL_UnlockMutex')); If Not assigned(SDL_UnlockMutex) Then result := false; SDL_DestroyMutex := TSDL_DestroyMutex_proc(GetProcAddress(LibHandle, 'SDL_DestroyMutex')); If Not assigned(SDL_DestroyMutex) Then result := false; - SDL_CreateSemaphore := TSDL_CreateSemaphore_fun(GetProcAddress(LibHandle, 'SDL_CreateSemaphore')); + SDL_CreateSemaphore := TSDL_CreateSemaphore_func(GetProcAddress(LibHandle, 'SDL_CreateSemaphore')); If Not assigned(SDL_CreateSemaphore) Then result := false; SDL_DestroySemaphore := TSDL_DestroySemaphore_proc(GetProcAddress(LibHandle, 'SDL_DestroySemaphore')); If Not assigned(SDL_DestroySemaphore) Then result := false; - SDL_SemWait := TSDL_SemWait_fun(GetProcAddress(LibHandle, 'SDL_SemWait')); + SDL_SemWait := TSDL_SemWait_func(GetProcAddress(LibHandle, 'SDL_SemWait')); If Not assigned(SDL_SemWait) Then result := false; - SDL_SemTryWait := TSDL_SemTryWait_fun(GetProcAddress(LibHandle, 'SDL_SemTryWait')); + SDL_SemTryWait := TSDL_SemTryWait_func(GetProcAddress(LibHandle, 'SDL_SemTryWait')); If Not assigned(SDL_SemTryWait) Then result := false; - SDL_SemWaitTimeout := TSDL_SemWaitTimeout_fun(GetProcAddress(LibHandle, 'SDL_SemWaitTimeout')); + SDL_SemWaitTimeout := TSDL_SemWaitTimeout_func(GetProcAddress(LibHandle, 'SDL_SemWaitTimeout')); If Not assigned(SDL_SemWaitTimeout) Then result := false; - SDL_SemPost := TSDL_SemPost_fun(GetProcAddress(LibHandle, 'SDL_SemPost')); + SDL_SemPost := TSDL_SemPost_func(GetProcAddress(LibHandle, 'SDL_SemPost')); If Not assigned(SDL_SemPost) Then result := false; - SDL_SemValue := TSDL_SemValue_fun(GetProcAddress(LibHandle, 'SDL_SemValue')); + SDL_SemValue := TSDL_SemValue_func(GetProcAddress(LibHandle, 'SDL_SemValue')); If Not assigned(SDL_SemValue) Then result := false; SDL_DestroyCond := TSDL_DestroyCond_proc(GetProcAddress(LibHandle, 'SDL_DestroyCond')); If Not assigned(SDL_DestroyCond) Then result := false; - SDL_CondSignal := TSDL_CondSignal_fun(GetProcAddress(LibHandle, 'SDL_CondSignal')); + SDL_CondSignal := TSDL_CondSignal_func(GetProcAddress(LibHandle, 'SDL_CondSignal')); If Not assigned(SDL_CondSignal) Then result := false; - SDL_CondBroadcast := TSDL_CondBroadcast_fun(GetProcAddress(LibHandle, 'SDL_CondBroadcast')); + SDL_CondBroadcast := TSDL_CondBroadcast_func(GetProcAddress(LibHandle, 'SDL_CondBroadcast')); If Not assigned(SDL_CondBroadcast) Then result := false; - SDL_CondWait := TSDL_CondWait_fun(GetProcAddress(LibHandle, 'SDL_CondWait')); + SDL_CondWait := TSDL_CondWait_func(GetProcAddress(LibHandle, 'SDL_CondWait')); If Not assigned(SDL_CondWait) Then result := false; - SDL_CondWaitTimeout := TSDL_CondWaitTimeout_fun(GetProcAddress(LibHandle, 'SDL_CondWaitTimeout')); + SDL_CondWaitTimeout := TSDL_CondWaitTimeout_func(GetProcAddress(LibHandle, 'SDL_CondWaitTimeout')); If Not assigned(SDL_CondWaitTimeout) Then result := false; - SDL_GetPixelFormatName := TSDL_GetPixelFormatName_fun(GetProcAddress(LibHandle, 'SDL_GetPixelFormatName')); + SDL_GetPixelFormatName := TSDL_GetPixelFormatName_func(GetProcAddress(LibHandle, 'SDL_GetPixelFormatName')); If Not assigned(SDL_GetPixelFormatName) Then result := false; - SDL_PixelFormatEnumToMasks := TSDL_PixelFormatEnumToMasks_fun(GetProcAddress(LibHandle, 'SDL_PixelFormatEnumToMasks')); + SDL_PixelFormatEnumToMasks := TSDL_PixelFormatEnumToMasks_func(GetProcAddress(LibHandle, 'SDL_PixelFormatEnumToMasks')); If Not assigned(SDL_PixelFormatEnumToMasks) Then result := false; - SDL_MasksToPixelFormatEnum := TSDL_MasksToPixelFormatEnum_fun(GetProcAddress(LibHandle, 'SDL_MasksToPixelFormatEnum')); + SDL_MasksToPixelFormatEnum := TSDL_MasksToPixelFormatEnum_func(GetProcAddress(LibHandle, 'SDL_MasksToPixelFormatEnum')); If Not assigned(SDL_MasksToPixelFormatEnum) Then result := false; - SDL_AllocFormat := TSDL_AllocFormat_fun(GetProcAddress(LibHandle, 'SDL_AllocFormat')); + SDL_AllocFormat := TSDL_AllocFormat_func(GetProcAddress(LibHandle, 'SDL_AllocFormat')); If Not assigned(SDL_AllocFormat) Then result := false; SDL_FreeFormat := TSDL_FreeFormat_proc(GetProcAddress(LibHandle, 'SDL_FreeFormat')); If Not assigned(SDL_FreeFormat) Then result := false; - SDL_AllocPalette := TSDL_AllocPalette_fun(GetProcAddress(LibHandle, 'SDL_AllocPalette')); + SDL_AllocPalette := TSDL_AllocPalette_func(GetProcAddress(LibHandle, 'SDL_AllocPalette')); If Not assigned(SDL_AllocPalette) Then result := false; - SDL_SetPixelFormatPalette := TSDL_SetPixelFormatPalette_fun(GetProcAddress(LibHandle, 'SDL_SetPixelFormatPalette')); + SDL_SetPixelFormatPalette := TSDL_SetPixelFormatPalette_func(GetProcAddress(LibHandle, 'SDL_SetPixelFormatPalette')); If Not assigned(SDL_SetPixelFormatPalette) Then result := false; - SDL_SetPaletteColors := TSDL_SetPaletteColors_fun(GetProcAddress(LibHandle, 'SDL_SetPaletteColors')); + SDL_SetPaletteColors := TSDL_SetPaletteColors_func(GetProcAddress(LibHandle, 'SDL_SetPaletteColors')); If Not assigned(SDL_SetPaletteColors) Then result := false; SDL_FreePalette := TSDL_FreePalette_proc(GetProcAddress(LibHandle, 'SDL_FreePalette')); If Not assigned(SDL_FreePalette) Then result := false; - SDL_MapRGB := TSDL_MapRGB_fun(GetProcAddress(LibHandle, 'SDL_MapRGB')); + SDL_MapRGB := TSDL_MapRGB_func(GetProcAddress(LibHandle, 'SDL_MapRGB')); If Not assigned(SDL_MapRGB) Then result := false; - SDL_MapRGBA := TSDL_MapRGBA_fun(GetProcAddress(LibHandle, 'SDL_MapRGBA')); + SDL_MapRGBA := TSDL_MapRGBA_func(GetProcAddress(LibHandle, 'SDL_MapRGBA')); If Not assigned(SDL_MapRGBA) Then result := false; SDL_GetRGB := TSDL_GetRGB_proc(GetProcAddress(LibHandle, 'SDL_GetRGB')); If Not assigned(SDL_GetRGB) Then result := false; @@ -531,487 +531,487 @@ Begin If Not assigned(SDL_GetRGBA) Then result := false; SDL_CalculateGammaRamp := TSDL_CalculateGammaRamp_proc(GetProcAddress(LibHandle, 'SDL_CalculateGammaRamp')); If Not assigned(SDL_CalculateGammaRamp) Then result := false; - SDL_GetPowerInfo := TSDL_GetPowerInfo_fun(GetProcAddress(LibHandle, 'SDL_GetPowerInfo')); + SDL_GetPowerInfo := TSDL_GetPowerInfo_func(GetProcAddress(LibHandle, 'SDL_GetPowerInfo')); If Not assigned(SDL_GetPowerInfo) Then result := false; - SDL_HasIntersection := TSDL_HasIntersection_fun(GetProcAddress(LibHandle, 'SDL_HasIntersection')); + SDL_HasIntersection := TSDL_HasIntersection_func(GetProcAddress(LibHandle, 'SDL_HasIntersection')); If Not assigned(SDL_HasIntersection) Then result := false; - SDL_IntersectRect := TSDL_IntersectRect_fun(GetProcAddress(LibHandle, 'SDL_IntersectRect')); + SDL_IntersectRect := TSDL_IntersectRect_func(GetProcAddress(LibHandle, 'SDL_IntersectRect')); If Not assigned(SDL_IntersectRect) Then result := false; SDL_UnionRect := TSDL_UnionRect_proc(GetProcAddress(LibHandle, 'SDL_UnionRect')); If Not assigned(SDL_UnionRect) Then result := false; - SDL_EnclosePoints := TSDL_EnclosePoints_fun(GetProcAddress(LibHandle, 'SDL_EnclosePoints')); + SDL_EnclosePoints := TSDL_EnclosePoints_func(GetProcAddress(LibHandle, 'SDL_EnclosePoints')); If Not assigned(SDL_EnclosePoints) Then result := false; - SDL_IntersectRectAndLine := TSDL_IntersectRectAndLine_fun(GetProcAddress(LibHandle, 'SDL_IntersectRectAndLine')); + SDL_IntersectRectAndLine := TSDL_IntersectRectAndLine_func(GetProcAddress(LibHandle, 'SDL_IntersectRectAndLine')); If Not assigned(SDL_IntersectRectAndLine) Then result := false; - SDL_HasIntersectionF := TSDL_HasIntersectionF_fun(GetProcAddress(LibHandle, 'SDL_HasIntersectionF')); + SDL_HasIntersectionF := TSDL_HasIntersectionF_func(GetProcAddress(LibHandle, 'SDL_HasIntersectionF')); If Not assigned(SDL_HasIntersectionF) Then result := false; - SDL_IntersectFRect := TSDL_IntersectFRect_fun(GetProcAddress(LibHandle, 'SDL_IntersectFRect')); + SDL_IntersectFRect := TSDL_IntersectFRect_func(GetProcAddress(LibHandle, 'SDL_IntersectFRect')); If Not assigned(SDL_IntersectFRect) Then result := false; - SDL_UnionFRect := TSDL_UnionFRect_fun(GetProcAddress(LibHandle, 'SDL_UnionFRect')); + SDL_UnionFRect := TSDL_UnionFRect_func(GetProcAddress(LibHandle, 'SDL_UnionFRect')); If Not assigned(SDL_UnionFRect) Then result := false; - SDL_EncloseFPoints := TSDL_EncloseFPoints_fun(GetProcAddress(LibHandle, 'SDL_EncloseFPoints')); + SDL_EncloseFPoints := TSDL_EncloseFPoints_func(GetProcAddress(LibHandle, 'SDL_EncloseFPoints')); If Not assigned(SDL_EncloseFPoints) Then result := false; - SDL_IntersectFRectAndLine := TSDL_IntersectFRectAndLine_fun(GetProcAddress(LibHandle, 'SDL_IntersectFRectAndLine')); + SDL_IntersectFRectAndLine := TSDL_IntersectFRectAndLine_func(GetProcAddress(LibHandle, 'SDL_IntersectFRectAndLine')); If Not assigned(SDL_IntersectFRectAndLine) Then result := false; - SDL_LockTexture := TSDL_LockTexture_fun(GetProcAddress(LibHandle, 'SDL_LockTexture')); + SDL_LockTexture := TSDL_LockTexture_func(GetProcAddress(LibHandle, 'SDL_LockTexture')); If Not assigned(SDL_LockTexture) Then result := false; - SDL_LockTextureToSurface := TSDL_LockTextureToSurface_fun(GetProcAddress(LibHandle, 'SDL_LockTextureToSurface')); + SDL_LockTextureToSurface := TSDL_LockTextureToSurface_func(GetProcAddress(LibHandle, 'SDL_LockTextureToSurface')); If Not assigned(SDL_LockTextureToSurface) Then result := false; - SDL_RenderIsClipEnabled := TSDL_RenderIsClipEnabled_fun(GetProcAddress(LibHandle, 'SDL_RenderIsClipEnabled')); + SDL_RenderIsClipEnabled := TSDL_RenderIsClipEnabled_func(GetProcAddress(LibHandle, 'SDL_RenderIsClipEnabled')); If Not assigned(SDL_RenderIsClipEnabled) Then result := false; - SDL_RenderDrawPointF := TSDL_RenderDrawPointF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawPointF')); + SDL_RenderDrawPointF := TSDL_RenderDrawPointF_func(GetProcAddress(LibHandle, 'SDL_RenderDrawPointF')); If Not assigned(SDL_RenderDrawPointF) Then result := false; - SDL_RenderDrawPointsF := TSDL_RenderDrawPointsF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawPointsF')); + SDL_RenderDrawPointsF := TSDL_RenderDrawPointsF_func(GetProcAddress(LibHandle, 'SDL_RenderDrawPointsF')); If Not assigned(SDL_RenderDrawPointsF) Then result := false; - SDL_RenderDrawLineF := TSDL_RenderDrawLineF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawLineF')); + SDL_RenderDrawLineF := TSDL_RenderDrawLineF_func(GetProcAddress(LibHandle, 'SDL_RenderDrawLineF')); If Not assigned(SDL_RenderDrawLineF) Then result := false; - SDL_RenderDrawLinesF := TSDL_RenderDrawLinesF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawLinesF')); + SDL_RenderDrawLinesF := TSDL_RenderDrawLinesF_func(GetProcAddress(LibHandle, 'SDL_RenderDrawLinesF')); If Not assigned(SDL_RenderDrawLinesF) Then result := false; - SDL_RenderDrawRectF := TSDL_RenderDrawRectF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawRectF')); + SDL_RenderDrawRectF := TSDL_RenderDrawRectF_func(GetProcAddress(LibHandle, 'SDL_RenderDrawRectF')); If Not assigned(SDL_RenderDrawRectF) Then result := false; - SDL_RenderDrawRectsF := TSDL_RenderDrawRectsF_fun(GetProcAddress(LibHandle, 'SDL_RenderDrawRectsF')); + SDL_RenderDrawRectsF := TSDL_RenderDrawRectsF_func(GetProcAddress(LibHandle, 'SDL_RenderDrawRectsF')); If Not assigned(SDL_RenderDrawRectsF) Then result := false; - SDL_RenderFillRectF := TSDL_RenderFillRectF_fun(GetProcAddress(LibHandle, 'SDL_RenderFillRectF')); + SDL_RenderFillRectF := TSDL_RenderFillRectF_func(GetProcAddress(LibHandle, 'SDL_RenderFillRectF')); If Not assigned(SDL_RenderFillRectF) Then result := false; - SDL_RenderFillRectsF := TSDL_RenderFillRectsF_fun(GetProcAddress(LibHandle, 'SDL_RenderFillRectsF')); + SDL_RenderFillRectsF := TSDL_RenderFillRectsF_func(GetProcAddress(LibHandle, 'SDL_RenderFillRectsF')); If Not assigned(SDL_RenderFillRectsF) Then result := false; - SDL_RenderCopyF := TSDL_RenderCopyF_fun(GetProcAddress(LibHandle, 'SDL_RenderCopyF')); + SDL_RenderCopyF := TSDL_RenderCopyF_func(GetProcAddress(LibHandle, 'SDL_RenderCopyF')); If Not assigned(SDL_RenderCopyF) Then result := false; - SDL_RenderCopyExF := TSDL_RenderCopyExF_fun(GetProcAddress(LibHandle, 'SDL_RenderCopyExF')); + SDL_RenderCopyExF := TSDL_RenderCopyExF_func(GetProcAddress(LibHandle, 'SDL_RenderCopyExF')); If Not assigned(SDL_RenderCopyExF) Then result := false; - SDL_RenderGetMetalLayer := TSDL_RenderGetMetalLayer_fun(GetProcAddress(LibHandle, 'SDL_RenderGetMetalLayer')); + SDL_RenderGetMetalLayer := TSDL_RenderGetMetalLayer_func(GetProcAddress(LibHandle, 'SDL_RenderGetMetalLayer')); If Not assigned(SDL_RenderGetMetalLayer) Then result := false; - SDL_RenderGetMetalCommandEncoder := TSDL_RenderGetMetalCommandEncoder_fun(GetProcAddress(LibHandle, 'SDL_RenderGetMetalCommandEncoder')); + SDL_RenderGetMetalCommandEncoder := TSDL_RenderGetMetalCommandEncoder_func(GetProcAddress(LibHandle, 'SDL_RenderGetMetalCommandEncoder')); If Not assigned(SDL_RenderGetMetalCommandEncoder) Then result := false; - SDL_UpdateYUVTexture := TSDL_UpdateYUVTexture_fun(GetProcAddress(LibHandle, 'SDL_UpdateYUVTexture')); + SDL_UpdateYUVTexture := TSDL_UpdateYUVTexture_func(GetProcAddress(LibHandle, 'SDL_UpdateYUVTexture')); If Not assigned(SDL_UpdateYUVTexture) Then result := false; - SDL_RWFromFile := TSDL_RWFromFile_fun(GetProcAddress(LibHandle, 'SDL_RWFromFile')); + SDL_RWFromFile := TSDL_RWFromFile_func(GetProcAddress(LibHandle, 'SDL_RWFromFile')); If Not assigned(SDL_RWFromFile) Then result := false; - SDL_RWFromFP := TSDL_RWFromFP_fun(GetProcAddress(LibHandle, 'SDL_RWFromFP')); + SDL_RWFromFP := TSDL_RWFromFP_func(GetProcAddress(LibHandle, 'SDL_RWFromFP')); If Not assigned(SDL_RWFromFP) Then result := false; - SDL_RWFromMem := TSDL_RWFromMem_fun(GetProcAddress(LibHandle, 'SDL_RWFromMem')); + SDL_RWFromMem := TSDL_RWFromMem_func(GetProcAddress(LibHandle, 'SDL_RWFromMem')); If Not assigned(SDL_RWFromMem) Then result := false; - SDL_RWFromConstMem := TSDL_RWFromConstMem_fun(GetProcAddress(LibHandle, 'SDL_RWFromConstMem')); + SDL_RWFromConstMem := TSDL_RWFromConstMem_func(GetProcAddress(LibHandle, 'SDL_RWFromConstMem')); If Not assigned(SDL_RWFromConstMem) Then result := false; SDL_FreeRW := TSDL_FreeRW_proc(GetProcAddress(LibHandle, 'SDL_FreeRW')); If Not assigned(SDL_FreeRW) Then result := false; - SDL_RWsize := TSDL_RWsize_fun(GetProcAddress(LibHandle, 'SDL_RWsize')); + SDL_RWsize := TSDL_RWsize_func(GetProcAddress(LibHandle, 'SDL_RWsize')); If Not assigned(SDL_RWsize) Then result := false; - SDL_RWseek := TSDL_RWseek_fun(GetProcAddress(LibHandle, 'SDL_RWseek')); + SDL_RWseek := TSDL_RWseek_func(GetProcAddress(LibHandle, 'SDL_RWseek')); If Not assigned(SDL_RWseek) Then result := false; - SDL_RWtell := TSDL_RWtell_fun(GetProcAddress(LibHandle, 'SDL_RWtell')); + SDL_RWtell := TSDL_RWtell_func(GetProcAddress(LibHandle, 'SDL_RWtell')); If Not assigned(SDL_RWtell) Then result := false; - SDL_RWread := TSDL_RWread_fun(GetProcAddress(LibHandle, 'SDL_RWread')); + SDL_RWread := TSDL_RWread_func(GetProcAddress(LibHandle, 'SDL_RWread')); If Not assigned(SDL_RWread) Then result := false; - SDL_RWwrite := TSDL_RWwrite_fun(GetProcAddress(LibHandle, 'SDL_RWwrite')); + SDL_RWwrite := TSDL_RWwrite_func(GetProcAddress(LibHandle, 'SDL_RWwrite')); If Not assigned(SDL_RWwrite) Then result := false; - SDL_RWclose := TSDL_RWclose_fun(GetProcAddress(LibHandle, 'SDL_RWclose')); + SDL_RWclose := TSDL_RWclose_func(GetProcAddress(LibHandle, 'SDL_RWclose')); If Not assigned(SDL_RWclose) Then result := false; - SDL_LoadFile_RW := TSDL_LoadFile_RW_fun(GetProcAddress(LibHandle, 'SDL_LoadFile_RW')); + SDL_LoadFile_RW := TSDL_LoadFile_RW_func(GetProcAddress(LibHandle, 'SDL_LoadFile_RW')); If Not assigned(SDL_LoadFile_RW) Then result := false; - SDL_LoadFile := TSDL_LoadFile_fun(GetProcAddress(LibHandle, 'SDL_LoadFile')); + SDL_LoadFile := TSDL_LoadFile_func(GetProcAddress(LibHandle, 'SDL_LoadFile')); If Not assigned(SDL_LoadFile) Then result := false; - SDL_ReadU8 := TSDL_ReadU8_fun(GetProcAddress(LibHandle, 'SDL_ReadU8')); + SDL_ReadU8 := TSDL_ReadU8_func(GetProcAddress(LibHandle, 'SDL_ReadU8')); If Not assigned(SDL_ReadU8) Then result := false; - SDL_ReadLE16 := TSDL_ReadLE16_fun(GetProcAddress(LibHandle, 'SDL_ReadLE16')); + SDL_ReadLE16 := TSDL_ReadLE16_func(GetProcAddress(LibHandle, 'SDL_ReadLE16')); If Not assigned(SDL_ReadLE16) Then result := false; - SDL_ReadBE16 := TSDL_ReadBE16_fun(GetProcAddress(LibHandle, 'SDL_ReadBE16')); + SDL_ReadBE16 := TSDL_ReadBE16_func(GetProcAddress(LibHandle, 'SDL_ReadBE16')); If Not assigned(SDL_ReadBE16) Then result := false; - SDL_ReadLE32 := TSDL_ReadLE32_fun(GetProcAddress(LibHandle, 'SDL_ReadLE32')); + SDL_ReadLE32 := TSDL_ReadLE32_func(GetProcAddress(LibHandle, 'SDL_ReadLE32')); If Not assigned(SDL_ReadLE32) Then result := false; - SDL_ReadBE32 := TSDL_ReadBE32_fun(GetProcAddress(LibHandle, 'SDL_ReadBE32')); + SDL_ReadBE32 := TSDL_ReadBE32_func(GetProcAddress(LibHandle, 'SDL_ReadBE32')); If Not assigned(SDL_ReadBE32) Then result := false; - SDL_ReadLE64 := TSDL_ReadLE64_fun(GetProcAddress(LibHandle, 'SDL_ReadLE64')); + SDL_ReadLE64 := TSDL_ReadLE64_func(GetProcAddress(LibHandle, 'SDL_ReadLE64')); If Not assigned(SDL_ReadLE64) Then result := false; - SDL_ReadBE64 := TSDL_ReadBE64_fun(GetProcAddress(LibHandle, 'SDL_ReadBE64')); + SDL_ReadBE64 := TSDL_ReadBE64_func(GetProcAddress(LibHandle, 'SDL_ReadBE64')); If Not assigned(SDL_ReadBE64) Then result := false; - SDL_WriteU8 := TSDL_WriteU8_fun(GetProcAddress(LibHandle, 'SDL_WriteU8')); + SDL_WriteU8 := TSDL_WriteU8_func(GetProcAddress(LibHandle, 'SDL_WriteU8')); If Not assigned(SDL_WriteU8) Then result := false; - SDL_WriteLE16 := TSDL_WriteLE16_fun(GetProcAddress(LibHandle, 'SDL_WriteLE16')); + SDL_WriteLE16 := TSDL_WriteLE16_func(GetProcAddress(LibHandle, 'SDL_WriteLE16')); If Not assigned(SDL_WriteLE16) Then result := false; - SDL_WriteBE16 := TSDL_WriteBE16_fun(GetProcAddress(LibHandle, 'SDL_WriteBE16')); + SDL_WriteBE16 := TSDL_WriteBE16_func(GetProcAddress(LibHandle, 'SDL_WriteBE16')); If Not assigned(SDL_WriteBE16) Then result := false; - SDL_WriteLE32 := TSDL_WriteLE32_fun(GetProcAddress(LibHandle, 'SDL_WriteLE32')); + SDL_WriteLE32 := TSDL_WriteLE32_func(GetProcAddress(LibHandle, 'SDL_WriteLE32')); If Not assigned(SDL_WriteLE32) Then result := false; - SDL_WriteBE32 := TSDL_WriteBE32_fun(GetProcAddress(LibHandle, 'SDL_WriteBE32')); + SDL_WriteBE32 := TSDL_WriteBE32_func(GetProcAddress(LibHandle, 'SDL_WriteBE32')); If Not assigned(SDL_WriteBE32) Then result := false; - SDL_WriteLE64 := TSDL_WriteLE64_fun(GetProcAddress(LibHandle, 'SDL_WriteLE64')); + SDL_WriteLE64 := TSDL_WriteLE64_func(GetProcAddress(LibHandle, 'SDL_WriteLE64')); If Not assigned(SDL_WriteLE64) Then result := false; - SDL_WriteBE64 := TSDL_WriteBE64_fun(GetProcAddress(LibHandle, 'SDL_WriteBE64')); + SDL_WriteBE64 := TSDL_WriteBE64_func(GetProcAddress(LibHandle, 'SDL_WriteBE64')); If Not assigned(SDL_WriteBE64) Then result := false; - SDL_CreateShapedWindow := TSDL_CreateShapedWindow_fun(GetProcAddress(LibHandle, 'SDL_CreateShapedWindow')); + SDL_CreateShapedWindow := TSDL_CreateShapedWindow_func(GetProcAddress(LibHandle, 'SDL_CreateShapedWindow')); If Not assigned(SDL_CreateShapedWindow) Then result := false; - SDL_IsShapedWindow := TSDL_IsShapedWindow_fun(GetProcAddress(LibHandle, 'SDL_IsShapedWindow')); + SDL_IsShapedWindow := TSDL_IsShapedWindow_func(GetProcAddress(LibHandle, 'SDL_IsShapedWindow')); If Not assigned(SDL_IsShapedWindow) Then result := false; - SDL_SetWindowShape := TSDL_SetWindowShape_fun(GetProcAddress(LibHandle, 'SDL_SetWindowShape')); + SDL_SetWindowShape := TSDL_SetWindowShape_func(GetProcAddress(LibHandle, 'SDL_SetWindowShape')); If Not assigned(SDL_SetWindowShape) Then result := false; - SDL_GetShapedWindowMode := TSDL_GetShapedWindowMode_fun(GetProcAddress(LibHandle, 'SDL_GetShapedWindowMode')); + SDL_GetShapedWindowMode := TSDL_GetShapedWindowMode_func(GetProcAddress(LibHandle, 'SDL_GetShapedWindowMode')); If Not assigned(SDL_GetShapedWindowMode) Then result := false; - SDL_GetNumAllocations := TSDL_GetNumAllocations_fun(GetProcAddress(LibHandle, 'SDL_GetNumAllocations')); + SDL_GetNumAllocations := TSDL_GetNumAllocations_func(GetProcAddress(LibHandle, 'SDL_GetNumAllocations')); If Not assigned(SDL_GetNumAllocations) Then result := false; - SDL_malloc := TSDL_malloc_fun(GetProcAddress(LibHandle, 'SDL_malloc')); + SDL_malloc := TSDL_malloc_func(GetProcAddress(LibHandle, 'SDL_malloc')); If Not assigned(SDL_malloc) Then result := false; - SDL_calloc := TSDL_calloc_fun(GetProcAddress(LibHandle, 'SDL_calloc')); + SDL_calloc := TSDL_calloc_func(GetProcAddress(LibHandle, 'SDL_calloc')); If Not assigned(SDL_calloc) Then result := false; - SDL_realloc := TSDL_realloc_fun(GetProcAddress(LibHandle, 'SDL_realloc')); + SDL_realloc := TSDL_realloc_func(GetProcAddress(LibHandle, 'SDL_realloc')); If Not assigned(SDL_realloc) Then result := false; SDL_free := TSDL_free_proc(GetProcAddress(LibHandle, 'SDL_free')); If Not assigned(SDL_free) Then result := false; - SDL_isalpha := TSDL_isalpha_fun(GetProcAddress(LibHandle, 'SDL_isalpha')); + SDL_isalpha := TSDL_isalpha_func(GetProcAddress(LibHandle, 'SDL_isalpha')); If Not assigned(SDL_isalpha) Then result := false; - SDL_isalnum := TSDL_isalnum_fun(GetProcAddress(LibHandle, 'SDL_isalnum')); + SDL_isalnum := TSDL_isalnum_func(GetProcAddress(LibHandle, 'SDL_isalnum')); If Not assigned(SDL_isalnum) Then result := false; - SDL_isblank := TSDL_isblank_fun(GetProcAddress(LibHandle, 'SDL_isblank')); + SDL_isblank := TSDL_isblank_func(GetProcAddress(LibHandle, 'SDL_isblank')); If Not assigned(SDL_isblank) Then result := false; - SDL_iscntrl := TSDL_iscntrl_fun(GetProcAddress(LibHandle, 'SDL_iscntrl')); + SDL_iscntrl := TSDL_iscntrl_func(GetProcAddress(LibHandle, 'SDL_iscntrl')); If Not assigned(SDL_iscntrl) Then result := false; - SDL_isdigit := TSDL_isdigit_fun(GetProcAddress(LibHandle, 'SDL_isdigit')); + SDL_isdigit := TSDL_isdigit_func(GetProcAddress(LibHandle, 'SDL_isdigit')); If Not assigned(SDL_isdigit) Then result := false; - SDL_isxdigit := TSDL_isxdigit_fun(GetProcAddress(LibHandle, 'SDL_isxdigit')); + SDL_isxdigit := TSDL_isxdigit_func(GetProcAddress(LibHandle, 'SDL_isxdigit')); If Not assigned(SDL_isxdigit) Then result := false; - SDL_ispunct := TSDL_ispunct_fun(GetProcAddress(LibHandle, 'SDL_ispunct')); + SDL_ispunct := TSDL_ispunct_func(GetProcAddress(LibHandle, 'SDL_ispunct')); If Not assigned(SDL_ispunct) Then result := false; - SDL_isspace := TSDL_isspace_fun(GetProcAddress(LibHandle, 'SDL_isspace')); + SDL_isspace := TSDL_isspace_func(GetProcAddress(LibHandle, 'SDL_isspace')); If Not assigned(SDL_isspace) Then result := false; - SDL_isupper := TSDL_isupper_fun(GetProcAddress(LibHandle, 'SDL_isupper')); + SDL_isupper := TSDL_isupper_func(GetProcAddress(LibHandle, 'SDL_isupper')); If Not assigned(SDL_isupper) Then result := false; - SDL_islower := TSDL_islower_fun(GetProcAddress(LibHandle, 'SDL_islower')); + SDL_islower := TSDL_islower_func(GetProcAddress(LibHandle, 'SDL_islower')); If Not assigned(SDL_islower) Then result := false; - SDL_isprint := TSDL_isprint_fun(GetProcAddress(LibHandle, 'SDL_isprint')); + SDL_isprint := TSDL_isprint_func(GetProcAddress(LibHandle, 'SDL_isprint')); If Not assigned(SDL_isprint) Then result := false; - SDL_isgraph := TSDL_isgraph_fun(GetProcAddress(LibHandle, 'SDL_isgraph')); + SDL_isgraph := TSDL_isgraph_func(GetProcAddress(LibHandle, 'SDL_isgraph')); If Not assigned(SDL_isgraph) Then result := false; - SDL_toupper := TSDL_toupper_fun(GetProcAddress(LibHandle, 'SDL_toupper')); + SDL_toupper := TSDL_toupper_func(GetProcAddress(LibHandle, 'SDL_toupper')); If Not assigned(SDL_toupper) Then result := false; - SDL_tolower := TSDL_tolower_fun(GetProcAddress(LibHandle, 'SDL_tolower')); + SDL_tolower := TSDL_tolower_func(GetProcAddress(LibHandle, 'SDL_tolower')); If Not assigned(SDL_tolower) Then result := false; - SDL_acos := TSDL_acos_fun(GetProcAddress(LibHandle, 'SDL_acos')); + SDL_acos := TSDL_acos_func(GetProcAddress(LibHandle, 'SDL_acos')); If Not assigned(SDL_acos) Then result := false; - SDL_acosf := TSDL_acosf_fun(GetProcAddress(LibHandle, 'SDL_acosf')); + SDL_acosf := TSDL_acosf_func(GetProcAddress(LibHandle, 'SDL_acosf')); If Not assigned(SDL_acosf) Then result := false; - SDL_asin := TSDL_asin_fun(GetProcAddress(LibHandle, 'SDL_asin')); + SDL_asin := TSDL_asin_func(GetProcAddress(LibHandle, 'SDL_asin')); If Not assigned(SDL_asin) Then result := false; - SDL_asinf := TSDL_asinf_fun(GetProcAddress(LibHandle, 'SDL_asinf')); + SDL_asinf := TSDL_asinf_func(GetProcAddress(LibHandle, 'SDL_asinf')); If Not assigned(SDL_asinf) Then result := false; - SDL_atan := TSDL_atan_fun(GetProcAddress(LibHandle, 'SDL_atan')); + SDL_atan := TSDL_atan_func(GetProcAddress(LibHandle, 'SDL_atan')); If Not assigned(SDL_atan) Then result := false; - SDL_atanf := TSDL_atanf_fun(GetProcAddress(LibHandle, 'SDL_atanf')); + SDL_atanf := TSDL_atanf_func(GetProcAddress(LibHandle, 'SDL_atanf')); If Not assigned(SDL_atanf) Then result := false; - SDL_atan2 := TSDL_atan2_fun(GetProcAddress(LibHandle, 'SDL_atan2')); + SDL_atan2 := TSDL_atan2_func(GetProcAddress(LibHandle, 'SDL_atan2')); If Not assigned(SDL_atan2) Then result := false; - SDL_atan2f := TSDL_atan2f_fun(GetProcAddress(LibHandle, 'SDL_atan2f')); + SDL_atan2f := TSDL_atan2f_func(GetProcAddress(LibHandle, 'SDL_atan2f')); If Not assigned(SDL_atan2f) Then result := false; - SDL_ceil := TSDL_ceil_fun(GetProcAddress(LibHandle, 'SDL_ceil')); + SDL_ceil := TSDL_ceil_func(GetProcAddress(LibHandle, 'SDL_ceil')); If Not assigned(SDL_ceil) Then result := false; - SDL_ceilf := TSDL_ceilf_fun(GetProcAddress(LibHandle, 'SDL_ceilf')); + SDL_ceilf := TSDL_ceilf_func(GetProcAddress(LibHandle, 'SDL_ceilf')); If Not assigned(SDL_ceilf) Then result := false; - SDL_copysign := TSDL_copysign_fun(GetProcAddress(LibHandle, 'SDL_copysign')); + SDL_copysign := TSDL_copysign_func(GetProcAddress(LibHandle, 'SDL_copysign')); If Not assigned(SDL_copysign) Then result := false; - SDL_copysignf := TSDL_copysignf_fun(GetProcAddress(LibHandle, 'SDL_copysignf')); + SDL_copysignf := TSDL_copysignf_func(GetProcAddress(LibHandle, 'SDL_copysignf')); If Not assigned(SDL_copysignf) Then result := false; - SDL_cos := TSDL_cos_fun(GetProcAddress(LibHandle, 'SDL_cos')); + SDL_cos := TSDL_cos_func(GetProcAddress(LibHandle, 'SDL_cos')); If Not assigned(SDL_cos) Then result := false; - SDL_cosf := TSDL_cosf_fun(GetProcAddress(LibHandle, 'SDL_cosf')); + SDL_cosf := TSDL_cosf_func(GetProcAddress(LibHandle, 'SDL_cosf')); If Not assigned(SDL_cosf) Then result := false; - SDL_exp := TSDL_exp_fun(GetProcAddress(LibHandle, 'SDL_exp')); + SDL_exp := TSDL_exp_func(GetProcAddress(LibHandle, 'SDL_exp')); If Not assigned(SDL_exp) Then result := false; - SDL_expf := TSDL_expf_fun(GetProcAddress(LibHandle, 'SDL_expf')); + SDL_expf := TSDL_expf_func(GetProcAddress(LibHandle, 'SDL_expf')); If Not assigned(SDL_expf) Then result := false; - SDL_fabs := TSDL_fabs_fun(GetProcAddress(LibHandle, 'SDL_fabs')); + SDL_fabs := TSDL_fabs_func(GetProcAddress(LibHandle, 'SDL_fabs')); If Not assigned(SDL_fabs) Then result := false; - SDL_fabsf := TSDL_fabsf_fun(GetProcAddress(LibHandle, 'SDL_fabsf')); + SDL_fabsf := TSDL_fabsf_func(GetProcAddress(LibHandle, 'SDL_fabsf')); If Not assigned(SDL_fabsf) Then result := false; - SDL_floor := TSDL_floor_fun(GetProcAddress(LibHandle, 'SDL_floor')); + SDL_floor := TSDL_floor_func(GetProcAddress(LibHandle, 'SDL_floor')); If Not assigned(SDL_floor) Then result := false; - SDL_floorf := TSDL_floorf_fun(GetProcAddress(LibHandle, 'SDL_floorf')); + SDL_floorf := TSDL_floorf_func(GetProcAddress(LibHandle, 'SDL_floorf')); If Not assigned(SDL_floorf) Then result := false; - SDL_fmod := TSDL_fmod_fun(GetProcAddress(LibHandle, 'SDL_fmod')); + SDL_fmod := TSDL_fmod_func(GetProcAddress(LibHandle, 'SDL_fmod')); If Not assigned(SDL_fmod) Then result := false; - SDL_fmodf := TSDL_fmodf_fun(GetProcAddress(LibHandle, 'SDL_fmodf')); + SDL_fmodf := TSDL_fmodf_func(GetProcAddress(LibHandle, 'SDL_fmodf')); If Not assigned(SDL_fmodf) Then result := false; - SDL_nlog := TSDL_nlog_fun(GetProcAddress(LibHandle, 'SDL_nlog')); + SDL_nlog := TSDL_nlog_func(GetProcAddress(LibHandle, 'SDL_nlog')); If Not assigned(SDL_nlog) Then result := false; - SDL_nlogf := TSDL_nlogf_fun(GetProcAddress(LibHandle, 'SDL_nlogf')); + SDL_nlogf := TSDL_nlogf_func(GetProcAddress(LibHandle, 'SDL_nlogf')); If Not assigned(SDL_nlogf) Then result := false; - SDL_log10 := TSDL_log10_fun(GetProcAddress(LibHandle, 'SDL_log10')); + SDL_log10 := TSDL_log10_func(GetProcAddress(LibHandle, 'SDL_log10')); If Not assigned(SDL_log10) Then result := false; - SDL_log10f := TSDL_log10f_fun(GetProcAddress(LibHandle, 'SDL_log10f')); + SDL_log10f := TSDL_log10f_func(GetProcAddress(LibHandle, 'SDL_log10f')); If Not assigned(SDL_log10f) Then result := false; - SDL_lround := TSDL_lround_fun(GetProcAddress(LibHandle, 'SDL_lround')); + SDL_lround := TSDL_lround_func(GetProcAddress(LibHandle, 'SDL_lround')); If Not assigned(SDL_lround) Then result := false; - SDL_lroundf := TSDL_lroundf_fun(GetProcAddress(LibHandle, 'SDL_lroundf')); + SDL_lroundf := TSDL_lroundf_func(GetProcAddress(LibHandle, 'SDL_lroundf')); If Not assigned(SDL_lroundf) Then result := false; - SDL_pow := TSDL_pow_fun(GetProcAddress(LibHandle, 'SDL_pow')); + SDL_pow := TSDL_pow_func(GetProcAddress(LibHandle, 'SDL_pow')); If Not assigned(SDL_pow) Then result := false; - SDL_powf := TSDL_powf_fun(GetProcAddress(LibHandle, 'SDL_powf')); + SDL_powf := TSDL_powf_func(GetProcAddress(LibHandle, 'SDL_powf')); If Not assigned(SDL_powf) Then result := false; - SDL_round := TSDL_round_fun(GetProcAddress(LibHandle, 'SDL_round')); + SDL_round := TSDL_round_func(GetProcAddress(LibHandle, 'SDL_round')); If Not assigned(SDL_round) Then result := false; - SDL_roundf := TSDL_roundf_fun(GetProcAddress(LibHandle, 'SDL_roundf')); + SDL_roundf := TSDL_roundf_func(GetProcAddress(LibHandle, 'SDL_roundf')); If Not assigned(SDL_roundf) Then result := false; - SDL_scalbn := TSDL_scalbn_fun(GetProcAddress(LibHandle, 'SDL_scalbn')); + SDL_scalbn := TSDL_scalbn_func(GetProcAddress(LibHandle, 'SDL_scalbn')); If Not assigned(SDL_scalbn) Then result := false; - SDL_scalbnf := TSDL_scalbnf_fun(GetProcAddress(LibHandle, 'SDL_scalbnf')); + SDL_scalbnf := TSDL_scalbnf_func(GetProcAddress(LibHandle, 'SDL_scalbnf')); If Not assigned(SDL_scalbnf) Then result := false; - SDL_sin := TSDL_sin_fun(GetProcAddress(LibHandle, 'SDL_sin')); + SDL_sin := TSDL_sin_func(GetProcAddress(LibHandle, 'SDL_sin')); If Not assigned(SDL_sin) Then result := false; - SDL_sinf := TSDL_sinf_fun(GetProcAddress(LibHandle, 'SDL_sinf')); + SDL_sinf := TSDL_sinf_func(GetProcAddress(LibHandle, 'SDL_sinf')); If Not assigned(SDL_sinf) Then result := false; - SDL_sqrt := TSDL_sqrt_fun(GetProcAddress(LibHandle, 'SDL_sqrt')); + SDL_sqrt := TSDL_sqrt_func(GetProcAddress(LibHandle, 'SDL_sqrt')); If Not assigned(SDL_sqrt) Then result := false; - SDL_sqrtf := TSDL_sqrtf_fun(GetProcAddress(LibHandle, 'SDL_sqrtf')); + SDL_sqrtf := TSDL_sqrtf_func(GetProcAddress(LibHandle, 'SDL_sqrtf')); If Not assigned(SDL_sqrtf) Then result := false; - SDL_tan := TSDL_tan_fun(GetProcAddress(LibHandle, 'SDL_tan')); + SDL_tan := TSDL_tan_func(GetProcAddress(LibHandle, 'SDL_tan')); If Not assigned(SDL_tan) Then result := false; - SDL_tanf := TSDL_tanf_fun(GetProcAddress(LibHandle, 'SDL_tanf')); + SDL_tanf := TSDL_tanf_func(GetProcAddress(LibHandle, 'SDL_tanf')); If Not assigned(SDL_tanf) Then result := false; - SDL_trunc := TSDL_trunc_fun(GetProcAddress(LibHandle, 'SDL_trunc')); + SDL_trunc := TSDL_trunc_func(GetProcAddress(LibHandle, 'SDL_trunc')); If Not assigned(SDL_trunc) Then result := false; - SDL_truncf := TSDL_truncf_fun(GetProcAddress(LibHandle, 'SDL_truncf')); + SDL_truncf := TSDL_truncf_func(GetProcAddress(LibHandle, 'SDL_truncf')); If Not assigned(SDL_truncf) Then result := false; - SDL_iconv_string := TSDL_iconv_string_fun(GetProcAddress(LibHandle, 'SDL_iconv_string')); + SDL_iconv_string := TSDL_iconv_string_func(GetProcAddress(LibHandle, 'SDL_iconv_string')); If Not assigned(SDL_iconv_string) Then result := false; - SDL_iconv_open := TSDL_iconv_open_fun(GetProcAddress(LibHandle, 'SDL_iconv_open')); + SDL_iconv_open := TSDL_iconv_open_func(GetProcAddress(LibHandle, 'SDL_iconv_open')); If Not assigned(SDL_iconv_open) Then result := false; - SDL_iconv_close := TSDL_iconv_close_fun(GetProcAddress(LibHandle, 'SDL_iconv_close')); + SDL_iconv_close := TSDL_iconv_close_func(GetProcAddress(LibHandle, 'SDL_iconv_close')); If Not assigned(SDL_iconv_close) Then result := false; - SDL_iconv := TSDL_iconv_fun(GetProcAddress(LibHandle, 'SDL_iconv')); + SDL_iconv := TSDL_iconv_func(GetProcAddress(LibHandle, 'SDL_iconv')); If Not assigned(SDL_iconv) Then result := false; - SDL_CreateRGBSurface := TSDL_CreateRGBSurface_fun(GetProcAddress(LibHandle, 'SDL_CreateRGBSurface')); + SDL_CreateRGBSurface := TSDL_CreateRGBSurface_func(GetProcAddress(LibHandle, 'SDL_CreateRGBSurface')); If Not assigned(SDL_CreateRGBSurface) Then result := false; - SDL_CreateRGBSurfaceWithFormat := TSDL_CreateRGBSurfaceWithFormat_fun(GetProcAddress(LibHandle, 'SDL_CreateRGBSurfaceWithFormat')); + SDL_CreateRGBSurfaceWithFormat := TSDL_CreateRGBSurfaceWithFormat_func(GetProcAddress(LibHandle, 'SDL_CreateRGBSurfaceWithFormat')); If Not assigned(SDL_CreateRGBSurfaceWithFormat) Then result := false; - SDL_CreateRGBSurfaceFrom := TSDL_CreateRGBSurfaceFrom_fun(GetProcAddress(LibHandle, 'SDL_CreateRGBSurfaceFrom')); + SDL_CreateRGBSurfaceFrom := TSDL_CreateRGBSurfaceFrom_func(GetProcAddress(LibHandle, 'SDL_CreateRGBSurfaceFrom')); If Not assigned(SDL_CreateRGBSurfaceFrom) Then result := false; - SDL_CreateRGBSurfaceWithFormatFrom := TSDL_CreateRGBSurfaceWithFormatFrom_fun(GetProcAddress(LibHandle, 'SDL_CreateRGBSurfaceWithFormatFrom')); + SDL_CreateRGBSurfaceWithFormatFrom := TSDL_CreateRGBSurfaceWithFormatFrom_func(GetProcAddress(LibHandle, 'SDL_CreateRGBSurfaceWithFormatFrom')); If Not assigned(SDL_CreateRGBSurfaceWithFormatFrom) Then result := false; SDL_FreeSurface := TSDL_FreeSurface_proc(GetProcAddress(LibHandle, 'SDL_FreeSurface')); If Not assigned(SDL_FreeSurface) Then result := false; - SDL_SetSurfacePalette := TSDL_SetSurfacePalette_fun(GetProcAddress(LibHandle, 'SDL_SetSurfacePalette')); + SDL_SetSurfacePalette := TSDL_SetSurfacePalette_func(GetProcAddress(LibHandle, 'SDL_SetSurfacePalette')); If Not assigned(SDL_SetSurfacePalette) Then result := false; - SDL_LockSurface := TSDL_LockSurface_fun(GetProcAddress(LibHandle, 'SDL_LockSurface')); + SDL_LockSurface := TSDL_LockSurface_func(GetProcAddress(LibHandle, 'SDL_LockSurface')); If Not assigned(SDL_LockSurface) Then result := false; SDL_UnlockSurface := TSDL_UnlockSurface_proc(GetProcAddress(LibHandle, 'SDL_UnlockSurface')); If Not assigned(SDL_UnlockSurface) Then result := false; - SDL_LoadBMP_RW := TSDL_LoadBMP_RW_fun(GetProcAddress(LibHandle, 'SDL_LoadBMP_RW')); + SDL_LoadBMP_RW := TSDL_LoadBMP_RW_func(GetProcAddress(LibHandle, 'SDL_LoadBMP_RW')); If Not assigned(SDL_LoadBMP_RW) Then result := false; - SDL_SaveBMP_RW := TSDL_SaveBMP_RW_fun(GetProcAddress(LibHandle, 'SDL_SaveBMP_RW')); + SDL_SaveBMP_RW := TSDL_SaveBMP_RW_func(GetProcAddress(LibHandle, 'SDL_SaveBMP_RW')); If Not assigned(SDL_SaveBMP_RW) Then result := false; - SDL_SetSurfaceRLE := TSDL_SetSurfaceRLE_fun(GetProcAddress(LibHandle, 'SDL_SetSurfaceRLE')); + SDL_SetSurfaceRLE := TSDL_SetSurfaceRLE_func(GetProcAddress(LibHandle, 'SDL_SetSurfaceRLE')); If Not assigned(SDL_SetSurfaceRLE) Then result := false; - SDL_HasSurfaceRLE := TSDL_HasSurfaceRLE_fun(GetProcAddress(LibHandle, 'SDL_HasSurfaceRLE')); + SDL_HasSurfaceRLE := TSDL_HasSurfaceRLE_func(GetProcAddress(LibHandle, 'SDL_HasSurfaceRLE')); If Not assigned(SDL_HasSurfaceRLE) Then result := false; - SDL_SetColorKey := TSDL_SetColorKey_fun(GetProcAddress(LibHandle, 'SDL_SetColorKey')); + SDL_SetColorKey := TSDL_SetColorKey_func(GetProcAddress(LibHandle, 'SDL_SetColorKey')); If Not assigned(SDL_SetColorKey) Then result := false; - SDL_HasColorKey := TSDL_HasColorKey_fun(GetProcAddress(LibHandle, 'SDL_HasColorKey')); + SDL_HasColorKey := TSDL_HasColorKey_func(GetProcAddress(LibHandle, 'SDL_HasColorKey')); If Not assigned(SDL_HasColorKey) Then result := false; - SDL_GetColorKey := TSDL_GetColorKey_fun(GetProcAddress(LibHandle, 'SDL_GetColorKey')); + SDL_GetColorKey := TSDL_GetColorKey_func(GetProcAddress(LibHandle, 'SDL_GetColorKey')); If Not assigned(SDL_GetColorKey) Then result := false; - SDL_SetSurfaceColorMod := TSDL_SetSurfaceColorMod_fun(GetProcAddress(LibHandle, 'SDL_SetSurfaceColorMod')); + SDL_SetSurfaceColorMod := TSDL_SetSurfaceColorMod_func(GetProcAddress(LibHandle, 'SDL_SetSurfaceColorMod')); If Not assigned(SDL_SetSurfaceColorMod) Then result := false; - SDL_GetSurfaceColorMod := TSDL_GetSurfaceColorMod_fun(GetProcAddress(LibHandle, 'SDL_GetSurfaceColorMod')); + SDL_GetSurfaceColorMod := TSDL_GetSurfaceColorMod_func(GetProcAddress(LibHandle, 'SDL_GetSurfaceColorMod')); If Not assigned(SDL_GetSurfaceColorMod) Then result := false; - SDL_SetSurfaceAlphaMod := TSDL_SetSurfaceAlphaMod_fun(GetProcAddress(LibHandle, 'SDL_SetSurfaceAlphaMod')); + SDL_SetSurfaceAlphaMod := TSDL_SetSurfaceAlphaMod_func(GetProcAddress(LibHandle, 'SDL_SetSurfaceAlphaMod')); If Not assigned(SDL_SetSurfaceAlphaMod) Then result := false; - SDL_GetSurfaceAlphaMod := TSDL_GetSurfaceAlphaMod_fun(GetProcAddress(LibHandle, 'SDL_GetSurfaceAlphaMod')); + SDL_GetSurfaceAlphaMod := TSDL_GetSurfaceAlphaMod_func(GetProcAddress(LibHandle, 'SDL_GetSurfaceAlphaMod')); If Not assigned(SDL_GetSurfaceAlphaMod) Then result := false; - SDL_SetSurfaceBlendMode := TSDL_SetSurfaceBlendMode_fun(GetProcAddress(LibHandle, 'SDL_SetSurfaceBlendMode')); + SDL_SetSurfaceBlendMode := TSDL_SetSurfaceBlendMode_func(GetProcAddress(LibHandle, 'SDL_SetSurfaceBlendMode')); If Not assigned(SDL_SetSurfaceBlendMode) Then result := false; - SDL_GetSurfaceBlendMode := TSDL_GetSurfaceBlendMode_fun(GetProcAddress(LibHandle, 'SDL_GetSurfaceBlendMode')); + SDL_GetSurfaceBlendMode := TSDL_GetSurfaceBlendMode_func(GetProcAddress(LibHandle, 'SDL_GetSurfaceBlendMode')); If Not assigned(SDL_GetSurfaceBlendMode) Then result := false; - SDL_SetClipRect := TSDL_SetClipRect_fun(GetProcAddress(LibHandle, 'SDL_SetClipRect')); + SDL_SetClipRect := TSDL_SetClipRect_func(GetProcAddress(LibHandle, 'SDL_SetClipRect')); If Not assigned(SDL_SetClipRect) Then result := false; SDL_GetClipRect := TSDL_GetClipRect_proc(GetProcAddress(LibHandle, 'SDL_GetClipRect')); If Not assigned(SDL_GetClipRect) Then result := false; - SDL_DuplicateSurface := TSDL_DuplicateSurface_fun(GetProcAddress(LibHandle, 'SDL_DuplicateSurface')); + SDL_DuplicateSurface := TSDL_DuplicateSurface_func(GetProcAddress(LibHandle, 'SDL_DuplicateSurface')); If Not assigned(SDL_DuplicateSurface) Then result := false; - SDL_ConvertSurface := TSDL_ConvertSurface_fun(GetProcAddress(LibHandle, 'SDL_ConvertSurface')); + SDL_ConvertSurface := TSDL_ConvertSurface_func(GetProcAddress(LibHandle, 'SDL_ConvertSurface')); If Not assigned(SDL_ConvertSurface) Then result := false; - SDL_ConvertSurfaceFormat := TSDL_ConvertSurfaceFormat_fun(GetProcAddress(LibHandle, 'SDL_ConvertSurfaceFormat')); + SDL_ConvertSurfaceFormat := TSDL_ConvertSurfaceFormat_func(GetProcAddress(LibHandle, 'SDL_ConvertSurfaceFormat')); If Not assigned(SDL_ConvertSurfaceFormat) Then result := false; - SDL_ConvertPixels := TSDL_ConvertPixels_fun(GetProcAddress(LibHandle, 'SDL_ConvertPixels')); + SDL_ConvertPixels := TSDL_ConvertPixels_func(GetProcAddress(LibHandle, 'SDL_ConvertPixels')); If Not assigned(SDL_ConvertPixels) Then result := false; - SDL_FillRect := TSDL_FillRect_fun(GetProcAddress(LibHandle, 'SDL_FillRect')); + SDL_FillRect := TSDL_FillRect_func(GetProcAddress(LibHandle, 'SDL_FillRect')); If Not assigned(SDL_FillRect) Then result := false; - SDL_FillRects := TSDL_FillRects_fun(GetProcAddress(LibHandle, 'SDL_FillRects')); + SDL_FillRects := TSDL_FillRects_func(GetProcAddress(LibHandle, 'SDL_FillRects')); If Not assigned(SDL_FillRects) Then result := false; - SDL_BlitSurface := TSDL_BlitSurface_fun(GetProcAddress(LibHandle, 'SDL_BlitSurface')); + SDL_BlitSurface := TSDL_BlitSurface_func(GetProcAddress(LibHandle, 'SDL_BlitSurface')); If Not assigned(SDL_BlitSurface) Then result := false; - SDL_UpperBlit := TSDL_UpperBlit_fun(GetProcAddress(LibHandle, 'SDL_UpperBlit')); + SDL_UpperBlit := TSDL_UpperBlit_func(GetProcAddress(LibHandle, 'SDL_UpperBlit')); If Not assigned(SDL_UpperBlit) Then result := false; - SDL_LowerBlit := TSDL_LowerBlit_fun(GetProcAddress(LibHandle, 'SDL_LowerBlit')); + SDL_LowerBlit := TSDL_LowerBlit_func(GetProcAddress(LibHandle, 'SDL_LowerBlit')); If Not assigned(SDL_LowerBlit) Then result := false; - SDL_SoftStretch := TSDL_SoftStretch_fun(GetProcAddress(LibHandle, 'SDL_SoftStretch')); + SDL_SoftStretch := TSDL_SoftStretch_func(GetProcAddress(LibHandle, 'SDL_SoftStretch')); If Not assigned(SDL_SoftStretch) Then result := false; - SDL_BlitSurfaceScaled := TSDL_BlitSurfaceScaled_fun(GetProcAddress(LibHandle, 'SDL_BlitSurfaceScaled')); + SDL_BlitSurfaceScaled := TSDL_BlitSurfaceScaled_func(GetProcAddress(LibHandle, 'SDL_BlitSurfaceScaled')); If Not assigned(SDL_BlitSurfaceScaled) Then result := false; - SDL_UpperBlitScaled := TSDL_UpperBlitScaled_fun(GetProcAddress(LibHandle, 'SDL_UpperBlitScaled')); + SDL_UpperBlitScaled := TSDL_UpperBlitScaled_func(GetProcAddress(LibHandle, 'SDL_UpperBlitScaled')); If Not assigned(SDL_UpperBlitScaled) Then result := false; - SDL_LowerBlitScaled := TSDL_LowerBlitScaled_fun(GetProcAddress(LibHandle, 'SDL_LowerBlitScaled')); + SDL_LowerBlitScaled := TSDL_LowerBlitScaled_func(GetProcAddress(LibHandle, 'SDL_LowerBlitScaled')); If Not assigned(SDL_LowerBlitScaled) Then result := false; SDL_SetYUVConversionMode := TSDL_SetYUVConversionMode_proc(GetProcAddress(LibHandle, 'SDL_SetYUVConversionMode')); If Not assigned(SDL_SetYUVConversionMode) Then result := false; - SDL_GetYUVConversionModeForResolution := TSDL_GetYUVConversionModeForResolution_fun(GetProcAddress(LibHandle, 'SDL_GetYUVConversionModeForResolution')); + SDL_GetYUVConversionModeForResolution := TSDL_GetYUVConversionModeForResolution_func(GetProcAddress(LibHandle, 'SDL_GetYUVConversionModeForResolution')); If Not assigned(SDL_GetYUVConversionModeForResolution) Then result := false; SDL_SetWindowsMessageHook := TSDL_SetWindowsMessageHook_proc(GetProcAddress(LibHandle, 'SDL_SetWindowsMessageHook')); If Not assigned(SDL_SetWindowsMessageHook) Then result := false; - SDL_Direct3D9GetAdapterIndex := TSDL_Direct3D9GetAdapterIndex_fun(GetProcAddress(LibHandle, 'SDL_Direct3D9GetAdapterIndex')); + SDL_Direct3D9GetAdapterIndex := TSDL_Direct3D9GetAdapterIndex_func(GetProcAddress(LibHandle, 'SDL_Direct3D9GetAdapterIndex')); If Not assigned(SDL_Direct3D9GetAdapterIndex) Then result := false; - SDL_RenderGetD3D9Device := TSDL_RenderGetD3D9Device_fun(GetProcAddress(LibHandle, 'SDL_RenderGetD3D9Device')); + SDL_RenderGetD3D9Device := TSDL_RenderGetD3D9Device_func(GetProcAddress(LibHandle, 'SDL_RenderGetD3D9Device')); If Not assigned(SDL_RenderGetD3D9Device) Then result := false; - SDL_RenderGetD3D11Device := TSDL_RenderGetD3D11Device_fun(GetProcAddress(LibHandle, 'SDL_RenderGetD3D11Device')); + SDL_RenderGetD3D11Device := TSDL_RenderGetD3D11Device_func(GetProcAddress(LibHandle, 'SDL_RenderGetD3D11Device')); If Not assigned(SDL_RenderGetD3D11Device) Then result := false; - SDL_RenderGetD3D12Device := TSDL_RenderGetD3D12Device_fun(GetProcAddress(LibHandle, 'SDL_RenderGetD3D12Device')); + SDL_RenderGetD3D12Device := TSDL_RenderGetD3D12Device_func(GetProcAddress(LibHandle, 'SDL_RenderGetD3D12Device')); If Not assigned(SDL_RenderGetD3D12Device) Then result := false; - SDL_DXGIGetOutputInfo := TSDL_DXGIGetOutputInfo_fun(GetProcAddress(LibHandle, 'SDL_DXGIGetOutputInfo')); + SDL_DXGIGetOutputInfo := TSDL_DXGIGetOutputInfo_func(GetProcAddress(LibHandle, 'SDL_DXGIGetOutputInfo')); If Not assigned(SDL_DXGIGetOutputInfo) Then result := false; //*) {$IFDEF LINUX} - SDL_LinuxSetThreadPriority := TSDL_LinuxSetThreadPriority_fun(GetProcAddress(LibHandle, 'SDL_LinuxSetThreadPriority')); + SDL_LinuxSetThreadPriority := TSDL_LinuxSetThreadPriority_func(GetProcAddress(LibHandle, 'SDL_LinuxSetThreadPriority')); If Not assigned(SDL_LinuxSetThreadPriority) Then result := false; - SDL_LinuxSetThreadPriorityAndPolicy := TSDL_LinuxSetThreadPriorityAndPolicy_fun(GetProcAddress(LibHandle, 'SDL_LinuxSetThreadPriorityAndPolicy')); + SDL_LinuxSetThreadPriorityAndPolicy := TSDL_LinuxSetThreadPriorityAndPolicy_func(GetProcAddress(LibHandle, 'SDL_LinuxSetThreadPriorityAndPolicy')); If Not assigned(SDL_LinuxSetThreadPriorityAndPolicy) Then result := false; {$IFDEF Windows} - SDL_iPhoneSetAnimationCallback := TSDL_iPhoneSetAnimationCallback_fun(GetProcAddress(LibHandle, 'SDL_iPhoneSetAnimationCallback')); + SDL_iPhoneSetAnimationCallback := TSDL_iPhoneSetAnimationCallback_func(GetProcAddress(LibHandle, 'SDL_iPhoneSetAnimationCallback')); If Not assigned(SDL_iPhoneSetAnimationCallback) Then result := false; SDL_iPhoneSetEventPump := TSDL_iPhoneSetEventPump_proc(GetProcAddress(LibHandle, 'SDL_iPhoneSetEventPump')); If Not assigned(SDL_iPhoneSetEventPump) Then result := false; - SDL_AndroidGetJNIEnv := TSDL_AndroidGetJNIEnv_fun(GetProcAddress(LibHandle, 'SDL_AndroidGetJNIEnv')); + SDL_AndroidGetJNIEnv := TSDL_AndroidGetJNIEnv_func(GetProcAddress(LibHandle, 'SDL_AndroidGetJNIEnv')); If Not assigned(SDL_AndroidGetJNIEnv) Then result := false; - SDL_AndroidGetActivity := TSDL_AndroidGetActivity_fun(GetProcAddress(LibHandle, 'SDL_AndroidGetActivity')); + SDL_AndroidGetActivity := TSDL_AndroidGetActivity_func(GetProcAddress(LibHandle, 'SDL_AndroidGetActivity')); If Not assigned(SDL_AndroidGetActivity) Then result := false; - SDL_GetAndroidSDKVersion := TSDL_GetAndroidSDKVersion_fun(GetProcAddress(LibHandle, 'SDL_GetAndroidSDKVersion')); + SDL_GetAndroidSDKVersion := TSDL_GetAndroidSDKVersion_func(GetProcAddress(LibHandle, 'SDL_GetAndroidSDKVersion')); If Not assigned(SDL_GetAndroidSDKVersion) Then result := false; - SDL_IsAndroidTV := TSDL_IsAndroidTV_fun(GetProcAddress(LibHandle, 'SDL_IsAndroidTV')); + SDL_IsAndroidTV := TSDL_IsAndroidTV_func(GetProcAddress(LibHandle, 'SDL_IsAndroidTV')); If Not assigned(SDL_IsAndroidTV) Then result := false; - SDL_IsChromebook := TSDL_IsChromebook_fun(GetProcAddress(LibHandle, 'SDL_IsChromebook')); + SDL_IsChromebook := TSDL_IsChromebook_func(GetProcAddress(LibHandle, 'SDL_IsChromebook')); If Not assigned(SDL_IsChromebook) Then result := false; - SDL_IsDeXMode := TSDL_IsDeXMode_fun(GetProcAddress(LibHandle, 'SDL_IsDeXMode')); + SDL_IsDeXMode := TSDL_IsDeXMode_func(GetProcAddress(LibHandle, 'SDL_IsDeXMode')); If Not assigned(SDL_IsDeXMode) Then result := false; SDL_AndroidBackButton := TSDL_AndroidBackButton_proc(GetProcAddress(LibHandle, 'SDL_AndroidBackButton')); If Not assigned(SDL_AndroidBackButton) Then result := false; - SDL_AndroidGetInternalStoragePath := TSDL_AndroidGetInternalStoragePath_fun(GetProcAddress(LibHandle, 'SDL_AndroidGetInternalStoragePath')); + SDL_AndroidGetInternalStoragePath := TSDL_AndroidGetInternalStoragePath_func(GetProcAddress(LibHandle, 'SDL_AndroidGetInternalStoragePath')); If Not assigned(SDL_AndroidGetInternalStoragePath) Then result := false; - SDL_AndroidGetExternalStorageState := TSDL_AndroidGetExternalStorageState_fun(GetProcAddress(LibHandle, 'SDL_AndroidGetExternalStorageState')); + SDL_AndroidGetExternalStorageState := TSDL_AndroidGetExternalStorageState_func(GetProcAddress(LibHandle, 'SDL_AndroidGetExternalStorageState')); If Not assigned(SDL_AndroidGetExternalStorageState) Then result := false; - SDL_AndroidGetExternalStoragePath := TSDL_AndroidGetExternalStoragePath_fun(GetProcAddress(LibHandle, 'SDL_AndroidGetExternalStoragePath')); + SDL_AndroidGetExternalStoragePath := TSDL_AndroidGetExternalStoragePath_func(GetProcAddress(LibHandle, 'SDL_AndroidGetExternalStoragePath')); If Not assigned(SDL_AndroidGetExternalStoragePath) Then result := false; - SDL_AndroidRequestPermission := TSDL_AndroidRequestPermission_fun(GetProcAddress(LibHandle, 'SDL_AndroidRequestPermission')); + SDL_AndroidRequestPermission := TSDL_AndroidRequestPermission_func(GetProcAddress(LibHandle, 'SDL_AndroidRequestPermission')); If Not assigned(SDL_AndroidRequestPermission) Then result := false; - SDL_AndroidShowToast := TSDL_AndroidShowToast_fun(GetProcAddress(LibHandle, 'SDL_AndroidShowToast')); + SDL_AndroidShowToast := TSDL_AndroidShowToast_func(GetProcAddress(LibHandle, 'SDL_AndroidShowToast')); If Not assigned(SDL_AndroidShowToast) Then result := false; - SDL_AndroidSendMessage := TSDL_AndroidSendMessage_fun(GetProcAddress(LibHandle, 'SDL_AndroidSendMessage')); + SDL_AndroidSendMessage := TSDL_AndroidSendMessage_func(GetProcAddress(LibHandle, 'SDL_AndroidSendMessage')); If Not assigned(SDL_AndroidSendMessage) Then result := false; - SDL_WinRTGetFSPathUNICODE := TSDL_WinRTGetFSPathUNICODE_fun(GetProcAddress(LibHandle, 'SDL_WinRTGetFSPathUNICODE')); + SDL_WinRTGetFSPathUNICODE := TSDL_WinRTGetFSPathUNICODE_func(GetProcAddress(LibHandle, 'SDL_WinRTGetFSPathUNICODE')); If Not assigned(SDL_WinRTGetFSPathUNICODE) Then result := false; - SDL_WinRTGetFSPathUTF8 := TSDL_WinRTGetFSPathUTF8_fun(GetProcAddress(LibHandle, 'SDL_WinRTGetFSPathUTF8')); + SDL_WinRTGetFSPathUTF8 := TSDL_WinRTGetFSPathUTF8_func(GetProcAddress(LibHandle, 'SDL_WinRTGetFSPathUTF8')); If Not assigned(SDL_WinRTGetFSPathUTF8) Then result := false; - SDL_WinRTGetDeviceFamily := TSDL_WinRTGetDeviceFamily_fun(GetProcAddress(LibHandle, 'SDL_WinRTGetDeviceFamily')); + SDL_WinRTGetDeviceFamily := TSDL_WinRTGetDeviceFamily_func(GetProcAddress(LibHandle, 'SDL_WinRTGetDeviceFamily')); If Not assigned(SDL_WinRTGetDeviceFamily) Then result := false; {$ENDIF} {$ENDIF} - SDL_IsTablet := TSDL_IsTablet_fun(GetProcAddress(LibHandle, 'SDL_IsTablet')); + SDL_IsTablet := TSDL_IsTablet_func(GetProcAddress(LibHandle, 'SDL_IsTablet')); If Not assigned(SDL_IsTablet) Then result := false; - SDL_GetWindowWMInfo := TSDL_GetWindowWMInfo_fun(GetProcAddress(LibHandle, 'SDL_GetWindowWMInfo')); + SDL_GetWindowWMInfo := TSDL_GetWindowWMInfo_func(GetProcAddress(LibHandle, 'SDL_GetWindowWMInfo')); If Not assigned(SDL_GetWindowWMInfo) Then result := false; - SDL_CreateThread := TSDL_CreateThread_fun(GetProcAddress(LibHandle, 'SDL_CreateThread')); + SDL_CreateThread := TSDL_CreateThread_func(GetProcAddress(LibHandle, 'SDL_CreateThread')); If Not assigned(SDL_CreateThread) Then result := false; - SDL_CreateThreadWithStackSize := TSDL_CreateThreadWithStackSize_fun(GetProcAddress(LibHandle, 'SDL_CreateThreadWithStackSize')); + SDL_CreateThreadWithStackSize := TSDL_CreateThreadWithStackSize_func(GetProcAddress(LibHandle, 'SDL_CreateThreadWithStackSize')); If Not assigned(SDL_CreateThreadWithStackSize) Then result := false; - SDL_CreateThread := TSDL_CreateThread_fun(GetProcAddress(LibHandle, 'SDL_CreateThread')); + SDL_CreateThread := TSDL_CreateThread_func(GetProcAddress(LibHandle, 'SDL_CreateThread')); If Not assigned(SDL_CreateThread) Then result := false; - SDL_CreateThreadWithStackSize := TSDL_CreateThreadWithStackSize_fun(GetProcAddress(LibHandle, 'SDL_CreateThreadWithStackSize')); + SDL_CreateThreadWithStackSize := TSDL_CreateThreadWithStackSize_func(GetProcAddress(LibHandle, 'SDL_CreateThreadWithStackSize')); If Not assigned(SDL_CreateThreadWithStackSize) Then result := false; - SDL_GetThreadName := TSDL_GetThreadName_fun(GetProcAddress(LibHandle, 'SDL_GetThreadName')); + SDL_GetThreadName := TSDL_GetThreadName_func(GetProcAddress(LibHandle, 'SDL_GetThreadName')); If Not assigned(SDL_GetThreadName) Then result := false; - SDL_GetThreadID := TSDL_GetThreadID_fun(GetProcAddress(LibHandle, 'SDL_GetThreadID')); + SDL_GetThreadID := TSDL_GetThreadID_func(GetProcAddress(LibHandle, 'SDL_GetThreadID')); If Not assigned(SDL_GetThreadID) Then result := false; - SDL_SetThreadPriority := TSDL_SetThreadPriority_fun(GetProcAddress(LibHandle, 'SDL_SetThreadPriority')); + SDL_SetThreadPriority := TSDL_SetThreadPriority_func(GetProcAddress(LibHandle, 'SDL_SetThreadPriority')); If Not assigned(SDL_SetThreadPriority) Then result := false; SDL_WaitThread := TSDL_WaitThread_proc(GetProcAddress(LibHandle, 'SDL_WaitThread')); If Not assigned(SDL_WaitThread) Then result := false; SDL_DetachThread := TSDL_DetachThread_proc(GetProcAddress(LibHandle, 'SDL_DetachThread')); If Not assigned(SDL_DetachThread) Then result := false; - SDL_TLSGet := TSDL_TLSGet_fun(GetProcAddress(LibHandle, 'SDL_TLSGet')); + SDL_TLSGet := TSDL_TLSGet_func(GetProcAddress(LibHandle, 'SDL_TLSGet')); If Not assigned(SDL_TLSGet) Then result := false; - SDL_TLSSet := TSDL_TLSSet_fun(GetProcAddress(LibHandle, 'SDL_TLSSet')); + SDL_TLSSet := TSDL_TLSSet_func(GetProcAddress(LibHandle, 'SDL_TLSSet')); If Not assigned(SDL_TLSSet) Then result := false; SDL_Delay := TSDL_Delay_proc(GetProcAddress(LibHandle, 'SDL_Delay')); If Not assigned(SDL_Delay) Then result := false; - SDL_AddTimer := TSDL_AddTimer_fun(GetProcAddress(LibHandle, 'SDL_AddTimer')); + SDL_AddTimer := TSDL_AddTimer_func(GetProcAddress(LibHandle, 'SDL_AddTimer')); If Not assigned(SDL_AddTimer) Then result := false; - SDL_RemoveTimer := TSDL_RemoveTimer_fun(GetProcAddress(LibHandle, 'SDL_RemoveTimer')); + SDL_RemoveTimer := TSDL_RemoveTimer_func(GetProcAddress(LibHandle, 'SDL_RemoveTimer')); If Not assigned(SDL_RemoveTimer) Then result := false; - SDL_GetNumTouchDevices := TSDL_GetNumTouchDevices_fun(GetProcAddress(LibHandle, 'SDL_GetNumTouchDevices')); + SDL_GetNumTouchDevices := TSDL_GetNumTouchDevices_func(GetProcAddress(LibHandle, 'SDL_GetNumTouchDevices')); If Not assigned(SDL_GetNumTouchDevices) Then result := false; - SDL_GetTouchDevice := TSDL_GetTouchDevice_fun(GetProcAddress(LibHandle, 'SDL_GetTouchDevice')); + SDL_GetTouchDevice := TSDL_GetTouchDevice_func(GetProcAddress(LibHandle, 'SDL_GetTouchDevice')); If Not assigned(SDL_GetTouchDevice) Then result := false; - (* SDL_GetTouchName := TSDL_GetTouchName_fun(GetProcAddress(LibHandle, 'SDL_GetTouchName')); + (* SDL_GetTouchName := TSDL_GetTouchName_func(GetProcAddress(LibHandle, 'SDL_GetTouchName')); If Not assigned(SDL_GetTouchName) Then result := false; - SDL_GetTouchDeviceType := TSDL_GetTouchDeviceType_fun(GetProcAddress(LibHandle, 'SDL_GetTouchDeviceType')); + SDL_GetTouchDeviceType := TSDL_GetTouchDeviceType_func(GetProcAddress(LibHandle, 'SDL_GetTouchDeviceType')); If Not assigned(SDL_GetTouchDeviceType) Then result := false; - SDL_GetNumTouchFingers := TSDL_GetNumTouchFingers_fun(GetProcAddress(LibHandle, 'SDL_GetNumTouchFingers')); + SDL_GetNumTouchFingers := TSDL_GetNumTouchFingers_func(GetProcAddress(LibHandle, 'SDL_GetNumTouchFingers')); If Not assigned(SDL_GetNumTouchFingers) Then result := false; - SDL_GetTouchFinger := TSDL_GetTouchFinger_fun(GetProcAddress(LibHandle, 'SDL_GetTouchFinger')); + SDL_GetTouchFinger := TSDL_GetTouchFinger_func(GetProcAddress(LibHandle, 'SDL_GetTouchFinger')); If Not assigned(SDL_GetTouchFinger) Then result := false; //*) SDL_GetVersion := TSDL_GetVersion_proc(GetProcAddress(LibHandle, 'SDL_GetVersion')); If Not assigned(SDL_GetVersion) Then result := false; - (* SDL_GetVideoDriver := TSDL_GetVideoDriver_fun(GetProcAddress(LibHandle, 'SDL_GetVideoDriver')); + (* SDL_GetVideoDriver := TSDL_GetVideoDriver_func(GetProcAddress(LibHandle, 'SDL_GetVideoDriver')); If Not assigned(SDL_GetVideoDriver) Then result := false; - SDL_VideoInit := TSDL_VideoInit_fun(GetProcAddress(LibHandle, 'SDL_VideoInit')); + SDL_VideoInit := TSDL_VideoInit_func(GetProcAddress(LibHandle, 'SDL_VideoInit')); If Not assigned(SDL_VideoInit) Then result := false; - SDL_GetDisplayName := TSDL_GetDisplayName_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayName')); + SDL_GetDisplayName := TSDL_GetDisplayName_func(GetProcAddress(LibHandle, 'SDL_GetDisplayName')); If Not assigned(SDL_GetDisplayName) Then result := false; - SDL_GetDisplayBounds := TSDL_GetDisplayBounds_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayBounds')); + SDL_GetDisplayBounds := TSDL_GetDisplayBounds_func(GetProcAddress(LibHandle, 'SDL_GetDisplayBounds')); If Not assigned(SDL_GetDisplayBounds) Then result := false; - SDL_GetDisplayUsableBounds := TSDL_GetDisplayUsableBounds_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayUsableBounds')); + SDL_GetDisplayUsableBounds := TSDL_GetDisplayUsableBounds_func(GetProcAddress(LibHandle, 'SDL_GetDisplayUsableBounds')); If Not assigned(SDL_GetDisplayUsableBounds) Then result := false; - SDL_GetDisplayDPI := TSDL_GetDisplayDPI_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayDPI')); + SDL_GetDisplayDPI := TSDL_GetDisplayDPI_func(GetProcAddress(LibHandle, 'SDL_GetDisplayDPI')); If Not assigned(SDL_GetDisplayDPI) Then result := false; - SDL_GetDisplayOrientation := TSDL_GetDisplayOrientation_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayOrientation')); + SDL_GetDisplayOrientation := TSDL_GetDisplayOrientation_func(GetProcAddress(LibHandle, 'SDL_GetDisplayOrientation')); If Not assigned(SDL_GetDisplayOrientation) Then result := false; - SDL_GetNumDisplayModes := TSDL_GetNumDisplayModes_fun(GetProcAddress(LibHandle, 'SDL_GetNumDisplayModes')); + SDL_GetNumDisplayModes := TSDL_GetNumDisplayModes_func(GetProcAddress(LibHandle, 'SDL_GetNumDisplayModes')); If Not assigned(SDL_GetNumDisplayModes) Then result := false; - SDL_GetDisplayMode := TSDL_GetDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_GetDisplayMode')); + SDL_GetDisplayMode := TSDL_GetDisplayMode_func(GetProcAddress(LibHandle, 'SDL_GetDisplayMode')); If Not assigned(SDL_GetDisplayMode) Then result := false; - SDL_GetDesktopDisplayMode := TSDL_GetDesktopDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_GetDesktopDisplayMode')); + SDL_GetDesktopDisplayMode := TSDL_GetDesktopDisplayMode_func(GetProcAddress(LibHandle, 'SDL_GetDesktopDisplayMode')); If Not assigned(SDL_GetDesktopDisplayMode) Then result := false; - SDL_GetCurrentDisplayMode := TSDL_GetCurrentDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_GetCurrentDisplayMode')); + SDL_GetCurrentDisplayMode := TSDL_GetCurrentDisplayMode_func(GetProcAddress(LibHandle, 'SDL_GetCurrentDisplayMode')); If Not assigned(SDL_GetCurrentDisplayMode) Then result := false; - SDL_GetClosestDisplayMode := TSDL_GetClosestDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_GetClosestDisplayMode')); + SDL_GetClosestDisplayMode := TSDL_GetClosestDisplayMode_func(GetProcAddress(LibHandle, 'SDL_GetClosestDisplayMode')); If Not assigned(SDL_GetClosestDisplayMode) Then result := false; - SDL_GetPointDisplayIndex := TSDL_GetPointDisplayIndex_fun(GetProcAddress(LibHandle, 'SDL_GetPointDisplayIndex')); + SDL_GetPointDisplayIndex := TSDL_GetPointDisplayIndex_func(GetProcAddress(LibHandle, 'SDL_GetPointDisplayIndex')); If Not assigned(SDL_GetPointDisplayIndex) Then result := false; - SDL_GetRectDisplayIndex := TSDL_GetRectDisplayIndex_fun(GetProcAddress(LibHandle, 'SDL_GetRectDisplayIndex')); + SDL_GetRectDisplayIndex := TSDL_GetRectDisplayIndex_func(GetProcAddress(LibHandle, 'SDL_GetRectDisplayIndex')); If Not assigned(SDL_GetRectDisplayIndex) Then result := false; - SDL_GetWindowDisplayIndex := TSDL_GetWindowDisplayIndex_fun(GetProcAddress(LibHandle, 'SDL_GetWindowDisplayIndex')); + SDL_GetWindowDisplayIndex := TSDL_GetWindowDisplayIndex_func(GetProcAddress(LibHandle, 'SDL_GetWindowDisplayIndex')); If Not assigned(SDL_GetWindowDisplayIndex) Then result := false; - SDL_SetWindowDisplayMode := TSDL_SetWindowDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_SetWindowDisplayMode')); + SDL_SetWindowDisplayMode := TSDL_SetWindowDisplayMode_func(GetProcAddress(LibHandle, 'SDL_SetWindowDisplayMode')); If Not assigned(SDL_SetWindowDisplayMode) Then result := false; - SDL_GetWindowDisplayMode := TSDL_GetWindowDisplayMode_fun(GetProcAddress(LibHandle, 'SDL_GetWindowDisplayMode')); + SDL_GetWindowDisplayMode := TSDL_GetWindowDisplayMode_func(GetProcAddress(LibHandle, 'SDL_GetWindowDisplayMode')); If Not assigned(SDL_GetWindowDisplayMode) Then result := false; - SDL_GetWindowICCProfile := TSDL_GetWindowICCProfile_fun(GetProcAddress(LibHandle, 'SDL_GetWindowICCProfile')); + SDL_GetWindowICCProfile := TSDL_GetWindowICCProfile_func(GetProcAddress(LibHandle, 'SDL_GetWindowICCProfile')); If Not assigned(SDL_GetWindowICCProfile) Then result := false; - SDL_GetWindowPixelFormat := TSDL_GetWindowPixelFormat_fun(GetProcAddress(LibHandle, 'SDL_GetWindowPixelFormat')); + SDL_GetWindowPixelFormat := TSDL_GetWindowPixelFormat_func(GetProcAddress(LibHandle, 'SDL_GetWindowPixelFormat')); If Not assigned(SDL_GetWindowPixelFormat) Then result := false; - SDL_CreateWindow := TSDL_CreateWindow_fun(GetProcAddress(LibHandle, 'SDL_CreateWindow')); + SDL_CreateWindow := TSDL_CreateWindow_func(GetProcAddress(LibHandle, 'SDL_CreateWindow')); If Not assigned(SDL_CreateWindow) Then result := false; - SDL_CreateWindowFrom := TSDL_CreateWindowFrom_fun(GetProcAddress(LibHandle, 'SDL_CreateWindowFrom')); + SDL_CreateWindowFrom := TSDL_CreateWindowFrom_func(GetProcAddress(LibHandle, 'SDL_CreateWindowFrom')); If Not assigned(SDL_CreateWindowFrom) Then result := false; - SDL_GetWindowID := TSDL_GetWindowID_fun(GetProcAddress(LibHandle, 'SDL_GetWindowID')); + SDL_GetWindowID := TSDL_GetWindowID_func(GetProcAddress(LibHandle, 'SDL_GetWindowID')); If Not assigned(SDL_GetWindowID) Then result := false; - SDL_GetWindowFromID := TSDL_GetWindowFromID_fun(GetProcAddress(LibHandle, 'SDL_GetWindowFromID')); + SDL_GetWindowFromID := TSDL_GetWindowFromID_func(GetProcAddress(LibHandle, 'SDL_GetWindowFromID')); If Not assigned(SDL_GetWindowFromID) Then result := false; - SDL_GetWindowFlags := TSDL_GetWindowFlags_fun(GetProcAddress(LibHandle, 'SDL_GetWindowFlags')); + SDL_GetWindowFlags := TSDL_GetWindowFlags_func(GetProcAddress(LibHandle, 'SDL_GetWindowFlags')); If Not assigned(SDL_GetWindowFlags) Then result := false; SDL_SetWindowTitle := TSDL_SetWindowTitle_proc(GetProcAddress(LibHandle, 'SDL_SetWindowTitle')); If Not assigned(SDL_SetWindowTitle) Then result := false; - SDL_GetWindowTitle := TSDL_GetWindowTitle_fun(GetProcAddress(LibHandle, 'SDL_GetWindowTitle')); + SDL_GetWindowTitle := TSDL_GetWindowTitle_func(GetProcAddress(LibHandle, 'SDL_GetWindowTitle')); If Not assigned(SDL_GetWindowTitle) Then result := false; SDL_SetWindowIcon := TSDL_SetWindowIcon_proc(GetProcAddress(LibHandle, 'SDL_SetWindowIcon')); If Not assigned(SDL_SetWindowIcon) Then result := false; - SDL_SetWindowData := TSDL_SetWindowData_fun(GetProcAddress(LibHandle, 'SDL_SetWindowData')); + SDL_SetWindowData := TSDL_SetWindowData_func(GetProcAddress(LibHandle, 'SDL_SetWindowData')); If Not assigned(SDL_SetWindowData) Then result := false; - SDL_GetWindowData := TSDL_GetWindowData_fun(GetProcAddress(LibHandle, 'SDL_GetWindowData')); + SDL_GetWindowData := TSDL_GetWindowData_func(GetProcAddress(LibHandle, 'SDL_GetWindowData')); If Not assigned(SDL_GetWindowData) Then result := false; SDL_SetWindowPosition := TSDL_SetWindowPosition_proc(GetProcAddress(LibHandle, 'SDL_SetWindowPosition')); If Not assigned(SDL_SetWindowPosition) Then result := false; @@ -1021,7 +1021,7 @@ Begin If Not assigned(SDL_SetWindowSize) Then result := false; SDL_GetWindowSize := TSDL_GetWindowSize_proc(GetProcAddress(LibHandle, 'SDL_GetWindowSize')); If Not assigned(SDL_GetWindowSize) Then result := false; - SDL_GetWindowBordersSize := TSDL_GetWindowBordersSize_fun(GetProcAddress(LibHandle, 'SDL_GetWindowBordersSize')); + SDL_GetWindowBordersSize := TSDL_GetWindowBordersSize_func(GetProcAddress(LibHandle, 'SDL_GetWindowBordersSize')); If Not assigned(SDL_GetWindowBordersSize) Then result := false; SDL_GetWindowSizeInPixels := TSDL_GetWindowSizeInPixels_proc(GetProcAddress(LibHandle, 'SDL_GetWindowSizeInPixels')); If Not assigned(SDL_GetWindowSizeInPixels) Then result := false; @@ -1051,77 +1051,77 @@ Begin If Not assigned(SDL_MinimizeWindow) Then result := false; SDL_RestoreWindow := TSDL_RestoreWindow_proc(GetProcAddress(LibHandle, 'SDL_RestoreWindow')); If Not assigned(SDL_RestoreWindow) Then result := false; - SDL_SetWindowFullscreen := TSDL_SetWindowFullscreen_fun(GetProcAddress(LibHandle, 'SDL_SetWindowFullscreen')); + SDL_SetWindowFullscreen := TSDL_SetWindowFullscreen_func(GetProcAddress(LibHandle, 'SDL_SetWindowFullscreen')); If Not assigned(SDL_SetWindowFullscreen) Then result := false; - SDL_HasWindowSurface := TSDL_HasWindowSurface_fun(GetProcAddress(LibHandle, 'SDL_HasWindowSurface')); + SDL_HasWindowSurface := TSDL_HasWindowSurface_func(GetProcAddress(LibHandle, 'SDL_HasWindowSurface')); If Not assigned(SDL_HasWindowSurface) Then result := false; - SDL_GetWindowSurface := TSDL_GetWindowSurface_fun(GetProcAddress(LibHandle, 'SDL_GetWindowSurface')); + SDL_GetWindowSurface := TSDL_GetWindowSurface_func(GetProcAddress(LibHandle, 'SDL_GetWindowSurface')); If Not assigned(SDL_GetWindowSurface) Then result := false; - SDL_UpdateWindowSurface := TSDL_UpdateWindowSurface_fun(GetProcAddress(LibHandle, 'SDL_UpdateWindowSurface')); + SDL_UpdateWindowSurface := TSDL_UpdateWindowSurface_func(GetProcAddress(LibHandle, 'SDL_UpdateWindowSurface')); If Not assigned(SDL_UpdateWindowSurface) Then result := false; - SDL_UpdateWindowSurfaceRects := TSDL_UpdateWindowSurfaceRects_fun(GetProcAddress(LibHandle, 'SDL_UpdateWindowSurfaceRects')); + SDL_UpdateWindowSurfaceRects := TSDL_UpdateWindowSurfaceRects_func(GetProcAddress(LibHandle, 'SDL_UpdateWindowSurfaceRects')); If Not assigned(SDL_UpdateWindowSurfaceRects) Then result := false; - SDL_DestroyWindowSurface := TSDL_DestroyWindowSurface_fun(GetProcAddress(LibHandle, 'SDL_DestroyWindowSurface')); + SDL_DestroyWindowSurface := TSDL_DestroyWindowSurface_func(GetProcAddress(LibHandle, 'SDL_DestroyWindowSurface')); If Not assigned(SDL_DestroyWindowSurface) Then result := false; SDL_SetWindowGrab := TSDL_SetWindowGrab_proc(GetProcAddress(LibHandle, 'SDL_SetWindowGrab')); If Not assigned(SDL_SetWindowGrab) Then result := false; - SDL_GetWindowGrab := TSDL_GetWindowGrab_fun(GetProcAddress(LibHandle, 'SDL_GetWindowGrab')); + SDL_GetWindowGrab := TSDL_GetWindowGrab_func(GetProcAddress(LibHandle, 'SDL_GetWindowGrab')); If Not assigned(SDL_GetWindowGrab) Then result := false; SDL_SetWindowKeyboardGrab := TSDL_SetWindowKeyboardGrab_proc(GetProcAddress(LibHandle, 'SDL_SetWindowKeyboardGrab')); If Not assigned(SDL_SetWindowKeyboardGrab) Then result := false; - SDL_GetWindowKeyboardGrab := TSDL_GetWindowKeyboardGrab_fun(GetProcAddress(LibHandle, 'SDL_GetWindowKeyboardGrab')); + SDL_GetWindowKeyboardGrab := TSDL_GetWindowKeyboardGrab_func(GetProcAddress(LibHandle, 'SDL_GetWindowKeyboardGrab')); If Not assigned(SDL_GetWindowKeyboardGrab) Then result := false; SDL_SetWindowMouseGrab := TSDL_SetWindowMouseGrab_proc(GetProcAddress(LibHandle, 'SDL_SetWindowMouseGrab')); If Not assigned(SDL_SetWindowMouseGrab) Then result := false; - SDL_GetWindowMouseGrab := TSDL_GetWindowMouseGrab_fun(GetProcAddress(LibHandle, 'SDL_GetWindowMouseGrab')); + SDL_GetWindowMouseGrab := TSDL_GetWindowMouseGrab_func(GetProcAddress(LibHandle, 'SDL_GetWindowMouseGrab')); If Not assigned(SDL_GetWindowMouseGrab) Then result := false; SDL_SetWindowMouseRect := TSDL_SetWindowMouseRect_proc(GetProcAddress(LibHandle, 'SDL_SetWindowMouseRect')); If Not assigned(SDL_SetWindowMouseRect) Then result := false; - SDL_GetWindowMouseRect := TSDL_GetWindowMouseRect_fun(GetProcAddress(LibHandle, 'SDL_GetWindowMouseRect')); + SDL_GetWindowMouseRect := TSDL_GetWindowMouseRect_func(GetProcAddress(LibHandle, 'SDL_GetWindowMouseRect')); If Not assigned(SDL_GetWindowMouseRect) Then result := false; - SDL_GetGrabbedWindow := TSDL_GetGrabbedWindow_fun(GetProcAddress(LibHandle, 'SDL_GetGrabbedWindow')); + SDL_GetGrabbedWindow := TSDL_GetGrabbedWindow_func(GetProcAddress(LibHandle, 'SDL_GetGrabbedWindow')); If Not assigned(SDL_GetGrabbedWindow) Then result := false; - SDL_SetWindowBrightness := TSDL_SetWindowBrightness_fun(GetProcAddress(LibHandle, 'SDL_SetWindowBrightness')); + SDL_SetWindowBrightness := TSDL_SetWindowBrightness_func(GetProcAddress(LibHandle, 'SDL_SetWindowBrightness')); If Not assigned(SDL_SetWindowBrightness) Then result := false; - SDL_GetWindowBrightness := TSDL_GetWindowBrightness_fun(GetProcAddress(LibHandle, 'SDL_GetWindowBrightness')); + SDL_GetWindowBrightness := TSDL_GetWindowBrightness_func(GetProcAddress(LibHandle, 'SDL_GetWindowBrightness')); If Not assigned(SDL_GetWindowBrightness) Then result := false; - SDL_SetWindowOpacity := TSDL_SetWindowOpacity_fun(GetProcAddress(LibHandle, 'SDL_SetWindowOpacity')); + SDL_SetWindowOpacity := TSDL_SetWindowOpacity_func(GetProcAddress(LibHandle, 'SDL_SetWindowOpacity')); If Not assigned(SDL_SetWindowOpacity) Then result := false; - SDL_GetWindowOpacity := TSDL_GetWindowOpacity_fun(GetProcAddress(LibHandle, 'SDL_GetWindowOpacity')); + SDL_GetWindowOpacity := TSDL_GetWindowOpacity_func(GetProcAddress(LibHandle, 'SDL_GetWindowOpacity')); If Not assigned(SDL_GetWindowOpacity) Then result := false; - SDL_SetWindowModalFor := TSDL_SetWindowModalFor_fun(GetProcAddress(LibHandle, 'SDL_SetWindowModalFor')); + SDL_SetWindowModalFor := TSDL_SetWindowModalFor_func(GetProcAddress(LibHandle, 'SDL_SetWindowModalFor')); If Not assigned(SDL_SetWindowModalFor) Then result := false; - SDL_SetWindowInputFocus := TSDL_SetWindowInputFocus_fun(GetProcAddress(LibHandle, 'SDL_SetWindowInputFocus')); + SDL_SetWindowInputFocus := TSDL_SetWindowInputFocus_func(GetProcAddress(LibHandle, 'SDL_SetWindowInputFocus')); If Not assigned(SDL_SetWindowInputFocus) Then result := false; - SDL_SetWindowGammaRamp := TSDL_SetWindowGammaRamp_fun(GetProcAddress(LibHandle, 'SDL_SetWindowGammaRamp')); + SDL_SetWindowGammaRamp := TSDL_SetWindowGammaRamp_func(GetProcAddress(LibHandle, 'SDL_SetWindowGammaRamp')); If Not assigned(SDL_SetWindowGammaRamp) Then result := false; - SDL_GetWindowGammaRamp := TSDL_GetWindowGammaRamp_fun(GetProcAddress(LibHandle, 'SDL_GetWindowGammaRamp')); + SDL_GetWindowGammaRamp := TSDL_GetWindowGammaRamp_func(GetProcAddress(LibHandle, 'SDL_GetWindowGammaRamp')); If Not assigned(SDL_GetWindowGammaRamp) Then result := false; - SDL_SetWindowHitTest := TSDL_SetWindowHitTest_fun(GetProcAddress(LibHandle, 'SDL_SetWindowHitTest')); + SDL_SetWindowHitTest := TSDL_SetWindowHitTest_func(GetProcAddress(LibHandle, 'SDL_SetWindowHitTest')); If Not assigned(SDL_SetWindowHitTest) Then result := false; - SDL_FlashWindow := TSDL_FlashWindow_fun(GetProcAddress(LibHandle, 'SDL_FlashWindow')); + SDL_FlashWindow := TSDL_FlashWindow_func(GetProcAddress(LibHandle, 'SDL_FlashWindow')); If Not assigned(SDL_FlashWindow) Then result := false; SDL_DestroyWindow := TSDL_DestroyWindow_proc(GetProcAddress(LibHandle, 'SDL_DestroyWindow')); If Not assigned(SDL_DestroyWindow) Then result := false; - SDL_GL_LoadLibrary := TSDL_GL_LoadLibrary_fun(GetProcAddress(LibHandle, 'SDL_GL_LoadLibrary')); + SDL_GL_LoadLibrary := TSDL_GL_LoadLibrary_func(GetProcAddress(LibHandle, 'SDL_GL_LoadLibrary')); If Not assigned(SDL_GL_LoadLibrary) Then result := false; - SDL_GL_GetProcAddress := TSDL_GL_GetProcAddress_fun(GetProcAddress(LibHandle, 'SDL_GL_GetProcAddress')); + SDL_GL_GetProcAddress := TSDL_GL_GetProcAddress_func(GetProcAddress(LibHandle, 'SDL_GL_GetProcAddress')); If Not assigned(SDL_GL_GetProcAddress) Then result := false; - SDL_GL_ExtensionSupported := TSDL_GL_ExtensionSupported_fun(GetProcAddress(LibHandle, 'SDL_GL_ExtensionSupported')); + SDL_GL_ExtensionSupported := TSDL_GL_ExtensionSupported_func(GetProcAddress(LibHandle, 'SDL_GL_ExtensionSupported')); If Not assigned(SDL_GL_ExtensionSupported) Then result := false; SDL_GL_ResetAttributes := TSDL_GL_ResetAttributes_proc(GetProcAddress(LibHandle, 'SDL_GL_ResetAttributes')); If Not assigned(SDL_GL_ResetAttributes) Then result := false; - SDL_GL_SetAttribute := TSDL_GL_SetAttribute_fun(GetProcAddress(LibHandle, 'SDL_GL_SetAttribute')); + SDL_GL_SetAttribute := TSDL_GL_SetAttribute_func(GetProcAddress(LibHandle, 'SDL_GL_SetAttribute')); If Not assigned(SDL_GL_SetAttribute) Then result := false; - SDL_GL_GetAttribute := TSDL_GL_GetAttribute_fun(GetProcAddress(LibHandle, 'SDL_GL_GetAttribute')); + SDL_GL_GetAttribute := TSDL_GL_GetAttribute_func(GetProcAddress(LibHandle, 'SDL_GL_GetAttribute')); If Not assigned(SDL_GL_GetAttribute) Then result := false; - SDL_GL_CreateContext := TSDL_GL_CreateContext_fun(GetProcAddress(LibHandle, 'SDL_GL_CreateContext')); + SDL_GL_CreateContext := TSDL_GL_CreateContext_func(GetProcAddress(LibHandle, 'SDL_GL_CreateContext')); If Not assigned(SDL_GL_CreateContext) Then result := false; - SDL_GL_MakeCurrent := TSDL_GL_MakeCurrent_fun(GetProcAddress(LibHandle, 'SDL_GL_MakeCurrent')); + SDL_GL_MakeCurrent := TSDL_GL_MakeCurrent_func(GetProcAddress(LibHandle, 'SDL_GL_MakeCurrent')); If Not assigned(SDL_GL_MakeCurrent) Then result := false; SDL_GL_GetDrawableSize := TSDL_GL_GetDrawableSize_proc(GetProcAddress(LibHandle, 'SDL_GL_GetDrawableSize')); If Not assigned(SDL_GL_GetDrawableSize) Then result := false; - SDL_GL_SetSwapInterval := TSDL_GL_SetSwapInterval_fun(GetProcAddress(LibHandle, 'SDL_GL_SetSwapInterval')); + SDL_GL_SetSwapInterval := TSDL_GL_SetSwapInterval_func(GetProcAddress(LibHandle, 'SDL_GL_SetSwapInterval')); If Not assigned(SDL_GL_SetSwapInterval) Then result := false; SDL_GL_SwapWindow := TSDL_GL_SwapWindow_proc(GetProcAddress(LibHandle, 'SDL_GL_SwapWindow')); If Not assigned(SDL_GL_SwapWindow) Then result := false; diff --git a/units/sdlaudio.inc b/units/sdlaudio.inc index 7ababe1d..b6c3f871 100644 --- a/units/sdlaudio.inc +++ b/units/sdlaudio.inc @@ -244,9 +244,9 @@ function SDL_GetNumAudioDrivers: cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetAudioDriver_fun = function(index: cint): PAnsiChar; cdecl; + TSDL_GetAudioDriver_func = function(index: cint): PAnsiChar; cdecl; Var - SDL_GetAudioDriver : TSDL_GetAudioDriver_fun = Nil; + SDL_GetAudioDriver : TSDL_GetAudioDriver_func = Nil; {$else} function SDL_GetAudioDriver(index: cint): PAnsiChar; cdecl; @@ -278,9 +278,9 @@ function SDL_GetAudioDriver(index: cint): PAnsiChar; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_AudioInit_fun = function(driver_name: PAnsiChar): cint; cdecl; + TSDL_AudioInit_func = function(driver_name: PAnsiChar): cint; cdecl; Var - SDL_AudioInit : TSDL_AudioInit_fun = Nil; + SDL_AudioInit : TSDL_AudioInit_func = Nil; {$else} function SDL_AudioInit(driver_name: PAnsiChar): cint; cdecl; @@ -370,9 +370,9 @@ function SDL_GetCurrentAudioDriver: PAnsiChar; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_OpenAudio_fun = function(desired: PSDL_AudioSpec; obtained: PSDL_AudioSpec): cint; cdecl; + TSDL_OpenAudio_func = function(desired: PSDL_AudioSpec; obtained: PSDL_AudioSpec): cint; cdecl; Var - SDL_OpenAudio : TSDL_OpenAudio_fun = Nil; + SDL_OpenAudio : TSDL_OpenAudio_func = Nil; {$else} function SDL_OpenAudio(desired: PSDL_AudioSpec; obtained: PSDL_AudioSpec): cint; cdecl; @@ -439,9 +439,9 @@ type *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetNumAudioDevices_fun = function(iscapture: cint): cint; cdecl; + TSDL_GetNumAudioDevices_func = function(iscapture: cint): cint; cdecl; Var - SDL_GetNumAudioDevices : TSDL_GetNumAudioDevices_fun = Nil; + SDL_GetNumAudioDevices : TSDL_GetNumAudioDevices_func = Nil; {$else} function SDL_GetNumAudioDevices(iscapture: cint): cint; cdecl; @@ -475,9 +475,9 @@ function SDL_GetNumAudioDevices(iscapture: cint): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetAudioDeviceName_fun = function(index: cint; iscapture: cint): PAnsiChar; cdecl; + TSDL_GetAudioDeviceName_func = function(index: cint; iscapture: cint): PAnsiChar; cdecl; Var - SDL_GetAudioDeviceName : TSDL_GetAudioDeviceName_fun = Nil; + SDL_GetAudioDeviceName : TSDL_GetAudioDeviceName_func = Nil; {$else} function SDL_GetAudioDeviceName(index: cint; iscapture: cint): PAnsiChar; cdecl; @@ -509,9 +509,9 @@ function SDL_GetAudioDeviceName(index: cint; iscapture: cint): PAnsiChar; cdecl; } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetAudioDeviceSpec_fun = function(index: cint; iscapture: cint; spec: PSDL_AudioSpec): cint; cdecl; + TSDL_GetAudioDeviceSpec_func = function(index: cint; iscapture: cint; spec: PSDL_AudioSpec): cint; cdecl; Var - SDL_GetAudioDeviceSpec : TSDL_GetAudioDeviceSpec_fun = Nil; + SDL_GetAudioDeviceSpec : TSDL_GetAudioDeviceSpec_func = Nil; {$else} function SDL_GetAudioDeviceSpec(index: cint; iscapture: cint; spec: PSDL_AudioSpec): cint; cdecl; @@ -550,9 +550,9 @@ function SDL_GetAudioDeviceSpec(index: cint; iscapture: cint; spec: PSDL_AudioSp } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetDefaultAudioInfo_fun = function(name: PPAnsiChar; spec: PSDL_AudioSpec; iscapture: cint): cint; cdecl; + TSDL_GetDefaultAudioInfo_func = function(name: PPAnsiChar; spec: PSDL_AudioSpec; iscapture: cint): cint; cdecl; Var - SDL_GetDefaultAudioInfo : TSDL_GetDefaultAudioInfo_fun = Nil; + SDL_GetDefaultAudioInfo : TSDL_GetDefaultAudioInfo_func = Nil; {$else} function SDL_GetDefaultAudioInfo(name: PPAnsiChar; spec: PSDL_AudioSpec; iscapture: cint): cint; cdecl; @@ -672,13 +672,13 @@ function SDL_GetDefaultAudioInfo(name: PPAnsiChar; spec: PSDL_AudioSpec; iscaptu *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_OpenAudioDevice_fun = function(device: PAnsiChar; + TSDL_OpenAudioDevice_func = function(device: PAnsiChar; iscapture: cint; desired: PSDL_AudioSpec; obtained: PSDL_AudioSpec; allowed_changes: cint): TSDL_AudioDeviceID; cdecl; Var - SDL_OpenAudioDevice : TSDL_OpenAudioDevice_fun = Nil; + SDL_OpenAudioDevice : TSDL_OpenAudioDevice_func = Nil; {$else} function SDL_OpenAudioDevice(device: PAnsiChar; @@ -739,9 +739,9 @@ function SDL_GetAudioStatus: TSDL_AudioStatus; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetAudioDeviceStatus_fun = function(dev: TSDL_AudioDeviceID): TSDL_AudioStatus; cdecl; + TSDL_GetAudioDeviceStatus_func = function(dev: TSDL_AudioDeviceID): TSDL_AudioStatus; cdecl; Var - SDL_GetAudioDeviceStatus : TSDL_GetAudioDeviceStatus_fun = Nil; + SDL_GetAudioDeviceStatus : TSDL_GetAudioDeviceStatus_func = Nil; {$else} function SDL_GetAudioDeviceStatus(dev: TSDL_AudioDeviceID): TSDL_AudioStatus; cdecl; @@ -914,13 +914,13 @@ procedure SDL_PauseAudioDevice(dev: TSDL_AudioDeviceID; pause_on: cint); cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_LoadWAV_RW_fun = function(src: PSDL_RWops; + TSDL_LoadWAV_RW_func = function(src: PSDL_RWops; freesrc: cint; spec: PSDL_AudioSpec; audio_buf: ppcuint8; audio_len: pcuint32): PSDL_AudioSpec; cdecl; Var - SDL_LoadWAV_RW : TSDL_LoadWAV_RW_fun = Nil; + SDL_LoadWAV_RW : TSDL_LoadWAV_RW_func = Nil; {$else} function SDL_LoadWAV_RW(src: PSDL_RWops; @@ -997,7 +997,7 @@ procedure SDL_FreeWAV(audio_buf: pcuint8); cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_BuildAudioCVT_fun = function(cvt: PSDL_AudioCVT; + TSDL_BuildAudioCVT_func = function(cvt: PSDL_AudioCVT; src_format: TSDL_AudioFormat; src_channels: cuint8; src_rate: cint; @@ -1005,7 +1005,7 @@ Type dst_channels: cuint8; dst_rate: cint): cint; cdecl; Var - SDL_BuildAudioCVT : TSDL_BuildAudioCVT_fun = Nil; + SDL_BuildAudioCVT : TSDL_BuildAudioCVT_func = Nil; {$else} function SDL_BuildAudioCVT(cvt: PSDL_AudioCVT; @@ -1058,9 +1058,9 @@ function SDL_BuildAudioCVT(cvt: PSDL_AudioCVT; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_ConvertAudio_fun = function(cvt: PSDL_AudioCVT): cint; cdecl; + TSDL_ConvertAudio_func = function(cvt: PSDL_AudioCVT): cint; cdecl; Var - SDL_ConvertAudio : TSDL_ConvertAudio_fun = Nil; + SDL_ConvertAudio : TSDL_ConvertAudio_func = Nil; {$else} function SDL_ConvertAudio(cvt: PSDL_AudioCVT): cint; cdecl; @@ -1100,10 +1100,10 @@ type } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_NewAudioStream_fun = function(src_format: TSDL_AudioFormat; src_channels: cuint8; src_rate: cint; dst_format: TSDL_AudioFormat; dst_channels: cuint8; + TSDL_NewAudioStream_func = function(src_format: TSDL_AudioFormat; src_channels: cuint8; src_rate: cint; dst_format: TSDL_AudioFormat; dst_channels: cuint8; dst_rate: cint): PSDL_AudioStream; cdecl; Var - SDL_NewAudioStream : TSDL_NewAudioStream_fun = Nil; + SDL_NewAudioStream : TSDL_NewAudioStream_func = Nil; {$else} function SDL_NewAudioStream(src_format: TSDL_AudioFormat; src_channels: cuint8; src_rate: cint; dst_format: TSDL_AudioFormat; dst_channels: cuint8; @@ -1130,9 +1130,9 @@ function SDL_NewAudioStream(src_format: TSDL_AudioFormat; src_channels: cuint8; } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_AudioStreamPut_fun = function(stream: PSDL_AudioStream; buf: pointer; len: cint): cint; cdecl; + TSDL_AudioStreamPut_func = function(stream: PSDL_AudioStream; buf: pointer; len: cint): cint; cdecl; Var - SDL_AudioStreamPut : TSDL_AudioStreamPut_fun = Nil; + SDL_AudioStreamPut : TSDL_AudioStreamPut_func = Nil; {$else} function SDL_AudioStreamPut(stream: PSDL_AudioStream; buf: pointer; len: cint): cint; cdecl; @@ -1158,9 +1158,9 @@ function SDL_AudioStreamPut(stream: PSDL_AudioStream; buf: pointer; len: cint): } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_AudioStreamGet_fun = function(stream: PSDL_AudioStream; buf: pointer; len: cint): cint; cdecl; + TSDL_AudioStreamGet_func = function(stream: PSDL_AudioStream; buf: pointer; len: cint): cint; cdecl; Var - SDL_AudioStreamGet : TSDL_AudioStreamGet_fun = Nil; + SDL_AudioStreamGet : TSDL_AudioStreamGet_func = Nil; {$else} function SDL_AudioStreamGet(stream: PSDL_AudioStream; buf: pointer; len: cint): cint; cdecl; @@ -1185,9 +1185,9 @@ function SDL_AudioStreamGet(stream: PSDL_AudioStream; buf: pointer; len: cint): } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_AudioStreamAvailable_fun = function(stream: PSDL_AudioStream): cint; cdecl; + TSDL_AudioStreamAvailable_func = function(stream: PSDL_AudioStream): cint; cdecl; Var - SDL_AudioStreamAvailable : TSDL_AudioStreamAvailable_fun = Nil; + SDL_AudioStreamAvailable : TSDL_AudioStreamAvailable_func = Nil; {$else} function SDL_AudioStreamAvailable(stream: PSDL_AudioStream): cint; cdecl; @@ -1213,9 +1213,9 @@ function SDL_AudioStreamAvailable(stream: PSDL_AudioStream): cint; cdecl; } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_AudioStreamFlush_fun = function(stream: PSDL_AudioStream): cint; cdecl; + TSDL_AudioStreamFlush_func = function(stream: PSDL_AudioStream): cint; cdecl; Var - SDL_AudioStreamFlush : TSDL_AudioStreamFlush_fun = Nil; + SDL_AudioStreamFlush : TSDL_AudioStreamFlush_func = Nil; {$else} function SDL_AudioStreamFlush(stream: PSDL_AudioStream): cint; cdecl; @@ -1393,9 +1393,9 @@ procedure SDL_MixAudioFormat(dst: pcuint8; src: pcuint8; format: TSDL_AudioForma *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_QueueAudio_fun = function(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): cint; cdecl; + TSDL_QueueAudio_func = function(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): cint; cdecl; Var - SDL_QueueAudio : TSDL_QueueAudio_fun = Nil; + SDL_QueueAudio : TSDL_QueueAudio_func = Nil; {$else} function SDL_QueueAudio(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): cint; cdecl; @@ -1450,9 +1450,9 @@ function SDL_QueueAudio(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): c *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_DequeueAudio_fun = function(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): cuint32; cdecl; + TSDL_DequeueAudio_func = function(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): cuint32; cdecl; Var - SDL_DequeueAudio : TSDL_DequeueAudio_fun = Nil; + SDL_DequeueAudio : TSDL_DequeueAudio_func = Nil; {$else} function SDL_DequeueAudio(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): cuint32; cdecl; @@ -1493,9 +1493,9 @@ function SDL_DequeueAudio(dev: TSDL_AudioDeviceID; data: Pointer; len: cuint32): *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetQueuedAudioSize_fun = function(dev: TSDL_AudioDeviceID): cuint32; cdecl; + TSDL_GetQueuedAudioSize_func = function(dev: TSDL_AudioDeviceID): cuint32; cdecl; Var - SDL_GetQueuedAudioSize : TSDL_GetQueuedAudioSize_fun = Nil; + SDL_GetQueuedAudioSize : TSDL_GetQueuedAudioSize_func = Nil; {$else} function SDL_GetQueuedAudioSize(dev: TSDL_AudioDeviceID): cuint32; cdecl; diff --git a/units/sdlblendmode.inc b/units/sdlblendmode.inc index 4c02df15..c4ea1b3c 100644 --- a/units/sdlblendmode.inc +++ b/units/sdlblendmode.inc @@ -80,9 +80,9 @@ const *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_ComposeCustomBlendMode_fun = function(srcColorFactor, dstColorFactor: TSDL_BlendFactor; colorOperation: TSDL_BlendOperation; srcAlphaFactor, dstAlphaFactor: TSDL_BlendFactor; alphaOperation: TSDL_BlendOperation): TSDL_BlendMode; cdecl; + TSDL_ComposeCustomBlendMode_func = function(srcColorFactor, dstColorFactor: TSDL_BlendFactor; colorOperation: TSDL_BlendOperation; srcAlphaFactor, dstAlphaFactor: TSDL_BlendFactor; alphaOperation: TSDL_BlendOperation): TSDL_BlendMode; cdecl; Var - SDL_ComposeCustomBlendMode : TSDL_ComposeCustomBlendMode_fun = Nil; + SDL_ComposeCustomBlendMode : TSDL_ComposeCustomBlendMode_func = Nil; {$else} function SDL_ComposeCustomBlendMode(srcColorFactor, dstColorFactor: TSDL_BlendFactor; colorOperation: TSDL_BlendOperation; srcAlphaFactor, dstAlphaFactor: TSDL_BlendFactor; alphaOperation: TSDL_BlendOperation): TSDL_BlendMode; cdecl; diff --git a/units/sdlclipboard.inc b/units/sdlclipboard.inc index db270916..b38b579d 100644 --- a/units/sdlclipboard.inc +++ b/units/sdlclipboard.inc @@ -21,9 +21,9 @@ } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetClipboardText_fun = function(text: PAnsiChar): cint; cdecl; + TSDL_SetClipboardText_func = function(text: PAnsiChar): cint; cdecl; Var - SDL_SetClipboardText : TSDL_SetClipboardText_fun = Nil; + SDL_SetClipboardText : TSDL_SetClipboardText_func = Nil; {$else} function SDL_SetClipboardText(text: PAnsiChar): cint; cdecl; @@ -48,9 +48,9 @@ function SDL_SetClipboardText(text: PAnsiChar): cint; cdecl; } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetClipboardText_fun = function(): PAnsiChar; cdecl; + TSDL_GetClipboardText_func = function(): PAnsiChar; cdecl; Var - SDL_GetClipboardText : TSDL_GetClipboardText_fun = Nil; + SDL_GetClipboardText : TSDL_GetClipboardText_func = Nil; {$else} function SDL_GetClipboardText(): PAnsiChar; cdecl; @@ -69,9 +69,9 @@ function SDL_GetClipboardText(): PAnsiChar; cdecl; } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HasClipboardText_fun = function(): TSDL_bool; cdecl; + TSDL_HasClipboardText_func = function(): TSDL_bool; cdecl; Var - SDL_HasClipboardText : TSDL_HasClipboardText_fun = Nil; + SDL_HasClipboardText : TSDL_HasClipboardText_func = Nil; {$else} function SDL_HasClipboardText(): TSDL_bool; cdecl; @@ -92,9 +92,9 @@ function SDL_HasClipboardText(): TSDL_bool; cdecl; } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetPrimarySelectionText_fun = function(text: PAnsiChar): cint; cdecl; + TSDL_SetPrimarySelectionText_func = function(text: PAnsiChar): cint; cdecl; Var - SDL_SetPrimarySelectionText : TSDL_SetPrimarySelectionText_fun = Nil; + SDL_SetPrimarySelectionText : TSDL_SetPrimarySelectionText_func = Nil; {$else} function SDL_SetPrimarySelectionText(text: PAnsiChar): cint; cdecl; @@ -120,9 +120,9 @@ function SDL_SetPrimarySelectionText(text: PAnsiChar): cint; cdecl; } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetPrimarySelectionText_fun = function(): PAnsiChar; cdecl; + TSDL_GetPrimarySelectionText_func = function(): PAnsiChar; cdecl; Var - SDL_GetPrimarySelectionText : TSDL_GetPrimarySelectionText_fun = Nil; + SDL_GetPrimarySelectionText : TSDL_GetPrimarySelectionText_func = Nil; {$else} function SDL_GetPrimarySelectionText(): PAnsiChar; cdecl; @@ -143,9 +143,9 @@ function SDL_GetPrimarySelectionText(): PAnsiChar; cdecl; } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HasPrimarySelectionText_fun = function(): TSDL_bool; cdecl; + TSDL_HasPrimarySelectionText_func = function(): TSDL_bool; cdecl; Var - SDL_HasPrimarySelectionText : TSDL_HasPrimarySelectionText_fun = Nil; + SDL_HasPrimarySelectionText : TSDL_HasPrimarySelectionText_func = Nil; {$else} function SDL_HasPrimarySelectionText(): TSDL_bool; cdecl; diff --git a/units/sdlcpuinfo.inc b/units/sdlcpuinfo.inc index afc8ba25..40e811cd 100644 --- a/units/sdlcpuinfo.inc +++ b/units/sdlcpuinfo.inc @@ -13,9 +13,9 @@ const *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetCPUCount_fun = function(): cint; cdecl; + TSDL_GetCPUCount_func = function(): cint; cdecl; Var - SDL_GetCPUCount : TSDL_GetCPUCount_fun = Nil; + SDL_GetCPUCount : TSDL_GetCPUCount_func = Nil; {$else} function SDL_GetCPUCount(): cint; cdecl; diff --git a/units/sdlerror.inc b/units/sdlerror.inc index 74e38a6b..8ac52f2a 100644 --- a/units/sdlerror.inc +++ b/units/sdlerror.inc @@ -15,9 +15,9 @@ *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetError_fun = function(const fmt: PAnsiChar; args: array of const): cint; cdecl; + TSDL_SetError_func = function(const fmt: PAnsiChar; args: array of const): cint; cdecl; Var - SDL_SetError : TSDL_SetError_fun = Nil; + SDL_SetError : TSDL_SetError_func = Nil; {$else} function SDL_SetError(const fmt: PAnsiChar; args: array of const): cint; cdecl; @@ -52,9 +52,9 @@ function SDL_GetError: PAnsiChar; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetErrorMsg_fun = function(const errstr: PAnsiChar; maxlen: cint): PAnsiChar; cdecl; + TSDL_GetErrorMsg_func = function(const errstr: PAnsiChar; maxlen: cint): PAnsiChar; cdecl; Var - SDL_GetErrorMsg : TSDL_GetErrorMsg_fun = Nil; + SDL_GetErrorMsg : TSDL_GetErrorMsg_func = Nil; {$else} function SDL_GetErrorMsg(const errstr: PAnsiChar; maxlen: cint): PAnsiChar; cdecl; @@ -92,9 +92,9 @@ type {* SDL_Error() unconditionally returns -1. *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_Error_fun = function(code: TSDL_ErrorCode): cint; cdecl; + TSDL_Error_func = function(code: TSDL_ErrorCode): cint; cdecl; Var - SDL_Error : TSDL_Error_fun = Nil; + SDL_Error : TSDL_Error_func = Nil; {$else} function SDL_Error(code: TSDL_ErrorCode): cint; cdecl; diff --git a/units/sdlfilesystem.inc b/units/sdlfilesystem.inc index 62d1baba..e8f84b78 100644 --- a/units/sdlfilesystem.inc +++ b/units/sdlfilesystem.inc @@ -44,9 +44,9 @@ } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetBasePath_fun = function(): PAnsiChar; cdecl; + TSDL_GetBasePath_func = function(): PAnsiChar; cdecl; Var - SDL_GetBasePath : TSDL_GetBasePath_fun = Nil; + SDL_GetBasePath : TSDL_GetBasePath_func = Nil; {$else} function SDL_GetBasePath(): PAnsiChar; cdecl; @@ -110,9 +110,9 @@ function SDL_GetBasePath(): PAnsiChar; cdecl; } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetPrefPath_fun = function(org: PAnsiChar; app: PAnsiChar): PAnsiChar; cdecl; + TSDL_GetPrefPath_func = function(org: PAnsiChar; app: PAnsiChar): PAnsiChar; cdecl; Var - SDL_GetPrefPath : TSDL_GetPrefPath_fun = Nil; + SDL_GetPrefPath : TSDL_GetPrefPath_func = Nil; {$else} function SDL_GetPrefPath(org: PAnsiChar; app: PAnsiChar): PAnsiChar; cdecl; diff --git a/units/sdlgamecontroller.inc b/units/sdlgamecontroller.inc index e861a785..da6ff91b 100644 --- a/units/sdlgamecontroller.inc +++ b/units/sdlgamecontroller.inc @@ -109,10 +109,10 @@ function SDL_GameControllerAddMapping( mappingString: PAnsiChar ): cint cdecl; e *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerAddMappingsFromRW_fun = function(rw: PSDL_RWops; freerw: cint32):cint32; + TSDL_GameControllerAddMappingsFromRW_func = function(rw: PSDL_RWops; freerw: cint32):cint32; cdecl; Var - SDL_GameControllerAddMappingsFromRW : TSDL_GameControllerAddMappingsFromRW_fun = Nil; + SDL_GameControllerAddMappingsFromRW : TSDL_GameControllerAddMappingsFromRW_func = Nil; {$else} function SDL_GameControllerAddMappingsFromRW(rw: PSDL_RWops; freerw: cint32):cint32; @@ -124,9 +124,9 @@ function SDL_GameControllerAddMappingsFromRW(rw: PSDL_RWops; freerw: cint32):cin *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerNumMappings_fun = function():cint; cdecl; + TSDL_GameControllerNumMappings_func = function():cint; cdecl; Var - SDL_GameControllerNumMappings : TSDL_GameControllerNumMappings_fun = Nil; + SDL_GameControllerNumMappings : TSDL_GameControllerNumMappings_func = Nil; {$else} function SDL_GameControllerNumMappings():cint; cdecl; @@ -148,9 +148,9 @@ function SDL_GameControllerMappingForGUID( guid: TSDL_JoystickGUID ): PAnsiChar *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerMappingForIndex_fun = function(mapping_index: cint): PAnsiChar; cdecl; + TSDL_GameControllerMappingForIndex_func = function(mapping_index: cint): PAnsiChar; cdecl; Var - SDL_GameControllerMappingForIndex : TSDL_GameControllerMappingForIndex_fun = Nil; + SDL_GameControllerMappingForIndex : TSDL_GameControllerMappingForIndex_func = Nil; {$else} function SDL_GameControllerMappingForIndex(mapping_index: cint): PAnsiChar; cdecl; @@ -195,9 +195,9 @@ function SDL_GameControllerNameForIndex(joystick_index: cint): PAnsiChar cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerPathForIndex_fun = function(joystick_index: cint): PAnsiChar; cdecl; + TSDL_GameControllerPathForIndex_func = function(joystick_index: cint): PAnsiChar; cdecl; Var - SDL_GameControllerPathForIndex : TSDL_GameControllerPathForIndex_fun = Nil; + SDL_GameControllerPathForIndex : TSDL_GameControllerPathForIndex_func = Nil; {$else} function SDL_GameControllerPathForIndex(joystick_index: cint): PAnsiChar; cdecl; @@ -210,9 +210,9 @@ function SDL_GameControllerPathForIndex(joystick_index: cint): PAnsiChar; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerTypeForIndex_fun = function(joystick_index: cint): TSDL_GameControllerType; cdecl; + TSDL_GameControllerTypeForIndex_func = function(joystick_index: cint): TSDL_GameControllerType; cdecl; Var - SDL_GameControllerTypeForIndex : TSDL_GameControllerTypeForIndex_fun = Nil; + SDL_GameControllerTypeForIndex : TSDL_GameControllerTypeForIndex_func = Nil; {$else} function SDL_GameControllerTypeForIndex(joystick_index: cint): TSDL_GameControllerType; cdecl; @@ -228,9 +228,9 @@ function SDL_GameControllerTypeForIndex(joystick_index: cint): TSDL_GameControll *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerMappingForDeviceIndex_fun = function(joystick_index: cint): PAnsiChar; cdecl; + TSDL_GameControllerMappingForDeviceIndex_func = function(joystick_index: cint): PAnsiChar; cdecl; Var - SDL_GameControllerMappingForDeviceIndex : TSDL_GameControllerMappingForDeviceIndex_fun = Nil; + SDL_GameControllerMappingForDeviceIndex : TSDL_GameControllerMappingForDeviceIndex_func = Nil; {$else} function SDL_GameControllerMappingForDeviceIndex(joystick_index: cint): PAnsiChar; cdecl; @@ -252,9 +252,9 @@ function SDL_GameControllerOpen(joystick_index: cint): PSDL_GameController cdecl *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerFromInstanceID_fun = function(joyid: TSDL_JoystickID): PSDL_GameController; cdecl; + TSDL_GameControllerFromInstanceID_func = function(joyid: TSDL_JoystickID): PSDL_GameController; cdecl; Var - SDL_GameControllerFromInstanceID : TSDL_GameControllerFromInstanceID_fun = Nil; + SDL_GameControllerFromInstanceID : TSDL_GameControllerFromInstanceID_func = Nil; {$else} function SDL_GameControllerFromInstanceID(joyid: TSDL_JoystickID): PSDL_GameController; cdecl; @@ -270,9 +270,9 @@ function SDL_GameControllerFromInstanceID(joyid: TSDL_JoystickID): PSDL_GameCont *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerFromPlayerIndex_fun = function(player_index: cint): PSDL_GameController; cdecl; + TSDL_GameControllerFromPlayerIndex_func = function(player_index: cint): PSDL_GameController; cdecl; Var - SDL_GameControllerFromPlayerIndex : TSDL_GameControllerFromPlayerIndex_fun = Nil; + SDL_GameControllerFromPlayerIndex : TSDL_GameControllerFromPlayerIndex_func = Nil; {$else} function SDL_GameControllerFromPlayerIndex(player_index: cint): PSDL_GameController; cdecl; @@ -301,9 +301,9 @@ function SDL_GameControllerName(gamecontroller: PSDL_GameController): PAnsiChar *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerPath_fun = function(gamecontroller: PSDL_GameController): PAnsiChar; cdecl; + TSDL_GameControllerPath_func = function(gamecontroller: PSDL_GameController): PAnsiChar; cdecl; Var - SDL_GameControllerPath : TSDL_GameControllerPath_fun = Nil; + SDL_GameControllerPath : TSDL_GameControllerPath_func = Nil; {$else} function SDL_GameControllerPath(gamecontroller: PSDL_GameController): PAnsiChar; cdecl; @@ -318,9 +318,9 @@ function SDL_GameControllerPath(gamecontroller: PSDL_GameController): PAnsiChar; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerGetType_fun = function(gamecontroller: PSDL_GameController): TSDL_GameControllerType; cdecl; + TSDL_GameControllerGetType_func = function(gamecontroller: PSDL_GameController): TSDL_GameControllerType; cdecl; Var - SDL_GameControllerGetType : TSDL_GameControllerGetType_fun = Nil; + SDL_GameControllerGetType : TSDL_GameControllerGetType_func = Nil; {$else} function SDL_GameControllerGetType(gamecontroller: PSDL_GameController): TSDL_GameControllerType; cdecl; @@ -335,9 +335,9 @@ function SDL_GameControllerGetType(gamecontroller: PSDL_GameController): TSDL_Ga *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerGetPlayerIndex_fun = function(gamecontroller: PSDL_GameController): cint; cdecl; + TSDL_GameControllerGetPlayerIndex_func = function(gamecontroller: PSDL_GameController): cint; cdecl; Var - SDL_GameControllerGetPlayerIndex : TSDL_GameControllerGetPlayerIndex_fun = Nil; + SDL_GameControllerGetPlayerIndex : TSDL_GameControllerGetPlayerIndex_func = Nil; {$else} function SDL_GameControllerGetPlayerIndex(gamecontroller: PSDL_GameController): cint; cdecl; @@ -370,9 +370,9 @@ procedure SDL_GameControllerSetPlayerIndex(gamecontroller: PSDL_GameController; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerGetVendor_fun = function(gamecontroller: PSDL_GameController): cuint16; cdecl; + TSDL_GameControllerGetVendor_func = function(gamecontroller: PSDL_GameController): cuint16; cdecl; Var - SDL_GameControllerGetVendor : TSDL_GameControllerGetVendor_fun = Nil; + SDL_GameControllerGetVendor : TSDL_GameControllerGetVendor_func = Nil; {$else} function SDL_GameControllerGetVendor(gamecontroller: PSDL_GameController): cuint16; cdecl; @@ -385,9 +385,9 @@ function SDL_GameControllerGetVendor(gamecontroller: PSDL_GameController): cuint *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerGetProduct_fun = function(gamecontroller: PSDL_GameController): cuint16; cdecl; + TSDL_GameControllerGetProduct_func = function(gamecontroller: PSDL_GameController): cuint16; cdecl; Var - SDL_GameControllerGetProduct : TSDL_GameControllerGetProduct_fun = Nil; + SDL_GameControllerGetProduct : TSDL_GameControllerGetProduct_func = Nil; {$else} function SDL_GameControllerGetProduct(gamecontroller: PSDL_GameController): cuint16; cdecl; @@ -400,9 +400,9 @@ function SDL_GameControllerGetProduct(gamecontroller: PSDL_GameController): cuin *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerGetProductVersion_fun = function(gamecontroller: PSDL_GameController): cuint16; cdecl; + TSDL_GameControllerGetProductVersion_func = function(gamecontroller: PSDL_GameController): cuint16; cdecl; Var - SDL_GameControllerGetProductVersion : TSDL_GameControllerGetProductVersion_fun = Nil; + SDL_GameControllerGetProductVersion : TSDL_GameControllerGetProductVersion_func = Nil; {$else} function SDL_GameControllerGetProductVersion(gamecontroller: PSDL_GameController): cuint16; cdecl; @@ -421,9 +421,9 @@ function SDL_GameControllerGetProductVersion(gamecontroller: PSDL_GameController *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerGetFirmwareVersion_fun = function(gamecontroller: PSDL_GameController): cuint16; cdecl; + TSDL_GameControllerGetFirmwareVersion_func = function(gamecontroller: PSDL_GameController): cuint16; cdecl; Var - SDL_GameControllerGetFirmwareVersion : TSDL_GameControllerGetFirmwareVersion_fun = Nil; + SDL_GameControllerGetFirmwareVersion : TSDL_GameControllerGetFirmwareVersion_func = Nil; {$else} function SDL_GameControllerGetFirmwareVersion(gamecontroller: PSDL_GameController): cuint16; cdecl; @@ -438,9 +438,9 @@ function SDL_GameControllerGetFirmwareVersion(gamecontroller: PSDL_GameControlle *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerGetSerial_fun = function(gamecontroller: PSDL_GameController): PAnsiChar; cdecl; + TSDL_GameControllerGetSerial_func = function(gamecontroller: PSDL_GameController): PAnsiChar; cdecl; Var - SDL_GameControllerGetSerial : TSDL_GameControllerGetSerial_fun = Nil; + SDL_GameControllerGetSerial : TSDL_GameControllerGetSerial_func = Nil; {$else} function SDL_GameControllerGetSerial(gamecontroller: PSDL_GameController): PAnsiChar; cdecl; @@ -460,9 +460,9 @@ function SDL_GameControllerGetSerial(gamecontroller: PSDL_GameController): PAnsi *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerGetSteamHandle_fun = function(gamecontroller: PSDL_GameController): cuint64; cdecl; + TSDL_GameControllerGetSteamHandle_func = function(gamecontroller: PSDL_GameController): cuint64; cdecl; Var - SDL_GameControllerGetSteamHandle : TSDL_GameControllerGetSteamHandle_fun = Nil; + SDL_GameControllerGetSteamHandle : TSDL_GameControllerGetSteamHandle_func = Nil; {$else} function SDL_GameControllerGetSteamHandle(gamecontroller: PSDL_GameController): cuint64; cdecl; @@ -540,9 +540,9 @@ function SDL_GameControllerGetBindForAxis(gamecontroller: PSDL_GameController; a *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerHasAxis_fun = function(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): TSDL_Bool; cdecl; + TSDL_GameControllerHasAxis_func = function(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): TSDL_Bool; cdecl; Var - SDL_GameControllerHasAxis : TSDL_GameControllerHasAxis_fun = Nil; + SDL_GameControllerHasAxis : TSDL_GameControllerHasAxis_func = Nil; {$else} function SDL_GameControllerHasAxis(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): TSDL_Bool; cdecl; @@ -613,9 +613,9 @@ function SDL_GameControllerGetBindForButton(gamecontroller: PSDL_GameController; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerHasButton_fun = function(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): TSDL_Bool; cdecl; + TSDL_GameControllerHasButton_func = function(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): TSDL_Bool; cdecl; Var - SDL_GameControllerHasButton : TSDL_GameControllerHasButton_fun = Nil; + SDL_GameControllerHasButton : TSDL_GameControllerHasButton_func = Nil; {$else} function SDL_GameControllerHasButton(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): TSDL_Bool; cdecl; @@ -634,9 +634,9 @@ function SDL_GameControllerGetButton(gamecontroller: PSDL_GameController; button *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerGetNumTouchpads_fun = function(gamecontroller: PSDL_GameController): cint; cdecl; + TSDL_GameControllerGetNumTouchpads_func = function(gamecontroller: PSDL_GameController): cint; cdecl; Var - SDL_GameControllerGetNumTouchpads : TSDL_GameControllerGetNumTouchpads_fun = Nil; + SDL_GameControllerGetNumTouchpads : TSDL_GameControllerGetNumTouchpads_func = Nil; {$else} function SDL_GameControllerGetNumTouchpads(gamecontroller: PSDL_GameController): cint; cdecl; @@ -648,9 +648,9 @@ function SDL_GameControllerGetNumTouchpads(gamecontroller: PSDL_GameController): *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerGetNumTouchpadFingers_fun = function(gamecontroller: PSDL_GameController; touchpad: cint): cint; cdecl; + TSDL_GameControllerGetNumTouchpadFingers_func = function(gamecontroller: PSDL_GameController; touchpad: cint): cint; cdecl; Var - SDL_GameControllerGetNumTouchpadFingers : TSDL_GameControllerGetNumTouchpadFingers_fun = Nil; + SDL_GameControllerGetNumTouchpadFingers : TSDL_GameControllerGetNumTouchpadFingers_func = Nil; {$else} function SDL_GameControllerGetNumTouchpadFingers(gamecontroller: PSDL_GameController; touchpad: cint): cint; cdecl; @@ -662,14 +662,14 @@ function SDL_GameControllerGetNumTouchpadFingers(gamecontroller: PSDL_GameContro *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerGetTouchpadFinger_fun = function( + TSDL_GameControllerGetTouchpadFinger_func = function( gamecontroller: PSDL_GameController; touchpad, finger: cint; state: pcuint8; x, y, pressure: pcfloat ): cint; cdecl; Var - SDL_GameControllerGetTouchpadFinger : TSDL_GameControllerGetTouchpadFinger_fun = Nil; + SDL_GameControllerGetTouchpadFinger : TSDL_GameControllerGetTouchpadFinger_func = Nil; {$else} function SDL_GameControllerGetTouchpadFinger( @@ -686,9 +686,9 @@ function SDL_GameControllerGetTouchpadFinger( *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerHasSensor_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): TSDL_Bool; cdecl; + TSDL_GameControllerHasSensor_func = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): TSDL_Bool; cdecl; Var - SDL_GameControllerHasSensor : TSDL_GameControllerHasSensor_fun = Nil; + SDL_GameControllerHasSensor : TSDL_GameControllerHasSensor_func = Nil; {$else} function SDL_GameControllerHasSensor(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): TSDL_Bool; cdecl; @@ -700,9 +700,9 @@ function SDL_GameControllerHasSensor(gamecontroller: PSDL_GameController; sensty *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerSetSensorEnabled_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; enabled: TSDL_bool): cint; cdecl; + TSDL_GameControllerSetSensorEnabled_func = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; enabled: TSDL_bool): cint; cdecl; Var - SDL_GameControllerSetSensorEnabled : TSDL_GameControllerSetSensorEnabled_fun = Nil; + SDL_GameControllerSetSensorEnabled : TSDL_GameControllerSetSensorEnabled_func = Nil; {$else} function SDL_GameControllerSetSensorEnabled(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; enabled: TSDL_bool): cint; cdecl; @@ -714,9 +714,9 @@ function SDL_GameControllerSetSensorEnabled(gamecontroller: PSDL_GameController; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerIsSensorEnabled_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): TSDL_Bool; cdecl; + TSDL_GameControllerIsSensorEnabled_func = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): TSDL_Bool; cdecl; Var - SDL_GameControllerIsSensorEnabled : TSDL_GameControllerIsSensorEnabled_fun = Nil; + SDL_GameControllerIsSensorEnabled : TSDL_GameControllerIsSensorEnabled_func = Nil; {$else} function SDL_GameControllerIsSensorEnabled(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): TSDL_Bool; cdecl; @@ -731,9 +731,9 @@ function SDL_GameControllerIsSensorEnabled(gamecontroller: PSDL_GameController; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerGetSensorDataRate_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): cfloat; cdecl; + TSDL_GameControllerGetSensorDataRate_func = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): cfloat; cdecl; Var - SDL_GameControllerGetSensorDataRate : TSDL_GameControllerGetSensorDataRate_fun = Nil; + SDL_GameControllerGetSensorDataRate : TSDL_GameControllerGetSensorDataRate_func = Nil; {$else} function SDL_GameControllerGetSensorDataRate(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType): cfloat; cdecl; @@ -748,9 +748,9 @@ function SDL_GameControllerGetSensorDataRate(gamecontroller: PSDL_GameController *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerGetSensorData_fun = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; data: pcfloat; num_values: cint): cint; cdecl; + TSDL_GameControllerGetSensorData_func = function(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; data: pcfloat; num_values: cint): cint; cdecl; Var - SDL_GameControllerGetSensorData : TSDL_GameControllerGetSensorData_fun = Nil; + SDL_GameControllerGetSensorData : TSDL_GameControllerGetSensorData_func = Nil; {$else} function SDL_GameControllerGetSensorData(gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; data: pcfloat; num_values: cint): cint; cdecl; @@ -776,7 +776,7 @@ function SDL_GameControllerGetSensorData(gamecontroller: PSDL_GameController; se *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerGetSensorDataWithTimestamp_fun = function( + TSDL_GameControllerGetSensorDataWithTimestamp_func = function( gamecontroller: PSDL_GameController; senstype: TSDL_SensorType; timestamp: pcuint64; @@ -784,7 +784,7 @@ Type num_values: cint ): cint; cdecl; Var - SDL_GameControllerGetSensorDataWithTimestamp : TSDL_GameControllerGetSensorDataWithTimestamp_fun = Nil; + SDL_GameControllerGetSensorDataWithTimestamp : TSDL_GameControllerGetSensorDataWithTimestamp_func = Nil; {$else} function SDL_GameControllerGetSensorDataWithTimestamp( @@ -802,9 +802,9 @@ function SDL_GameControllerGetSensorDataWithTimestamp( *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerHasRumble_fun = function(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; + TSDL_GameControllerHasRumble_func = function(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; Var - SDL_GameControllerHasRumble : TSDL_GameControllerHasRumble_fun = Nil; + SDL_GameControllerHasRumble : TSDL_GameControllerHasRumble_func = Nil; {$else} function SDL_GameControllerHasRumble(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; @@ -821,14 +821,14 @@ function SDL_GameControllerHasRumble(gamecontroller: PSDL_GameController): TSDL_ *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerRumble_fun = function( + TSDL_GameControllerRumble_func = function( gamecontroller: PSDL_GameController; low_frequency_rumble, high_frequency_rumble: cuint16; duration_ms: cuint32 ): cint; cdecl; Var - SDL_GameControllerRumble : TSDL_GameControllerRumble_fun = Nil; + SDL_GameControllerRumble : TSDL_GameControllerRumble_func = Nil; {$else} function SDL_GameControllerRumble( @@ -844,9 +844,9 @@ function SDL_GameControllerRumble( *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerHasRumbleTriggers_fun = function(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; + TSDL_GameControllerHasRumbleTriggers_func = function(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; Var - SDL_GameControllerHasRumbleTriggers : TSDL_GameControllerHasRumbleTriggers_fun = Nil; + SDL_GameControllerHasRumbleTriggers : TSDL_GameControllerHasRumbleTriggers_func = Nil; {$else} function SDL_GameControllerHasRumbleTriggers(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; @@ -868,14 +868,14 @@ function SDL_GameControllerHasRumbleTriggers(gamecontroller: PSDL_GameController *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerRumbleTriggers_fun = function( + TSDL_GameControllerRumbleTriggers_func = function( gamecontroller: PSDL_GameController; left_rumble, right_rumble: cuint16; duration_ms: cuint32 ): cint; cdecl; Var - SDL_GameControllerRumbleTriggers : TSDL_GameControllerRumbleTriggers_fun = Nil; + SDL_GameControllerRumbleTriggers : TSDL_GameControllerRumbleTriggers_func = Nil; {$else} function SDL_GameControllerRumbleTriggers( @@ -891,9 +891,9 @@ function SDL_GameControllerRumbleTriggers( *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerHasLED_fun = function(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; + TSDL_GameControllerHasLED_func = function(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; Var - SDL_GameControllerHasLED : TSDL_GameControllerHasLED_fun = Nil; + SDL_GameControllerHasLED : TSDL_GameControllerHasLED_func = Nil; {$else} function SDL_GameControllerHasLED(gamecontroller: PSDL_GameController): TSDL_Bool; cdecl; @@ -907,9 +907,9 @@ function SDL_GameControllerHasLED(gamecontroller: PSDL_GameController): TSDL_Boo *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerSetLED_fun = function(gamecontroller: PSDL_GameController; red, green, blue: cuint8): cint; cdecl; + TSDL_GameControllerSetLED_func = function(gamecontroller: PSDL_GameController; red, green, blue: cuint8): cint; cdecl; Var - SDL_GameControllerSetLED : TSDL_GameControllerSetLED_fun = Nil; + SDL_GameControllerSetLED : TSDL_GameControllerSetLED_func = Nil; {$else} function SDL_GameControllerSetLED(gamecontroller: PSDL_GameController; red, green, blue: cuint8): cint; cdecl; @@ -924,9 +924,9 @@ function SDL_GameControllerSetLED(gamecontroller: PSDL_GameController; red, gree *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerSendEffect_fun = function(gamecontroller: PSDL_GameController; data: Pointer; size: cint): cint; cdecl; + TSDL_GameControllerSendEffect_func = function(gamecontroller: PSDL_GameController; data: Pointer; size: cint): cint; cdecl; Var - SDL_GameControllerSendEffect : TSDL_GameControllerSendEffect_fun = Nil; + SDL_GameControllerSendEffect : TSDL_GameControllerSendEffect_func = Nil; {$else} function SDL_GameControllerSendEffect(gamecontroller: PSDL_GameController; data: Pointer; size: cint): cint; cdecl; @@ -947,9 +947,9 @@ procedure SDL_GameControllerClose(gamecontroller: PSDL_GameController) cdecl; ex *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerGetAppleSFSymbolsNameForAxis_fun = function(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): PAnsiChar; cdecl; + TSDL_GameControllerGetAppleSFSymbolsNameForAxis_func = function(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): PAnsiChar; cdecl; Var - SDL_GameControllerGetAppleSFSymbolsNameForAxis : TSDL_GameControllerGetAppleSFSymbolsNameForAxis_fun = Nil; + SDL_GameControllerGetAppleSFSymbolsNameForAxis : TSDL_GameControllerGetAppleSFSymbolsNameForAxis_func = Nil; {$else} function SDL_GameControllerGetAppleSFSymbolsNameForAxis(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): PAnsiChar; cdecl; @@ -965,9 +965,9 @@ function SDL_GameControllerGetAppleSFSymbolsNameForAxis(gamecontroller: PSDL_Gam *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GameControllerGetAppleSFSymbolsNameForButton_fun = function(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): PAnsiChar; cdecl; + TSDL_GameControllerGetAppleSFSymbolsNameForButton_func = function(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): PAnsiChar; cdecl; Var - SDL_GameControllerGetAppleSFSymbolsNameForButton : TSDL_GameControllerGetAppleSFSymbolsNameForButton_fun = Nil; + SDL_GameControllerGetAppleSFSymbolsNameForButton : TSDL_GameControllerGetAppleSFSymbolsNameForButton_func = Nil; {$else} function SDL_GameControllerGetAppleSFSymbolsNameForButton(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): PAnsiChar; cdecl; diff --git a/units/sdlgesture.inc b/units/sdlgesture.inc index 0244efe1..d170932c 100644 --- a/units/sdlgesture.inc +++ b/units/sdlgesture.inc @@ -22,9 +22,9 @@ type *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RecordGesture_fun = function(touchId: TSDL_TouchID): cint; cdecl; + TSDL_RecordGesture_func = function(touchId: TSDL_TouchID): cint; cdecl; Var - SDL_RecordGesture : TSDL_RecordGesture_fun = Nil; + SDL_RecordGesture : TSDL_RecordGesture_func = Nil; {$else} function SDL_RecordGesture(touchId: TSDL_TouchID): cint; cdecl; @@ -45,9 +45,9 @@ function SDL_RecordGesture(touchId: TSDL_TouchID): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SaveAllDollarTemplates_fun = function(dst: PSDL_RWops): cint; cdecl; + TSDL_SaveAllDollarTemplates_func = function(dst: PSDL_RWops): cint; cdecl; Var - SDL_SaveAllDollarTemplates : TSDL_SaveAllDollarTemplates_fun = Nil; + SDL_SaveAllDollarTemplates : TSDL_SaveAllDollarTemplates_func = Nil; {$else} function SDL_SaveAllDollarTemplates(dst: PSDL_RWops): cint; cdecl; @@ -69,9 +69,9 @@ function SDL_SaveAllDollarTemplates(dst: PSDL_RWops): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SaveDollarTemplate_fun = function(gestureId: TSDL_GestureID; dst: PSDL_RWops): cint; cdecl; + TSDL_SaveDollarTemplate_func = function(gestureId: TSDL_GestureID; dst: PSDL_RWops): cint; cdecl; Var - SDL_SaveDollarTemplate : TSDL_SaveDollarTemplate_fun = Nil; + SDL_SaveDollarTemplate : TSDL_SaveDollarTemplate_func = Nil; {$else} function SDL_SaveDollarTemplate(gestureId: TSDL_GestureID; dst: PSDL_RWops): cint; cdecl; @@ -94,9 +94,9 @@ function SDL_SaveDollarTemplate(gestureId: TSDL_GestureID; dst: PSDL_RWops): cin *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_LoadDollarTemplates_fun = function(touchId: TSDL_TouchID; src: PSDL_RWops): cint; cdecl; + TSDL_LoadDollarTemplates_func = function(touchId: TSDL_TouchID; src: PSDL_RWops): cint; cdecl; Var - SDL_LoadDollarTemplates : TSDL_LoadDollarTemplates_fun = Nil; + SDL_LoadDollarTemplates : TSDL_LoadDollarTemplates_func = Nil; {$else} function SDL_LoadDollarTemplates(touchId: TSDL_TouchID; src: PSDL_RWops): cint; cdecl; diff --git a/units/sdlguid.inc b/units/sdlguid.inc index 1174eeb3..5ce96d1f 100644 --- a/units/sdlguid.inc +++ b/units/sdlguid.inc @@ -66,9 +66,9 @@ procedure SDL_GUIDToString(guid: TSDL_GUID; pszGUID: PAnsiChar; cbGUID: cint); c *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GUIDFromString_fun = function(const pchGUID: PAnsiChar): TSDL_GUID; cdecl; + TSDL_GUIDFromString_func = function(const pchGUID: PAnsiChar): TSDL_GUID; cdecl; Var - SDL_GUIDFromString : TSDL_GUIDFromString_fun = Nil; + SDL_GUIDFromString : TSDL_GUIDFromString_func = Nil; {$else} function SDL_GUIDFromString(const pchGUID: PAnsiChar): TSDL_GUID; cdecl; diff --git a/units/sdlhaptic.inc b/units/sdlhaptic.inc index 94c3dba2..5dafc467 100644 --- a/units/sdlhaptic.inc +++ b/units/sdlhaptic.inc @@ -821,9 +821,9 @@ function SDL_NumHaptics: cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticName_fun = function(device_index: cint): PAnsiChar; cdecl; + TSDL_HapticName_func = function(device_index: cint): PAnsiChar; cdecl; Var - SDL_HapticName : TSDL_HapticName_fun = Nil; + SDL_HapticName : TSDL_HapticName_func = Nil; {$else} function SDL_HapticName(device_index: cint): PAnsiChar; cdecl; @@ -857,9 +857,9 @@ function SDL_HapticName(device_index: cint): PAnsiChar; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticOpen_fun = function(device_index: cint): PSDL_Haptic; cdecl; + TSDL_HapticOpen_func = function(device_index: cint): PSDL_Haptic; cdecl; Var - SDL_HapticOpen : TSDL_HapticOpen_fun = Nil; + SDL_HapticOpen : TSDL_HapticOpen_func = Nil; {$else} function SDL_HapticOpen(device_index: cint): PSDL_Haptic; cdecl; @@ -880,9 +880,9 @@ function SDL_HapticOpen(device_index: cint): PSDL_Haptic; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticOpened_fun = function(device_index: cint): cint; cdecl; + TSDL_HapticOpened_func = function(device_index: cint): cint; cdecl; Var - SDL_HapticOpened : TSDL_HapticOpened_fun = Nil; + SDL_HapticOpened : TSDL_HapticOpened_func = Nil; {$else} function SDL_HapticOpened(device_index: cint): cint; cdecl; @@ -903,9 +903,9 @@ function SDL_HapticOpened(device_index: cint): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticIndex_fun = function(haptic: PSDL_Haptic): cint; cdecl; + TSDL_HapticIndex_func = function(haptic: PSDL_Haptic): cint; cdecl; Var - SDL_HapticIndex : TSDL_HapticIndex_fun = Nil; + SDL_HapticIndex : TSDL_HapticIndex_func = Nil; {$else} function SDL_HapticIndex(haptic: PSDL_Haptic): cint; cdecl; @@ -952,9 +952,9 @@ function SDL_HapticOpenFromMouse: PSDL_Haptic; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickIsHaptic_fun = function(joystick: PSDL_Joystick): cint; cdecl; + TSDL_JoystickIsHaptic_func = function(joystick: PSDL_Joystick): cint; cdecl; Var - SDL_JoystickIsHaptic : TSDL_JoystickIsHaptic_fun = Nil; + SDL_JoystickIsHaptic : TSDL_JoystickIsHaptic_func = Nil; {$else} function SDL_JoystickIsHaptic(joystick: PSDL_Joystick): cint; cdecl; @@ -984,9 +984,9 @@ function SDL_JoystickIsHaptic(joystick: PSDL_Joystick): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticOpenFromJoystick_fun = function(joystick: PSDL_Joystick): PSDL_Haptic; cdecl; + TSDL_HapticOpenFromJoystick_func = function(joystick: PSDL_Joystick): PSDL_Haptic; cdecl; Var - SDL_HapticOpenFromJoystick : TSDL_HapticOpenFromJoystick_fun = Nil; + SDL_HapticOpenFromJoystick : TSDL_HapticOpenFromJoystick_func = Nil; {$else} function SDL_HapticOpenFromJoystick(joystick: PSDL_Joystick): PSDL_Haptic; cdecl; @@ -1031,9 +1031,9 @@ procedure SDL_HapticClose(haptic: PSDL_Haptic); cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticNumEffects_fun = function(haptic: PSDL_Haptic): cint; cdecl; + TSDL_HapticNumEffects_func = function(haptic: PSDL_Haptic): cint; cdecl; Var - SDL_HapticNumEffects : TSDL_HapticNumEffects_fun = Nil; + SDL_HapticNumEffects : TSDL_HapticNumEffects_func = Nil; {$else} function SDL_HapticNumEffects(haptic: PSDL_Haptic): cint; cdecl; @@ -1057,9 +1057,9 @@ function SDL_HapticNumEffects(haptic: PSDL_Haptic): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticNumEffectsPlaying_fun = function(haptic: PSDL_Haptic): cint; cdecl; + TSDL_HapticNumEffectsPlaying_func = function(haptic: PSDL_Haptic): cint; cdecl; Var - SDL_HapticNumEffectsPlaying : TSDL_HapticNumEffectsPlaying_fun = Nil; + SDL_HapticNumEffectsPlaying : TSDL_HapticNumEffectsPlaying_func = Nil; {$else} function SDL_HapticNumEffectsPlaying(haptic: PSDL_Haptic): cint; cdecl; @@ -1080,9 +1080,9 @@ function SDL_HapticNumEffectsPlaying(haptic: PSDL_Haptic): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticQuery_fun = function(haptic: PSDL_Haptic): cint; cdecl; + TSDL_HapticQuery_func = function(haptic: PSDL_Haptic): cint; cdecl; Var - SDL_HapticQuery : TSDL_HapticQuery_fun = Nil; + SDL_HapticQuery : TSDL_HapticQuery_func = Nil; {$else} function SDL_HapticQuery(haptic: PSDL_Haptic): cint; cdecl; @@ -1103,9 +1103,9 @@ function SDL_HapticQuery(haptic: PSDL_Haptic): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticNumAxes_fun = function(haptic: PSDL_Haptic): cint; cdecl; + TSDL_HapticNumAxes_func = function(haptic: PSDL_Haptic): cint; cdecl; Var - SDL_HapticNumAxes : TSDL_HapticNumAxes_fun = Nil; + SDL_HapticNumAxes : TSDL_HapticNumAxes_func = Nil; {$else} function SDL_HapticNumAxes(haptic: PSDL_Haptic): cint; cdecl; @@ -1128,9 +1128,9 @@ function SDL_HapticNumAxes(haptic: PSDL_Haptic): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticEffectSupported_fun = function(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): cint; cdecl; + TSDL_HapticEffectSupported_func = function(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): cint; cdecl; Var - SDL_HapticEffectSupported : TSDL_HapticEffectSupported_fun = Nil; + SDL_HapticEffectSupported : TSDL_HapticEffectSupported_func = Nil; {$else} function SDL_HapticEffectSupported(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): cint; cdecl; @@ -1154,9 +1154,9 @@ function SDL_HapticEffectSupported(haptic: PSDL_Haptic; effect: PSDL_HapticEffec *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticNewEffect_fun = function(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): cint; cdecl; + TSDL_HapticNewEffect_func = function(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): cint; cdecl; Var - SDL_HapticNewEffect : TSDL_HapticNewEffect_fun = Nil; + SDL_HapticNewEffect : TSDL_HapticNewEffect_func = Nil; {$else} function SDL_HapticNewEffect(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): cint; cdecl; @@ -1186,9 +1186,9 @@ function SDL_HapticNewEffect(haptic: PSDL_Haptic; effect: PSDL_HapticEffect): ci *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticUpdateEffect_fun = function(haptic: PSDL_Haptic; effect: cint; data: PSDL_HapticEffect): cint; cdecl; + TSDL_HapticUpdateEffect_func = function(haptic: PSDL_Haptic; effect: cint; data: PSDL_HapticEffect): cint; cdecl; Var - SDL_HapticUpdateEffect : TSDL_HapticUpdateEffect_fun = Nil; + SDL_HapticUpdateEffect : TSDL_HapticUpdateEffect_func = Nil; {$else} function SDL_HapticUpdateEffect(haptic: PSDL_Haptic; effect: cint; data: PSDL_HapticEffect): cint; cdecl; @@ -1219,9 +1219,9 @@ function SDL_HapticUpdateEffect(haptic: PSDL_Haptic; effect: cint; data: PSDL_Ha *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticRunEffect_fun = function(haptic: PSDL_Haptic; effect: cint; iterations: cuint32): cint; cdecl; + TSDL_HapticRunEffect_func = function(haptic: PSDL_Haptic; effect: cint; iterations: cuint32): cint; cdecl; Var - SDL_HapticRunEffect : TSDL_HapticRunEffect_fun = Nil; + SDL_HapticRunEffect : TSDL_HapticRunEffect_func = Nil; {$else} function SDL_HapticRunEffect(haptic: PSDL_Haptic; effect: cint; iterations: cuint32): cint; cdecl; @@ -1245,9 +1245,9 @@ function SDL_HapticRunEffect(haptic: PSDL_Haptic; effect: cint; iterations: cuin *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticStopEffect_fun = function(haptic: PSDL_Haptic; effect: cint): cint; cdecl; + TSDL_HapticStopEffect_func = function(haptic: PSDL_Haptic; effect: cint): cint; cdecl; Var - SDL_HapticStopEffect : TSDL_HapticStopEffect_fun = Nil; + SDL_HapticStopEffect : TSDL_HapticStopEffect_func = Nil; {$else} function SDL_HapticStopEffect(haptic: PSDL_Haptic; effect: cint): cint; cdecl; @@ -1295,9 +1295,9 @@ procedure SDL_HapticDestroyEffect(haptic: PSDL_Haptic; effect: cint); cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticGetEffectStatus_fun = function(haptic: PSDL_Haptic; effect: cint): cint; cdecl; + TSDL_HapticGetEffectStatus_func = function(haptic: PSDL_Haptic; effect: cint): cint; cdecl; Var - SDL_HapticGetEffectStatus : TSDL_HapticGetEffectStatus_fun = Nil; + SDL_HapticGetEffectStatus : TSDL_HapticGetEffectStatus_func = Nil; {$else} function SDL_HapticGetEffectStatus(haptic: PSDL_Haptic; effect: cint): cint; cdecl; @@ -1325,9 +1325,9 @@ function SDL_HapticGetEffectStatus(haptic: PSDL_Haptic; effect: cint): cint; cde *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticSetGain_fun = function(haptic: PSDL_Haptic; gain: cint): cint; cdecl; + TSDL_HapticSetGain_func = function(haptic: PSDL_Haptic; gain: cint): cint; cdecl; Var - SDL_HapticSetGain : TSDL_HapticSetGain_fun = Nil; + SDL_HapticSetGain : TSDL_HapticSetGain_func = Nil; {$else} function SDL_HapticSetGain(haptic: PSDL_Haptic; gain: cint): cint; cdecl; @@ -1353,9 +1353,9 @@ function SDL_HapticSetGain(haptic: PSDL_Haptic; gain: cint): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticSetAutocenter_fun = function(haptic: PSDL_Haptic; autocenter: cint): cint; cdecl; + TSDL_HapticSetAutocenter_func = function(haptic: PSDL_Haptic; autocenter: cint): cint; cdecl; Var - SDL_HapticSetAutocenter : TSDL_HapticSetAutocenter_fun = Nil; + SDL_HapticSetAutocenter : TSDL_HapticSetAutocenter_func = Nil; {$else} function SDL_HapticSetAutocenter(haptic: PSDL_Haptic; autocenter: cint): cint; cdecl; @@ -1381,9 +1381,9 @@ function SDL_HapticSetAutocenter(haptic: PSDL_Haptic; autocenter: cint): cint; c *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticPause_fun = function(haptic: PSDL_Haptic): cint; cdecl; + TSDL_HapticPause_func = function(haptic: PSDL_Haptic): cint; cdecl; Var - SDL_HapticPause : TSDL_HapticPause_fun = Nil; + SDL_HapticPause : TSDL_HapticPause_func = Nil; {$else} function SDL_HapticPause(haptic: PSDL_Haptic): cint; cdecl; @@ -1405,9 +1405,9 @@ function SDL_HapticPause(haptic: PSDL_Haptic): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticUnpause_fun = function(haptic: PSDL_Haptic): cint; cdecl; + TSDL_HapticUnpause_func = function(haptic: PSDL_Haptic): cint; cdecl; Var - SDL_HapticUnpause : TSDL_HapticUnpause_fun = Nil; + SDL_HapticUnpause : TSDL_HapticUnpause_func = Nil; {$else} function SDL_HapticUnpause(haptic: PSDL_Haptic): cint; cdecl; @@ -1425,9 +1425,9 @@ function SDL_HapticUnpause(haptic: PSDL_Haptic): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticStopAll_fun = function(haptic: PSDL_Haptic): cint; cdecl; + TSDL_HapticStopAll_func = function(haptic: PSDL_Haptic): cint; cdecl; Var - SDL_HapticStopAll : TSDL_HapticStopAll_fun = Nil; + SDL_HapticStopAll : TSDL_HapticStopAll_func = Nil; {$else} function SDL_HapticStopAll(haptic: PSDL_Haptic): cint; cdecl; @@ -1450,9 +1450,9 @@ function SDL_HapticStopAll(haptic: PSDL_Haptic): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticRumbleSupported_fun = function(haptic: PSDL_Haptic): cint; cdecl; + TSDL_HapticRumbleSupported_func = function(haptic: PSDL_Haptic): cint; cdecl; Var - SDL_HapticRumbleSupported : TSDL_HapticRumbleSupported_fun = Nil; + SDL_HapticRumbleSupported : TSDL_HapticRumbleSupported_func = Nil; {$else} function SDL_HapticRumbleSupported(haptic: PSDL_Haptic): cint; cdecl; @@ -1475,9 +1475,9 @@ function SDL_HapticRumbleSupported(haptic: PSDL_Haptic): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticRumbleInit_fun = function(haptic: PSDL_Haptic): cint; cdecl; + TSDL_HapticRumbleInit_func = function(haptic: PSDL_Haptic): cint; cdecl; Var - SDL_HapticRumbleInit : TSDL_HapticRumbleInit_fun = Nil; + SDL_HapticRumbleInit : TSDL_HapticRumbleInit_func = Nil; {$else} function SDL_HapticRumbleInit(haptic: PSDL_Haptic): cint; cdecl; @@ -1501,9 +1501,9 @@ function SDL_HapticRumbleInit(haptic: PSDL_Haptic): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticRumblePlay_fun = function(haptic: PSDL_Haptic; strength: cfloat; length: cuint32): cint; cdecl; + TSDL_HapticRumblePlay_func = function(haptic: PSDL_Haptic; strength: cfloat; length: cuint32): cint; cdecl; Var - SDL_HapticRumblePlay : TSDL_HapticRumblePlay_fun = Nil; + SDL_HapticRumblePlay : TSDL_HapticRumblePlay_func = Nil; {$else} function SDL_HapticRumblePlay(haptic: PSDL_Haptic; strength: cfloat; length: cuint32): cint; cdecl; @@ -1525,9 +1525,9 @@ function SDL_HapticRumblePlay(haptic: PSDL_Haptic; strength: cfloat; length: cui *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HapticRumbleStop_fun = function(haptic: PSDL_Haptic): cint; cdecl; + TSDL_HapticRumbleStop_func = function(haptic: PSDL_Haptic): cint; cdecl; Var - SDL_HapticRumbleStop : TSDL_HapticRumbleStop_fun = Nil; + SDL_HapticRumbleStop : TSDL_HapticRumbleStop_func = Nil; {$else} function SDL_HapticRumbleStop(haptic: PSDL_Haptic): cint; cdecl; diff --git a/units/sdlhints.inc b/units/sdlhints.inc index 6955eaf3..3f3128bb 100644 --- a/units/sdlhints.inc +++ b/units/sdlhints.inc @@ -2417,9 +2417,9 @@ const */} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetHintWithPriority_fun = function(const name: PAnsiChar; const value: PAnsiChar; priority: TSDL_HintPriority): TSDL_Bool; cdecl; + TSDL_SetHintWithPriority_func = function(const name: PAnsiChar; const value: PAnsiChar; priority: TSDL_HintPriority): TSDL_Bool; cdecl; Var - SDL_SetHintWithPriority : TSDL_SetHintWithPriority_fun = Nil; + SDL_SetHintWithPriority : TSDL_SetHintWithPriority_func = Nil; {$else} function SDL_SetHintWithPriority(const name: PAnsiChar; const value: PAnsiChar; priority: TSDL_HintPriority): TSDL_Bool; cdecl; @@ -2433,9 +2433,9 @@ function SDL_SetHintWithPriority(const name: PAnsiChar; const value: PAnsiChar; */} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetHint_fun = function(const name: PAnsiChar; const value: PAnsiChar): TSDL_Bool; cdecl; + TSDL_SetHint_func = function(const name: PAnsiChar; const value: PAnsiChar): TSDL_Bool; cdecl; Var - SDL_SetHint : TSDL_SetHint_fun = Nil; + SDL_SetHint : TSDL_SetHint_func = Nil; {$else} function SDL_SetHint(const name: PAnsiChar; const value: PAnsiChar): TSDL_Bool; cdecl; @@ -2456,9 +2456,9 @@ function SDL_SetHint(const name: PAnsiChar; const value: PAnsiChar): TSDL_Bool; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_ResetHint_fun = function(const name: PAnsiChar): TSDL_Bool; cdecl; + TSDL_ResetHint_func = function(const name: PAnsiChar): TSDL_Bool; cdecl; Var - SDL_ResetHint : TSDL_ResetHint_fun = Nil; + SDL_ResetHint : TSDL_ResetHint_func = Nil; {$else} function SDL_ResetHint(const name: PAnsiChar): TSDL_Bool; cdecl; @@ -2496,9 +2496,9 @@ procedure SDL_ResetHints(); cdecl; */} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetHint_fun = function(const name: PAnsiChar): PAnsiChar; cdecl; + TSDL_GetHint_func = function(const name: PAnsiChar): PAnsiChar; cdecl; Var - SDL_GetHint : TSDL_GetHint_fun = Nil; + SDL_GetHint : TSDL_GetHint_func = Nil; {$else} function SDL_GetHint(const name: PAnsiChar): PAnsiChar; cdecl; @@ -2512,9 +2512,9 @@ function SDL_GetHint(const name: PAnsiChar): PAnsiChar; cdecl; */} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetHintBoolean_fun = function(const name: PAnsiChar; default_value: TSDL_Bool): TSDL_Bool; cdecl; + TSDL_GetHintBoolean_func = function(const name: PAnsiChar; default_value: TSDL_Bool): TSDL_Bool; cdecl; Var - SDL_GetHintBoolean : TSDL_GetHintBoolean_fun = Nil; + SDL_GetHintBoolean : TSDL_GetHintBoolean_func = Nil; {$else} function SDL_GetHintBoolean(const name: PAnsiChar; default_value: TSDL_Bool): TSDL_Bool; cdecl; diff --git a/units/sdljoystick.inc b/units/sdljoystick.inc index 0e19c1ea..1baf9b71 100644 --- a/units/sdljoystick.inc +++ b/units/sdljoystick.inc @@ -152,9 +152,9 @@ procedure SDL_UnlockJoysticks(); cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_NumJoysticks_fun = function(): cint; cdecl; + TSDL_NumJoysticks_func = function(): cint; cdecl; Var - SDL_NumJoysticks : TSDL_NumJoysticks_fun = Nil; + SDL_NumJoysticks : TSDL_NumJoysticks_func = Nil; {$else} function SDL_NumJoysticks(): cint; cdecl; @@ -178,9 +178,9 @@ function SDL_NumJoysticks(): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickNameForIndex_fun = function(device_index: cint): PAnsiChar; cdecl; + TSDL_JoystickNameForIndex_func = function(device_index: cint): PAnsiChar; cdecl; Var - SDL_JoystickNameForIndex : TSDL_JoystickNameForIndex_fun = Nil; + SDL_JoystickNameForIndex : TSDL_JoystickNameForIndex_func = Nil; {$else} function SDL_JoystickNameForIndex(device_index: cint): PAnsiChar; cdecl; @@ -204,9 +204,9 @@ function SDL_JoystickNameForIndex(device_index: cint): PAnsiChar; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickPathForIndex_fun = function(device_index: cint): PAnsiChar; cdecl; + TSDL_JoystickPathForIndex_func = function(device_index: cint): PAnsiChar; cdecl; Var - SDL_JoystickPathForIndex : TSDL_JoystickPathForIndex_fun = Nil; + SDL_JoystickPathForIndex : TSDL_JoystickPathForIndex_func = Nil; {$else} function SDL_JoystickPathForIndex(device_index: cint): PAnsiChar; cdecl; @@ -221,9 +221,9 @@ function SDL_JoystickPathForIndex(device_index: cint): PAnsiChar; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickGetDevicePlayerIndex_fun = function(device_index: cint): cint; cdecl; + TSDL_JoystickGetDevicePlayerIndex_func = function(device_index: cint): cint; cdecl; Var - SDL_JoystickGetDevicePlayerIndex : TSDL_JoystickGetDevicePlayerIndex_fun = Nil; + SDL_JoystickGetDevicePlayerIndex : TSDL_JoystickGetDevicePlayerIndex_func = Nil; {$else} function SDL_JoystickGetDevicePlayerIndex(device_index: cint): cint; cdecl; @@ -236,9 +236,9 @@ function SDL_JoystickGetDevicePlayerIndex(device_index: cint): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickGetDeviceGUID_fun = function(device_index: cint): TSDL_JoystickGUID; cdecl; + TSDL_JoystickGetDeviceGUID_func = function(device_index: cint): TSDL_JoystickGUID; cdecl; Var - SDL_JoystickGetDeviceGUID : TSDL_JoystickGetDeviceGUID_fun = Nil; + SDL_JoystickGetDeviceGUID : TSDL_JoystickGetDeviceGUID_func = Nil; {$else} function SDL_JoystickGetDeviceGUID(device_index: cint): TSDL_JoystickGUID; cdecl; @@ -260,9 +260,9 @@ function SDL_JoystickGetDeviceGUID(device_index: cint): TSDL_JoystickGUID; cdecl *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickGetDeviceVendor_fun = function(device_index: cint): cuint16; cdecl; + TSDL_JoystickGetDeviceVendor_func = function(device_index: cint): cuint16; cdecl; Var - SDL_JoystickGetDeviceVendor : TSDL_JoystickGetDeviceVendor_fun = Nil; + SDL_JoystickGetDeviceVendor : TSDL_JoystickGetDeviceVendor_func = Nil; {$else} function SDL_JoystickGetDeviceVendor(device_index: cint): cuint16; cdecl; @@ -284,9 +284,9 @@ function SDL_JoystickGetDeviceVendor(device_index: cint): cuint16; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickGetDeviceProduct_fun = function(device_index: cint): cuint16; cdecl; + TSDL_JoystickGetDeviceProduct_func = function(device_index: cint): cuint16; cdecl; Var - SDL_JoystickGetDeviceProduct : TSDL_JoystickGetDeviceProduct_fun = Nil; + SDL_JoystickGetDeviceProduct : TSDL_JoystickGetDeviceProduct_func = Nil; {$else} function SDL_JoystickGetDeviceProduct(device_index: cint): cuint16; cdecl; @@ -308,9 +308,9 @@ function SDL_JoystickGetDeviceProduct(device_index: cint): cuint16; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickGetDeviceProductVersion_fun = function(device_index: cint): cuint16; cdecl; + TSDL_JoystickGetDeviceProductVersion_func = function(device_index: cint): cuint16; cdecl; Var - SDL_JoystickGetDeviceProductVersion : TSDL_JoystickGetDeviceProductVersion_fun = Nil; + SDL_JoystickGetDeviceProductVersion : TSDL_JoystickGetDeviceProductVersion_func = Nil; {$else} function SDL_JoystickGetDeviceProductVersion(device_index: cint): cuint16; cdecl; @@ -331,9 +331,9 @@ function SDL_JoystickGetDeviceProductVersion(device_index: cint): cuint16; cdecl *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickGetDeviceType_fun = function(device_index: cint): TSDL_JoystickType; cdecl; + TSDL_JoystickGetDeviceType_func = function(device_index: cint): TSDL_JoystickType; cdecl; Var - SDL_JoystickGetDeviceType : TSDL_JoystickGetDeviceType_fun = Nil; + SDL_JoystickGetDeviceType : TSDL_JoystickGetDeviceType_func = Nil; {$else} function SDL_JoystickGetDeviceType(device_index: cint): TSDL_JoystickType; cdecl; @@ -355,9 +355,9 @@ function SDL_JoystickGetDeviceType(device_index: cint): TSDL_JoystickType; cdecl *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickGetDeviceInstanceID_fun = function(device_index: cint): TSDL_JoystickID; cdecl; + TSDL_JoystickGetDeviceInstanceID_func = function(device_index: cint): TSDL_JoystickID; cdecl; Var - SDL_JoystickGetDeviceInstanceID : TSDL_JoystickGetDeviceInstanceID_fun = Nil; + SDL_JoystickGetDeviceInstanceID : TSDL_JoystickGetDeviceInstanceID_func = Nil; {$else} function SDL_JoystickGetDeviceInstanceID(device_index: cint): TSDL_JoystickID; cdecl; @@ -386,10 +386,10 @@ function SDL_JoystickGetDeviceInstanceID(device_index: cint): TSDL_JoystickID; c *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickOpen_fun = function(device_index: cint): PSDL_Joystick; cdecl; + TSDL_JoystickOpen_func = function(device_index: cint): PSDL_Joystick; cdecl; Var - SDL_JoystickOpen : TSDL_JoystickOpen_fun = Nil; + SDL_JoystickOpen : TSDL_JoystickOpen_func = Nil; {$else} function SDL_JoystickOpen(device_index: cint): PSDL_Joystick; cdecl; @@ -407,9 +407,9 @@ function SDL_JoystickOpen(device_index: cint): PSDL_Joystick; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickFromInstanceID_fun = function(instance_id: TSDL_JoystickID): PSDL_Joystick; cdecl; + TSDL_JoystickFromInstanceID_func = function(instance_id: TSDL_JoystickID): PSDL_Joystick; cdecl; Var - SDL_JoystickFromInstanceID : TSDL_JoystickFromInstanceID_fun = Nil; + SDL_JoystickFromInstanceID : TSDL_JoystickFromInstanceID_func = Nil; {$else} function SDL_JoystickFromInstanceID(instance_id: TSDL_JoystickID): PSDL_Joystick; cdecl; @@ -427,9 +427,9 @@ function SDL_JoystickFromInstanceID(instance_id: TSDL_JoystickID): PSDL_Joystick *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickFromPlayerIndex_fun = function(player_index: cint): PSDL_Joystick; cdecl; + TSDL_JoystickFromPlayerIndex_func = function(player_index: cint): PSDL_Joystick; cdecl; Var - SDL_JoystickFromPlayerIndex : TSDL_JoystickFromPlayerIndex_fun = Nil; + SDL_JoystickFromPlayerIndex : TSDL_JoystickFromPlayerIndex_func = Nil; {$else} function SDL_JoystickFromPlayerIndex(player_index: cint): PSDL_Joystick; cdecl; @@ -445,9 +445,9 @@ function SDL_JoystickFromPlayerIndex(player_index: cint): PSDL_Joystick; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickAttachVirtual_fun = function(type_: TSDL_JoystickType; naxes: cint; nbuttons: cint; nhats: cint): cint; cdecl; + TSDL_JoystickAttachVirtual_func = function(type_: TSDL_JoystickType; naxes: cint; nbuttons: cint; nhats: cint): cint; cdecl; Var - SDL_JoystickAttachVirtual : TSDL_JoystickAttachVirtual_fun = Nil; + SDL_JoystickAttachVirtual : TSDL_JoystickAttachVirtual_func = Nil; {$else} function SDL_JoystickAttachVirtual(type_: TSDL_JoystickType; naxes: cint; nbuttons: cint; nhats: cint): cint; cdecl; @@ -511,9 +511,9 @@ const */} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickAttachVirtualEx_fun = function(const desc: PSDL_VirtualJoystickDesc): cint; cdecl; + TSDL_JoystickAttachVirtualEx_func = function(const desc: PSDL_VirtualJoystickDesc): cint; cdecl; Var - SDL_JoystickAttachVirtualEx : TSDL_JoystickAttachVirtualEx_fun = Nil; + SDL_JoystickAttachVirtualEx : TSDL_JoystickAttachVirtualEx_func = Nil; {$else} function SDL_JoystickAttachVirtualEx(const desc: PSDL_VirtualJoystickDesc): cint; cdecl; @@ -531,9 +531,9 @@ function SDL_JoystickAttachVirtualEx(const desc: PSDL_VirtualJoystickDesc): cint *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickDetachVirtual_fun = function(device_index: cint): cint; cdecl; + TSDL_JoystickDetachVirtual_func = function(device_index: cint): cint; cdecl; Var - SDL_JoystickDetachVirtual : TSDL_JoystickDetachVirtual_fun = Nil; + SDL_JoystickDetachVirtual : TSDL_JoystickDetachVirtual_func = Nil; {$else} function SDL_JoystickDetachVirtual(device_index: cint): cint; cdecl; @@ -550,9 +550,9 @@ function SDL_JoystickDetachVirtual(device_index: cint): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickIsVirtual_fun = function(device_index: cint): TSDL_Bool; cdecl; + TSDL_JoystickIsVirtual_func = function(device_index: cint): TSDL_Bool; cdecl; Var - SDL_JoystickIsVirtual : TSDL_JoystickIsVirtual_fun = Nil; + SDL_JoystickIsVirtual : TSDL_JoystickIsVirtual_func = Nil; {$else} function SDL_JoystickIsVirtual(device_index: cint): TSDL_Bool; cdecl; @@ -581,9 +581,9 @@ function SDL_JoystickIsVirtual(device_index: cint): TSDL_Bool; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickSetVirtualAxis_fun = function(joystick: PSDL_Joystick; axis: cint; value: cint16): cint; cdecl; + TSDL_JoystickSetVirtualAxis_func = function(joystick: PSDL_Joystick; axis: cint; value: cint16): cint; cdecl; Var - SDL_JoystickSetVirtualAxis : TSDL_JoystickSetVirtualAxis_fun = Nil; + SDL_JoystickSetVirtualAxis : TSDL_JoystickSetVirtualAxis_func = Nil; {$else} function SDL_JoystickSetVirtualAxis(joystick: PSDL_Joystick; axis: cint; value: cint16): cint; cdecl; @@ -608,9 +608,9 @@ function SDL_JoystickSetVirtualAxis(joystick: PSDL_Joystick; axis: cint; value: *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickSetVirtualButton_fun = function(joystick: PSDL_Joystick; button: cint; value: cuint8): cint; cdecl; + TSDL_JoystickSetVirtualButton_func = function(joystick: PSDL_Joystick; button: cint; value: cuint8): cint; cdecl; Var - SDL_JoystickSetVirtualButton : TSDL_JoystickSetVirtualButton_fun = Nil; + SDL_JoystickSetVirtualButton : TSDL_JoystickSetVirtualButton_func = Nil; {$else} function SDL_JoystickSetVirtualButton(joystick: PSDL_Joystick; button: cint; value: cuint8): cint; cdecl; @@ -635,9 +635,9 @@ function SDL_JoystickSetVirtualButton(joystick: PSDL_Joystick; button: cint; val *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickSetVirtualHat_fun = function(joystick: PSDL_Joystick; hat: cint; value: cuint8): cint; cdecl; + TSDL_JoystickSetVirtualHat_func = function(joystick: PSDL_Joystick; hat: cint; value: cuint8): cint; cdecl; Var - SDL_JoystickSetVirtualHat : TSDL_JoystickSetVirtualHat_fun = Nil; + SDL_JoystickSetVirtualHat : TSDL_JoystickSetVirtualHat_func = Nil; {$else} function SDL_JoystickSetVirtualHat(joystick: PSDL_Joystick; hat: cint; value: cuint8): cint; cdecl; @@ -658,9 +658,9 @@ function SDL_JoystickSetVirtualHat(joystick: PSDL_Joystick; hat: cint; value: cu *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickName_fun = function(joystick: PSDL_Joystick): PAnsiChar; cdecl; + TSDL_JoystickName_func = function(joystick: PSDL_Joystick): PAnsiChar; cdecl; Var - SDL_JoystickName : TSDL_JoystickName_fun = Nil; + SDL_JoystickName : TSDL_JoystickName_func = Nil; {$else} function SDL_JoystickName(joystick: PSDL_Joystick): PAnsiChar; cdecl; @@ -680,9 +680,9 @@ function SDL_JoystickName(joystick: PSDL_Joystick): PAnsiChar; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickPath_fun = function(joystick: PSDL_Joystick): PAnsiChar; cdecl; + TSDL_JoystickPath_func = function(joystick: PSDL_Joystick): PAnsiChar; cdecl; Var - SDL_JoystickPath : TSDL_JoystickPath_fun = Nil; + SDL_JoystickPath : TSDL_JoystickPath_func = Nil; {$else} function SDL_JoystickPath(joystick: PSDL_Joystick): PAnsiChar; cdecl; @@ -702,9 +702,9 @@ function SDL_JoystickPath(joystick: PSDL_Joystick): PAnsiChar; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickGetPlayerIndex_fun = function(joystick: PSDL_Joystick): cint; cdecl; + TSDL_JoystickGetPlayerIndex_func = function(joystick: PSDL_Joystick): cint; cdecl; Var - SDL_JoystickGetPlayerIndex : TSDL_JoystickGetPlayerIndex_fun = Nil; + SDL_JoystickGetPlayerIndex : TSDL_JoystickGetPlayerIndex_func = Nil; {$else} function SDL_JoystickGetPlayerIndex(joystick: PSDL_Joystick): cint; cdecl; @@ -748,9 +748,9 @@ procedure SDL_JoystickSetPlayerIndex(joystick: PSDL_Joystick; player_index: cint *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickGetGUID_fun = function(joystick: PSDL_Joystick): TSDL_JoystickGUID; cdecl; + TSDL_JoystickGetGUID_func = function(joystick: PSDL_Joystick): TSDL_JoystickGUID; cdecl; Var - SDL_JoystickGetGUID : TSDL_JoystickGetGUID_fun = Nil; + SDL_JoystickGetGUID : TSDL_JoystickGetGUID_func = Nil; {$else} function SDL_JoystickGetGUID(joystick: PSDL_Joystick): TSDL_JoystickGUID; cdecl; @@ -769,9 +769,9 @@ function SDL_JoystickGetGUID(joystick: PSDL_Joystick): TSDL_JoystickGUID; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickGetVendor_fun = function(joystick: PSDL_Joystick): cuint16; cdecl; + TSDL_JoystickGetVendor_func = function(joystick: PSDL_Joystick): cuint16; cdecl; Var - SDL_JoystickGetVendor : TSDL_JoystickGetVendor_fun = Nil; + SDL_JoystickGetVendor : TSDL_JoystickGetVendor_func = Nil; {$else} function SDL_JoystickGetVendor(joystick: PSDL_Joystick): cuint16; cdecl; @@ -790,9 +790,9 @@ function SDL_JoystickGetVendor(joystick: PSDL_Joystick): cuint16; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickGetProduct_fun = function(joystick: PSDL_Joystick): cuint16; cdecl; + TSDL_JoystickGetProduct_func = function(joystick: PSDL_Joystick): cuint16; cdecl; Var - SDL_JoystickGetProduct : TSDL_JoystickGetProduct_fun = Nil; + SDL_JoystickGetProduct : TSDL_JoystickGetProduct_func = Nil; {$else} function SDL_JoystickGetProduct(joystick: PSDL_Joystick): cuint16; cdecl; @@ -811,9 +811,9 @@ function SDL_JoystickGetProduct(joystick: PSDL_Joystick): cuint16; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickGetProductVersion_fun = function(joystick: PSDL_Joystick): cuint16; cdecl; + TSDL_JoystickGetProductVersion_func = function(joystick: PSDL_Joystick): cuint16; cdecl; Var - SDL_JoystickGetProductVersion : TSDL_JoystickGetProductVersion_fun = Nil; + SDL_JoystickGetProductVersion : TSDL_JoystickGetProductVersion_func = Nil; {$else} function SDL_JoystickGetProductVersion(joystick: PSDL_Joystick): cuint16; cdecl; @@ -833,9 +833,9 @@ function SDL_JoystickGetProductVersion(joystick: PSDL_Joystick): cuint16; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickGetFirmwareVersion_fun = function(joystick: PSDL_Joystick): cuint16; cdecl; + TSDL_JoystickGetFirmwareVersion_func = function(joystick: PSDL_Joystick): cuint16; cdecl; Var - SDL_JoystickGetFirmwareVersion : TSDL_JoystickGetFirmwareVersion_fun = Nil; + SDL_JoystickGetFirmwareVersion : TSDL_JoystickGetFirmwareVersion_func = Nil; {$else} function SDL_JoystickGetFirmwareVersion(joystick: PSDL_Joystick): cuint16; cdecl; @@ -855,9 +855,9 @@ function SDL_JoystickGetFirmwareVersion(joystick: PSDL_Joystick): cuint16; cdecl *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickGetSerial_fun = function(joystick: PSDL_Joystick): PAnsiChar; cdecl; + TSDL_JoystickGetSerial_func = function(joystick: PSDL_Joystick): PAnsiChar; cdecl; Var - SDL_JoystickGetSerial : TSDL_JoystickGetSerial_fun = Nil; + SDL_JoystickGetSerial : TSDL_JoystickGetSerial_func = Nil; {$else} function SDL_JoystickGetSerial(joystick: PSDL_Joystick): PAnsiChar; cdecl; @@ -874,9 +874,9 @@ function SDL_JoystickGetSerial(joystick: PSDL_Joystick): PAnsiChar; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickGetType_fun = function(joystick: PSDL_Joystick): TSDL_JoystickType; cdecl; + TSDL_JoystickGetType_func = function(joystick: PSDL_Joystick): TSDL_JoystickType; cdecl; Var - SDL_JoystickGetType : TSDL_JoystickGetType_fun = Nil; + SDL_JoystickGetType : TSDL_JoystickGetType_func = Nil; {$else} function SDL_JoystickGetType(joystick: PSDL_Joystick): TSDL_JoystickType; cdecl; @@ -925,9 +925,9 @@ procedure SDL_JoystickGetGUIDString(guid: TSDL_JoystickGUID; pszGUID: PAnsiChar; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickGetGUIDFromString_fun = function(const pchGUID: PAnsiChar): TSDL_JoystickGUID; cdecl; + TSDL_JoystickGetGUIDFromString_func = function(const pchGUID: PAnsiChar): TSDL_JoystickGUID; cdecl; Var - SDL_JoystickGetGUIDFromString : TSDL_JoystickGetGUIDFromString_fun = Nil; + SDL_JoystickGetGUIDFromString : TSDL_JoystickGetGUIDFromString_func = Nil; {$else} function SDL_JoystickGetGUIDFromString(const pchGUID: PAnsiChar): TSDL_JoystickGUID; cdecl; @@ -976,9 +976,9 @@ procedure SDL_GetJoystickGUIDInfo(guid: TSDL_JoystickGUID; vendor: pcuint16; pro *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickGetAttached_fun = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; + TSDL_JoystickGetAttached_func = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; Var - SDL_JoystickGetAttached : TSDL_JoystickGetAttached_fun = Nil; + SDL_JoystickGetAttached : TSDL_JoystickGetAttached_func = Nil; {$else} function SDL_JoystickGetAttached(joystick: PSDL_Joystick): TSDL_Bool; cdecl; @@ -998,9 +998,9 @@ function SDL_JoystickGetAttached(joystick: PSDL_Joystick): TSDL_Bool; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickInstanceID_fun = function(joystick: PSDL_Joystick): TSDL_JoystickID; cdecl; + TSDL_JoystickInstanceID_func = function(joystick: PSDL_Joystick): TSDL_JoystickID; cdecl; Var - SDL_JoystickInstanceID : TSDL_JoystickInstanceID_fun = Nil; + SDL_JoystickInstanceID : TSDL_JoystickInstanceID_func = Nil; {$else} function SDL_JoystickInstanceID(joystick: PSDL_Joystick): TSDL_JoystickID; cdecl; @@ -1026,9 +1026,9 @@ function SDL_JoystickInstanceID(joystick: PSDL_Joystick): TSDL_JoystickID; cdecl *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickNumAxes_fun = function(joystick: PSDL_Joystick): cint; cdecl; + TSDL_JoystickNumAxes_func = function(joystick: PSDL_Joystick): cint; cdecl; Var - SDL_JoystickNumAxes : TSDL_JoystickNumAxes_fun = Nil; + SDL_JoystickNumAxes : TSDL_JoystickNumAxes_func = Nil; {$else} function SDL_JoystickNumAxes(joystick: PSDL_Joystick): cint; cdecl; @@ -1053,9 +1053,9 @@ function SDL_JoystickNumAxes(joystick: PSDL_Joystick): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickNumBalls_fun = function(joystick: PSDL_Joystick): cint; cdecl; + TSDL_JoystickNumBalls_func = function(joystick: PSDL_Joystick): cint; cdecl; Var - SDL_JoystickNumBalls : TSDL_JoystickNumBalls_fun = Nil; + SDL_JoystickNumBalls : TSDL_JoystickNumBalls_func = Nil; {$else} function SDL_JoystickNumBalls(joystick: PSDL_Joystick): cint; cdecl; @@ -1076,9 +1076,9 @@ function SDL_JoystickNumBalls(joystick: PSDL_Joystick): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickNumHats_fun = function(joystick: PSDL_Joystick): cint; cdecl; + TSDL_JoystickNumHats_func = function(joystick: PSDL_Joystick): cint; cdecl; Var - SDL_JoystickNumHats : TSDL_JoystickNumHats_fun = Nil; + SDL_JoystickNumHats : TSDL_JoystickNumHats_func = Nil; {$else} function SDL_JoystickNumHats(joystick: PSDL_Joystick): cint; cdecl; @@ -1099,9 +1099,9 @@ function SDL_JoystickNumHats(joystick: PSDL_Joystick): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickNumButtons_fun = function(joystick: PSDL_Joystick): cint; cdecl; + TSDL_JoystickNumButtons_func = function(joystick: PSDL_Joystick): cint; cdecl; Var - SDL_JoystickNumButtons : TSDL_JoystickNumButtons_fun = Nil; + SDL_JoystickNumButtons : TSDL_JoystickNumButtons_func = Nil; {$else} function SDL_JoystickNumButtons(joystick: PSDL_Joystick): cint; cdecl; @@ -1154,9 +1154,9 @@ procedure SDL_JoystickUpdate(); cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickEventState_fun = function(state: cint): cint; cdecl; + TSDL_JoystickEventState_func = function(state: cint): cint; cdecl; Var - SDL_JoystickEventState : TSDL_JoystickEventState_fun = Nil; + SDL_JoystickEventState : TSDL_JoystickEventState_func = Nil; {$else} function SDL_JoystickEventState(state: cint): cint; cdecl; @@ -1191,9 +1191,9 @@ const *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickGetAxis_fun = function(joystick: PSDL_Joystick; axis: cint): cint16; cdecl; + TSDL_JoystickGetAxis_func = function(joystick: PSDL_Joystick; axis: cint): cint16; cdecl; Var - SDL_JoystickGetAxis : TSDL_JoystickGetAxis_fun = Nil; + SDL_JoystickGetAxis : TSDL_JoystickGetAxis_func = Nil; {$else} function SDL_JoystickGetAxis(joystick: PSDL_Joystick; axis: cint): cint16; cdecl; @@ -1216,9 +1216,9 @@ function SDL_JoystickGetAxis(joystick: PSDL_Joystick; axis: cint): cint16; cdecl *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickGetAxisInitialState_fun = function(joystick: PSDL_Joystick; axis: cint; state: pcint16): TSDL_Bool; cdecl; + TSDL_JoystickGetAxisInitialState_func = function(joystick: PSDL_Joystick; axis: cint; state: pcint16): TSDL_Bool; cdecl; Var - SDL_JoystickGetAxisInitialState : TSDL_JoystickGetAxisInitialState_fun = Nil; + SDL_JoystickGetAxisInitialState : TSDL_JoystickGetAxisInitialState_func = Nil; {$else} function SDL_JoystickGetAxisInitialState(joystick: PSDL_Joystick; axis: cint; state: pcint16): TSDL_Bool; cdecl; @@ -1264,9 +1264,9 @@ const *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickGetHat_fun = function(joystick: PSDL_Joystick; hat: cint): cuint8; cdecl; + TSDL_JoystickGetHat_func = function(joystick: PSDL_Joystick; hat: cint): cuint8; cdecl; Var - SDL_JoystickGetHat : TSDL_JoystickGetHat_fun = Nil; + SDL_JoystickGetHat : TSDL_JoystickGetHat_func = Nil; {$else} function SDL_JoystickGetHat(joystick: PSDL_Joystick; hat: cint): cuint8; cdecl; @@ -1294,9 +1294,9 @@ function SDL_JoystickGetHat(joystick: PSDL_Joystick; hat: cint): cuint8; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickGetBall_fun = function(joystick: PSDL_Joystick; ball: cint; dx: pcint; dy: pcint): cint; cdecl; + TSDL_JoystickGetBall_func = function(joystick: PSDL_Joystick; ball: cint; dx: pcint; dy: pcint): cint; cdecl; Var - SDL_JoystickGetBall : TSDL_JoystickGetBall_fun = Nil; + SDL_JoystickGetBall : TSDL_JoystickGetBall_func = Nil; {$else} function SDL_JoystickGetBall(joystick: PSDL_Joystick; ball: cint; dx: pcint; dy: pcint): cint; cdecl; @@ -1317,9 +1317,9 @@ function SDL_JoystickGetBall(joystick: PSDL_Joystick; ball: cint; dx: pcint; dy: *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickGetButton_fun = function(joystick: PSDL_Joystick; button: cint): cuint8; cdecl; + TSDL_JoystickGetButton_func = function(joystick: PSDL_Joystick; button: cint): cuint8; cdecl; Var - SDL_JoystickGetButton : TSDL_JoystickGetButton_fun = Nil; + SDL_JoystickGetButton : TSDL_JoystickGetButton_func = Nil; {$else} function SDL_JoystickGetButton(joystick: PSDL_Joystick; button: cint): cuint8; cdecl; @@ -1346,9 +1346,9 @@ function SDL_JoystickGetButton(joystick: PSDL_Joystick; button: cint): cuint8; c *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickRumble_fun = function(joystick: PSDL_Joystick; low_frequency_rumble: cuint16; high_frequency_rumble: cuint16; duration_ms: cuint32): cint; cdecl; + TSDL_JoystickRumble_func = function(joystick: PSDL_Joystick; low_frequency_rumble: cuint16; high_frequency_rumble: cuint16; duration_ms: cuint32): cint; cdecl; Var - SDL_JoystickRumble : TSDL_JoystickRumble_fun = Nil; + SDL_JoystickRumble : TSDL_JoystickRumble_func = Nil; {$else} function SDL_JoystickRumble(joystick: PSDL_Joystick; low_frequency_rumble: cuint16; high_frequency_rumble: cuint16; duration_ms: cuint32): cint; cdecl; @@ -1380,9 +1380,9 @@ function SDL_JoystickRumble(joystick: PSDL_Joystick; low_frequency_rumble: cuint *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickRumbleTriggers_fun = function(joystick: PSDL_Joystick; left_rumble: cuint16; right_rumble: cuint16; duration_ms: cuint32): cint; cdecl; + TSDL_JoystickRumbleTriggers_func = function(joystick: PSDL_Joystick; left_rumble: cuint16; right_rumble: cuint16; duration_ms: cuint32): cint; cdecl; Var - SDL_JoystickRumbleTriggers : TSDL_JoystickRumbleTriggers_fun = Nil; + SDL_JoystickRumbleTriggers : TSDL_JoystickRumbleTriggers_func = Nil; {$else} function SDL_JoystickRumbleTriggers(joystick: PSDL_Joystick; left_rumble: cuint16; right_rumble: cuint16; duration_ms: cuint32): cint; cdecl; @@ -1402,9 +1402,9 @@ function SDL_JoystickRumbleTriggers(joystick: PSDL_Joystick; left_rumble: cuint1 *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickHasLED_fun = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; + TSDL_JoystickHasLED_func = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; Var - SDL_JoystickHasLED : TSDL_JoystickHasLED_fun = Nil; + SDL_JoystickHasLED : TSDL_JoystickHasLED_func = Nil; {$else} function SDL_JoystickHasLED(joystick: PSDL_Joystick): TSDL_Bool; cdecl; @@ -1423,9 +1423,9 @@ function SDL_JoystickHasLED(joystick: PSDL_Joystick): TSDL_Bool; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickHasRumble_fun = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; + TSDL_JoystickHasRumble_func = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; Var - SDL_JoystickHasRumble : TSDL_JoystickHasRumble_fun = Nil; + SDL_JoystickHasRumble : TSDL_JoystickHasRumble_func = Nil; {$else} function SDL_JoystickHasRumble(joystick: PSDL_Joystick): TSDL_Bool; cdecl; @@ -1444,9 +1444,9 @@ function SDL_JoystickHasRumble(joystick: PSDL_Joystick): TSDL_Bool; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickHasRumbleTriggers_fun = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; + TSDL_JoystickHasRumbleTriggers_func = function(joystick: PSDL_Joystick): TSDL_Bool; cdecl; Var - SDL_JoystickHasRumbleTriggers : TSDL_JoystickHasRumbleTriggers_fun = Nil; + SDL_JoystickHasRumbleTriggers : TSDL_JoystickHasRumbleTriggers_func = Nil; {$else} function SDL_JoystickHasRumbleTriggers(joystick: PSDL_Joystick): TSDL_Bool; cdecl; @@ -1470,9 +1470,9 @@ function SDL_JoystickHasRumbleTriggers(joystick: PSDL_Joystick): TSDL_Bool; cdec *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickSetLED_fun = function(joystick: PSDL_Joystick; red: cuint8; green: cuint8; blue: cuint8): cint; cdecl; + TSDL_JoystickSetLED_func = function(joystick: PSDL_Joystick; red: cuint8; green: cuint8; blue: cuint8): cint; cdecl; Var - SDL_JoystickSetLED : TSDL_JoystickSetLED_fun = Nil; + SDL_JoystickSetLED : TSDL_JoystickSetLED_func = Nil; {$else} function SDL_JoystickSetLED(joystick: PSDL_Joystick; red: cuint8; green: cuint8; blue: cuint8): cint; cdecl; @@ -1491,9 +1491,9 @@ function SDL_JoystickSetLED(joystick: PSDL_Joystick; red: cuint8; green: cuint8; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickSendEffect_fun = function(joystick: PSDL_Joystick; const data: Pointer; size: cint): cint; cdecl; + TSDL_JoystickSendEffect_func = function(joystick: PSDL_Joystick; const data: Pointer; size: cint): cint; cdecl; Var - SDL_JoystickSendEffect : TSDL_JoystickSendEffect_fun = Nil; + SDL_JoystickSendEffect : TSDL_JoystickSendEffect_func = Nil; {$else} function SDL_JoystickSendEffect(joystick: PSDL_Joystick; const data: Pointer; size: cint): cint; cdecl; @@ -1531,9 +1531,9 @@ procedure SDL_JoystickClose(joystick: PSDL_Joystick); cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_JoystickCurrentPowerLevel_fun = function(joystick: PSDL_Joystick): TSDL_JoystickPowerLevel; cdecl; + TSDL_JoystickCurrentPowerLevel_func = function(joystick: PSDL_Joystick): TSDL_JoystickPowerLevel; cdecl; Var - SDL_JoystickCurrentPowerLevel : TSDL_JoystickCurrentPowerLevel_fun = Nil; + SDL_JoystickCurrentPowerLevel : TSDL_JoystickCurrentPowerLevel_func = Nil; {$else} function SDL_JoystickCurrentPowerLevel(joystick: PSDL_Joystick): TSDL_JoystickPowerLevel; cdecl; diff --git a/units/sdlkeyboard.inc b/units/sdlkeyboard.inc index a44dbaa2..7750487f 100644 --- a/units/sdlkeyboard.inc +++ b/units/sdlkeyboard.inc @@ -72,9 +72,9 @@ function SDL_GetKeyboardFocus: PSDL_Window; cdecl; } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetKeyboardState_fun = function(numkeys: pcint): pcuint8; cdecl; + TSDL_GetKeyboardState_func = function(numkeys: pcint): pcuint8; cdecl; Var - SDL_GetKeyboardState : TSDL_GetKeyboardState_fun = Nil; + SDL_GetKeyboardState : TSDL_GetKeyboardState_func = Nil; {$else} function SDL_GetKeyboardState(numkeys: pcint): pcuint8; cdecl; @@ -151,9 +151,9 @@ procedure SDL_SetModState(modstate: TSDL_Keymod); cdecl; } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetKeyFromScancode_fun = function(scancode: TSDL_Scancode): TSDL_Keycode; cdecl; + TSDL_GetKeyFromScancode_func = function(scancode: TSDL_Scancode): TSDL_Keycode; cdecl; Var - SDL_GetKeyFromScancode : TSDL_GetKeyFromScancode_fun = Nil; + SDL_GetKeyFromScancode : TSDL_GetKeyFromScancode_func = Nil; {$else} function SDL_GetKeyFromScancode(scancode: TSDL_Scancode): TSDL_Keycode; cdecl; @@ -176,9 +176,9 @@ function SDL_GetKeyFromScancode(scancode: TSDL_Scancode): TSDL_Keycode; cdecl; } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetScancodeFromKey_fun = function(key: TSDL_Keycode): TSDL_Scancode; cdecl; + TSDL_GetScancodeFromKey_func = function(key: TSDL_Keycode): TSDL_Scancode; cdecl; Var - SDL_GetScancodeFromKey : TSDL_GetScancodeFromKey_fun = Nil; + SDL_GetScancodeFromKey : TSDL_GetScancodeFromKey_func = Nil; {$else} function SDL_GetScancodeFromKey(key: TSDL_Keycode): TSDL_Scancode; cdecl; @@ -210,9 +210,9 @@ function SDL_GetScancodeFromKey(key: TSDL_Keycode): TSDL_Scancode; cdecl; } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetScancodeName_fun = function(scancode: TSDL_Scancode): PAnsiChar; cdecl; + TSDL_GetScancodeName_func = function(scancode: TSDL_Scancode): PAnsiChar; cdecl; Var - SDL_GetScancodeName : TSDL_GetScancodeName_fun = Nil; + SDL_GetScancodeName : TSDL_GetScancodeName_func = Nil; {$else} function SDL_GetScancodeName(scancode: TSDL_Scancode): PAnsiChar; cdecl; @@ -234,9 +234,9 @@ function SDL_GetScancodeName(scancode: TSDL_Scancode): PAnsiChar; cdecl; } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetScancodeFromName_fun = function(name: PAnsiChar): TSDL_Scancode; cdecl; + TSDL_GetScancodeFromName_func = function(name: PAnsiChar): TSDL_Scancode; cdecl; Var - SDL_GetScancodeFromName : TSDL_GetScancodeFromName_fun = Nil; + SDL_GetScancodeFromName : TSDL_GetScancodeFromName_func = Nil; {$else} function SDL_GetScancodeFromName(name: PAnsiChar): TSDL_Scancode; cdecl; @@ -262,9 +262,9 @@ function SDL_GetScancodeFromName(name: PAnsiChar): TSDL_Scancode; cdecl; } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetKeyName_fun = function(key: TSDL_Keycode): PAnsiChar; cdecl; + TSDL_GetKeyName_func = function(key: TSDL_Keycode): PAnsiChar; cdecl; Var - SDL_GetKeyName : TSDL_GetKeyName_fun = Nil; + SDL_GetKeyName : TSDL_GetKeyName_func = Nil; {$else} function SDL_GetKeyName(key: TSDL_Keycode): PAnsiChar; cdecl; @@ -286,9 +286,9 @@ function SDL_GetKeyName(key: TSDL_Keycode): PAnsiChar; cdecl; } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetKeyFromName_fun = function(name: PAnsiChar): TSDL_Keycode; cdecl; + TSDL_GetKeyFromName_func = function(name: PAnsiChar): TSDL_Keycode; cdecl; Var - SDL_GetKeyFromName : TSDL_GetKeyFromName_fun = Nil; + SDL_GetKeyFromName : TSDL_GetKeyFromName_func = Nil; {$else} function SDL_GetKeyFromName(name: PAnsiChar): TSDL_Keycode; cdecl; @@ -409,9 +409,9 @@ function SDL_HasScreenKeyboardSupport: TSDL_bool; cdecl; } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_IsScreenKeyboardShown_fun = function(window: PSDL_Window): TSDL_bool; cdecl; + TSDL_IsScreenKeyboardShown_func = function(window: PSDL_Window): TSDL_bool; cdecl; Var - SDL_IsScreenKeyboardShown : TSDL_IsScreenKeyboardShown_fun = Nil; + SDL_IsScreenKeyboardShown : TSDL_IsScreenKeyboardShown_func = Nil; {$else} function SDL_IsScreenKeyboardShown(window: PSDL_Window): TSDL_bool; cdecl; diff --git a/units/sdlloadso.inc b/units/sdlloadso.inc index b9ace4f1..8d8a3eca 100644 --- a/units/sdlloadso.inc +++ b/units/sdlloadso.inc @@ -33,9 +33,9 @@ } {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_LoadObject_fun = function(sofile: PAnsiChar): Pointer; cdecl; + TSDL_LoadObject_func = function(sofile: PAnsiChar): Pointer; cdecl; Var - SDL_LoadObject : TSDL_LoadObject_fun = Nil; + SDL_LoadObject : TSDL_LoadObject_func = Nil; {$else} function SDL_LoadObject(sofile: PAnsiChar): Pointer; cdecl; diff --git a/units/sdllog.inc b/units/sdllog.inc index 7e8bef9d..006e1f6c 100644 --- a/units/sdllog.inc +++ b/units/sdllog.inc @@ -98,9 +98,9 @@ procedure SDL_LogSetPriority(category: TSDL_LogCategory; priority: TSDL_LogPrior *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_LogGetPriority_fun = function(category: TSDL_LogCategory): TSDL_LogPriority; cdecl; + TSDL_LogGetPriority_func = function(category: TSDL_LogCategory): TSDL_LogPriority; cdecl; Var - SDL_LogGetPriority : TSDL_LogGetPriority_fun = Nil; + SDL_LogGetPriority : TSDL_LogGetPriority_func = Nil; {$else} function SDL_LogGetPriority(category: TSDL_LogCategory): TSDL_LogPriority; cdecl; diff --git a/units/sdlmessagebox.inc b/units/sdlmessagebox.inc index 04d6c8e1..e380f3d6 100644 --- a/units/sdlmessagebox.inc +++ b/units/sdlmessagebox.inc @@ -106,9 +106,9 @@ type *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_ShowMessageBox_fun = function(messageboxdata: PSDL_MessageBoxData; buttonid: pcint): cint; cdecl; + TSDL_ShowMessageBox_func = function(messageboxdata: PSDL_MessageBoxData; buttonid: pcint): cint; cdecl; Var - SDL_ShowMessageBox : TSDL_ShowMessageBox_fun = Nil; + SDL_ShowMessageBox : TSDL_ShowMessageBox_func = Nil; {$else} function SDL_ShowMessageBox(messageboxdata: PSDL_MessageBoxData; buttonid: pcint): cint; cdecl; @@ -129,9 +129,9 @@ function SDL_ShowMessageBox(messageboxdata: PSDL_MessageBoxData; buttonid: pcint *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_ShowSimpleMessageBox_fun = function(flags: TSDL_MessageBoxFlags; title: PAnsiChar; _message: PAnsiChar; window: PSDL_Window): cint; cdecl; + TSDL_ShowSimpleMessageBox_func = function(flags: TSDL_MessageBoxFlags; title: PAnsiChar; _message: PAnsiChar; window: PSDL_Window): cint; cdecl; Var - SDL_ShowSimpleMessageBox : TSDL_ShowSimpleMessageBox_fun = Nil; + SDL_ShowSimpleMessageBox : TSDL_ShowSimpleMessageBox_func = Nil; {$else} function SDL_ShowSimpleMessageBox(flags: TSDL_MessageBoxFlags; title: PAnsiChar; _message: PAnsiChar; window: PSDL_Window): cint; cdecl; diff --git a/units/sdlmouse.inc b/units/sdlmouse.inc index 405d9890..54760dc6 100644 --- a/units/sdlmouse.inc +++ b/units/sdlmouse.inc @@ -71,9 +71,9 @@ function SDL_GetMouseFocus: PSDL_Window; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetMouseState_fun = function(x: pcint; y: pcint): cuint32; cdecl; + TSDL_GetMouseState_func = function(x: pcint; y: pcint): cuint32; cdecl; Var - SDL_GetMouseState : TSDL_GetMouseState_fun = Nil; + SDL_GetMouseState : TSDL_GetMouseState_func = Nil; {$else} function SDL_GetMouseState(x: pcint; y: pcint): cuint32; cdecl; @@ -110,9 +110,9 @@ function SDL_GetMouseState(x: pcint; y: pcint): cuint32; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetGlobalMouseState_fun = function(x, y: pcint32): cuint32; cdecl; + TSDL_GetGlobalMouseState_func = function(x, y: pcint32): cuint32; cdecl; Var - SDL_GetGlobalMouseState : TSDL_GetGlobalMouseState_fun = Nil; + SDL_GetGlobalMouseState : TSDL_GetGlobalMouseState_func = Nil; {$else} function SDL_GetGlobalMouseState(x, y: pcint32): cuint32; cdecl; @@ -138,9 +138,9 @@ function SDL_GetGlobalMouseState(x, y: pcint32): cuint32; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetRelativeMouseState_fun = function(x: pcint; y: pcint): cuint32; cdecl; + TSDL_GetRelativeMouseState_func = function(x: pcint; y: pcint): cuint32; cdecl; Var - SDL_GetRelativeMouseState : TSDL_GetRelativeMouseState_fun = Nil; + SDL_GetRelativeMouseState : TSDL_GetRelativeMouseState_func = Nil; {$else} function SDL_GetRelativeMouseState(x: pcint; y: pcint): cuint32; cdecl; @@ -199,9 +199,9 @@ procedure SDL_WarpMouseInWindow(window: PSDL_Window; x: cint; y: cint); cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_WarpMouseGlobal_fun = function(x, y: cint): cint; cdecl; + TSDL_WarpMouseGlobal_func = function(x, y: cint): cint; cdecl; Var - SDL_WarpMouseGlobal : TSDL_WarpMouseGlobal_fun = Nil; + SDL_WarpMouseGlobal : TSDL_WarpMouseGlobal_func = Nil; {$else} function SDL_WarpMouseGlobal(x, y: cint): cint; cdecl; @@ -233,9 +233,9 @@ function SDL_WarpMouseGlobal(x, y: cint): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetRelativeMouseMode_fun = function(enabled: TSDL_Bool): cint; cdecl; + TSDL_SetRelativeMouseMode_func = function(enabled: TSDL_Bool): cint; cdecl; Var - SDL_SetRelativeMouseMode : TSDL_SetRelativeMouseMode_fun = Nil; + SDL_SetRelativeMouseMode : TSDL_SetRelativeMouseMode_func = Nil; {$else} function SDL_SetRelativeMouseMode(enabled: TSDL_Bool): cint; cdecl; @@ -288,9 +288,9 @@ function SDL_SetRelativeMouseMode(enabled: TSDL_Bool): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_CaptureMouse_fun = function(enabled: TSDL_Bool): cint; cdecl; + TSDL_CaptureMouse_func = function(enabled: TSDL_Bool): cint; cdecl; Var - SDL_CaptureMouse : TSDL_CaptureMouse_fun = Nil; + SDL_CaptureMouse : TSDL_CaptureMouse_func = Nil; {$else} function SDL_CaptureMouse(enabled: TSDL_Bool): cint; cdecl; @@ -352,13 +352,13 @@ function SDL_GetRelativeMouseMode: TSDL_Bool; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_CreateCursor_fun = function( + TSDL_CreateCursor_func = function( const data: pcuint8; const mask: pcuint8; w: cint; h: cint; hot_x: cint; hot_y: cint): PSDL_Cursor; cdecl; Var - SDL_CreateCursor : TSDL_CreateCursor_fun = Nil; + SDL_CreateCursor : TSDL_CreateCursor_func = Nil; {$else} function SDL_CreateCursor( @@ -385,12 +385,12 @@ function SDL_CreateCursor( *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_CreateColorCursor_fun = function( + TSDL_CreateColorCursor_func = function( surface: PSDL_Surface; hot_x: cint; hot_y: cint): PSDL_Cursor; cdecl; Var - SDL_CreateColorCursor : TSDL_CreateColorCursor_fun = Nil; + SDL_CreateColorCursor : TSDL_CreateColorCursor_func = Nil; {$else} function SDL_CreateColorCursor( @@ -413,9 +413,9 @@ function SDL_CreateColorCursor( *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_CreateSystemCursor_fun = function(id: TSDL_SystemCursor): PSDL_Cursor; cdecl; + TSDL_CreateSystemCursor_func = function(id: TSDL_SystemCursor): PSDL_Cursor; cdecl; Var - SDL_CreateSystemCursor : TSDL_CreateSystemCursor_fun = Nil; + SDL_CreateSystemCursor : TSDL_CreateSystemCursor_func = Nil; {$else} function SDL_CreateSystemCursor(id: TSDL_SystemCursor): PSDL_Cursor; cdecl; @@ -523,9 +523,9 @@ procedure SDL_FreeCursor(cursor: PSDL_Cursor); cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_ShowCursor_fun = function(toggle: cint): cint; cdecl; + TSDL_ShowCursor_func = function(toggle: cint): cint; cdecl; Var - SDL_ShowCursor : TSDL_ShowCursor_fun = Nil; + SDL_ShowCursor : TSDL_ShowCursor_func = Nil; {$else} function SDL_ShowCursor(toggle: cint): cint; cdecl; diff --git a/units/sdlmutex.inc b/units/sdlmutex.inc index b629173a..410ae7fe 100644 --- a/units/sdlmutex.inc +++ b/units/sdlmutex.inc @@ -54,9 +54,9 @@ function SDL_CreateMutex: PSDL_Mutex; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_LockMutex_fun = function(mutex: PSDL_Mutex): cint; cdecl; + TSDL_LockMutex_func = function(mutex: PSDL_Mutex): cint; cdecl; Var - SDL_LockMutex : TSDL_LockMutex_fun = Nil; + SDL_LockMutex : TSDL_LockMutex_func = Nil; {$else} function SDL_LockMutex(mutex: PSDL_Mutex): cint; cdecl; @@ -83,9 +83,9 @@ function SDL_LockMutex(mutex: PSDL_Mutex): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_TryLockMutex_fun = function(mutex: PSDL_Mutex): cint; cdecl; + TSDL_TryLockMutex_func = function(mutex: PSDL_Mutex): cint; cdecl; Var - SDL_TryLockMutex : TSDL_TryLockMutex_fun = Nil; + SDL_TryLockMutex : TSDL_TryLockMutex_func = Nil; {$else} function SDL_TryLockMutex(mutex: PSDL_Mutex): cint; cdecl; @@ -111,9 +111,9 @@ function SDL_TryLockMutex(mutex: PSDL_Mutex): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_UnlockMutex_fun = function(mutex: PSDL_Mutex): cint; cdecl; + TSDL_UnlockMutex_func = function(mutex: PSDL_Mutex): cint; cdecl; Var - SDL_UnlockMutex : TSDL_UnlockMutex_fun = Nil; + SDL_UnlockMutex : TSDL_UnlockMutex_func = Nil; {$else} function SDL_UnlockMutex(mutex: PSDL_Mutex): cint; cdecl; @@ -170,9 +170,9 @@ type *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_CreateSemaphore_fun = function(initial_value: cuint32): PSDL_sem; cdecl; + TSDL_CreateSemaphore_func = function(initial_value: cuint32): PSDL_sem; cdecl; Var - SDL_CreateSemaphore : TSDL_CreateSemaphore_fun = Nil; + SDL_CreateSemaphore : TSDL_CreateSemaphore_func = Nil; {$else} function SDL_CreateSemaphore(initial_value: cuint32): PSDL_sem; cdecl; @@ -219,9 +219,9 @@ procedure SDL_DestroySemaphore(sem: PSDL_Sem); cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SemWait_fun = function(sem: PSDL_Sem): cint; cdecl; + TSDL_SemWait_func = function(sem: PSDL_Sem): cint; cdecl; Var - SDL_SemWait : TSDL_SemWait_fun = Nil; + SDL_SemWait : TSDL_SemWait_func = Nil; {$else} function SDL_SemWait(sem: PSDL_Sem): cint; cdecl; @@ -245,9 +245,9 @@ function SDL_SemWait(sem: PSDL_Sem): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SemTryWait_fun = function(sem: PSDL_Sem): cint; cdecl; + TSDL_SemTryWait_func = function(sem: PSDL_Sem): cint; cdecl; Var - SDL_SemTryWait : TSDL_SemTryWait_fun = Nil; + SDL_SemTryWait : TSDL_SemTryWait_func = Nil; {$else} function SDL_SemTryWait(sem: PSDL_Sem): cint; cdecl; @@ -272,9 +272,9 @@ function SDL_SemTryWait(sem: PSDL_Sem): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SemWaitTimeout_fun = function(sem: PSDL_Sem; ms: cuint32): cint; cdecl; + TSDL_SemWaitTimeout_func = function(sem: PSDL_Sem; ms: cuint32): cint; cdecl; Var - SDL_SemWaitTimeout : TSDL_SemWaitTimeout_fun = Nil; + SDL_SemWaitTimeout : TSDL_SemWaitTimeout_func = Nil; {$else} function SDL_SemWaitTimeout(sem: PSDL_Sem; ms: cuint32): cint; cdecl; @@ -292,9 +292,9 @@ function SDL_SemWaitTimeout(sem: PSDL_Sem; ms: cuint32): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SemPost_fun = function(sem: PSDL_Sem): cint; cdecl; + TSDL_SemPost_func = function(sem: PSDL_Sem): cint; cdecl; Var - SDL_SemPost : TSDL_SemPost_fun = Nil; + SDL_SemPost : TSDL_SemPost_func = Nil; {$else} function SDL_SemPost(sem: PSDL_Sem): cint; cdecl; @@ -311,9 +311,9 @@ function SDL_SemPost(sem: PSDL_Sem): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SemValue_fun = function(sem: PSDL_Sem): cuint32; cdecl; + TSDL_SemValue_func = function(sem: PSDL_Sem): cuint32; cdecl; Var - SDL_SemValue : TSDL_SemValue_fun = Nil; + SDL_SemValue : TSDL_SemValue_func = Nil; {$else} function SDL_SemValue(sem: PSDL_Sem): cuint32; cdecl; @@ -396,9 +396,9 @@ procedure SDL_DestroyCond(cond: PSDL_Cond); cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_CondSignal_fun = function(cond: PSDL_Cond): cint; cdecl; + TSDL_CondSignal_func = function(cond: PSDL_Cond): cint; cdecl; Var - SDL_CondSignal : TSDL_CondSignal_fun = Nil; + SDL_CondSignal : TSDL_CondSignal_func = Nil; {$else} function SDL_CondSignal(cond: PSDL_Cond): cint; cdecl; @@ -416,9 +416,9 @@ function SDL_CondSignal(cond: PSDL_Cond): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_CondBroadcast_fun = function(cond: PSDL_Cond): cint; cdecl; + TSDL_CondBroadcast_func = function(cond: PSDL_Cond): cint; cdecl; Var - SDL_CondBroadcast : TSDL_CondBroadcast_fun = Nil; + SDL_CondBroadcast : TSDL_CondBroadcast_func = Nil; {$else} function SDL_CondBroadcast(cond: PSDL_Cond): cint; cdecl; @@ -447,9 +447,9 @@ function SDL_CondBroadcast(cond: PSDL_Cond): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_CondWait_fun = function(cond: PSDL_Cond; mutex: PSDL_Mutex): cint; cdecl; + TSDL_CondWait_func = function(cond: PSDL_Cond; mutex: PSDL_Mutex): cint; cdecl; Var - SDL_CondWait : TSDL_CondWait_fun = Nil; + SDL_CondWait : TSDL_CondWait_func = Nil; {$else} function SDL_CondWait(cond: PSDL_Cond; mutex: PSDL_Mutex): cint; cdecl; @@ -479,9 +479,9 @@ function SDL_CondWait(cond: PSDL_Cond; mutex: PSDL_Mutex): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_CondWaitTimeout_fun = function(cond: PSDL_Cond; mutex: PSDL_Mutex; ms: cuint32): cint; cdecl; + TSDL_CondWaitTimeout_func = function(cond: PSDL_Cond; mutex: PSDL_Mutex; ms: cuint32): cint; cdecl; Var - SDL_CondWaitTimeout : TSDL_CondWaitTimeout_fun = Nil; + SDL_CondWaitTimeout : TSDL_CondWaitTimeout_func = Nil; {$else} function SDL_CondWaitTimeout(cond: PSDL_Cond; mutex: PSDL_Mutex; ms: cuint32): cint; cdecl; diff --git a/units/sdlpixels.inc b/units/sdlpixels.inc index 8f583416..8e8fc2a1 100644 --- a/units/sdlpixels.inc +++ b/units/sdlpixels.inc @@ -538,9 +538,9 @@ type *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetPixelFormatName_fun = function(format: cuint32): PAnsiChar; cdecl; + TSDL_GetPixelFormatName_func = function(format: cuint32): PAnsiChar; cdecl; Var - SDL_GetPixelFormatName : TSDL_GetPixelFormatName_fun = Nil; + SDL_GetPixelFormatName : TSDL_GetPixelFormatName_func = Nil; {$else} function SDL_GetPixelFormatName(format: cuint32): PAnsiChar; cdecl; @@ -565,10 +565,10 @@ function SDL_GetPixelFormatName(format: cuint32): PAnsiChar; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_PixelFormatEnumToMasks_fun = function(format: cuint32; bpp: pcint; + TSDL_PixelFormatEnumToMasks_func = function(format: cuint32; bpp: pcint; Rmask: pcuint32; Gmask: pcuint32; Bmask: pcuint32; Amask: pcuint32): TSDL_Bool; cdecl; Var - SDL_PixelFormatEnumToMasks : TSDL_PixelFormatEnumToMasks_fun = Nil; + SDL_PixelFormatEnumToMasks : TSDL_PixelFormatEnumToMasks_func = Nil; {$else} function SDL_PixelFormatEnumToMasks(format: cuint32; bpp: pcint; @@ -595,9 +595,9 @@ function SDL_PixelFormatEnumToMasks(format: cuint32; bpp: pcint; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_MasksToPixelFormatEnum_fun = function(bpp: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): cuint32; cdecl; + TSDL_MasksToPixelFormatEnum_func = function(bpp: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): cuint32; cdecl; Var - SDL_MasksToPixelFormatEnum : TSDL_MasksToPixelFormatEnum_fun = Nil; + SDL_MasksToPixelFormatEnum : TSDL_MasksToPixelFormatEnum_func = Nil; {$else} function SDL_MasksToPixelFormatEnum(bpp: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): cuint32; cdecl; @@ -621,9 +621,9 @@ function SDL_MasksToPixelFormatEnum(bpp: cint; Rmask: cuint32; Gmask: cuint32; B *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_AllocFormat_fun = function(pixel_format: cuint32): PSDL_PixelFormat; cdecl; + TSDL_AllocFormat_func = function(pixel_format: cuint32): PSDL_PixelFormat; cdecl; Var - SDL_AllocFormat : TSDL_AllocFormat_fun = Nil; + SDL_AllocFormat : TSDL_AllocFormat_func = Nil; {$else} function SDL_AllocFormat(pixel_format: cuint32): PSDL_PixelFormat; cdecl; @@ -666,9 +666,9 @@ procedure SDL_FreeFormat(format: PSDL_PixelFormat); cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_AllocPalette_fun = function(ncolors: cint): PSDL_Palette; cdecl; + TSDL_AllocPalette_func = function(ncolors: cint): PSDL_Palette; cdecl; Var - SDL_AllocPalette : TSDL_AllocPalette_fun = Nil; + SDL_AllocPalette : TSDL_AllocPalette_func = Nil; {$else} function SDL_AllocPalette(ncolors: cint): PSDL_Palette; cdecl; @@ -690,9 +690,9 @@ function SDL_AllocPalette(ncolors: cint): PSDL_Palette; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetPixelFormatPalette_fun = function(format: PSDL_PixelFormat; palette: PSDL_Palette): cint; cdecl; + TSDL_SetPixelFormatPalette_func = function(format: PSDL_PixelFormat; palette: PSDL_Palette): cint; cdecl; Var - SDL_SetPixelFormatPalette : TSDL_SetPixelFormatPalette_fun = Nil; + SDL_SetPixelFormatPalette : TSDL_SetPixelFormatPalette_func = Nil; {$else} function SDL_SetPixelFormatPalette(format: PSDL_PixelFormat; palette: PSDL_Palette): cint; cdecl; @@ -716,9 +716,9 @@ function SDL_SetPixelFormatPalette(format: PSDL_PixelFormat; palette: PSDL_Palet *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetPaletteColors_fun = function(palette: PSDL_Palette; const colors: PSDL_Color; firstcolor: cint; ncolors: cint): cint; cdecl; + TSDL_SetPaletteColors_func = function(palette: PSDL_Palette; const colors: PSDL_Color; firstcolor: cint; ncolors: cint): cint; cdecl; Var - SDL_SetPaletteColors : TSDL_SetPaletteColors_fun = Nil; + SDL_SetPaletteColors : TSDL_SetPaletteColors_func = Nil; {$else} function SDL_SetPaletteColors(palette: PSDL_Palette; const colors: PSDL_Color; firstcolor: cint; ncolors: cint): cint; cdecl; @@ -777,9 +777,9 @@ procedure SDL_FreePalette(palette: PSDL_Palette); cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_MapRGB_fun = function(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cuint8): cuint32; cdecl; + TSDL_MapRGB_func = function(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cuint8): cuint32; cdecl; Var - SDL_MapRGB : TSDL_MapRGB_fun = Nil; + SDL_MapRGB : TSDL_MapRGB_func = Nil; {$else} function SDL_MapRGB(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cuint8): cuint32; cdecl; @@ -820,9 +820,9 @@ function SDL_MapRGB(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cui *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_MapRGBA_fun = function(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cuint8; a: cuint8): cuint32; cdecl; + TSDL_MapRGBA_func = function(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cuint8; a: cuint8): cuint32; cdecl; Var - SDL_MapRGBA : TSDL_MapRGBA_fun = Nil; + SDL_MapRGBA : TSDL_MapRGBA_func = Nil; {$else} function SDL_MapRGBA(const format: PSDL_PixelFormat; r: cuint8; g: cuint8; b: cuint8; a: cuint8): cuint32; cdecl; diff --git a/units/sdlpower.inc b/units/sdlpower.inc index 4651f491..9b7da806 100644 --- a/units/sdlpower.inc +++ b/units/sdlpower.inc @@ -33,9 +33,9 @@ type *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetPowerInfo_fun = function(secs: pcint; pct: pcint): TSDL_PowerState; cdecl; + TSDL_GetPowerInfo_func = function(secs: pcint; pct: pcint): TSDL_PowerState; cdecl; Var - SDL_GetPowerInfo : TSDL_GetPowerInfo_fun = Nil; + SDL_GetPowerInfo : TSDL_GetPowerInfo_func = Nil; {$else} function SDL_GetPowerInfo(secs: pcint; pct: pcint): TSDL_PowerState; cdecl; diff --git a/units/sdlrect.inc b/units/sdlrect.inc index 063ceb0b..11be2740 100644 --- a/units/sdlrect.inc +++ b/units/sdlrect.inc @@ -82,9 +82,9 @@ function SDL_RectEquals(const a, b: PSDL_Rect): Boolean; inline; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HasIntersection_fun = function(const a, b: PSDL_Rect): TSDL_Bool; cdecl; + TSDL_HasIntersection_func = function(const a, b: PSDL_Rect): TSDL_Bool; cdecl; Var - SDL_HasIntersection : TSDL_HasIntersection_fun = Nil; + SDL_HasIntersection : TSDL_HasIntersection_func = Nil; {$else} function SDL_HasIntersection(const a, b: PSDL_Rect): TSDL_Bool; cdecl; @@ -98,9 +98,9 @@ function SDL_HasIntersection(const a, b: PSDL_Rect): TSDL_Bool; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_IntersectRect_fun = function(const A, B: PSDL_Rect; result: PSDL_Rect): TSDL_Bool; cdecl; + TSDL_IntersectRect_func = function(const A, B: PSDL_Rect; result: PSDL_Rect): TSDL_Bool; cdecl; Var - SDL_IntersectRect : TSDL_IntersectRect_fun = Nil; + SDL_IntersectRect : TSDL_IntersectRect_func = Nil; {$else} function SDL_IntersectRect(const A, B: PSDL_Rect; result: PSDL_Rect): TSDL_Bool; cdecl; @@ -128,9 +128,9 @@ procedure SDL_UnionRect(const A, B: PSDL_Rect; result: PSDL_Rect); cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_EnclosePoints_fun = function(const points: PSDL_Point; count: cint; const clip: PSDL_Rect; result: PSDL_Rect): TSDL_Bool; cdecl; + TSDL_EnclosePoints_func = function(const points: PSDL_Point; count: cint; const clip: PSDL_Rect; result: PSDL_Rect): TSDL_Bool; cdecl; Var - SDL_EnclosePoints : TSDL_EnclosePoints_fun = Nil; + SDL_EnclosePoints : TSDL_EnclosePoints_func = Nil; {$else} function SDL_EnclosePoints(const points: PSDL_Point; count: cint; const clip: PSDL_Rect; result: PSDL_Rect): TSDL_Bool; cdecl; @@ -144,9 +144,9 @@ function SDL_EnclosePoints(const points: PSDL_Point; count: cint; const clip: PS *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_IntersectRectAndLine_fun = function(const rect: PSDL_Rect; X1, Y1, X2, Y2: pcint): TSDL_Bool; cdecl; + TSDL_IntersectRectAndLine_func = function(const rect: PSDL_Rect; X1, Y1, X2, Y2: pcint): TSDL_Bool; cdecl; Var - SDL_IntersectRectAndLine : TSDL_IntersectRectAndLine_fun = Nil; + SDL_IntersectRectAndLine : TSDL_IntersectRectAndLine_func = Nil; {$else} function SDL_IntersectRectAndLine(const rect: PSDL_Rect; X1, Y1, X2, Y2: pcint): TSDL_Bool; cdecl; @@ -192,9 +192,9 @@ function SDL_FRectEquals(const a, b: PSDL_FRect): Boolean; Inline; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HasIntersectionF_fun = function(const a, b: PSDL_FRect): TSDL_Bool; cdecl; + TSDL_HasIntersectionF_func = function(const a, b: PSDL_FRect): TSDL_Bool; cdecl; Var - SDL_HasIntersectionF : TSDL_HasIntersectionF_fun = Nil; + SDL_HasIntersectionF : TSDL_HasIntersectionF_func = Nil; {$else} function SDL_HasIntersectionF(const a, b: PSDL_FRect): TSDL_Bool; cdecl; @@ -218,9 +218,9 @@ function SDL_HasIntersectionF(const a, b: PSDL_FRect): TSDL_Bool; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_IntersectFRect_fun = function(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; + TSDL_IntersectFRect_func = function(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; Var - SDL_IntersectFRect : TSDL_IntersectFRect_fun = Nil; + SDL_IntersectFRect : TSDL_IntersectFRect_func = Nil; {$else} function SDL_IntersectFRect(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; @@ -239,9 +239,9 @@ function SDL_IntersectFRect(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bo *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_UnionFRect_fun = function(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; + TSDL_UnionFRect_func = function(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; Var - SDL_UnionFRect : TSDL_UnionFRect_fun = Nil; + SDL_UnionFRect : TSDL_UnionFRect_func = Nil; {$else} function SDL_UnionFRect(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; @@ -268,9 +268,9 @@ function SDL_UnionFRect(const a, b: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_EncloseFPoints_fun = function(const points: PSDL_FPoint; count: cint; const clip: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; + TSDL_EncloseFPoints_func = function(const points: PSDL_FPoint; count: cint; const clip: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; Var - SDL_EncloseFPoints : TSDL_EncloseFPoints_fun = Nil; + SDL_EncloseFPoints : TSDL_EncloseFPoints_func = Nil; {$else} function SDL_EncloseFPoints(const points: PSDL_FPoint; count: cint; const clip: PSDL_FRect; result: PSDL_FRect): TSDL_Bool; cdecl; @@ -298,9 +298,9 @@ function SDL_EncloseFPoints(const points: PSDL_FPoint; count: cint; const clip: *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_IntersectFRectAndLine_fun = function(const rect: PSDL_FRect; X1, Y1, X2, Y2: pcfloat): TSDL_Bool; cdecl; + TSDL_IntersectFRectAndLine_func = function(const rect: PSDL_FRect; X1, Y1, X2, Y2: pcfloat): TSDL_Bool; cdecl; Var - SDL_IntersectFRectAndLine : TSDL_IntersectFRectAndLine_fun = Nil; + SDL_IntersectFRectAndLine : TSDL_IntersectFRectAndLine_func = Nil; {$else} function SDL_IntersectFRectAndLine(const rect: PSDL_FRect; X1, Y1, X2, Y2: pcfloat): TSDL_Bool; cdecl; diff --git a/units/sdlrenderer.inc b/units/sdlrenderer.inc index cf5586c8..973da577 100644 --- a/units/sdlrenderer.inc +++ b/units/sdlrenderer.inc @@ -383,9 +383,9 @@ function SDL_UpdateTexture(texture: PSDL_Texture; rect: PSDL_Rect; pixels: Point *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_LockTexture_fun = function(texture: PSDL_Texture; const rect: PSDL_Rect; pixels: PPointer; pitch: pcint): cint; cdecl; + TSDL_LockTexture_func = function(texture: PSDL_Texture; const rect: PSDL_Rect; pixels: PPointer; pitch: pcint): cint; cdecl; Var - SDL_LockTexture : TSDL_LockTexture_fun = Nil; + SDL_LockTexture : TSDL_LockTexture_func = Nil; {$else} function SDL_LockTexture(texture: PSDL_Texture; const rect: PSDL_Rect; pixels: PPointer; pitch: pcint): cint; cdecl; @@ -409,9 +409,9 @@ function SDL_LockTexture(texture: PSDL_Texture; const rect: PSDL_Rect; pixels: P *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_LockTextureToSurface_fun = function(texture: PSDL_Texture; const rect: PSDL_Rect; surface: PPSDL_Surface): cint; cdecl; + TSDL_LockTextureToSurface_func = function(texture: PSDL_Texture; const rect: PSDL_Rect; surface: PPSDL_Surface): cint; cdecl; Var - SDL_LockTextureToSurface : TSDL_LockTextureToSurface_fun = Nil; + SDL_LockTextureToSurface : TSDL_LockTextureToSurface_func = Nil; {$else} function SDL_LockTextureToSurface(texture: PSDL_Texture; const rect: PSDL_Rect; surface: PPSDL_Surface): cint; cdecl; @@ -571,9 +571,9 @@ procedure SDL_RenderGetClipRect(renderer: PSDL_Renderer; rect: PSDL_Rect) cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RenderIsClipEnabled_fun = function(renderer: PSDL_Renderer): TSDL_Bool; cdecl; + TSDL_RenderIsClipEnabled_func = function(renderer: PSDL_Renderer): TSDL_Bool; cdecl; Var - SDL_RenderIsClipEnabled : TSDL_RenderIsClipEnabled_fun = Nil; + SDL_RenderIsClipEnabled : TSDL_RenderIsClipEnabled_func = Nil; {$else} function SDL_RenderIsClipEnabled(renderer: PSDL_Renderer): TSDL_Bool; cdecl; @@ -713,9 +713,9 @@ function SDL_RenderDrawPoint(renderer: PSDL_Renderer; x: cint32; y: cint32): cin *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RenderDrawPointF_fun = function(renderer: PSDL_Renderer; x, y: single): cint32 cdecl; + TSDL_RenderDrawPointF_func = function(renderer: PSDL_Renderer; x, y: single): cint32 cdecl; Var - SDL_RenderDrawPointF : TSDL_RenderDrawPointF_fun = Nil; + SDL_RenderDrawPointF : TSDL_RenderDrawPointF_func = Nil; {$else} function SDL_RenderDrawPointF(renderer: PSDL_Renderer; x, y: single): cint32 cdecl; @@ -744,9 +744,9 @@ function SDL_RenderDrawPoints(renderer: PSDL_Renderer; points: PSDL_Point; count *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RenderDrawPointsF_fun = function(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl; + TSDL_RenderDrawPointsF_func = function(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl; Var - SDL_RenderDrawPointsF : TSDL_RenderDrawPointsF_fun = Nil; + SDL_RenderDrawPointsF : TSDL_RenderDrawPointsF_func = Nil; {$else} function SDL_RenderDrawPointsF(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl; @@ -779,9 +779,9 @@ function SDL_RenderDrawLine(renderer: PSDL_Renderer; x1: cint32; y1: cint32; x2: *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RenderDrawLineF_fun = function(renderer: PSDL_Renderer; x1, y1, x2, y2: single): cint32 cdecl; + TSDL_RenderDrawLineF_func = function(renderer: PSDL_Renderer; x1, y1, x2, y2: single): cint32 cdecl; Var - SDL_RenderDrawLineF : TSDL_RenderDrawLineF_fun = Nil; + SDL_RenderDrawLineF : TSDL_RenderDrawLineF_func = Nil; {$else} function SDL_RenderDrawLineF(renderer: PSDL_Renderer; x1, y1, x2, y2: single): cint32 cdecl; @@ -810,9 +810,9 @@ function SDL_RenderDrawLines(renderer: PSDL_Renderer; points: PSDL_Point; count: *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RenderDrawLinesF_fun = function(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl; + TSDL_RenderDrawLinesF_func = function(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl; Var - SDL_RenderDrawLinesF : TSDL_RenderDrawLinesF_fun = Nil; + SDL_RenderDrawLinesF : TSDL_RenderDrawLinesF_func = Nil; {$else} function SDL_RenderDrawLinesF(renderer: PSDL_Renderer; points: PSDL_FPoint; count: cint32): cint32 cdecl; @@ -839,9 +839,9 @@ function SDL_RenderDrawRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cd *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RenderDrawRectF_fun = function(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl; + TSDL_RenderDrawRectF_func = function(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl; Var - SDL_RenderDrawRectF : TSDL_RenderDrawRectF_fun = Nil; + SDL_RenderDrawRectF : TSDL_RenderDrawRectF_func = Nil; {$else} function SDL_RenderDrawRectF(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl; @@ -870,9 +870,9 @@ function SDL_RenderDrawRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: c *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RenderDrawRectsF_fun = function(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl; + TSDL_RenderDrawRectsF_func = function(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl; Var - SDL_RenderDrawRectsF : TSDL_RenderDrawRectsF_fun = Nil; + SDL_RenderDrawRectsF : TSDL_RenderDrawRectsF_func = Nil; {$else} function SDL_RenderDrawRectsF(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl; @@ -900,9 +900,9 @@ function SDL_RenderFillRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cd *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RenderFillRectF_fun = function(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl; + TSDL_RenderFillRectF_func = function(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl; Var - SDL_RenderFillRectF : TSDL_RenderFillRectF_fun = Nil; + SDL_RenderFillRectF : TSDL_RenderFillRectF_func = Nil; {$else} function SDL_RenderFillRectF(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 cdecl; @@ -931,9 +931,9 @@ function SDL_RenderFillRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: c *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RenderFillRectsF_fun = function(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl; + TSDL_RenderFillRectsF_func = function(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl; Var - SDL_RenderFillRectsF : TSDL_RenderFillRectsF_fun = Nil; + SDL_RenderFillRectsF : TSDL_RenderFillRectsF_func = Nil; {$else} function SDL_RenderFillRectsF(renderer: PSDL_Renderer; rects: PSDL_FRect; count: cint32): cint32 cdecl; @@ -966,9 +966,9 @@ function SDL_RenderCopy(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RenderCopyF_fun = function(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: PSDL_Rect; dstrect: PSDL_FRect): cint32 cdecl; + TSDL_RenderCopyF_func = function(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: PSDL_Rect; dstrect: PSDL_FRect): cint32 cdecl; Var - SDL_RenderCopyF : TSDL_RenderCopyF_fun = Nil; + SDL_RenderCopyF : TSDL_RenderCopyF_func = Nil; {$else} function SDL_RenderCopyF(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: PSDL_Rect; dstrect: PSDL_FRect): cint32 cdecl; @@ -1007,9 +1007,9 @@ function SDL_RenderCopyEx(renderer: PSDL_Renderer; texture: PSDL_Texture; const *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RenderCopyExF_fun = function(renderer: PSDL_Renderer; texture: PSDL_Texture; const srcrect: PSDL_Rect; dstrect: PSDL_FRect; angle: cdouble; center: PSDL_FPoint; flip: TSDL_RenderFlip): cint32 cdecl; + TSDL_RenderCopyExF_func = function(renderer: PSDL_Renderer; texture: PSDL_Texture; const srcrect: PSDL_Rect; dstrect: PSDL_FRect; angle: cdouble; center: PSDL_FPoint; flip: TSDL_RenderFlip): cint32 cdecl; Var - SDL_RenderCopyExF : TSDL_RenderCopyExF_fun = Nil; + SDL_RenderCopyExF : TSDL_RenderCopyExF_func = Nil; {$else} function SDL_RenderCopyExF(renderer: PSDL_Renderer; texture: PSDL_Texture; const srcrect: PSDL_Rect; dstrect: PSDL_FRect; angle: cdouble; center: PSDL_FPoint; flip: TSDL_RenderFlip): cint32 cdecl; @@ -1139,9 +1139,9 @@ function SDL_GL_UnbindTexture(texture: PSDL_Texture): cint32 cdecl; external SDL *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RenderGetMetalLayer_fun = function(renderer: PSDL_Renderer): Pointer; cdecl; + TSDL_RenderGetMetalLayer_func = function(renderer: PSDL_Renderer): Pointer; cdecl; Var - SDL_RenderGetMetalLayer : TSDL_RenderGetMetalLayer_fun = Nil; + SDL_RenderGetMetalLayer : TSDL_RenderGetMetalLayer_func = Nil; {$else} function SDL_RenderGetMetalLayer(renderer: PSDL_Renderer): Pointer; cdecl; @@ -1161,9 +1161,9 @@ function SDL_RenderGetMetalLayer(renderer: PSDL_Renderer): Pointer; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RenderGetMetalCommandEncoder_fun = function(renderer: PSDL_Renderer): Pointer; cdecl; + TSDL_RenderGetMetalCommandEncoder_func = function(renderer: PSDL_Renderer): Pointer; cdecl; Var - SDL_RenderGetMetalCommandEncoder : TSDL_RenderGetMetalCommandEncoder_fun = Nil; + SDL_RenderGetMetalCommandEncoder : TSDL_RenderGetMetalCommandEncoder_func = Nil; {$else} function SDL_RenderGetMetalCommandEncoder(renderer: PSDL_Renderer): Pointer; cdecl; @@ -1196,10 +1196,10 @@ function SDL_RenderSetVSync(renderer: PSDL_Renderer; vsync: cint): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_UpdateYUVTexture_fun = function(texture: PSDL_Texture; rect: PSDL_Rect; Yplane: pcuint8; Ypitch: cint32; Uplane: pcuint8; UPitch: cint32; Vplane: pcuint8; VPitch: cint32):cint32; + TSDL_UpdateYUVTexture_func = function(texture: PSDL_Texture; rect: PSDL_Rect; Yplane: pcuint8; Ypitch: cint32; Uplane: pcuint8; UPitch: cint32; Vplane: pcuint8; VPitch: cint32):cint32; cdecl; Var - SDL_UpdateYUVTexture : TSDL_UpdateYUVTexture_fun = Nil; + SDL_UpdateYUVTexture : TSDL_UpdateYUVTexture_func = Nil; {$else} function SDL_UpdateYUVTexture(texture: PSDL_Texture; rect: PSDL_Rect; Yplane: pcuint8; Ypitch: cint32; Uplane: pcuint8; UPitch: cint32; Vplane: pcuint8; VPitch: cint32):cint32; diff --git a/units/sdlrwops.inc b/units/sdlrwops.inc index 0e319be0..7e3dd73a 100644 --- a/units/sdlrwops.inc +++ b/units/sdlrwops.inc @@ -133,9 +133,9 @@ type *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RWFromFile_fun = function(const _file: PAnsiChar; const mode: PAnsiChar): PSDL_RWops; cdecl; + TSDL_RWFromFile_func = function(const _file: PAnsiChar; const mode: PAnsiChar): PSDL_RWops; cdecl; Var - SDL_RWFromFile : TSDL_RWFromFile_fun = Nil; + SDL_RWFromFile : TSDL_RWFromFile_func = Nil; {$else} function SDL_RWFromFile(const _file: PAnsiChar; const mode: PAnsiChar): PSDL_RWops; cdecl; @@ -147,9 +147,9 @@ function SDL_RWFromFile(const _file: PAnsiChar; const mode: PAnsiChar): PSDL_RWo {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RWFromFP_fun = function(fp: Pointer; autoclose: TSDL_Bool): PSDL_RWops; cdecl; + TSDL_RWFromFP_func = function(fp: Pointer; autoclose: TSDL_Bool): PSDL_RWops; cdecl; Var - SDL_RWFromFP : TSDL_RWFromFP_fun = Nil; + SDL_RWFromFP : TSDL_RWFromFP_func = Nil; {$else} function SDL_RWFromFP(fp: Pointer; autoclose: TSDL_Bool): PSDL_RWops; cdecl; @@ -158,9 +158,9 @@ function SDL_RWFromFP(fp: Pointer; autoclose: TSDL_Bool): PSDL_RWops; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RWFromMem_fun = function(mem: Pointer; size: cint): PSDL_RWops; cdecl; + TSDL_RWFromMem_func = function(mem: Pointer; size: cint): PSDL_RWops; cdecl; Var - SDL_RWFromMem : TSDL_RWFromMem_fun = Nil; + SDL_RWFromMem : TSDL_RWFromMem_func = Nil; {$else} function SDL_RWFromMem(mem: Pointer; size: cint): PSDL_RWops; cdecl; @@ -169,9 +169,9 @@ function SDL_RWFromMem(mem: Pointer; size: cint): PSDL_RWops; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RWFromConstMem_fun = function(const mem: Pointer; size: cint): PSDL_RWops; cdecl; + TSDL_RWFromConstMem_func = function(const mem: Pointer; size: cint): PSDL_RWops; cdecl; Var - SDL_RWFromConstMem : TSDL_RWFromConstMem_fun = Nil; + SDL_RWFromConstMem : TSDL_RWFromConstMem_func = Nil; {$else} function SDL_RWFromConstMem(const mem: Pointer; size: cint): PSDL_RWops; cdecl; @@ -203,9 +203,9 @@ const *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RWsize_fun = function(context: PSDL_RWops): cint64; cdecl; + TSDL_RWsize_func = function(context: PSDL_RWops): cint64; cdecl; Var - SDL_RWsize : TSDL_RWsize_fun = Nil; + SDL_RWsize : TSDL_RWsize_func = Nil; {$else} function SDL_RWsize(context: PSDL_RWops): cint64; cdecl; @@ -220,9 +220,9 @@ function SDL_RWsize(context: PSDL_RWops): cint64; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RWseek_fun = function(context: PSDL_RWops; offset: cint64; whence: cint): cint64; cdecl; + TSDL_RWseek_func = function(context: PSDL_RWops; offset: cint64; whence: cint): cint64; cdecl; Var - SDL_RWseek : TSDL_RWseek_fun = Nil; + SDL_RWseek : TSDL_RWseek_func = Nil; {$else} function SDL_RWseek(context: PSDL_RWops; offset: cint64; whence: cint): cint64; cdecl; @@ -234,9 +234,9 @@ function SDL_RWseek(context: PSDL_RWops; offset: cint64; whence: cint): cint64; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RWtell_fun = function(context: PSDL_RWops): cint64; cdecl; + TSDL_RWtell_func = function(context: PSDL_RWops): cint64; cdecl; Var - SDL_RWtell : TSDL_RWtell_fun = Nil; + SDL_RWtell : TSDL_RWtell_func = Nil; {$else} function SDL_RWtell(context: PSDL_RWops): cint64; cdecl; @@ -251,9 +251,9 @@ function SDL_RWtell(context: PSDL_RWops): cint64; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RWread_fun = function(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t): csize_t; cdecl; + TSDL_RWread_func = function(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t): csize_t; cdecl; Var - SDL_RWread : TSDL_RWread_fun = Nil; + SDL_RWread : TSDL_RWread_func = Nil; {$else} function SDL_RWread(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t): csize_t; cdecl; @@ -268,9 +268,9 @@ function SDL_RWread(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RWwrite_fun = function(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t): csize_t; cdecl; + TSDL_RWwrite_func = function(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t): csize_t; cdecl; Var - SDL_RWwrite : TSDL_RWwrite_fun = Nil; + SDL_RWwrite : TSDL_RWwrite_func = Nil; {$else} function SDL_RWwrite(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_t): csize_t; cdecl; @@ -284,9 +284,9 @@ function SDL_RWwrite(context: PSDL_RWops; ptr: Pointer; size: csize_t; n: csize_ *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RWclose_fun = function(context: PSDL_RWops): cint; cdecl; + TSDL_RWclose_func = function(context: PSDL_RWops): cint; cdecl; Var - SDL_RWclose : TSDL_RWclose_fun = Nil; + SDL_RWclose : TSDL_RWclose_func = Nil; {$else} function SDL_RWclose(context: PSDL_RWops): cint; cdecl; @@ -308,9 +308,9 @@ function SDL_RWclose(context: PSDL_RWops): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_LoadFile_RW_fun = function(src: PSDL_RWops; datasize: pcsize_t; freesrc: cint): Pointer; cdecl; + TSDL_LoadFile_RW_func = function(src: PSDL_RWops; datasize: pcsize_t; freesrc: cint): Pointer; cdecl; Var - SDL_LoadFile_RW : TSDL_LoadFile_RW_fun = Nil; + SDL_LoadFile_RW : TSDL_LoadFile_RW_func = Nil; {$else} function SDL_LoadFile_RW(src: PSDL_RWops; datasize: pcsize_t; freesrc: cint): Pointer; cdecl; @@ -332,9 +332,9 @@ function SDL_LoadFile_RW(src: PSDL_RWops; datasize: pcsize_t; freesrc: cint): Po *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_LoadFile_fun = function(file_: PAnsiChar; datasize: pcsize_t): Pointer; cdecl; + TSDL_LoadFile_func = function(file_: PAnsiChar; datasize: pcsize_t): Pointer; cdecl; Var - SDL_LoadFile : TSDL_LoadFile_fun = Nil; + SDL_LoadFile : TSDL_LoadFile_func = Nil; {$else} function SDL_LoadFile(file_: PAnsiChar; datasize: pcsize_t): Pointer; cdecl; @@ -348,9 +348,9 @@ function SDL_LoadFile(file_: PAnsiChar; datasize: pcsize_t): Pointer; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_ReadU8_fun = function(src: PSDL_RWops): cuint8; cdecl; + TSDL_ReadU8_func = function(src: PSDL_RWops): cuint8; cdecl; Var - SDL_ReadU8 : TSDL_ReadU8_fun = Nil; + SDL_ReadU8 : TSDL_ReadU8_func = Nil; {$else} function SDL_ReadU8(src: PSDL_RWops): cuint8; cdecl; @@ -358,9 +358,9 @@ function SDL_ReadU8(src: PSDL_RWops): cuint8; cdecl; {$endif} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_ReadLE16_fun = function(src: PSDL_RWops): cuint16; cdecl; + TSDL_ReadLE16_func = function(src: PSDL_RWops): cuint16; cdecl; Var - SDL_ReadLE16 : TSDL_ReadLE16_fun = Nil; + SDL_ReadLE16 : TSDL_ReadLE16_func = Nil; {$else} function SDL_ReadLE16(src: PSDL_RWops): cuint16; cdecl; @@ -368,9 +368,9 @@ function SDL_ReadLE16(src: PSDL_RWops): cuint16; cdecl; {$endif} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_ReadBE16_fun = function(src: PSDL_RWops): cuint16; cdecl; + TSDL_ReadBE16_func = function(src: PSDL_RWops): cuint16; cdecl; Var - SDL_ReadBE16 : TSDL_ReadBE16_fun = Nil; + SDL_ReadBE16 : TSDL_ReadBE16_func = Nil; {$else} function SDL_ReadBE16(src: PSDL_RWops): cuint16; cdecl; @@ -378,9 +378,9 @@ function SDL_ReadBE16(src: PSDL_RWops): cuint16; cdecl; {$endif} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_ReadLE32_fun = function(src: PSDL_RWops): cuint32; cdecl; + TSDL_ReadLE32_func = function(src: PSDL_RWops): cuint32; cdecl; Var - SDL_ReadLE32 : TSDL_ReadLE32_fun = Nil; + SDL_ReadLE32 : TSDL_ReadLE32_func = Nil; {$else} function SDL_ReadLE32(src: PSDL_RWops): cuint32; cdecl; @@ -388,9 +388,9 @@ function SDL_ReadLE32(src: PSDL_RWops): cuint32; cdecl; {$endif} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_ReadBE32_fun = function(src: PSDL_RWops): cuint32; cdecl; + TSDL_ReadBE32_func = function(src: PSDL_RWops): cuint32; cdecl; Var - SDL_ReadBE32 : TSDL_ReadBE32_fun = Nil; + SDL_ReadBE32 : TSDL_ReadBE32_func = Nil; {$else} function SDL_ReadBE32(src: PSDL_RWops): cuint32; cdecl; @@ -398,9 +398,9 @@ function SDL_ReadBE32(src: PSDL_RWops): cuint32; cdecl; {$endif} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_ReadLE64_fun = function(src: PSDL_RWops): cuint64; cdecl; + TSDL_ReadLE64_func = function(src: PSDL_RWops): cuint64; cdecl; Var - SDL_ReadLE64 : TSDL_ReadLE64_fun = Nil; + SDL_ReadLE64 : TSDL_ReadLE64_func = Nil; {$else} function SDL_ReadLE64(src: PSDL_RWops): cuint64; cdecl; @@ -408,9 +408,9 @@ function SDL_ReadLE64(src: PSDL_RWops): cuint64; cdecl; {$endif} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_ReadBE64_fun = function(src: PSDL_RWops): cuint64; cdecl; + TSDL_ReadBE64_func = function(src: PSDL_RWops): cuint64; cdecl; Var - SDL_ReadBE64 : TSDL_ReadBE64_fun = Nil; + SDL_ReadBE64 : TSDL_ReadBE64_func = Nil; {$else} function SDL_ReadBE64(src: PSDL_RWops): cuint64; cdecl; @@ -425,9 +425,9 @@ function SDL_ReadBE64(src: PSDL_RWops): cuint64; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_WriteU8_fun = function(dst: PSDL_RWops; value: cuint8): csize_t; cdecl; + TSDL_WriteU8_func = function(dst: PSDL_RWops; value: cuint8): csize_t; cdecl; Var - SDL_WriteU8 : TSDL_WriteU8_fun = Nil; + SDL_WriteU8 : TSDL_WriteU8_func = Nil; {$else} function SDL_WriteU8(dst: PSDL_RWops; value: cuint8): csize_t; cdecl; @@ -435,9 +435,9 @@ function SDL_WriteU8(dst: PSDL_RWops; value: cuint8): csize_t; cdecl; {$endif} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_WriteLE16_fun = function(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; + TSDL_WriteLE16_func = function(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; Var - SDL_WriteLE16 : TSDL_WriteLE16_fun = Nil; + SDL_WriteLE16 : TSDL_WriteLE16_func = Nil; {$else} function SDL_WriteLE16(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; @@ -445,9 +445,9 @@ function SDL_WriteLE16(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; {$endif} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_WriteBE16_fun = function(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; + TSDL_WriteBE16_func = function(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; Var - SDL_WriteBE16 : TSDL_WriteBE16_fun = Nil; + SDL_WriteBE16 : TSDL_WriteBE16_func = Nil; {$else} function SDL_WriteBE16(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; @@ -455,9 +455,9 @@ function SDL_WriteBE16(dst: PSDL_RWops; value: cuint16): csize_t; cdecl; {$endif} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_WriteLE32_fun = function(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; + TSDL_WriteLE32_func = function(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; Var - SDL_WriteLE32 : TSDL_WriteLE32_fun = Nil; + SDL_WriteLE32 : TSDL_WriteLE32_func = Nil; {$else} function SDL_WriteLE32(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; @@ -465,9 +465,9 @@ function SDL_WriteLE32(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; {$endif} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_WriteBE32_fun = function(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; + TSDL_WriteBE32_func = function(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; Var - SDL_WriteBE32 : TSDL_WriteBE32_fun = Nil; + SDL_WriteBE32 : TSDL_WriteBE32_func = Nil; {$else} function SDL_WriteBE32(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; @@ -475,9 +475,9 @@ function SDL_WriteBE32(dst: PSDL_RWops; value: cuint32): csize_t; cdecl; {$endif} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_WriteLE64_fun = function(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; + TSDL_WriteLE64_func = function(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; Var - SDL_WriteLE64 : TSDL_WriteLE64_fun = Nil; + SDL_WriteLE64 : TSDL_WriteLE64_func = Nil; {$else} function SDL_WriteLE64(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; @@ -485,9 +485,9 @@ function SDL_WriteLE64(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; {$endif} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_WriteBE64_fun = function(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; + TSDL_WriteBE64_func = function(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; Var - SDL_WriteBE64 : TSDL_WriteBE64_fun = Nil; + SDL_WriteBE64 : TSDL_WriteBE64_func = Nil; {$else} function SDL_WriteBE64(dst: PSDL_RWops; value: cuint64): csize_t; cdecl; diff --git a/units/sdlshape.inc b/units/sdlshape.inc index ab5434c7..7f15aa79 100644 --- a/units/sdlshape.inc +++ b/units/sdlshape.inc @@ -35,9 +35,9 @@ const *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_CreateShapedWindow_fun = function(title: PAnsiChar; x: cuint; y: cuint; w: cuint; h: cuint; flags: cuint32): PSDL_Window; cdecl; + TSDL_CreateShapedWindow_func = function(title: PAnsiChar; x: cuint; y: cuint; w: cuint; h: cuint; flags: cuint32): PSDL_Window; cdecl; Var - SDL_CreateShapedWindow : TSDL_CreateShapedWindow_fun = Nil; + SDL_CreateShapedWindow : TSDL_CreateShapedWindow_func = Nil; {$else} function SDL_CreateShapedWindow(title: PAnsiChar; x: cuint; y: cuint; w: cuint; h: cuint; flags: cuint32): PSDL_Window; cdecl; @@ -57,9 +57,9 @@ function SDL_CreateShapedWindow(title: PAnsiChar; x: cuint; y: cuint; w: cuint; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_IsShapedWindow_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; + TSDL_IsShapedWindow_func = function(window: PSDL_Window): TSDL_Bool; cdecl; Var - SDL_IsShapedWindow : TSDL_IsShapedWindow_fun = Nil; + SDL_IsShapedWindow : TSDL_IsShapedWindow_func = Nil; {$else} function SDL_IsShapedWindow(window: PSDL_Window): TSDL_Bool; cdecl; @@ -123,9 +123,9 @@ type *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetWindowShape_fun = function(window: PSDL_Window; shape: PSDL_Surface; shape_mode: PSDL_WindowShapeMode): cint; cdecl; + TSDL_SetWindowShape_func = function(window: PSDL_Window; shape: PSDL_Surface; shape_mode: PSDL_WindowShapeMode): cint; cdecl; Var - SDL_SetWindowShape : TSDL_SetWindowShape_fun = Nil; + SDL_SetWindowShape : TSDL_SetWindowShape_func = Nil; {$else} function SDL_SetWindowShape(window: PSDL_Window; shape: PSDL_Surface; shape_mode: PSDL_WindowShapeMode): cint; cdecl; @@ -151,9 +151,9 @@ function SDL_SetWindowShape(window: PSDL_Window; shape: PSDL_Surface; shape_mode *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetShapedWindowMode_fun = function(window: PSDL_Window; shape_mode: PSDL_WindowShapeMode): cint; cdecl; + TSDL_GetShapedWindowMode_func = function(window: PSDL_Window; shape_mode: PSDL_WindowShapeMode): cint; cdecl; Var - SDL_GetShapedWindowMode : TSDL_GetShapedWindowMode_fun = Nil; + SDL_GetShapedWindowMode : TSDL_GetShapedWindowMode_func = Nil; {$else} function SDL_GetShapedWindowMode(window: PSDL_Window; shape_mode: PSDL_WindowShapeMode): cint; cdecl; diff --git a/units/sdlstdinc.inc b/units/sdlstdinc.inc index 109c6757..4f908e8b 100644 --- a/units/sdlstdinc.inc +++ b/units/sdlstdinc.inc @@ -112,9 +112,9 @@ function SDL_SetMemoryFunctions( *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetNumAllocations_fun = function(): cint; cdecl; + TSDL_GetNumAllocations_func = function(): cint; cdecl; Var - SDL_GetNumAllocations : TSDL_GetNumAllocations_fun = Nil; + SDL_GetNumAllocations : TSDL_GetNumAllocations_func = Nil; {$else} function SDL_GetNumAllocations(): cint; cdecl; @@ -125,10 +125,8 @@ function SDL_GetNumAllocations(): cint; cdecl; * Allocate a block of memory. The memory is *not* initialized. *) {$ifdef SDL_RUNTIME_LOADING} -Type - TSDL_malloc_fun = function(size: csize_t): Pointer; cdecl; Var - SDL_malloc : TSDL_malloc_fun = Nil; + SDL_malloc : TSDL_malloc_func = Nil; {$else} function SDL_malloc(size: csize_t): Pointer; cdecl; @@ -140,10 +138,8 @@ function SDL_malloc(size: csize_t): Pointer; cdecl; * The memory is initialized by setting every byte to 0. *) {$ifdef SDL_RUNTIME_LOADING} -Type - TSDL_calloc_fun = function(nmemb, size: csize_t): Pointer; cdecl; Var - SDL_calloc : TSDL_calloc_fun = Nil; + SDL_calloc : TSDL_calloc_func = Nil; {$else} function SDL_calloc(nmemb, size: csize_t): Pointer; cdecl; @@ -157,10 +153,8 @@ function SDL_calloc(nmemb, size: csize_t): Pointer; cdecl; * If the new size is larger than the old size, any new memory will *not* be initialized. *) {$ifdef SDL_RUNTIME_LOADING} -Type - TSDL_realloc_fun = function(mem: Pointer; size: csize_t): Pointer; cdecl; Var - SDL_realloc : TSDL_realloc_fun = Nil; + SDL_realloc : TSDL_realloc_func = Nil; {$else} function SDL_realloc(mem: Pointer; size: csize_t): Pointer; cdecl; @@ -200,9 +194,9 @@ SDL2-for-Pascal: All comments are added by us and not found in the include file. *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_isalpha_fun = function(x: cint):cint; cdecl; + TSDL_isalpha_func = function(x: cint):cint; cdecl; Var - SDL_isalpha : TSDL_isalpha_fun = Nil; + SDL_isalpha : TSDL_isalpha_func = Nil; {$else} function SDL_isalpha(x: cint):cint; cdecl; @@ -218,9 +212,9 @@ function SDL_isalpha(x: cint):cint; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_isalnum_fun = function(x: cint):cint; cdecl; + TSDL_isalnum_func = function(x: cint):cint; cdecl; Var - SDL_isalnum : TSDL_isalnum_fun = Nil; + SDL_isalnum : TSDL_isalnum_func = Nil; {$else} function SDL_isalnum(x: cint):cint; cdecl; @@ -236,9 +230,9 @@ function SDL_isalnum(x: cint):cint; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_isblank_fun = function(x: cint):cint; cdecl; + TSDL_isblank_func = function(x: cint):cint; cdecl; Var - SDL_isblank : TSDL_isblank_fun = Nil; + SDL_isblank : TSDL_isblank_func = Nil; {$else} function SDL_isblank(x: cint):cint; cdecl; @@ -254,9 +248,9 @@ function SDL_isblank(x: cint):cint; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_iscntrl_fun = function(x: cint):cint; cdecl; + TSDL_iscntrl_func = function(x: cint):cint; cdecl; Var - SDL_iscntrl : TSDL_iscntrl_fun = Nil; + SDL_iscntrl : TSDL_iscntrl_func = Nil; {$else} function SDL_iscntrl(x: cint):cint; cdecl; @@ -272,9 +266,9 @@ function SDL_iscntrl(x: cint):cint; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_isdigit_fun = function(x: cint):cint; cdecl; + TSDL_isdigit_func = function(x: cint):cint; cdecl; Var - SDL_isdigit : TSDL_isdigit_fun = Nil; + SDL_isdigit : TSDL_isdigit_func = Nil; {$else} function SDL_isdigit(x: cint):cint; cdecl; @@ -290,9 +284,9 @@ function SDL_isdigit(x: cint):cint; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_isxdigit_fun = function(x: cint):cint; cdecl; + TSDL_isxdigit_func = function(x: cint):cint; cdecl; Var - SDL_isxdigit : TSDL_isxdigit_fun = Nil; + SDL_isxdigit : TSDL_isxdigit_func = Nil; {$else} function SDL_isxdigit(x: cint):cint; cdecl; @@ -309,9 +303,9 @@ function SDL_isxdigit(x: cint):cint; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_ispunct_fun = function(x: cint):cint; cdecl; + TSDL_ispunct_func = function(x: cint):cint; cdecl; Var - SDL_ispunct : TSDL_ispunct_fun = Nil; + SDL_ispunct : TSDL_ispunct_func = Nil; {$else} function SDL_ispunct(x: cint):cint; cdecl; @@ -330,9 +324,9 @@ function SDL_ispunct(x: cint):cint; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_isspace_fun = function(x: cint):cint; cdecl; + TSDL_isspace_func = function(x: cint):cint; cdecl; Var - SDL_isspace : TSDL_isspace_fun = Nil; + SDL_isspace : TSDL_isspace_func = Nil; {$else} function SDL_isspace(x: cint):cint; cdecl; @@ -348,9 +342,9 @@ function SDL_isspace(x: cint):cint; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_isupper_fun = function(x: cint):cint; cdecl; + TSDL_isupper_func = function(x: cint):cint; cdecl; Var - SDL_isupper : TSDL_isupper_fun = Nil; + SDL_isupper : TSDL_isupper_func = Nil; {$else} function SDL_isupper(x: cint):cint; cdecl; @@ -366,9 +360,9 @@ function SDL_isupper(x: cint):cint; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_islower_fun = function(x: cint):cint; cdecl; + TSDL_islower_func = function(x: cint):cint; cdecl; Var - SDL_islower : TSDL_islower_fun = Nil; + SDL_islower : TSDL_islower_func = Nil; {$else} function SDL_islower(x: cint):cint; cdecl; @@ -384,9 +378,9 @@ function SDL_islower(x: cint):cint; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_isprint_fun = function(x: cint):cint; cdecl; + TSDL_isprint_func = function(x: cint):cint; cdecl; Var - SDL_isprint : TSDL_isprint_fun = Nil; + SDL_isprint : TSDL_isprint_func = Nil; {$else} function SDL_isprint(x: cint):cint; cdecl; @@ -402,9 +396,9 @@ function SDL_isprint(x: cint):cint; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_isgraph_fun = function(x: cint):cint; cdecl; + TSDL_isgraph_func = function(x: cint):cint; cdecl; Var - SDL_isgraph : TSDL_isgraph_fun = Nil; + SDL_isgraph : TSDL_isgraph_func = Nil; {$else} function SDL_isgraph(x: cint):cint; cdecl; @@ -419,9 +413,9 @@ function SDL_isgraph(x: cint):cint; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_toupper_fun = function(x: cint):cint; cdecl; + TSDL_toupper_func = function(x: cint):cint; cdecl; Var - SDL_toupper : TSDL_toupper_fun = Nil; + SDL_toupper : TSDL_toupper_func = Nil; {$else} function SDL_toupper(x: cint):cint; cdecl; @@ -436,9 +430,9 @@ function SDL_toupper(x: cint):cint; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_tolower_fun = function(x: cint):cint; cdecl; + TSDL_tolower_func = function(x: cint):cint; cdecl; Var - SDL_tolower : TSDL_tolower_fun = Nil; + SDL_tolower : TSDL_tolower_func = Nil; {$else} function SDL_tolower(x: cint):cint; cdecl; @@ -458,9 +452,9 @@ function SDL_tolower(x: cint):cint; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_acos_fun = function(x: cdouble): cdouble; cdecl; + TSDL_acos_func = function(x: cdouble): cdouble; cdecl; Var - SDL_acos : TSDL_acos_fun = Nil; + SDL_acos : TSDL_acos_func = Nil; {$else} function SDL_acos(x: cdouble): cdouble; cdecl; @@ -475,9 +469,9 @@ function SDL_acos(x: cdouble): cdouble; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_acosf_fun = function(x: cfloat): cfloat; cdecl; + TSDL_acosf_func = function(x: cfloat): cfloat; cdecl; Var - SDL_acosf : TSDL_acosf_fun = Nil; + SDL_acosf : TSDL_acosf_func = Nil; {$else} function SDL_acosf(x: cfloat): cfloat; cdecl; @@ -492,9 +486,9 @@ function SDL_acosf(x: cfloat): cfloat; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_asin_fun = function(x: cdouble): cdouble; cdecl; + TSDL_asin_func = function(x: cdouble): cdouble; cdecl; Var - SDL_asin : TSDL_asin_fun = Nil; + SDL_asin : TSDL_asin_func = Nil; {$else} function SDL_asin(x: cdouble): cdouble; cdecl; @@ -509,9 +503,9 @@ function SDL_asin(x: cdouble): cdouble; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_asinf_fun = function(x: cfloat): cfloat; cdecl; + TSDL_asinf_func = function(x: cfloat): cfloat; cdecl; Var - SDL_asinf : TSDL_asinf_fun = Nil; + SDL_asinf : TSDL_asinf_func = Nil; {$else} function SDL_asinf(x: cfloat): cfloat; cdecl; @@ -526,9 +520,9 @@ function SDL_asinf(x: cfloat): cfloat; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_atan_fun = function(x: cdouble): cdouble; cdecl; + TSDL_atan_func = function(x: cdouble): cdouble; cdecl; Var - SDL_atan : TSDL_atan_fun = Nil; + SDL_atan : TSDL_atan_func = Nil; {$else} function SDL_atan(x: cdouble): cdouble; cdecl; @@ -543,9 +537,9 @@ function SDL_atan(x: cdouble): cdouble; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_atanf_fun = function(x: cfloat): cfloat; cdecl; + TSDL_atanf_func = function(x: cfloat): cfloat; cdecl; Var - SDL_atanf : TSDL_atanf_fun = Nil; + SDL_atanf : TSDL_atanf_func = Nil; {$else} function SDL_atanf(x: cfloat): cfloat; cdecl; @@ -560,9 +554,9 @@ function SDL_atanf(x: cfloat): cfloat; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_atan2_fun = function(y, x: cdouble): cdouble; cdecl; + TSDL_atan2_func = function(y, x: cdouble): cdouble; cdecl; Var - SDL_atan2 : TSDL_atan2_fun = Nil; + SDL_atan2 : TSDL_atan2_func = Nil; {$else} function SDL_atan2(y, x: cdouble): cdouble; cdecl; @@ -577,9 +571,9 @@ function SDL_atan2(y, x: cdouble): cdouble; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_atan2f_fun = function(y, x: cfloat): cfloat; cdecl; + TSDL_atan2f_func = function(y, x: cfloat): cfloat; cdecl; Var - SDL_atan2f : TSDL_atan2f_fun = Nil; + SDL_atan2f : TSDL_atan2f_func = Nil; {$else} function SDL_atan2f(y, x: cfloat): cfloat; cdecl; @@ -593,9 +587,9 @@ function SDL_atan2f(y, x: cfloat): cfloat; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_ceil_fun = function(x: cdouble): cdouble; cdecl; + TSDL_ceil_func = function(x: cdouble): cdouble; cdecl; Var - SDL_ceil : TSDL_ceil_fun = Nil; + SDL_ceil : TSDL_ceil_func = Nil; {$else} function SDL_ceil(x: cdouble): cdouble; cdecl; @@ -609,9 +603,9 @@ function SDL_ceil(x: cdouble): cdouble; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_ceilf_fun = function(x: cfloat): cfloat; cdecl; + TSDL_ceilf_func = function(x: cfloat): cfloat; cdecl; Var - SDL_ceilf : TSDL_ceilf_fun = Nil; + SDL_ceilf : TSDL_ceilf_func = Nil; {$else} function SDL_ceilf(x: cfloat): cfloat; cdecl; @@ -626,9 +620,9 @@ function SDL_ceilf(x: cfloat): cfloat; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_copysign_fun = function(x, y: cdouble): cdouble; cdecl; + TSDL_copysign_func = function(x, y: cdouble): cdouble; cdecl; Var - SDL_copysign : TSDL_copysign_fun = Nil; + SDL_copysign : TSDL_copysign_func = Nil; {$else} function SDL_copysign(x, y: cdouble): cdouble; cdecl; @@ -643,9 +637,9 @@ function SDL_copysign(x, y: cdouble): cdouble; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_copysignf_fun = function(x, y: cfloat): cfloat; cdecl; + TSDL_copysignf_func = function(x, y: cfloat): cfloat; cdecl; Var - SDL_copysignf : TSDL_copysignf_fun = Nil; + SDL_copysignf : TSDL_copysignf_func = Nil; {$else} function SDL_copysignf(x, y: cfloat): cfloat; cdecl; @@ -659,9 +653,9 @@ function SDL_copysignf(x, y: cfloat): cfloat; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_cos_fun = function(x: cdouble): cdouble; cdecl; + TSDL_cos_func = function(x: cdouble): cdouble; cdecl; Var - SDL_cos : TSDL_cos_fun = Nil; + SDL_cos : TSDL_cos_func = Nil; {$else} function SDL_cos(x: cdouble): cdouble; cdecl; @@ -675,9 +669,9 @@ function SDL_cos(x: cdouble): cdouble; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_cosf_fun = function(x: cfloat): cfloat; cdecl; + TSDL_cosf_func = function(x: cfloat): cfloat; cdecl; Var - SDL_cosf : TSDL_cosf_fun = Nil; + SDL_cosf : TSDL_cosf_func = Nil; {$else} function SDL_cosf(x: cfloat): cfloat; cdecl; @@ -692,9 +686,9 @@ function SDL_cosf(x: cfloat): cfloat; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_exp_fun = function(x: cdouble): cdouble; cdecl; + TSDL_exp_func = function(x: cdouble): cdouble; cdecl; Var - SDL_exp : TSDL_exp_fun = Nil; + SDL_exp : TSDL_exp_func = Nil; {$else} function SDL_exp(x: cdouble): cdouble; cdecl; @@ -709,9 +703,9 @@ function SDL_exp(x: cdouble): cdouble; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_expf_fun = function(x: cfloat): cfloat; cdecl; + TSDL_expf_func = function(x: cfloat): cfloat; cdecl; Var - SDL_expf : TSDL_expf_fun = Nil; + SDL_expf : TSDL_expf_func = Nil; {$else} function SDL_expf(x: cfloat): cfloat; cdecl; @@ -725,9 +719,9 @@ function SDL_expf(x: cfloat): cfloat; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_fabs_fun = function(x: cdouble): cdouble; cdecl; + TSDL_fabs_func = function(x: cdouble): cdouble; cdecl; Var - SDL_fabs : TSDL_fabs_fun = Nil; + SDL_fabs : TSDL_fabs_func = Nil; {$else} function SDL_fabs(x: cdouble): cdouble; cdecl; @@ -741,9 +735,9 @@ function SDL_fabs(x: cdouble): cdouble; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_fabsf_fun = function(x: cfloat): cfloat; cdecl; + TSDL_fabsf_func = function(x: cfloat): cfloat; cdecl; Var - SDL_fabsf : TSDL_fabsf_fun = Nil; + SDL_fabsf : TSDL_fabsf_func = Nil; {$else} function SDL_fabsf(x: cfloat): cfloat; cdecl; @@ -757,9 +751,9 @@ function SDL_fabsf(x: cfloat): cfloat; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_floor_fun = function(x: cdouble): cdouble; cdecl; + TSDL_floor_func = function(x: cdouble): cdouble; cdecl; Var - SDL_floor : TSDL_floor_fun = Nil; + SDL_floor : TSDL_floor_func = Nil; {$else} function SDL_floor(x: cdouble): cdouble; cdecl; @@ -773,9 +767,9 @@ function SDL_floor(x: cdouble): cdouble; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_floorf_fun = function(x: cfloat): cfloat; cdecl; + TSDL_floorf_func = function(x: cfloat): cfloat; cdecl; Var - SDL_floorf : TSDL_floorf_fun = Nil; + SDL_floorf : TSDL_floorf_func = Nil; {$else} function SDL_floorf(x: cfloat): cfloat; cdecl; @@ -789,9 +783,9 @@ function SDL_floorf(x: cfloat): cfloat; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_fmod_fun = function(x, y: cdouble): cdouble; cdecl; + TSDL_fmod_func = function(x, y: cdouble): cdouble; cdecl; Var - SDL_fmod : TSDL_fmod_fun = Nil; + SDL_fmod : TSDL_fmod_func = Nil; {$else} function SDL_fmod(x, y: cdouble): cdouble; cdecl; @@ -805,9 +799,9 @@ function SDL_fmod(x, y: cdouble): cdouble; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_fmodf_fun = function(x, y: cfloat): cfloat; cdecl; + TSDL_fmodf_func = function(x, y: cfloat): cfloat; cdecl; Var - SDL_fmodf : TSDL_fmodf_fun = Nil; + SDL_fmodf : TSDL_fmodf_func = Nil; {$else} function SDL_fmodf(x, y: cfloat): cfloat; cdecl; @@ -825,9 +819,9 @@ function SDL_fmodf(x, y: cfloat): cfloat; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_nlog_fun = function(x: cdouble): cdouble; cdecl; + TSDL_nlog_func = function(x: cdouble): cdouble; cdecl; Var - SDL_nlog : TSDL_nlog_fun = Nil; + SDL_nlog : TSDL_nlog_func = Nil; {$else} function SDL_nlog(x: cdouble): cdouble; cdecl; @@ -846,9 +840,9 @@ function SDL_nlog(x: cdouble): cdouble; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_nlogf_fun = function(x: cfloat): cfloat; cdecl; + TSDL_nlogf_func = function(x: cfloat): cfloat; cdecl; Var - SDL_nlogf : TSDL_nlogf_fun = Nil; + SDL_nlogf : TSDL_nlogf_func = Nil; {$else} function SDL_nlogf(x: cfloat): cfloat; cdecl; @@ -863,9 +857,9 @@ function SDL_nlogf(x: cfloat): cfloat; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_log10_fun = function(x: cdouble): cdouble; cdecl; + TSDL_log10_func = function(x: cdouble): cdouble; cdecl; Var - SDL_log10 : TSDL_log10_fun = Nil; + SDL_log10 : TSDL_log10_func = Nil; {$else} function SDL_log10(x: cdouble): cdouble; cdecl; @@ -879,9 +873,9 @@ function SDL_log10(x: cdouble): cdouble; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_log10f_fun = function(x: cfloat): cfloat; cdecl; + TSDL_log10f_func = function(x: cfloat): cfloat; cdecl; Var - SDL_log10f : TSDL_log10f_fun = Nil; + SDL_log10f : TSDL_log10f_func = Nil; {$else} function SDL_log10f(x: cfloat): cfloat; cdecl; @@ -895,9 +889,9 @@ function SDL_log10f(x: cfloat): cfloat; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_lround_fun = function(x: cdouble): clong; cdecl; + TSDL_lround_func = function(x: cdouble): clong; cdecl; Var - SDL_lround : TSDL_lround_fun = Nil; + SDL_lround : TSDL_lround_func = Nil; {$else} function SDL_lround(x: cdouble): clong; cdecl; @@ -911,9 +905,9 @@ function SDL_lround(x: cdouble): clong; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_lroundf_fun = function(x: cfloat): clong; cdecl; + TSDL_lroundf_func = function(x: cfloat): clong; cdecl; Var - SDL_lroundf : TSDL_lroundf_fun = Nil; + SDL_lroundf : TSDL_lroundf_func = Nil; {$else} function SDL_lroundf(x: cfloat): clong; cdecl; @@ -927,9 +921,9 @@ function SDL_lroundf(x: cfloat): clong; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_pow_fun = function(x, y: cdouble): cdouble; cdecl; + TSDL_pow_func = function(x, y: cdouble): cdouble; cdecl; Var - SDL_pow : TSDL_pow_fun = Nil; + SDL_pow : TSDL_pow_func = Nil; {$else} function SDL_pow(x, y: cdouble): cdouble; cdecl; @@ -943,9 +937,9 @@ function SDL_pow(x, y: cdouble): cdouble; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_powf_fun = function(x, y: cfloat): cfloat; cdecl; + TSDL_powf_func = function(x, y: cfloat): cfloat; cdecl; Var - SDL_powf : TSDL_powf_fun = Nil; + SDL_powf : TSDL_powf_func = Nil; {$else} function SDL_powf(x, y: cfloat): cfloat; cdecl; @@ -959,9 +953,9 @@ function SDL_powf(x, y: cfloat): cfloat; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_round_fun = function(x: cdouble): cdouble; cdecl; + TSDL_round_func = function(x: cdouble): cdouble; cdecl; Var - SDL_round : TSDL_round_fun = Nil; + SDL_round : TSDL_round_func = Nil; {$else} function SDL_round(x: cdouble): cdouble; cdecl; @@ -975,9 +969,9 @@ function SDL_round(x: cdouble): cdouble; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_roundf_fun = function(x: cfloat): cfloat; cdecl; + TSDL_roundf_func = function(x: cfloat): cfloat; cdecl; Var - SDL_roundf : TSDL_roundf_fun = Nil; + SDL_roundf : TSDL_roundf_func = Nil; {$else} function SDL_roundf(x: cfloat): cfloat; cdecl; @@ -992,9 +986,9 @@ function SDL_roundf(x: cfloat): cfloat; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_scalbn_fun = function(x: cdouble; n: cint): cdouble; cdecl; + TSDL_scalbn_func = function(x: cdouble; n: cint): cdouble; cdecl; Var - SDL_scalbn : TSDL_scalbn_fun = Nil; + SDL_scalbn : TSDL_scalbn_func = Nil; {$else} function SDL_scalbn(x: cdouble; n: cint): cdouble; cdecl; @@ -1009,9 +1003,9 @@ function SDL_scalbn(x: cdouble; n: cint): cdouble; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_scalbnf_fun = function(x: cfloat; n: cint): cfloat; cdecl; + TSDL_scalbnf_func = function(x: cfloat; n: cint): cfloat; cdecl; Var - SDL_scalbnf : TSDL_scalbnf_fun = Nil; + SDL_scalbnf : TSDL_scalbnf_func = Nil; {$else} function SDL_scalbnf(x: cfloat; n: cint): cfloat; cdecl; @@ -1025,9 +1019,9 @@ function SDL_scalbnf(x: cfloat; n: cint): cfloat; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_sin_fun = function(x: cdouble): cdouble; cdecl; + TSDL_sin_func = function(x: cdouble): cdouble; cdecl; Var - SDL_sin : TSDL_sin_fun = Nil; + SDL_sin : TSDL_sin_func = Nil; {$else} function SDL_sin(x: cdouble): cdouble; cdecl; @@ -1041,9 +1035,9 @@ function SDL_sin(x: cdouble): cdouble; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_sinf_fun = function(x: cfloat): cfloat; cdecl; + TSDL_sinf_func = function(x: cfloat): cfloat; cdecl; Var - SDL_sinf : TSDL_sinf_fun = Nil; + SDL_sinf : TSDL_sinf_func = Nil; {$else} function SDL_sinf(x: cfloat): cfloat; cdecl; @@ -1057,9 +1051,9 @@ function SDL_sinf(x: cfloat): cfloat; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_sqrt_fun = function(x: cdouble): cdouble; cdecl; + TSDL_sqrt_func = function(x: cdouble): cdouble; cdecl; Var - SDL_sqrt : TSDL_sqrt_fun = Nil; + SDL_sqrt : TSDL_sqrt_func = Nil; {$else} function SDL_sqrt(x: cdouble): cdouble; cdecl; @@ -1073,9 +1067,9 @@ function SDL_sqrt(x: cdouble): cdouble; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_sqrtf_fun = function(x: cfloat): cfloat; cdecl; + TSDL_sqrtf_func = function(x: cfloat): cfloat; cdecl; Var - SDL_sqrtf : TSDL_sqrtf_fun = Nil; + SDL_sqrtf : TSDL_sqrtf_func = Nil; {$else} function SDL_sqrtf(x: cfloat): cfloat; cdecl; @@ -1089,9 +1083,9 @@ function SDL_sqrtf(x: cfloat): cfloat; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_tan_fun = function(x: cdouble): cdouble; cdecl; + TSDL_tan_func = function(x: cdouble): cdouble; cdecl; Var - SDL_tan : TSDL_tan_fun = Nil; + SDL_tan : TSDL_tan_func = Nil; {$else} function SDL_tan(x: cdouble): cdouble; cdecl; @@ -1105,9 +1099,9 @@ function SDL_tan(x: cdouble): cdouble; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_tanf_fun = function(x: cfloat): cfloat; cdecl; + TSDL_tanf_func = function(x: cfloat): cfloat; cdecl; Var - SDL_tanf : TSDL_tanf_fun = Nil; + SDL_tanf : TSDL_tanf_func = Nil; {$else} function SDL_tanf(x: cfloat): cfloat; cdecl; @@ -1121,9 +1115,9 @@ function SDL_tanf(x: cfloat): cfloat; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_trunc_fun = function(x: cdouble): cdouble; cdecl; + TSDL_trunc_func = function(x: cdouble): cdouble; cdecl; Var - SDL_trunc : TSDL_trunc_fun = Nil; + SDL_trunc : TSDL_trunc_func = Nil; {$else} function SDL_trunc(x: cdouble): cdouble; cdecl; @@ -1137,9 +1131,9 @@ function SDL_trunc(x: cdouble): cdouble; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_truncf_fun = function(x: cfloat): cfloat; cdecl; + TSDL_truncf_func = function(x: cfloat): cfloat; cdecl; Var - SDL_truncf : TSDL_truncf_fun = Nil; + SDL_truncf : TSDL_truncf_func = Nil; {$else} function SDL_truncf(x: cfloat): cfloat; cdecl; @@ -1159,9 +1153,9 @@ function SDL_truncf(x: cfloat): cfloat; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_iconv_string_fun = function(Const tocode, fromcode, inbuf: PAnsiChar; inbytesleft: csize_t): PAnsiChar; cdecl; + TSDL_iconv_string_func = function(Const tocode, fromcode, inbuf: PAnsiChar; inbytesleft: csize_t): PAnsiChar; cdecl; Var - SDL_iconv_string : TSDL_iconv_string_fun = Nil; + SDL_iconv_string : TSDL_iconv_string_func = Nil; {$else} function SDL_iconv_string(Const tocode, fromcode, inbuf: PAnsiChar; inbytesleft: csize_t): PAnsiChar; cdecl; @@ -1185,9 +1179,9 @@ type {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_iconv_open_fun = function(Const tocode, fromcode: PAnsiChar): PSDL_iconv; cdecl; + TSDL_iconv_open_func = function(Const tocode, fromcode: PAnsiChar): PSDL_iconv; cdecl; Var - SDL_iconv_open : TSDL_iconv_open_fun = Nil; + SDL_iconv_open : TSDL_iconv_open_func = Nil; {$else} function SDL_iconv_open(Const tocode, fromcode: PAnsiChar): PSDL_iconv; cdecl; @@ -1196,9 +1190,9 @@ function SDL_iconv_open(Const tocode, fromcode: PAnsiChar): PSDL_iconv; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_iconv_close_fun = function(cd: PSDL_iconv): cint; cdecl; + TSDL_iconv_close_func = function(cd: PSDL_iconv): cint; cdecl; Var - SDL_iconv_close : TSDL_iconv_close_fun = Nil; + SDL_iconv_close : TSDL_iconv_close_func = Nil; {$else} function SDL_iconv_close(cd: PSDL_iconv): cint; cdecl; @@ -1207,9 +1201,9 @@ function SDL_iconv_close(cd: PSDL_iconv): cint; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_iconv_fun = function(cd: PSDL_iconv; Const inbuf: PPAnsiChar; inbytesleft: pcsize_t; outbuf: PPAnsiChar; outbytesleft: pcsize_t): csize_t; cdecl; + TSDL_iconv_func = function(cd: PSDL_iconv; Const inbuf: PPAnsiChar; inbytesleft: pcsize_t; outbuf: PPAnsiChar; outbytesleft: pcsize_t): csize_t; cdecl; Var - SDL_iconv : TSDL_iconv_fun = Nil; + SDL_iconv : TSDL_iconv_func = Nil; {$else} function SDL_iconv(cd: PSDL_iconv; Const inbuf: PPAnsiChar; inbytesleft: pcsize_t; outbuf: PPAnsiChar; outbytesleft: pcsize_t): csize_t; cdecl; diff --git a/units/sdlsurface.inc b/units/sdlsurface.inc index 18657dd0..878f0e66 100644 --- a/units/sdlsurface.inc +++ b/units/sdlsurface.inc @@ -98,9 +98,9 @@ const {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_CreateRGBSurface_fun = function(flags: cuint32; width: cint; height: cint; depth: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl; + TSDL_CreateRGBSurface_func = function(flags: cuint32; width: cint; height: cint; depth: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl; Var - SDL_CreateRGBSurface : TSDL_CreateRGBSurface_fun = Nil; + SDL_CreateRGBSurface : TSDL_CreateRGBSurface_func = Nil; {$else} function SDL_CreateRGBSurface(flags: cuint32; width: cint; height: cint; depth: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl; @@ -109,9 +109,9 @@ function SDL_CreateRGBSurface(flags: cuint32; width: cint; height: cint; depth: {* !!! FIXME for 2.1: why does this ask for depth? Format provides that. *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_CreateRGBSurfaceWithFormat_fun = function(flags: cuint32; width, height, depth: cint; format: cuint32):PSDL_Surface; cdecl; + TSDL_CreateRGBSurfaceWithFormat_func = function(flags: cuint32; width, height, depth: cint; format: cuint32):PSDL_Surface; cdecl; Var - SDL_CreateRGBSurfaceWithFormat : TSDL_CreateRGBSurfaceWithFormat_fun = Nil; + SDL_CreateRGBSurfaceWithFormat : TSDL_CreateRGBSurfaceWithFormat_func = Nil; {$else} function SDL_CreateRGBSurfaceWithFormat(flags: cuint32; width, height, depth: cint; format: cuint32):PSDL_Surface; cdecl; @@ -119,9 +119,9 @@ function SDL_CreateRGBSurfaceWithFormat(flags: cuint32; width, height, depth: ci {$endif} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_CreateRGBSurfaceFrom_fun = function(pixels: Pointer; width: cint; height: cint; depth: cint; pitch: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl; + TSDL_CreateRGBSurfaceFrom_func = function(pixels: Pointer; width: cint; height: cint; depth: cint; pitch: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl; Var - SDL_CreateRGBSurfaceFrom : TSDL_CreateRGBSurfaceFrom_fun = Nil; + SDL_CreateRGBSurfaceFrom : TSDL_CreateRGBSurfaceFrom_func = Nil; {$else} function SDL_CreateRGBSurfaceFrom(pixels: Pointer; width: cint; height: cint; depth: cint; pitch: cint; Rmask: cuint32; Gmask: cuint32; Bmask: cuint32; Amask: cuint32): PSDL_Surface; cdecl; @@ -129,9 +129,9 @@ function SDL_CreateRGBSurfaceFrom(pixels: Pointer; width: cint; height: cint; de {$endif} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_CreateRGBSurfaceWithFormatFrom_fun = function(pixels: Pointer; width, height, depth, pitch: cint; format: cuint32):PSDL_Surface; cdecl; + TSDL_CreateRGBSurfaceWithFormatFrom_func = function(pixels: Pointer; width, height, depth, pitch: cint; format: cuint32):PSDL_Surface; cdecl; Var - SDL_CreateRGBSurfaceWithFormatFrom : TSDL_CreateRGBSurfaceWithFormatFrom_fun = Nil; + SDL_CreateRGBSurfaceWithFormatFrom : TSDL_CreateRGBSurfaceWithFormatFrom_func = Nil; {$else} function SDL_CreateRGBSurfaceWithFormatFrom(pixels: Pointer; width, height, depth, pitch: cint; format: cuint32):PSDL_Surface; cdecl; @@ -158,9 +158,9 @@ procedure SDL_FreeSurface(surface: PSDL_Surface); cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetSurfacePalette_fun = function(surface: PSDL_Surface; palette: PSDL_Palette): cint; cdecl; + TSDL_SetSurfacePalette_func = function(surface: PSDL_Surface; palette: PSDL_Palette): cint; cdecl; Var - SDL_SetSurfacePalette : TSDL_SetSurfacePalette_fun = Nil; + SDL_SetSurfacePalette : TSDL_SetSurfacePalette_func = Nil; {$else} function SDL_SetSurfacePalette(surface: PSDL_Surface; palette: PSDL_Palette): cint; cdecl; @@ -189,9 +189,9 @@ function SDL_SetSurfacePalette(surface: PSDL_Surface; palette: PSDL_Palette): ci {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_LockSurface_fun = function(surface: PSDL_Surface): cint; cdecl; + TSDL_LockSurface_func = function(surface: PSDL_Surface): cint; cdecl; Var - SDL_LockSurface : TSDL_LockSurface_fun = Nil; + SDL_LockSurface : TSDL_LockSurface_func = Nil; {$else} function SDL_LockSurface(surface: PSDL_Surface): cint; cdecl; @@ -223,9 +223,9 @@ procedure SDL_UnlockSurface(surface: PSDL_Surface); cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_LoadBMP_RW_fun = function(src: PSDL_RWops; freesrc: cint): PSDL_Surface; cdecl; + TSDL_LoadBMP_RW_func = function(src: PSDL_RWops; freesrc: cint): PSDL_Surface; cdecl; Var - SDL_LoadBMP_RW : TSDL_LoadBMP_RW_fun = Nil; + SDL_LoadBMP_RW : TSDL_LoadBMP_RW_func = Nil; {$else} function SDL_LoadBMP_RW(src: PSDL_RWops; freesrc: cint): PSDL_Surface; cdecl; @@ -256,9 +256,9 @@ function SDL_LoadBMP(_file: PAnsiChar): PSDL_Surface; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SaveBMP_RW_fun = function(surface: PSDL_Surface; dst: PSDL_RWops; freedst: cint): cint; cdecl; + TSDL_SaveBMP_RW_func = function(surface: PSDL_Surface; dst: PSDL_RWops; freedst: cint): cint; cdecl; Var - SDL_SaveBMP_RW : TSDL_SaveBMP_RW_fun = Nil; + SDL_SaveBMP_RW : TSDL_SaveBMP_RW_func = Nil; {$else} function SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: cint): cint; cdecl; @@ -284,9 +284,9 @@ function SDL_SaveBMP(const surface: PSDL_Surface; const filename:AnsiString): ci {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetSurfaceRLE_fun = function(surface: PSDL_Surface; flag: cint): cint; cdecl; + TSDL_SetSurfaceRLE_func = function(surface: PSDL_Surface; flag: cint): cint; cdecl; Var - SDL_SetSurfaceRLE : TSDL_SetSurfaceRLE_fun = Nil; + SDL_SetSurfaceRLE : TSDL_SetSurfaceRLE_func = Nil; {$else} function SDL_SetSurfaceRLE(surface: PSDL_Surface; flag: cint): cint; cdecl; @@ -300,9 +300,9 @@ function SDL_SetSurfaceRLE(surface: PSDL_Surface; flag: cint): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HasSurfaceRLE_fun = function(surface: PSDL_Surface): TSDL_Bool; cdecl; + TSDL_HasSurfaceRLE_func = function(surface: PSDL_Surface): TSDL_Bool; cdecl; Var - SDL_HasSurfaceRLE : TSDL_HasSurfaceRLE_fun = Nil; + SDL_HasSurfaceRLE : TSDL_HasSurfaceRLE_func = Nil; {$else} function SDL_HasSurfaceRLE(surface: PSDL_Surface): TSDL_Bool; cdecl; @@ -323,9 +323,9 @@ Var {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetColorKey_fun = function(surface: PSDL_Surface; flag: cint; key: cuint32): cint; cdecl; + TSDL_SetColorKey_func = function(surface: PSDL_Surface; flag: cint; key: cuint32): cint; cdecl; Var - SDL_SetColorKey : TSDL_SetColorKey_fun = Nil; + SDL_SetColorKey : TSDL_SetColorKey_func = Nil; {$else} function SDL_SetColorKey(surface: PSDL_Surface; flag: cint; key: cuint32): cint; cdecl; @@ -339,9 +339,9 @@ function SDL_SetColorKey(surface: PSDL_Surface; flag: cint; key: cuint32): cint; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HasColorKey_fun = function(surface: PSDL_Surface): TSDL_Bool; cdecl; + TSDL_HasColorKey_func = function(surface: PSDL_Surface): TSDL_Bool; cdecl; Var - SDL_HasColorKey : TSDL_HasColorKey_fun = Nil; + SDL_HasColorKey : TSDL_HasColorKey_func = Nil; {$else} function SDL_HasColorKey(surface: PSDL_Surface): TSDL_Bool; cdecl; @@ -361,9 +361,9 @@ function SDL_HasColorKey(surface: PSDL_Surface): TSDL_Bool; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetColorKey_fun = function(surface: PSDL_Surface; key: pcuint32): cint; cdecl; + TSDL_GetColorKey_func = function(surface: PSDL_Surface; key: pcuint32): cint; cdecl; Var - SDL_GetColorKey : TSDL_GetColorKey_fun = Nil; + SDL_GetColorKey : TSDL_GetColorKey_func = Nil; {$else} function SDL_GetColorKey(surface: PSDL_Surface; key: pcuint32): cint; cdecl; @@ -385,9 +385,9 @@ function SDL_GetColorKey(surface: PSDL_Surface; key: pcuint32): cint; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetSurfaceColorMod_fun = function(surface: PSDL_Surface; r: cuint8; g: cuint8; b: cuint8): cint; cdecl; + TSDL_SetSurfaceColorMod_func = function(surface: PSDL_Surface; r: cuint8; g: cuint8; b: cuint8): cint; cdecl; Var - SDL_SetSurfaceColorMod : TSDL_SetSurfaceColorMod_fun = Nil; + SDL_SetSurfaceColorMod : TSDL_SetSurfaceColorMod_func = Nil; {$else} function SDL_SetSurfaceColorMod(surface: PSDL_Surface; r: cuint8; g: cuint8; b: cuint8): cint; cdecl; @@ -409,9 +409,9 @@ function SDL_SetSurfaceColorMod(surface: PSDL_Surface; r: cuint8; g: cuint8; b: {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetSurfaceColorMod_fun = function(surface: PSDL_Surface; r: pcuint8; g: pcuint8; b: pcuint8): cint; cdecl; + TSDL_GetSurfaceColorMod_func = function(surface: PSDL_Surface; r: pcuint8; g: pcuint8; b: pcuint8): cint; cdecl; Var - SDL_GetSurfaceColorMod : TSDL_GetSurfaceColorMod_fun = Nil; + SDL_GetSurfaceColorMod : TSDL_GetSurfaceColorMod_func = Nil; {$else} function SDL_GetSurfaceColorMod(surface: PSDL_Surface; r: pcuint8; g: pcuint8; b: pcuint8): cint; cdecl; @@ -431,9 +431,9 @@ function SDL_GetSurfaceColorMod(surface: PSDL_Surface; r: pcuint8; g: pcuint8; b {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetSurfaceAlphaMod_fun = function(surface: PSDL_Surface; alpha: cuint8): cint; cdecl; + TSDL_SetSurfaceAlphaMod_func = function(surface: PSDL_Surface; alpha: cuint8): cint; cdecl; Var - SDL_SetSurfaceAlphaMod : TSDL_SetSurfaceAlphaMod_fun = Nil; + SDL_SetSurfaceAlphaMod : TSDL_SetSurfaceAlphaMod_func = Nil; {$else} function SDL_SetSurfaceAlphaMod(surface: PSDL_Surface; alpha: cuint8): cint; cdecl; @@ -453,9 +453,9 @@ function SDL_SetSurfaceAlphaMod(surface: PSDL_Surface; alpha: cuint8): cint; cde {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetSurfaceAlphaMod_fun = function(surface: PSDL_Surface; alpha: pcuint8): cint; cdecl; + TSDL_GetSurfaceAlphaMod_func = function(surface: PSDL_Surface; alpha: pcuint8): cint; cdecl; Var - SDL_GetSurfaceAlphaMod : TSDL_GetSurfaceAlphaMod_fun = Nil; + SDL_GetSurfaceAlphaMod : TSDL_GetSurfaceAlphaMod_func = Nil; {$else} function SDL_GetSurfaceAlphaMod(surface: PSDL_Surface; alpha: pcuint8): cint; cdecl; @@ -475,9 +475,9 @@ function SDL_GetSurfaceAlphaMod(surface: PSDL_Surface; alpha: pcuint8): cint; cd {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetSurfaceBlendMode_fun = function(surface: PSDL_Surface; blendMode: TSDL_BlendMode): cint; cdecl; + TSDL_SetSurfaceBlendMode_func = function(surface: PSDL_Surface; blendMode: TSDL_BlendMode): cint; cdecl; Var - SDL_SetSurfaceBlendMode : TSDL_SetSurfaceBlendMode_fun = Nil; + SDL_SetSurfaceBlendMode : TSDL_SetSurfaceBlendMode_func = Nil; {$else} function SDL_SetSurfaceBlendMode(surface: PSDL_Surface; blendMode: TSDL_BlendMode): cint; cdecl; @@ -497,9 +497,9 @@ function SDL_SetSurfaceBlendMode(surface: PSDL_Surface; blendMode: TSDL_BlendMod {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetSurfaceBlendMode_fun = function(surface: PSDL_Surface; blendMode: PSDL_BlendMode): cint; cdecl; + TSDL_GetSurfaceBlendMode_func = function(surface: PSDL_Surface; blendMode: PSDL_BlendMode): cint; cdecl; Var - SDL_GetSurfaceBlendMode : TSDL_GetSurfaceBlendMode_fun = Nil; + SDL_GetSurfaceBlendMode : TSDL_GetSurfaceBlendMode_func = Nil; {$else} function SDL_GetSurfaceBlendMode(surface: PSDL_Surface; blendMode: PSDL_BlendMode): cint; cdecl; @@ -522,9 +522,9 @@ function SDL_GetSurfaceBlendMode(surface: PSDL_Surface; blendMode: PSDL_BlendMod {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetClipRect_fun = function(surface: PSDL_Surface; const rect: PSDL_Rect): TSDL_Bool; cdecl; + TSDL_SetClipRect_func = function(surface: PSDL_Surface; const rect: PSDL_Rect): TSDL_Bool; cdecl; Var - SDL_SetClipRect : TSDL_SetClipRect_fun = Nil; + SDL_SetClipRect : TSDL_SetClipRect_func = Nil; {$else} function SDL_SetClipRect(surface: PSDL_Surface; const rect: PSDL_Rect): TSDL_Bool; cdecl; @@ -554,9 +554,9 @@ procedure SDL_GetClipRect(surface: PSDL_Surface; rect: PSDL_Rect); cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_DuplicateSurface_fun = function(surface: PSDL_Surface): PSDL_Surface; cdecl; + TSDL_DuplicateSurface_func = function(surface: PSDL_Surface): PSDL_Surface; cdecl; Var - SDL_DuplicateSurface : TSDL_DuplicateSurface_fun = Nil; + SDL_DuplicateSurface : TSDL_DuplicateSurface_func = Nil; {$else} function SDL_DuplicateSurface(surface: PSDL_Surface): PSDL_Surface; cdecl; @@ -576,9 +576,9 @@ function SDL_DuplicateSurface(surface: PSDL_Surface): PSDL_Surface; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_ConvertSurface_fun = function(src: PSDL_Surface; const fmt: PSDL_PixelFormat; flags: cuint32): PSDL_Surface; cdecl; + TSDL_ConvertSurface_func = function(src: PSDL_Surface; const fmt: PSDL_PixelFormat; flags: cuint32): PSDL_Surface; cdecl; Var - SDL_ConvertSurface : TSDL_ConvertSurface_fun = Nil; + SDL_ConvertSurface : TSDL_ConvertSurface_func = Nil; {$else} function SDL_ConvertSurface(src: PSDL_Surface; const fmt: PSDL_PixelFormat; flags: cuint32): PSDL_Surface; cdecl; @@ -586,9 +586,9 @@ function SDL_ConvertSurface(src: PSDL_Surface; const fmt: PSDL_PixelFormat; flag {$endif} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_ConvertSurfaceFormat_fun = function(src: PSDL_Surface; pixel_format: cuint32; flags: cuint32): PSDL_Surface; cdecl; + TSDL_ConvertSurfaceFormat_func = function(src: PSDL_Surface; pixel_format: cuint32; flags: cuint32): PSDL_Surface; cdecl; Var - SDL_ConvertSurfaceFormat : TSDL_ConvertSurfaceFormat_fun = Nil; + SDL_ConvertSurfaceFormat : TSDL_ConvertSurfaceFormat_func = Nil; {$else} function SDL_ConvertSurfaceFormat(src: PSDL_Surface; pixel_format: cuint32; flags: cuint32): PSDL_Surface; cdecl; @@ -603,9 +603,9 @@ function SDL_ConvertSurfaceFormat(src: PSDL_Surface; pixel_format: cuint32; flag {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_ConvertPixels_fun = function(width: cint; height: cint; src_format: cuint32; const src: Pointer; src_pitch: cint; dst_format: cuint32; dst: Pointer; dst_pitch: cint): cint; cdecl; + TSDL_ConvertPixels_func = function(width: cint; height: cint; src_format: cuint32; const src: Pointer; src_pitch: cint; dst_format: cuint32; dst: Pointer; dst_pitch: cint): cint; cdecl; Var - SDL_ConvertPixels : TSDL_ConvertPixels_fun = Nil; + SDL_ConvertPixels : TSDL_ConvertPixels_func = Nil; {$else} function SDL_ConvertPixels(width: cint; height: cint; src_format: cuint32; const src: Pointer; src_pitch: cint; dst_format: cuint32; dst: Pointer; dst_pitch: cint): cint; cdecl; @@ -625,9 +625,9 @@ function SDL_ConvertPixels(width: cint; height: cint; src_format: cuint32; const {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_FillRect_fun = function(dst: PSDL_Surface; const rect: PSDL_Rect; color: cuint32): cint; cdecl; + TSDL_FillRect_func = function(dst: PSDL_Surface; const rect: PSDL_Rect; color: cuint32): cint; cdecl; Var - SDL_FillRect : TSDL_FillRect_fun = Nil; + SDL_FillRect : TSDL_FillRect_func = Nil; {$else} function SDL_FillRect(dst: PSDL_Surface; const rect: PSDL_Rect; color: cuint32): cint; cdecl; @@ -635,9 +635,9 @@ function SDL_FillRect(dst: PSDL_Surface; const rect: PSDL_Rect; color: cuint32): {$endif} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_FillRects_fun = function(dst: PSDL_Surface; const rects: PSDL_Rect; count: cint; color: cuint32): cint; cdecl; + TSDL_FillRects_func = function(dst: PSDL_Surface; const rects: PSDL_Rect; count: cint; color: cuint32): cint; cdecl; Var - SDL_FillRects : TSDL_FillRects_fun = Nil; + SDL_FillRects : TSDL_FillRects_func = Nil; {$else} function SDL_FillRects(dst: PSDL_Surface; const rects: PSDL_Rect; count: cint; color: cuint32): cint; cdecl; @@ -707,9 +707,9 @@ function SDL_FillRects(dst: PSDL_Surface; const rects: PSDL_Rect; count: cint; c * Since Pascal macro support is very limited, we workaround by outright pointing SDL_BlitSurface() to SDL_UpperBlit(). *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_BlitSurface_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; + TSDL_BlitSurface_func = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; Var - SDL_BlitSurface : TSDL_BlitSurface_fun = Nil; + SDL_BlitSurface : TSDL_BlitSurface_func = Nil; {$else} function SDL_BlitSurface(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; @@ -724,9 +724,9 @@ function SDL_BlitSurface(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_ {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_UpperBlit_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; + TSDL_UpperBlit_func = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; Var - SDL_UpperBlit : TSDL_UpperBlit_fun = Nil; + SDL_UpperBlit : TSDL_UpperBlit_func = Nil; {$else} function SDL_UpperBlit(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; @@ -740,9 +740,9 @@ function SDL_UpperBlit(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Su {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_LowerBlit_fun = function(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; + TSDL_LowerBlit_func = function(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; Var - SDL_LowerBlit : TSDL_LowerBlit_fun = Nil; + SDL_LowerBlit : TSDL_LowerBlit_func = Nil; {$else} function SDL_LowerBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; @@ -758,9 +758,9 @@ function SDL_LowerBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SoftStretch_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; const dstrect: PSDL_Surface): cint; cdecl; + TSDL_SoftStretch_func = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; const dstrect: PSDL_Surface): cint; cdecl; Var - SDL_SoftStretch : TSDL_SoftStretch_fun = Nil; + SDL_SoftStretch : TSDL_SoftStretch_func = Nil; {$else} function SDL_SoftStretch(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; const dstrect: PSDL_Surface): cint; cdecl; @@ -771,9 +771,9 @@ function SDL_SoftStretch(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_ * Since Pascal macro support is very limited, we workaround by outright pointing SDL_BlitSurfaceScaled() to SDL_UpperBlitScaled(). *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_BlitSurfaceScaled_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; + TSDL_BlitSurfaceScaled_func = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; Var - SDL_BlitSurfaceScaled : TSDL_BlitSurfaceScaled_fun = Nil; + SDL_BlitSurfaceScaled : TSDL_BlitSurfaceScaled_func = Nil; {$else} function SDL_BlitSurfaceScaled(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; @@ -787,9 +787,9 @@ function SDL_BlitSurfaceScaled(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_UpperBlitScaled_fun = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; + TSDL_UpperBlitScaled_func = function(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; Var - SDL_UpperBlitScaled : TSDL_UpperBlitScaled_fun = Nil; + SDL_UpperBlitScaled : TSDL_UpperBlitScaled_func = Nil; {$else} function SDL_UpperBlitScaled(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; @@ -803,9 +803,9 @@ function SDL_UpperBlitScaled(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: P {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_LowerBlitScaled_fun = function(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; + TSDL_LowerBlitScaled_func = function(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; Var - SDL_LowerBlitScaled : TSDL_LowerBlitScaled_fun = Nil; + SDL_LowerBlitScaled : TSDL_LowerBlitScaled_func = Nil; {$else} function SDL_LowerBlitScaled(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): cint; cdecl; @@ -837,9 +837,9 @@ function SDL_GetYUVConversionMode: TSDL_YUV_CONVERSION_MODE; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetYUVConversionModeForResolution_fun = function(width: cint; height: cint): TSDL_YUV_CONVERSION_MODE; cdecl; + TSDL_GetYUVConversionModeForResolution_func = function(width: cint; height: cint): TSDL_YUV_CONVERSION_MODE; cdecl; Var - SDL_GetYUVConversionModeForResolution : TSDL_GetYUVConversionModeForResolution_fun = Nil; + SDL_GetYUVConversionModeForResolution : TSDL_GetYUVConversionModeForResolution_func = Nil; {$else} function SDL_GetYUVConversionModeForResolution(width: cint; height: cint): TSDL_YUV_CONVERSION_MODE; cdecl; diff --git a/units/sdlsystem.inc b/units/sdlsystem.inc index 583ea203..ef3279c8 100644 --- a/units/sdlsystem.inc +++ b/units/sdlsystem.inc @@ -41,9 +41,9 @@ procedure SDL_SetWindowsMessageHook(callback: TSDL_WindowsMessageHook; userdata: *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_Direct3D9GetAdapterIndex_fun = function(displayIndex:cint):cint; cdecl; + TSDL_Direct3D9GetAdapterIndex_func = function(displayIndex:cint):cint; cdecl; Var - SDL_Direct3D9GetAdapterIndex : TSDL_Direct3D9GetAdapterIndex_fun = Nil; + SDL_Direct3D9GetAdapterIndex : TSDL_Direct3D9GetAdapterIndex_func = Nil; {$else} function SDL_Direct3D9GetAdapterIndex(displayIndex:cint):cint; cdecl; @@ -69,9 +69,9 @@ type *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RenderGetD3D9Device_fun = function(renderer:PSDL_Renderer):PIDirect3DDevice9; cdecl; + TSDL_RenderGetD3D9Device_func = function(renderer:PSDL_Renderer):PIDirect3DDevice9; cdecl; Var - SDL_RenderGetD3D9Device : TSDL_RenderGetD3D9Device_fun = Nil; + SDL_RenderGetD3D9Device : TSDL_RenderGetD3D9Device_func = Nil; {$else} function SDL_RenderGetD3D9Device(renderer:PSDL_Renderer):PIDirect3DDevice9; cdecl; @@ -92,9 +92,9 @@ function SDL_RenderGetD3D9Device(renderer:PSDL_Renderer):PIDirect3DDevice9; cdec *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RenderGetD3D11Device_fun = function(renderer:PSDL_Renderer):PID3D11Device; cdecl; + TSDL_RenderGetD3D11Device_func = function(renderer:PSDL_Renderer):PID3D11Device; cdecl; Var - SDL_RenderGetD3D11Device : TSDL_RenderGetD3D11Device_fun = Nil; + SDL_RenderGetD3D11Device : TSDL_RenderGetD3D11Device_func = Nil; {$else} function SDL_RenderGetD3D11Device(renderer:PSDL_Renderer):PID3D11Device; cdecl; @@ -115,9 +115,9 @@ function SDL_RenderGetD3D11Device(renderer:PSDL_Renderer):PID3D11Device; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RenderGetD3D12Device_fun = function(renderer:PSDL_Renderer):PID3D12Device; cdecl; + TSDL_RenderGetD3D12Device_func = function(renderer:PSDL_Renderer):PID3D12Device; cdecl; Var - SDL_RenderGetD3D12Device : TSDL_RenderGetD3D12Device_fun = Nil; + SDL_RenderGetD3D12Device : TSDL_RenderGetD3D12Device_func = Nil; {$else} function SDL_RenderGetD3D12Device(renderer:PSDL_Renderer):PID3D12Device; cdecl; @@ -144,9 +144,9 @@ function SDL_RenderGetD3D12Device(renderer:PSDL_Renderer):PID3D12Device; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_DXGIGetOutputInfo_fun = function(displayIndex: cint; adapterIndex, outputIndex: pcint): TSDL_Bool; cdecl; + TSDL_DXGIGetOutputInfo_func = function(displayIndex: cint; adapterIndex, outputIndex: pcint): TSDL_Bool; cdecl; Var - SDL_DXGIGetOutputInfo : TSDL_DXGIGetOutputInfo_fun = Nil; + SDL_DXGIGetOutputInfo : TSDL_DXGIGetOutputInfo_func = Nil; {$else} function SDL_DXGIGetOutputInfo(displayIndex: cint; adapterIndex, outputIndex: pcint): TSDL_Bool; @@ -170,9 +170,9 @@ function SDL_DXGIGetOutputInfo(displayIndex: cint; adapterIndex, outputIndex: pc *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_LinuxSetThreadPriority_fun = function(threadID: cint64; priority: cint): cint; cdecl; + TSDL_LinuxSetThreadPriority_func = function(threadID: cint64; priority: cint): cint; cdecl; Var - SDL_LinuxSetThreadPriority : TSDL_LinuxSetThreadPriority_fun = Nil; + SDL_LinuxSetThreadPriority : TSDL_LinuxSetThreadPriority_func = Nil; {$else} function SDL_LinuxSetThreadPriority(threadID: cint64; priority: cint): cint; cdecl; @@ -194,9 +194,9 @@ function SDL_LinuxSetThreadPriority(threadID: cint64; priority: cint): cint; cde *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_LinuxSetThreadPriorityAndPolicy_fun = function(threadID: cint64; sdlPriority, schedPolicy: cint): cint; cdecl; + TSDL_LinuxSetThreadPriorityAndPolicy_func = function(threadID: cint64; sdlPriority, schedPolicy: cint): cint; cdecl; Var - SDL_LinuxSetThreadPriorityAndPolicy : TSDL_LinuxSetThreadPriorityAndPolicy_fun = Nil; + SDL_LinuxSetThreadPriorityAndPolicy : TSDL_LinuxSetThreadPriorityAndPolicy_func = Nil; {$else} function SDL_LinuxSetThreadPriorityAndPolicy(threadID: cint64; sdlPriority, schedPolicy: cint): cint; cdecl; @@ -234,9 +234,9 @@ type *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_iPhoneSetAnimationCallback_fun = function(window: PSDL_Window; interval: cint; callback: TSDL_iPhoneAnimationCallback; callbackParam: Pointer); cdecl; + TSDL_iPhoneSetAnimationCallback_func = function(window: PSDL_Window; interval: cint; callback: TSDL_iPhoneAnimationCallback; callbackParam: Pointer); cdecl; Var - SDL_iPhoneSetAnimationCallback : TSDL_iPhoneSetAnimationCallback_fun = Nil; + SDL_iPhoneSetAnimationCallback : TSDL_iPhoneSetAnimationCallback_func = Nil; {$else} function SDL_iPhoneSetAnimationCallback(window: PSDL_Window; interval: cint; callback: TSDL_iPhoneAnimationCallback; callbackParam: Pointer); cdecl; @@ -289,9 +289,9 @@ procedure SDL_iPhoneSetEventPump(enabled: TSDL_Bool); cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_AndroidGetJNIEnv_fun = function(): Pointer; cdecl; + TSDL_AndroidGetJNIEnv_func = function(): Pointer; cdecl; Var - SDL_AndroidGetJNIEnv : TSDL_AndroidGetJNIEnv_fun = Nil; + SDL_AndroidGetJNIEnv : TSDL_AndroidGetJNIEnv_func = Nil; {$else} function SDL_AndroidGetJNIEnv(): Pointer; cdecl; @@ -320,9 +320,9 @@ function SDL_AndroidGetJNIEnv(): Pointer; cdecl; *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_AndroidGetActivity_fun = function(): Pointer; cdecl; + TSDL_AndroidGetActivity_func = function(): Pointer; cdecl; Var - SDL_AndroidGetActivity : TSDL_AndroidGetActivity_fun = Nil; + SDL_AndroidGetActivity : TSDL_AndroidGetActivity_func = Nil; {$else} function SDL_AndroidGetActivity(): Pointer; cdecl; @@ -364,9 +364,9 @@ function SDL_AndroidGetActivity(): Pointer; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetAndroidSDKVersion_fun = function(): cint; cdecl; + TSDL_GetAndroidSDKVersion_func = function(): cint; cdecl; Var - SDL_GetAndroidSDKVersion : TSDL_GetAndroidSDKVersion_fun = Nil; + SDL_GetAndroidSDKVersion : TSDL_GetAndroidSDKVersion_func = Nil; {$else} function SDL_GetAndroidSDKVersion(): cint; cdecl; @@ -382,9 +382,9 @@ function SDL_GetAndroidSDKVersion(): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_IsAndroidTV_fun = function(): TSDL_Bool; cdecl; + TSDL_IsAndroidTV_func = function(): TSDL_Bool; cdecl; Var - SDL_IsAndroidTV : TSDL_IsAndroidTV_fun = Nil; + SDL_IsAndroidTV : TSDL_IsAndroidTV_func = Nil; {$else} function SDL_IsAndroidTV(): TSDL_Bool; cdecl; @@ -400,9 +400,9 @@ function SDL_IsAndroidTV(): TSDL_Bool; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_IsChromebook_fun = function(): TSDL_Bool; cdecl; + TSDL_IsChromebook_func = function(): TSDL_Bool; cdecl; Var - SDL_IsChromebook : TSDL_IsChromebook_fun = Nil; + SDL_IsChromebook : TSDL_IsChromebook_func = Nil; {$else} function SDL_IsChromebook(): TSDL_Bool; cdecl; @@ -418,9 +418,9 @@ function SDL_IsChromebook(): TSDL_Bool; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_IsDeXMode_fun = function(): TSDL_Bool; cdecl; + TSDL_IsDeXMode_func = function(): TSDL_Bool; cdecl; Var - SDL_IsDeXMode : TSDL_IsDeXMode_fun = Nil; + SDL_IsDeXMode : TSDL_IsDeXMode_func = Nil; {$else} function SDL_IsDeXMode(): TSDL_Bool; cdecl; @@ -469,9 +469,9 @@ const *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_AndroidGetInternalStoragePath_fun = function(): PAnsiChar; cdecl; + TSDL_AndroidGetInternalStoragePath_func = function(): PAnsiChar; cdecl; Var - SDL_AndroidGetInternalStoragePath : TSDL_AndroidGetInternalStoragePath_fun = Nil; + SDL_AndroidGetInternalStoragePath : TSDL_AndroidGetInternalStoragePath_func = Nil; {$else} function SDL_AndroidGetInternalStoragePath(): PAnsiChar; cdecl; @@ -495,9 +495,9 @@ function SDL_AndroidGetInternalStoragePath(): PAnsiChar; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_AndroidGetExternalStorageState_fun = function(): cint; cdecl; + TSDL_AndroidGetExternalStorageState_func = function(): cint; cdecl; Var - SDL_AndroidGetExternalStorageState : TSDL_AndroidGetExternalStorageState_fun = Nil; + SDL_AndroidGetExternalStorageState : TSDL_AndroidGetExternalStorageState_func = Nil; {$else} function SDL_AndroidGetExternalStorageState(): cint; cdecl; @@ -522,9 +522,9 @@ function SDL_AndroidGetExternalStorageState(): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_AndroidGetExternalStoragePath_fun = function(): PAnsiChar; cdecl; + TSDL_AndroidGetExternalStoragePath_func = function(): PAnsiChar; cdecl; Var - SDL_AndroidGetExternalStoragePath : TSDL_AndroidGetExternalStoragePath_fun = Nil; + SDL_AndroidGetExternalStoragePath : TSDL_AndroidGetExternalStoragePath_func = Nil; {$else} function SDL_AndroidGetExternalStoragePath(): PAnsiChar; cdecl; @@ -546,9 +546,9 @@ function SDL_AndroidGetExternalStoragePath(): PAnsiChar; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_AndroidRequestPermission_fun = function(const permission: PAnsiChar): TSDL_Bool; cdecl; + TSDL_AndroidRequestPermission_func = function(const permission: PAnsiChar): TSDL_Bool; cdecl; Var - SDL_AndroidRequestPermission : TSDL_AndroidRequestPermission_fun = Nil; + SDL_AndroidRequestPermission : TSDL_AndroidRequestPermission_func = Nil; {$else} function SDL_AndroidRequestPermission(const permission: PAnsiChar): TSDL_Bool; cdecl; @@ -580,9 +580,9 @@ function SDL_AndroidRequestPermission(const permission: PAnsiChar): TSDL_Bool; c *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_AndroidShowToast_fun = function(const message: PAnsiChar; duration, gravity, xoffset, yoffset: cint): cint; cdecl; + TSDL_AndroidShowToast_func = function(const message: PAnsiChar; duration, gravity, xoffset, yoffset: cint): cint; cdecl; Var - SDL_AndroidShowToast : TSDL_AndroidShowToast_fun = Nil; + SDL_AndroidShowToast : TSDL_AndroidShowToast_func = Nil; {$else} function SDL_AndroidShowToast(const message: PAnsiChar; duration, gravity, xoffset, yoffset: cint): cint; cdecl; @@ -601,9 +601,9 @@ function SDL_AndroidShowToast(const message: PAnsiChar; duration, gravity, xoffs *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_AndroidSendMessage_fun = function(command: cUint32; param: cint): cint; cdecl; + TSDL_AndroidSendMessage_func = function(command: cUint32; param: cint): cint; cdecl; Var - SDL_AndroidSendMessage : TSDL_AndroidSendMessage_fun = Nil; + SDL_AndroidSendMessage : TSDL_AndroidSendMessage_func = Nil; {$else} function SDL_AndroidSendMessage(command: cUint32; param: cint): cint; cdecl; @@ -663,9 +663,9 @@ Type *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_WinRTGetFSPathUNICODE_fun = function(pathT + TSDL_WinRTGetFSPathUNICODE_func = function(pathT Var - SDL_WinRTGetFSPathUNICODE : TSDL_WinRTGetFSPathUNICODE_fun = Nil; + SDL_WinRTGetFSPathUNICODE : TSDL_WinRTGetFSPathUNICODE_func = Nil; {$else} function SDL_WinRTGetFSPathUNICODE(pathType :TSDL_WinRT_Path):PWideChar; @@ -690,9 +690,9 @@ function SDL_WinRTGetFSPathUNICODE(pathType :TSDL_WinRT_Path):PWideChar; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_WinRTGetFSPathUTF8_fun = function(pathT + TSDL_WinRTGetFSPathUTF8_func = function(pathT Var - SDL_WinRTGetFSPathUTF8 : TSDL_WinRTGetFSPathUTF8_fun = Nil; + SDL_WinRTGetFSPathUTF8 : TSDL_WinRTGetFSPathUTF8_func = Nil; {$else} function SDL_WinRTGetFSPathUTF8(pathType :TSDL_WinRT_Path):PChar; @@ -709,9 +709,9 @@ function SDL_WinRTGetFSPathUTF8(pathType :TSDL_WinRT_Path):PChar; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_WinRTGetDeviceFamily_fun = function(): TS + TSDL_WinRTGetDeviceFamily_func = function(): TS Var - SDL_WinRTGetDeviceFamily : TSDL_WinRTGetDeviceFamily_fun = Nil; + SDL_WinRTGetDeviceFamily : TSDL_WinRTGetDeviceFamily_func = Nil; {$else} function SDL_WinRTGetDeviceFamily(): TSDL_WinRT_DeviceFamily; @@ -731,9 +731,9 @@ function SDL_WinRTGetDeviceFamily(): TSDL_WinRT_DeviceFamily; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_IsTablet_fun = function(): TSDL_Bool; cdecl; + TSDL_IsTablet_func = function(): TSDL_Bool; cdecl; Var - SDL_IsTablet : TSDL_IsTablet_fun = Nil; + SDL_IsTablet : TSDL_IsTablet_func = Nil; {$else} function SDL_IsTablet(): TSDL_Bool; cdecl; diff --git a/units/sdlsyswm.inc b/units/sdlsyswm.inc index b3d36375..8d0755bf 100644 --- a/units/sdlsyswm.inc +++ b/units/sdlsyswm.inc @@ -359,9 +359,9 @@ type *) {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetWindowWMInfo_fun = function(window: PSDL_Window; info: PSDL_SysWMinfo): TSDL_bool; cdecl; + TSDL_GetWindowWMInfo_func = function(window: PSDL_Window; info: PSDL_SysWMinfo): TSDL_bool; cdecl; Var - SDL_GetWindowWMInfo : TSDL_GetWindowWMInfo_fun = Nil; + SDL_GetWindowWMInfo : TSDL_GetWindowWMInfo_func = Nil; {$else} function SDL_GetWindowWMInfo(window: PSDL_Window; info: PSDL_SysWMinfo): TSDL_bool; cdecl; diff --git a/units/sdlthread.inc b/units/sdlthread.inc index 60aa20ec..5eaf73f6 100644 --- a/units/sdlthread.inc +++ b/units/sdlthread.inc @@ -93,12 +93,12 @@ type {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_CreateThread_fun = function(fn: TSDL_ThreadFunction; name: PAnsiChar; + TSDL_CreateThread_func = function(fn: TSDL_ThreadFunction; name: PAnsiChar; data: Pointer; pfnBeginThread: TpfnSDL_CurrentBeginThread; pfnEndThread: TpfnSDL_CurrentEndThread): PSDL_Thread; cdecl; Var - SDL_CreateThread : TSDL_CreateThread_fun = Nil; + SDL_CreateThread : TSDL_CreateThread_func = Nil; {$else} function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PAnsiChar; @@ -110,12 +110,12 @@ function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PAnsiChar; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_CreateThreadWithStackSize_fun = function(fn: TSDL_ThreadFunction; + TSDL_CreateThreadWithStackSize_func = function(fn: TSDL_ThreadFunction; name: PAnsiChar; const stacksize: csize_t; data: Pointer; pfnBeginThread: TpfnSDL_CurrentBeginThread; pfnEndThread: TpfnSDL_CurrentEndThread): PSDL_Thread; cdecl; Var - SDL_CreateThreadWithStackSize : TSDL_CreateThreadWithStackSize_fun = Nil; + SDL_CreateThreadWithStackSize : TSDL_CreateThreadWithStackSize_func = Nil; {$else} function SDL_CreateThreadWithStackSize(fn: TSDL_ThreadFunction; @@ -169,10 +169,10 @@ function SDL_CreateThreadWithStackSize2(fn: TSDL_ThreadFunction; name: PAnsiChar *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_CreateThread_fun = function(fn: TSDL_ThreadFunction; name: PAnsiChar; + TSDL_CreateThread_func = function(fn: TSDL_ThreadFunction; name: PAnsiChar; data: Pointer): PSDL_Thread; cdecl; Var - SDL_CreateThread : TSDL_CreateThread_fun = Nil; + SDL_CreateThread : TSDL_CreateThread_func = Nil; {$else} function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PAnsiChar; @@ -225,10 +225,10 @@ function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PAnsiChar; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_CreateThreadWithStackSize_fun = function(fn: TSDL_ThreadFunction; name: PAnsiChar; + TSDL_CreateThreadWithStackSize_func = function(fn: TSDL_ThreadFunction; name: PAnsiChar; stacksize: csize_t; data: Pointer): PSDL_Thread; cdecl; Var - SDL_CreateThreadWithStackSize : TSDL_CreateThreadWithStackSize_fun = Nil; + SDL_CreateThreadWithStackSize : TSDL_CreateThreadWithStackSize_func = Nil; {$else} function SDL_CreateThreadWithStackSize(fn: TSDL_ThreadFunction; name: PAnsiChar; @@ -255,9 +255,9 @@ function SDL_CreateThreadWithStackSize(fn: TSDL_ThreadFunction; name: PAnsiChar; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetThreadName_fun = function(thread: PSDL_Thread): PAnsiChar; cdecl; + TSDL_GetThreadName_func = function(thread: PSDL_Thread): PAnsiChar; cdecl; Var - SDL_GetThreadName : TSDL_GetThreadName_fun = Nil; + SDL_GetThreadName : TSDL_GetThreadName_func = Nil; {$else} function SDL_GetThreadName(thread: PSDL_Thread): PAnsiChar; cdecl; @@ -300,9 +300,9 @@ function SDL_ThreadID: TSDL_ThreadID; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetThreadID_fun = function(thread: PSDL_Thread): TSDL_ThreadID; cdecl; + TSDL_GetThreadID_func = function(thread: PSDL_Thread): TSDL_ThreadID; cdecl; Var - SDL_GetThreadID : TSDL_GetThreadID_fun = Nil; + SDL_GetThreadID : TSDL_GetThreadID_func = Nil; {$else} function SDL_GetThreadID(thread: PSDL_Thread): TSDL_ThreadID; cdecl; @@ -324,9 +324,9 @@ function SDL_GetThreadID(thread: PSDL_Thread): TSDL_ThreadID; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetThreadPriority_fun = function(priority: TSDL_ThreadPriority): cint; cdecl; + TSDL_SetThreadPriority_func = function(priority: TSDL_ThreadPriority): cint; cdecl; Var - SDL_SetThreadPriority : TSDL_SetThreadPriority_fun = Nil; + SDL_SetThreadPriority : TSDL_SetThreadPriority_func = Nil; {$else} function SDL_SetThreadPriority(priority: TSDL_ThreadPriority): cint; cdecl; @@ -452,9 +452,9 @@ function SDL_TLSCreate: TSDL_TLSID; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_TLSGet_fun = function(id: TSDL_TLSID): Pointer; cdecl; + TSDL_TLSGet_func = function(id: TSDL_TLSID): Pointer; cdecl; Var - SDL_TLSGet : TSDL_TLSGet_fun = Nil; + SDL_TLSGet : TSDL_TLSGet_func = Nil; {$else} function SDL_TLSGet(id: TSDL_TLSID): Pointer; cdecl; @@ -495,9 +495,9 @@ type *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_TLSSet_fun = function(id: TSDL_TLSID; const value: Pointer; destructor_: TTLSDestructor): cint; cdecl; + TSDL_TLSSet_func = function(id: TSDL_TLSID; const value: Pointer; destructor_: TTLSDestructor): cint; cdecl; Var - SDL_TLSSet : TSDL_TLSSet_fun = Nil; + SDL_TLSSet : TSDL_TLSSet_func = Nil; {$else} function SDL_TLSSet(id: TSDL_TLSID; const value: Pointer; destructor_: TTLSDestructor): cint; cdecl; diff --git a/units/sdltimer.inc b/units/sdltimer.inc index 57c22703..559e4235 100644 --- a/units/sdltimer.inc +++ b/units/sdltimer.inc @@ -85,9 +85,9 @@ type *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_AddTimer_fun = function(interval: cuint32; callback: TSDL_TimerCallback; param: Pointer): TSDL_TimerID; cdecl; + TSDL_AddTimer_func = function(interval: cuint32; callback: TSDL_TimerCallback; param: Pointer): TSDL_TimerID; cdecl; Var - SDL_AddTimer : TSDL_AddTimer_fun = Nil; + SDL_AddTimer : TSDL_AddTimer_func = Nil; {$else} function SDL_AddTimer(interval: cuint32; callback: TSDL_TimerCallback; param: Pointer): TSDL_TimerID; cdecl; @@ -103,9 +103,9 @@ function SDL_AddTimer(interval: cuint32; callback: TSDL_TimerCallback; param: Po *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_RemoveTimer_fun = function(id: TSDL_TimerID): Boolean; cdecl; + TSDL_RemoveTimer_func = function(id: TSDL_TimerID): Boolean; cdecl; Var - SDL_RemoveTimer : TSDL_RemoveTimer_fun = Nil; + SDL_RemoveTimer : TSDL_RemoveTimer_func = Nil; {$else} function SDL_RemoveTimer(id: TSDL_TimerID): Boolean; cdecl; diff --git a/units/sdltouch.inc b/units/sdltouch.inc index beea612c..c1e909f3 100644 --- a/units/sdltouch.inc +++ b/units/sdltouch.inc @@ -42,9 +42,9 @@ const *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetNumTouchDevices_fun = function(): cint; cdecl; + TSDL_GetNumTouchDevices_func = function(): cint; cdecl; Var - SDL_GetNumTouchDevices : TSDL_GetNumTouchDevices_fun = Nil; + SDL_GetNumTouchDevices : TSDL_GetNumTouchDevices_func = Nil; {$else} function SDL_GetNumTouchDevices(): cint; cdecl; @@ -56,9 +56,9 @@ function SDL_GetNumTouchDevices(): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetTouchDevice_fun = function(index: cint): TSDL_TouchID; cdecl; + TSDL_GetTouchDevice_func = function(index: cint): TSDL_TouchID; cdecl; Var - SDL_GetTouchDevice : TSDL_GetTouchDevice_fun = Nil; + SDL_GetTouchDevice : TSDL_GetTouchDevice_func = Nil; {$else} function SDL_GetTouchDevice(index: cint): TSDL_TouchID; cdecl; @@ -73,9 +73,9 @@ function SDL_GetTouchDevice(index: cint): TSDL_TouchID; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetTouchName_fun = function(index: cint): PAnsiChar; cdecl; + TSDL_GetTouchName_func = function(index: cint): PAnsiChar; cdecl; Var - SDL_GetTouchName : TSDL_GetTouchName_fun = Nil; + SDL_GetTouchName : TSDL_GetTouchName_func = Nil; {$else} function SDL_GetTouchName(index: cint): PAnsiChar; cdecl; @@ -89,9 +89,9 @@ function SDL_GetTouchName(index: cint): PAnsiChar; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetTouchDeviceType_fun = function(touchID: TSDL_TouchID): TSDL_TouchDeviceType; cdecl; + TSDL_GetTouchDeviceType_func = function(touchID: TSDL_TouchID): TSDL_TouchDeviceType; cdecl; Var - SDL_GetTouchDeviceType : TSDL_GetTouchDeviceType_fun = Nil; + SDL_GetTouchDeviceType : TSDL_GetTouchDeviceType_func = Nil; {$else} function SDL_GetTouchDeviceType(touchID: TSDL_TouchID): TSDL_TouchDeviceType; cdecl; @@ -103,9 +103,9 @@ function SDL_GetTouchDeviceType(touchID: TSDL_TouchID): TSDL_TouchDeviceType; cd *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetNumTouchFingers_fun = function(touchID: TSDL_TouchID): cint; cdecl; + TSDL_GetNumTouchFingers_func = function(touchID: TSDL_TouchID): cint; cdecl; Var - SDL_GetNumTouchFingers : TSDL_GetNumTouchFingers_fun = Nil; + SDL_GetNumTouchFingers : TSDL_GetNumTouchFingers_func = Nil; {$else} function SDL_GetNumTouchFingers(touchID: TSDL_TouchID): cint; cdecl; @@ -117,9 +117,9 @@ function SDL_GetNumTouchFingers(touchID: TSDL_TouchID): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetTouchFinger_fun = function(touchID: TSDL_TouchID; index: cint): PSDL_Finger; cdecl; + TSDL_GetTouchFinger_func = function(touchID: TSDL_TouchID; index: cint): PSDL_Finger; cdecl; Var - SDL_GetTouchFinger : TSDL_GetTouchFinger_fun = Nil; + SDL_GetTouchFinger : TSDL_GetTouchFinger_func = Nil; {$else} function SDL_GetTouchFinger(touchID: TSDL_TouchID; index: cint): PSDL_Finger; cdecl; diff --git a/units/sdlvideo.inc b/units/sdlvideo.inc index 98a2fd76..05a768da 100644 --- a/units/sdlvideo.inc +++ b/units/sdlvideo.inc @@ -256,9 +256,9 @@ function SDL_GetNumVideoDrivers: cint; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetVideoDriver_fun = function(index: cint): PAnsiChar; cdecl; + TSDL_GetVideoDriver_func = function(index: cint): PAnsiChar; cdecl; Var - SDL_GetVideoDriver : TSDL_GetVideoDriver_fun = Nil; + SDL_GetVideoDriver : TSDL_GetVideoDriver_func = Nil; {$else} function SDL_GetVideoDriver(index: cint): PAnsiChar; cdecl; @@ -282,9 +282,9 @@ function SDL_GetVideoDriver(index: cint): PAnsiChar; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_VideoInit_fun = function(const driver_name: PAnsiChar): cint; cdecl; + TSDL_VideoInit_func = function(const driver_name: PAnsiChar): cint; cdecl; Var - SDL_VideoInit : TSDL_VideoInit_fun = Nil; + SDL_VideoInit : TSDL_VideoInit_func = Nil; {$else} function SDL_VideoInit(const driver_name: PAnsiChar): cint; cdecl; @@ -333,9 +333,9 @@ function SDL_GetNumVideoDisplays: cint; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetDisplayName_fun = function(displayIndex: cint): PAnsiChar; cdecl; + TSDL_GetDisplayName_func = function(displayIndex: cint): PAnsiChar; cdecl; Var - SDL_GetDisplayName : TSDL_GetDisplayName_fun = Nil; + SDL_GetDisplayName : TSDL_GetDisplayName_func = Nil; {$else} function SDL_GetDisplayName(displayIndex: cint): PAnsiChar; cdecl; @@ -353,9 +353,9 @@ function SDL_GetDisplayName(displayIndex: cint): PAnsiChar; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetDisplayBounds_fun = function(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; + TSDL_GetDisplayBounds_func = function(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; Var - SDL_GetDisplayBounds : TSDL_GetDisplayBounds_fun = Nil; + SDL_GetDisplayBounds : TSDL_GetDisplayBounds_func = Nil; {$else} function SDL_GetDisplayBounds(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; @@ -381,9 +381,9 @@ function SDL_GetDisplayBounds(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetDisplayUsableBounds_fun = function(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; + TSDL_GetDisplayUsableBounds_func = function(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; Var - SDL_GetDisplayUsableBounds : TSDL_GetDisplayUsableBounds_fun = Nil; + SDL_GetDisplayUsableBounds : TSDL_GetDisplayUsableBounds_func = Nil; {$else} function SDL_GetDisplayUsableBounds(displayIndex: cint; rect: PSDL_Rect): cint; cdecl; @@ -402,9 +402,9 @@ function SDL_GetDisplayUsableBounds(displayIndex: cint; rect: PSDL_Rect): cint; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetDisplayDPI_fun = function(displayIndex: cint; ddpi, hdpi, vdpi: pcfloat): cint; cdecl; + TSDL_GetDisplayDPI_func = function(displayIndex: cint; ddpi, hdpi, vdpi: pcfloat): cint; cdecl; Var - SDL_GetDisplayDPI : TSDL_GetDisplayDPI_fun = Nil; + SDL_GetDisplayDPI : TSDL_GetDisplayDPI_func = Nil; {$else} function SDL_GetDisplayDPI(displayIndex: cint; ddpi, hdpi, vdpi: pcfloat): cint; cdecl; @@ -420,9 +420,9 @@ function SDL_GetDisplayDPI(displayIndex: cint; ddpi, hdpi, vdpi: pcfloat): cint; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetDisplayOrientation_fun = function(displayIndex: cint): TSDL_DisplayOrientation; cdecl; + TSDL_GetDisplayOrientation_func = function(displayIndex: cint): TSDL_DisplayOrientation; cdecl; Var - SDL_GetDisplayOrientation : TSDL_GetDisplayOrientation_fun = Nil; + SDL_GetDisplayOrientation : TSDL_GetDisplayOrientation_func = Nil; {$else} function SDL_GetDisplayOrientation(displayIndex: cint): TSDL_DisplayOrientation; cdecl; @@ -437,9 +437,9 @@ function SDL_GetDisplayOrientation(displayIndex: cint): TSDL_DisplayOrientation; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetNumDisplayModes_fun = function(displayIndex: cint): cint; cdecl; + TSDL_GetNumDisplayModes_func = function(displayIndex: cint): cint; cdecl; Var - SDL_GetNumDisplayModes : TSDL_GetNumDisplayModes_fun = Nil; + SDL_GetNumDisplayModes : TSDL_GetNumDisplayModes_func = Nil; {$else} function SDL_GetNumDisplayModes(displayIndex: cint): cint; cdecl; @@ -460,9 +460,9 @@ function SDL_GetNumDisplayModes(displayIndex: cint): cint; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetDisplayMode_fun = function(displayIndex: cint; modeIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; + TSDL_GetDisplayMode_func = function(displayIndex: cint; modeIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; Var - SDL_GetDisplayMode : TSDL_GetDisplayMode_fun = Nil; + SDL_GetDisplayMode : TSDL_GetDisplayMode_func = Nil; {$else} function SDL_GetDisplayMode(displayIndex: cint; modeIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; @@ -475,9 +475,9 @@ function SDL_GetDisplayMode(displayIndex: cint; modeIndex: cint; mode: PSDL_Disp {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetDesktopDisplayMode_fun = function(displayIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; + TSDL_GetDesktopDisplayMode_func = function(displayIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; Var - SDL_GetDesktopDisplayMode : TSDL_GetDesktopDisplayMode_fun = Nil; + SDL_GetDesktopDisplayMode : TSDL_GetDesktopDisplayMode_func = Nil; {$else} function SDL_GetDesktopDisplayMode(displayIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; @@ -490,9 +490,9 @@ function SDL_GetDesktopDisplayMode(displayIndex: cint; mode: PSDL_DisplayMode): {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetCurrentDisplayMode_fun = function(displayIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; + TSDL_GetCurrentDisplayMode_func = function(displayIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; Var - SDL_GetCurrentDisplayMode : TSDL_GetCurrentDisplayMode_fun = Nil; + SDL_GetCurrentDisplayMode : TSDL_GetCurrentDisplayMode_func = Nil; {$else} function SDL_GetCurrentDisplayMode(displayIndex: cint; mode: PSDL_DisplayMode): cint; cdecl; @@ -522,9 +522,9 @@ function SDL_GetCurrentDisplayMode(displayIndex: cint; mode: PSDL_DisplayMode): {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetClosestDisplayMode_fun = function(displayIndex: cint; const mode: PSDL_DisplayMode; closest: PSDL_DisplayMode): PSDL_DisplayMode; cdecl; + TSDL_GetClosestDisplayMode_func = function(displayIndex: cint; const mode: PSDL_DisplayMode; closest: PSDL_DisplayMode): PSDL_DisplayMode; cdecl; Var - SDL_GetClosestDisplayMode : TSDL_GetClosestDisplayMode_fun = Nil; + SDL_GetClosestDisplayMode : TSDL_GetClosestDisplayMode_func = Nil; {$else} function SDL_GetClosestDisplayMode(displayIndex: cint; const mode: PSDL_DisplayMode; closest: PSDL_DisplayMode): PSDL_DisplayMode; cdecl; @@ -545,9 +545,9 @@ function SDL_GetClosestDisplayMode(displayIndex: cint; const mode: PSDL_DisplayM *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetPointDisplayIndex_fun = function(const point: PSDL_Point): cint; cdecl; + TSDL_GetPointDisplayIndex_func = function(const point: PSDL_Point): cint; cdecl; Var - SDL_GetPointDisplayIndex : TSDL_GetPointDisplayIndex_fun = Nil; + SDL_GetPointDisplayIndex : TSDL_GetPointDisplayIndex_func = Nil; {$else} function SDL_GetPointDisplayIndex(const point: PSDL_Point): cint; cdecl; @@ -569,9 +569,9 @@ function SDL_GetPointDisplayIndex(const point: PSDL_Point): cint; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetRectDisplayIndex_fun = function(const rect: PSDL_Rect): cint; cdecl; + TSDL_GetRectDisplayIndex_func = function(const rect: PSDL_Rect): cint; cdecl; Var - SDL_GetRectDisplayIndex : TSDL_GetRectDisplayIndex_fun = Nil; + SDL_GetRectDisplayIndex : TSDL_GetRectDisplayIndex_func = Nil; {$else} function SDL_GetRectDisplayIndex(const rect: PSDL_Rect): cint; cdecl; @@ -587,9 +587,9 @@ function SDL_GetRectDisplayIndex(const rect: PSDL_Rect): cint; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetWindowDisplayIndex_fun = function(window: PSDL_Window): cint; cdecl; + TSDL_GetWindowDisplayIndex_func = function(window: PSDL_Window): cint; cdecl; Var - SDL_GetWindowDisplayIndex : TSDL_GetWindowDisplayIndex_fun = Nil; + SDL_GetWindowDisplayIndex : TSDL_GetWindowDisplayIndex_func = Nil; {$else} function SDL_GetWindowDisplayIndex(window: PSDL_Window): cint; cdecl; @@ -612,9 +612,9 @@ function SDL_GetWindowDisplayIndex(window: PSDL_Window): cint; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetWindowDisplayMode_fun = function(window: PSDL_Window; const mode: PSDL_DisplayMode): cint; cdecl; + TSDL_SetWindowDisplayMode_func = function(window: PSDL_Window; const mode: PSDL_DisplayMode): cint; cdecl; Var - SDL_SetWindowDisplayMode : TSDL_SetWindowDisplayMode_fun = Nil; + SDL_SetWindowDisplayMode : TSDL_SetWindowDisplayMode_func = Nil; {$else} function SDL_SetWindowDisplayMode(window: PSDL_Window; const mode: PSDL_DisplayMode): cint; cdecl; @@ -631,9 +631,9 @@ function SDL_SetWindowDisplayMode(window: PSDL_Window; const mode: PSDL_DisplayM {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetWindowDisplayMode_fun = function(window: PSDL_Window; mode: PSDL_DisplayMode): cint; cdecl; + TSDL_GetWindowDisplayMode_func = function(window: PSDL_Window; mode: PSDL_DisplayMode): cint; cdecl; Var - SDL_GetWindowDisplayMode : TSDL_GetWindowDisplayMode_fun = Nil; + SDL_GetWindowDisplayMode : TSDL_GetWindowDisplayMode_func = Nil; {$else} function SDL_GetWindowDisplayMode(window: PSDL_Window; mode: PSDL_DisplayMode): cint; cdecl; @@ -654,9 +654,9 @@ function SDL_GetWindowDisplayMode(window: PSDL_Window; mode: PSDL_DisplayMode): *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetWindowICCProfile_fun = function(window: PSDL_Window; size: pcsize_t): Pointer; cdecl; + TSDL_GetWindowICCProfile_func = function(window: PSDL_Window; size: pcsize_t): Pointer; cdecl; Var - SDL_GetWindowICCProfile : TSDL_GetWindowICCProfile_fun = Nil; + SDL_GetWindowICCProfile : TSDL_GetWindowICCProfile_func = Nil; {$else} function SDL_GetWindowICCProfile(window: PSDL_Window; size: pcsize_t): Pointer; cdecl; @@ -669,9 +669,9 @@ function SDL_GetWindowICCProfile(window: PSDL_Window; size: pcsize_t): Pointer; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetWindowPixelFormat_fun = function(window: PSDL_Window): cuint32; cdecl; + TSDL_GetWindowPixelFormat_func = function(window: PSDL_Window): cuint32; cdecl; Var - SDL_GetWindowPixelFormat : TSDL_GetWindowPixelFormat_fun = Nil; + SDL_GetWindowPixelFormat : TSDL_GetWindowPixelFormat_func = Nil; {$else} function SDL_GetWindowPixelFormat(window: PSDL_Window): cuint32; cdecl; @@ -723,9 +723,9 @@ function SDL_GetWindowPixelFormat(window: PSDL_Window): cuint32; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_CreateWindow_fun = function(const title: PAnsiChar; x: cint; y: cint; w: cint; h: cint; flags: TSDL_WindowFlags): PSDL_Window; cdecl; + TSDL_CreateWindow_func = function(const title: PAnsiChar; x: cint; y: cint; w: cint; h: cint; flags: TSDL_WindowFlags): PSDL_Window; cdecl; Var - SDL_CreateWindow : TSDL_CreateWindow_fun = Nil; + SDL_CreateWindow : TSDL_CreateWindow_func = Nil; {$else} function SDL_CreateWindow(const title: PAnsiChar; x: cint; y: cint; w: cint; h: cint; flags: TSDL_WindowFlags): PSDL_Window; cdecl; @@ -744,9 +744,9 @@ function SDL_CreateWindow(const title: PAnsiChar; x: cint; y: cint; w: cint; h: {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_CreateWindowFrom_fun = function(const data: Pointer): PSDL_Window; cdecl; + TSDL_CreateWindowFrom_func = function(const data: Pointer): PSDL_Window; cdecl; Var - SDL_CreateWindowFrom : TSDL_CreateWindowFrom_fun = Nil; + SDL_CreateWindowFrom : TSDL_CreateWindowFrom_func = Nil; {$else} function SDL_CreateWindowFrom(const data: Pointer): PSDL_Window; cdecl; @@ -759,9 +759,9 @@ function SDL_CreateWindowFrom(const data: Pointer): PSDL_Window; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetWindowID_fun = function(window: PSDL_Window): cuint32; cdecl; + TSDL_GetWindowID_func = function(window: PSDL_Window): cuint32; cdecl; Var - SDL_GetWindowID : TSDL_GetWindowID_fun = Nil; + SDL_GetWindowID : TSDL_GetWindowID_func = Nil; {$else} function SDL_GetWindowID(window: PSDL_Window): cuint32; cdecl; @@ -774,9 +774,9 @@ function SDL_GetWindowID(window: PSDL_Window): cuint32; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetWindowFromID_fun = function(id: cuint32): PSDL_Window; cdecl; + TSDL_GetWindowFromID_func = function(id: cuint32): PSDL_Window; cdecl; Var - SDL_GetWindowFromID : TSDL_GetWindowFromID_fun = Nil; + SDL_GetWindowFromID : TSDL_GetWindowFromID_func = Nil; {$else} function SDL_GetWindowFromID(id: cuint32): PSDL_Window; cdecl; @@ -789,9 +789,9 @@ function SDL_GetWindowFromID(id: cuint32): PSDL_Window; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetWindowFlags_fun = function(window: PSDL_Window): TSDL_WindowFlags; cdecl; + TSDL_GetWindowFlags_func = function(window: PSDL_Window): TSDL_WindowFlags; cdecl; Var - SDL_GetWindowFlags : TSDL_GetWindowFlags_fun = Nil; + SDL_GetWindowFlags : TSDL_GetWindowFlags_func = Nil; {$else} function SDL_GetWindowFlags(window: PSDL_Window): TSDL_WindowFlags; cdecl; @@ -823,9 +823,9 @@ procedure SDL_SetWindowTitle(window: PSDL_Window; const title: PAnsiChar); cdecl {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetWindowTitle_fun = function(window: PSDL_Window): PAnsiChar; cdecl; + TSDL_GetWindowTitle_func = function(window: PSDL_Window): PAnsiChar; cdecl; Var - SDL_GetWindowTitle : TSDL_GetWindowTitle_fun = Nil; + SDL_GetWindowTitle : TSDL_GetWindowTitle_func = Nil; {$else} function SDL_GetWindowTitle(window: PSDL_Window): PAnsiChar; cdecl; @@ -865,9 +865,9 @@ procedure SDL_SetWindowIcon(window: PSDL_Window; icon: PSDL_Surface); cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetWindowData_fun = function(window: PSDL_Window; const name: PAnsiChar; userdata: Pointer): Pointer; cdecl; + TSDL_SetWindowData_func = function(window: PSDL_Window; const name: PAnsiChar; userdata: Pointer): Pointer; cdecl; Var - SDL_SetWindowData : TSDL_SetWindowData_fun = Nil; + SDL_SetWindowData : TSDL_SetWindowData_func = Nil; {$else} function SDL_SetWindowData(window: PSDL_Window; const name: PAnsiChar; userdata: Pointer): Pointer; cdecl; @@ -887,9 +887,9 @@ function SDL_SetWindowData(window: PSDL_Window; const name: PAnsiChar; userdata: {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetWindowData_fun = function(window: PSDL_Window; const name: PAnsiChar): Pointer; cdecl; + TSDL_GetWindowData_func = function(window: PSDL_Window; const name: PAnsiChar): Pointer; cdecl; Var - SDL_GetWindowData : TSDL_GetWindowData_fun = Nil; + SDL_GetWindowData : TSDL_GetWindowData_func = Nil; {$else} function SDL_GetWindowData(window: PSDL_Window; const name: PAnsiChar): Pointer; cdecl; @@ -1001,9 +1001,9 @@ procedure SDL_GetWindowSize(window: PSDL_Window; w: pcint; h: pcint); cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetWindowBordersSize_fun = function(window: PSDL_Window; top, left, bottom, right: pcint): cint; cdecl; + TSDL_GetWindowBordersSize_func = function(window: PSDL_Window; top, left, bottom, right: pcint): cint; cdecl; Var - SDL_GetWindowBordersSize : TSDL_GetWindowBordersSize_fun = Nil; + SDL_GetWindowBordersSize : TSDL_GetWindowBordersSize_func = Nil; {$else} function SDL_GetWindowBordersSize(window: PSDL_Window; top, left, bottom, right: pcint): cint; cdecl; @@ -1317,9 +1317,9 @@ procedure SDL_RestoreWindow(window: PSDL_Window); cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetWindowFullscreen_fun = function(window: PSDL_Window; flags: TSDL_WindowFlags): cint; cdecl; + TSDL_SetWindowFullscreen_func = function(window: PSDL_Window; flags: TSDL_WindowFlags): cint; cdecl; Var - SDL_SetWindowFullscreen : TSDL_SetWindowFullscreen_fun = Nil; + SDL_SetWindowFullscreen : TSDL_SetWindowFullscreen_func = Nil; {$else} function SDL_SetWindowFullscreen(window: PSDL_Window; flags: TSDL_WindowFlags): cint; cdecl; @@ -1338,9 +1338,9 @@ function SDL_SetWindowFullscreen(window: PSDL_Window; flags: TSDL_WindowFlags): *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_HasWindowSurface_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; + TSDL_HasWindowSurface_func = function(window: PSDL_Window): TSDL_Bool; cdecl; Var - SDL_HasWindowSurface : TSDL_HasWindowSurface_fun = Nil; + SDL_HasWindowSurface : TSDL_HasWindowSurface_func = Nil; {$else} function SDL_HasWindowSurface(window: PSDL_Window): TSDL_Bool; cdecl; @@ -1363,9 +1363,9 @@ function SDL_HasWindowSurface(window: PSDL_Window): TSDL_Bool; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetWindowSurface_fun = function(window: PSDL_Window): PSDL_Surface; cdecl; + TSDL_GetWindowSurface_func = function(window: PSDL_Window): PSDL_Surface; cdecl; Var - SDL_GetWindowSurface : TSDL_GetWindowSurface_fun = Nil; + SDL_GetWindowSurface : TSDL_GetWindowSurface_func = Nil; {$else} function SDL_GetWindowSurface(window: PSDL_Window): PSDL_Surface; cdecl; @@ -1383,9 +1383,9 @@ function SDL_GetWindowSurface(window: PSDL_Window): PSDL_Surface; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_UpdateWindowSurface_fun = function(window: PSDL_Window): cint; cdecl; + TSDL_UpdateWindowSurface_func = function(window: PSDL_Window): cint; cdecl; Var - SDL_UpdateWindowSurface : TSDL_UpdateWindowSurface_fun = Nil; + SDL_UpdateWindowSurface : TSDL_UpdateWindowSurface_func = Nil; {$else} function SDL_UpdateWindowSurface(window: PSDL_Window): cint; cdecl; @@ -1403,9 +1403,9 @@ function SDL_UpdateWindowSurface(window: PSDL_Window): cint; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_UpdateWindowSurfaceRects_fun = function(window: PSDL_Window; rects: PSDL_Rect; numrects: cint): cint; cdecl; + TSDL_UpdateWindowSurfaceRects_func = function(window: PSDL_Window; rects: PSDL_Rect; numrects: cint): cint; cdecl; Var - SDL_UpdateWindowSurfaceRects : TSDL_UpdateWindowSurfaceRects_fun = Nil; + SDL_UpdateWindowSurfaceRects : TSDL_UpdateWindowSurfaceRects_func = Nil; {$else} function SDL_UpdateWindowSurfaceRects(window: PSDL_Window; rects: PSDL_Rect; numrects: cint): cint; cdecl; @@ -1426,9 +1426,9 @@ function SDL_UpdateWindowSurfaceRects(window: PSDL_Window; rects: PSDL_Rect; num *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_DestroyWindowSurface_fun = function(window: PSDL_Window): cint; cdecl; + TSDL_DestroyWindowSurface_func = function(window: PSDL_Window): cint; cdecl; Var - SDL_DestroyWindowSurface : TSDL_DestroyWindowSurface_fun = Nil; + SDL_DestroyWindowSurface : TSDL_DestroyWindowSurface_func = Nil; {$else} function SDL_DestroyWindowSurface(window: PSDL_Window): cint; cdecl; @@ -1464,9 +1464,9 @@ procedure SDL_SetWindowGrab(window: PSDL_Window; grabbed: TSDL_Bool); cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetWindowGrab_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; + TSDL_GetWindowGrab_func = function(window: PSDL_Window): TSDL_Bool; cdecl; Var - SDL_GetWindowGrab : TSDL_GetWindowGrab_fun = Nil; + SDL_GetWindowGrab : TSDL_GetWindowGrab_func = Nil; {$else} function SDL_GetWindowGrab(window: PSDL_Window): TSDL_Bool; cdecl; @@ -1522,9 +1522,9 @@ procedure SDL_SetWindowKeyboardGrab(window: PSDL_Window; grabbed: TSDL_Bool); cd {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetWindowKeyboardGrab_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; + TSDL_GetWindowKeyboardGrab_func = function(window: PSDL_Window): TSDL_Bool; cdecl; Var - SDL_GetWindowKeyboardGrab : TSDL_GetWindowKeyboardGrab_fun = Nil; + SDL_GetWindowKeyboardGrab : TSDL_GetWindowKeyboardGrab_func = Nil; {$else} function SDL_GetWindowKeyboardGrab(window: PSDL_Window): TSDL_Bool; cdecl; @@ -1561,9 +1561,9 @@ procedure SDL_SetWindowMouseGrab(window: PSDL_Window; grabbed: TSDL_Bool); cdecl {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetWindowMouseGrab_fun = function(window: PSDL_Window): TSDL_Bool; cdecl; + TSDL_GetWindowMouseGrab_func = function(window: PSDL_Window): TSDL_Bool; cdecl; Var - SDL_GetWindowMouseGrab : TSDL_GetWindowMouseGrab_fun = Nil; + SDL_GetWindowMouseGrab : TSDL_GetWindowMouseGrab_func = Nil; {$else} function SDL_GetWindowMouseGrab(window: PSDL_Window): TSDL_Bool; cdecl; @@ -1600,9 +1600,9 @@ procedure SDL_SetWindowMouseRect(window: PSDL_Window; rect: PSDL_Rect); cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetWindowMouseRect_fun = function(window: PSDL_Window): PSDL_Rect; cdecl; + TSDL_GetWindowMouseRect_func = function(window: PSDL_Window): PSDL_Rect; cdecl; Var - SDL_GetWindowMouseRect : TSDL_GetWindowMouseRect_fun = Nil; + SDL_GetWindowMouseRect : TSDL_GetWindowMouseRect_func = Nil; {$else} function SDL_GetWindowMouseRect(window: PSDL_Window): PSDL_Rect; cdecl; @@ -1618,9 +1618,9 @@ function SDL_GetWindowMouseRect(window: PSDL_Window): PSDL_Rect; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetGrabbedWindow_fun = function(): PSDL_Window; cdecl; + TSDL_GetGrabbedWindow_func = function(): PSDL_Window; cdecl; Var - SDL_GetGrabbedWindow : TSDL_GetGrabbedWindow_fun = Nil; + SDL_GetGrabbedWindow : TSDL_GetGrabbedWindow_func = Nil; {$else} function SDL_GetGrabbedWindow(): PSDL_Window; cdecl; @@ -1638,9 +1638,9 @@ function SDL_GetGrabbedWindow(): PSDL_Window; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetWindowBrightness_fun = function(window: PSDL_Window; brightness: cfloat): cint; cdecl; + TSDL_SetWindowBrightness_func = function(window: PSDL_Window; brightness: cfloat): cint; cdecl; Var - SDL_SetWindowBrightness : TSDL_SetWindowBrightness_fun = Nil; + SDL_SetWindowBrightness : TSDL_SetWindowBrightness_func = Nil; {$else} function SDL_SetWindowBrightness(window: PSDL_Window; brightness: cfloat): cint; cdecl; @@ -1657,9 +1657,9 @@ function SDL_SetWindowBrightness(window: PSDL_Window; brightness: cfloat): cint; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetWindowBrightness_fun = function(window: PSDL_Window): cfloat; cdecl; + TSDL_GetWindowBrightness_func = function(window: PSDL_Window): cfloat; cdecl; Var - SDL_GetWindowBrightness : TSDL_GetWindowBrightness_fun = Nil; + SDL_GetWindowBrightness : TSDL_GetWindowBrightness_func = Nil; {$else} function SDL_GetWindowBrightness(window: PSDL_Window): cfloat; cdecl; @@ -1679,9 +1679,9 @@ function SDL_GetWindowBrightness(window: PSDL_Window): cfloat; cdecl; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetWindowOpacity_fun = function(window: PSDL_Window; opacity: cfloat): cint; cdecl; + TSDL_SetWindowOpacity_func = function(window: PSDL_Window; opacity: cfloat): cint; cdecl; Var - SDL_SetWindowOpacity : TSDL_SetWindowOpacity_fun = Nil; + SDL_SetWindowOpacity : TSDL_SetWindowOpacity_func = Nil; {$else} function SDL_SetWindowOpacity(window: PSDL_Window; opacity: cfloat): cint; cdecl; @@ -1703,9 +1703,9 @@ function SDL_SetWindowOpacity(window: PSDL_Window; opacity: cfloat): cint; cdecl *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetWindowOpacity_fun = function(window: PSDL_Window; out_opacity: pcfloat): cint; cdecl; + TSDL_GetWindowOpacity_func = function(window: PSDL_Window; out_opacity: pcfloat): cint; cdecl; Var - SDL_GetWindowOpacity : TSDL_GetWindowOpacity_fun = Nil; + SDL_GetWindowOpacity : TSDL_GetWindowOpacity_func = Nil; {$else} function SDL_GetWindowOpacity(window: PSDL_Window; out_opacity: pcfloat): cint; cdecl; @@ -1722,9 +1722,9 @@ function SDL_GetWindowOpacity(window: PSDL_Window; out_opacity: pcfloat): cint; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetWindowModalFor_fun = function(modal_window, parent_window: PSDL_Window): cint; cdecl; + TSDL_SetWindowModalFor_func = function(modal_window, parent_window: PSDL_Window): cint; cdecl; Var - SDL_SetWindowModalFor : TSDL_SetWindowModalFor_fun = Nil; + SDL_SetWindowModalFor : TSDL_SetWindowModalFor_func = Nil; {$else} function SDL_SetWindowModalFor(modal_window, parent_window: PSDL_Window): cint; cdecl; @@ -1745,9 +1745,9 @@ function SDL_SetWindowModalFor(modal_window, parent_window: PSDL_Window): cint; *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetWindowInputFocus_fun = function(window: PSDL_Window): cint; cdecl; + TSDL_SetWindowInputFocus_func = function(window: PSDL_Window): cint; cdecl; Var - SDL_SetWindowInputFocus : TSDL_SetWindowInputFocus_fun = Nil; + SDL_SetWindowInputFocus : TSDL_SetWindowInputFocus_func = Nil; {$else} function SDL_SetWindowInputFocus(window: PSDL_Window): cint; cdecl; @@ -1774,9 +1774,9 @@ function SDL_SetWindowInputFocus(window: PSDL_Window): cint; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetWindowGammaRamp_fun = function(window: PSDL_Window; const red: pcuint16; const green: pcuint16; const blue: pcuint16): cint; cdecl; + TSDL_SetWindowGammaRamp_func = function(window: PSDL_Window; const red: pcuint16; const green: pcuint16; const blue: pcuint16): cint; cdecl; Var - SDL_SetWindowGammaRamp : TSDL_SetWindowGammaRamp_fun = Nil; + SDL_SetWindowGammaRamp : TSDL_SetWindowGammaRamp_func = Nil; {$else} function SDL_SetWindowGammaRamp(window: PSDL_Window; const red: pcuint16; const green: pcuint16; const blue: pcuint16): cint; cdecl; @@ -1800,9 +1800,9 @@ function SDL_SetWindowGammaRamp(window: PSDL_Window; const red: pcuint16; const {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GetWindowGammaRamp_fun = function(window: PSDL_Window; red: pcuint16; green: pcuint16; blue: pcuint16): cint; cdecl; + TSDL_GetWindowGammaRamp_func = function(window: PSDL_Window; red: pcuint16; green: pcuint16; blue: pcuint16): cint; cdecl; Var - SDL_GetWindowGammaRamp : TSDL_GetWindowGammaRamp_fun = Nil; + SDL_GetWindowGammaRamp : TSDL_GetWindowGammaRamp_func = Nil; {$else} function SDL_GetWindowGammaRamp(window: PSDL_Window; red: pcuint16; green: pcuint16; blue: pcuint16): cint; cdecl; @@ -1880,9 +1880,9 @@ type *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_SetWindowHitTest_fun = function(window: PSDL_Window; callback: TSDL_HitTest; callback_data: Pointer): cint; cdecl; + TSDL_SetWindowHitTest_func = function(window: PSDL_Window; callback: TSDL_HitTest; callback_data: Pointer): cint; cdecl; Var - SDL_SetWindowHitTest : TSDL_SetWindowHitTest_fun = Nil; + SDL_SetWindowHitTest : TSDL_SetWindowHitTest_func = Nil; {$else} function SDL_SetWindowHitTest(window: PSDL_Window; callback: TSDL_HitTest; callback_data: Pointer): cint; cdecl; @@ -1901,9 +1901,9 @@ function SDL_SetWindowHitTest(window: PSDL_Window; callback: TSDL_HitTest; callb *} {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_FlashWindow_fun = function(window: PSDL_Window; operation: TSDL_FlashOperation): cint; cdecl; + TSDL_FlashWindow_func = function(window: PSDL_Window; operation: TSDL_FlashOperation): cint; cdecl; Var - SDL_FlashWindow : TSDL_FlashWindow_fun = Nil; + SDL_FlashWindow : TSDL_FlashWindow_func = Nil; {$else} function SDL_FlashWindow(window: PSDL_Window; operation: TSDL_FlashOperation): cint; cdecl; @@ -1980,9 +1980,9 @@ procedure SDL_DisableScreenSaver; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GL_LoadLibrary_fun = function(const path: PAnsiChar): cint; cdecl; + TSDL_GL_LoadLibrary_func = function(const path: PAnsiChar): cint; cdecl; Var - SDL_GL_LoadLibrary : TSDL_GL_LoadLibrary_fun = Nil; + SDL_GL_LoadLibrary : TSDL_GL_LoadLibrary_func = Nil; {$else} function SDL_GL_LoadLibrary(const path: PAnsiChar): cint; cdecl; @@ -1995,9 +1995,9 @@ function SDL_GL_LoadLibrary(const path: PAnsiChar): cint; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GL_GetProcAddress_fun = function(const proc: PAnsiChar): Pointer; cdecl; + TSDL_GL_GetProcAddress_func = function(const proc: PAnsiChar): Pointer; cdecl; Var - SDL_GL_GetProcAddress : TSDL_GL_GetProcAddress_fun = Nil; + SDL_GL_GetProcAddress : TSDL_GL_GetProcAddress_func = Nil; {$else} function SDL_GL_GetProcAddress(const proc: PAnsiChar): Pointer; cdecl; @@ -2020,9 +2020,9 @@ procedure SDL_GL_UnloadLibrary; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GL_ExtensionSupported_fun = function(const extension: PAnsiChar): TSDL_Bool; cdecl; + TSDL_GL_ExtensionSupported_func = function(const extension: PAnsiChar): TSDL_Bool; cdecl; Var - SDL_GL_ExtensionSupported : TSDL_GL_ExtensionSupported_fun = Nil; + SDL_GL_ExtensionSupported : TSDL_GL_ExtensionSupported_func = Nil; {$else} function SDL_GL_ExtensionSupported(const extension: PAnsiChar): TSDL_Bool; cdecl; @@ -2049,9 +2049,9 @@ procedure SDL_GL_ResetAttributes(); cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GL_SetAttribute_fun = function(attr: TSDL_GLattr; value: cint): cint; cdecl; + TSDL_GL_SetAttribute_func = function(attr: TSDL_GLattr; value: cint): cint; cdecl; Var - SDL_GL_SetAttribute : TSDL_GL_SetAttribute_fun = Nil; + SDL_GL_SetAttribute : TSDL_GL_SetAttribute_func = Nil; {$else} function SDL_GL_SetAttribute(attr: TSDL_GLattr; value: cint): cint; cdecl; @@ -2064,9 +2064,9 @@ function SDL_GL_SetAttribute(attr: TSDL_GLattr; value: cint): cint; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GL_GetAttribute_fun = function(attr: TSDL_GLattr; value: pcint): cint; cdecl; + TSDL_GL_GetAttribute_func = function(attr: TSDL_GLattr; value: pcint): cint; cdecl; Var - SDL_GL_GetAttribute : TSDL_GL_GetAttribute_fun = Nil; + SDL_GL_GetAttribute : TSDL_GL_GetAttribute_func = Nil; {$else} function SDL_GL_GetAttribute(attr: TSDL_GLattr; value: pcint): cint; cdecl; @@ -2082,9 +2082,9 @@ function SDL_GL_GetAttribute(attr: TSDL_GLattr; value: pcint): cint; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GL_CreateContext_fun = function(window: PSDL_Window): TSDL_GLContext; cdecl; + TSDL_GL_CreateContext_func = function(window: PSDL_Window): TSDL_GLContext; cdecl; Var - SDL_GL_CreateContext : TSDL_GL_CreateContext_fun = Nil; + SDL_GL_CreateContext : TSDL_GL_CreateContext_func = Nil; {$else} function SDL_GL_CreateContext(window: PSDL_Window): TSDL_GLContext; cdecl; @@ -2099,9 +2099,9 @@ function SDL_GL_CreateContext(window: PSDL_Window): TSDL_GLContext; cdecl; {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GL_MakeCurrent_fun = function(window: PSDL_Window; context: TSDL_GLContext): cint; cdecl; + TSDL_GL_MakeCurrent_func = function(window: PSDL_Window; context: TSDL_GLContext): cint; cdecl; Var - SDL_GL_MakeCurrent : TSDL_GL_MakeCurrent_fun = Nil; + SDL_GL_MakeCurrent : TSDL_GL_MakeCurrent_func = Nil; {$else} function SDL_GL_MakeCurrent(window: PSDL_Window; context: TSDL_GLContext): cint; cdecl; @@ -2163,9 +2163,9 @@ procedure SDL_GL_GetDrawableSize(window: PSDL_Window; w: pcint; h: pcint); cdecl {$ifdef SDL_RUNTIME_LOADING} Type - TSDL_GL_SetSwapInterval_fun = function(interval: cint): cint; cdecl; + TSDL_GL_SetSwapInterval_func = function(interval: cint): cint; cdecl; Var - SDL_GL_SetSwapInterval : TSDL_GL_SetSwapInterval_fun = Nil; + SDL_GL_SetSwapInterval : TSDL_GL_SetSwapInterval_func = Nil; {$else} function SDL_GL_SetSwapInterval(interval: cint): cint; cdecl; From 1d8725553b0fc1768df75c3d5abda56056eeeb52 Mon Sep 17 00:00:00 2001 From: PascalCorpsman Date: Sun, 5 Jan 2025 14:58:40 +0100 Subject: [PATCH 7/8] FIX: It seems that not "everything" was dynamic linked like it should be, now it is ;) --- units/sdl_runtime_linking.inc | 4 + units/sdlatomic.inc | 78 +++++++++++- units/sdlaudio.inc | 55 +++++++- units/sdlcpuinfo.inc | 4 + units/sdlerror.inc | 14 ++ units/sdlevents.inc | 45 ++++++- units/sdlgamecontroller.inc | 66 +++++++--- units/sdlhaptic.inc | 12 +- units/sdlhidapi.inc | 5 +- units/sdlkeyboard.inc | 74 +++++++++-- units/sdlloadso.inc | 8 +- units/sdllocale.inc | 4 + units/sdllog.inc | 5 +- units/sdlmisc.inc | 4 + units/sdlmouse.inc | 18 ++- units/sdlmutex.inc | 20 ++- units/sdlplatform.inc | 8 ++ units/sdlrenderer.inc | 234 ++++++++++++++++++++++++---------- units/sdlrwops.inc | 7 + units/sdlsensor.inc | 5 +- units/sdlstdinc.inc | 38 ++++++ units/sdlsurface.inc | 8 +- units/sdlsystem.inc | 5 +- units/sdlthread.inc | 22 +++- units/sdltimer.inc | 30 ++++- units/sdlversion.inc | 15 +++ units/sdlvideo.inc | 92 ++++++++++--- 27 files changed, 730 insertions(+), 150 deletions(-) diff --git a/units/sdl_runtime_linking.inc b/units/sdl_runtime_linking.inc index fa628e28..5e56b7cf 100644 --- a/units/sdl_runtime_linking.inc +++ b/units/sdl_runtime_linking.inc @@ -911,6 +911,10 @@ Begin {$ENDIF} SDL_IsTablet := TSDL_IsTablet_func(GetProcAddress(LibHandle, 'SDL_IsTablet')); If Not assigned(SDL_IsTablet) Then result := false; + SDL_PollEvent := TSDL_PollEvent_func(GetProcAddress(LibHandle, 'SDL_PollEvent')); + If Not assigned(SDL_PollEvent) Then result := false; + SDL_EventState := TSDL_EventState_func(GetProcAddress(LibHandle, 'SDL_EventState')); + If Not assigned(SDL_EventState) Then result := false; SDL_GetWindowWMInfo := TSDL_GetWindowWMInfo_func(GetProcAddress(LibHandle, 'SDL_GetWindowWMInfo')); If Not assigned(SDL_GetWindowWMInfo) Then result := false; SDL_CreateThread := TSDL_CreateThread_func(GetProcAddress(LibHandle, 'SDL_CreateThread')); diff --git a/units/sdlatomic.inc b/units/sdlatomic.inc index d380ed40..80bf1d58 100644 --- a/units/sdlatomic.inc +++ b/units/sdlatomic.inc @@ -17,22 +17,43 @@ type {** * Try to lock a spin lock by setting it to a non-zero value. *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_AtomicTryLock_func = function (lock: PSDL_SpinLock): TSDL_bool; cdecl; +Var + SDL_AtomicTryLock : TSDL_AtomicTryLock_func = Nil; +{$else} function SDL_AtomicTryLock(lock: PSDL_SpinLock): TSDL_bool; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicTryLock' {$ENDIF} {$ENDIF}; +{$endif} {** * Lock a spin lock by setting it to a non-zero value. *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_AtomicLock_func = function (lock: PSDL_SpinLock): TSDL_bool; cdecl; +Var + SDL_AtomicLock : TSDL_AtomicLock_func = Nil; +{$else} function SDL_AtomicLock(lock: PSDL_SpinLock): TSDL_bool; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicLock' {$ENDIF} {$ENDIF}; +{$endif} {** * Unlock a spin lock by setting it to 0. * * Always returns immediately. *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_AtomicUnlock_proc = procedure (lock: PSDL_SpinLock); cdecl; +Var + SDL_AtomicUnlock : TSDL_AtomicUnlock_proc = Nil; +{$else} procedure SDL_AtomicUnlock(lock: PSDL_SpinLock); cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicUnlock' {$ENDIF} {$ENDIF}; +{$endif} {** * The compiler barrier prevents the compiler from reordering @@ -54,30 +75,58 @@ type {** * Set an atomic variable to a new value if it is currently an old value. *} -function SDL_AtomicCAS(atomic: PSDL_Atomic; oldValue, newValue: cint): TSDL_bool; cdecl; + {$ifdef SDL_RUNTIME_LOADING} + Type + TSDL_AtomicCAS_func = function (atomic: PSDL_Atomic; oldValue, newValue: cint): TSDL_bool; cdecl; + Var + SDL_AtomicCAS : TSDL_AtomicCAS_func = Nil; + {$else} + function SDL_AtomicCAS(atomic: PSDL_Atomic; oldValue, newValue: cint): TSDL_bool; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicCAS' {$ENDIF} {$ENDIF}; + {$endif} {** * Set an atomic variable to a new value and return the old one. * * This function also acts as a full memory barrier. *} -function SDL_AtomicSet(atomic: PSDL_Atomic; value: cint): cint; cdecl; + {$ifdef SDL_RUNTIME_LOADING} + Type + TSDL_AtomicSet_func = function (atomic: PSDL_Atomic; value: cint): cint; cdecl; + Var + SDL_AtomicSet : TSDL_AtomicSet_func = Nil; + {$else} + function SDL_AtomicSet(atomic: PSDL_Atomic; value: cint): cint; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicSet' {$ENDIF} {$ENDIF}; + {$endif} {** * Get the value of an atomic variable. *} -function SDL_AtomicGet(atomic: PSDL_Atomic): cint; cdecl; + {$ifdef SDL_RUNTIME_LOADING} + Type + TSDL_AtomicGet_func = function (atomic: PSDL_Atomic): cint; cdecl; + Var + SDL_AtomicGet : TSDL_AtomicGet_func = Nil; + {$else} + function SDL_AtomicGet(atomic: PSDL_Atomic): cint; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicGet' {$ENDIF} {$ENDIF}; + {$endif} {** * Add to an atomic variable, and return the old value. * * This function also acts as a full memory barrier. *} -function SDL_AtomicAdd(atomic: PSDL_Atomic; value: cint): cint; cdecl; + {$ifdef SDL_RUNTIME_LOADING} + Type + TSDL_AtomicAdd_func = function (atomic: PSDL_Atomic; value: cint): cint; cdecl; + Var + SDL_AtomicAdd : TSDL_AtomicAdd_func = Nil; + {$else} + function SDL_AtomicAdd(atomic: PSDL_Atomic; value: cint): cint; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicAdd' {$ENDIF} {$ENDIF}; + {$endif} {** * Increment an atomic variable used as a reference count. @@ -92,18 +141,39 @@ function SDL_AtomicDecRef(atomic: PSDL_Atomic): Boolean; {** * Set a pointer to a new value if it is currently an old value. *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_AtomicCASPtr_func = function (ptr: PPointer; oldValue, newValue: Pointer): TSDL_bool; cdecl; +Var + SDL_AtomicCASPtr : TSDL_AtomicCASPtr_func = Nil; +{$else} function SDL_AtomicCASPtr(ptr: PPointer; oldValue, newValue: Pointer): TSDL_bool; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicCASPtr' {$ENDIF} {$ENDIF}; +{$endif} {** * Set a pointer to a new value atomically, and return the old value. *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_AtomicSetPtr_func = function (ptr: PPointer; value: Pointer): Pointer; cdecl; +Var + SDL_AtomicSetPtr : TSDL_AtomicSetPtr_func = Nil; +{$else} function SDL_AtomicSetPtr(ptr: PPointer; value: Pointer): Pointer; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicSetPtr' {$ENDIF} {$ENDIF}; +{$endif} {** * Get the value of a pointer atomically. *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_AtomicGetPtr_func = function (ptr: PPointer): Pointer; cdecl; +Var + SDL_AtomicGetPtr : TSDL_AtomicGetPtr_func = Nil; +{$else} function SDL_AtomicGetPtr(ptr: PPointer): Pointer; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AtomicGetPtr' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlaudio.inc b/units/sdlaudio.inc index b6c3f871..7c608cf1 100644 --- a/units/sdlaudio.inc +++ b/units/sdlaudio.inc @@ -219,8 +219,15 @@ type * * \sa SDL_GetAudioDriver *} + {$ifdef SDL_RUNTIME_LOADING} + Type + TSDL_GetNumAudioDrivers_func = function : cint; cdecl; + Var + SDL_GetNumAudioDrivers : TSDL_GetNumAudioDrivers_func = Nil; + {$else} function SDL_GetNumAudioDrivers: cint; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumAudioDrivers' {$ENDIF} {$ENDIF}; +{$endif} {** * Use this function to get the name of a built in audio driver. @@ -299,9 +306,15 @@ function SDL_AudioInit(driver_name: PAnsiChar): cint; cdecl; * * \sa SDL_AudioInit *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_AudioQuit_proc = procedure ; cdecl; +Var + SDL_AudioQuit : TSDL_AudioQuit_proc = Nil; +{$else} procedure SDL_AudioQuit; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AudioQuit' {$ENDIF} {$ENDIF}; - +{$endif} {** * Get the name of the current audio driver. * @@ -318,9 +331,15 @@ procedure SDL_AudioQuit; cdecl; * * \sa SDL_AudioInit *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_GetCurrentAudioDriver_func = function : PAnsiChar; cdecl; +Var + SDL_GetCurrentAudioDriver : TSDL_GetCurrentAudioDriver_func = Nil; +{$else} function SDL_GetCurrentAudioDriver: PAnsiChar; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCurrentAudioDriver' {$ENDIF} {$ENDIF}; - +{$endif} {** * This function is a legacy means of opening the audio device. * @@ -723,8 +742,15 @@ const * * \sa SDL_GetAudioDeviceStatus *} -function SDL_GetAudioStatus: TSDL_AudioStatus; cdecl; + {$ifdef SDL_RUNTIME_LOADING} + Type + TSDL_GetAudioStatus_func = function : TSDL_AudioStatus; cdecl; + Var + SDL_GetAudioStatus : TSDL_GetAudioStatus_func = Nil; + {$else} + function SDL_GetAudioStatus: TSDL_AudioStatus; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetAudioStatus' {$ENDIF} {$ENDIF}; + {$endif} {** * Use this function to get the current audio state of an audio device. @@ -1572,8 +1598,15 @@ procedure SDL_ClearQueuedAudio(dev: TSDL_AudioDeviceID); cdecl; * \sa SDL_UnlockAudio * \sa SDL_UnlockAudioDevice *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_LockAudio_proc = procedure ; cdecl; +Var + SDL_LockAudio : TSDL_LockAudio_proc = Nil; +{$else} procedure SDL_LockAudio; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockAudio' {$ENDIF} {$ENDIF}; +{$endif} {** * Use this function to lock out the audio callback function for a specified @@ -1640,9 +1673,15 @@ procedure SDL_LockAudioDevice(dev: TSDL_AudioDeviceID); cdecl; * \sa SDL_LockAudio * \sa SDL_UnlockAudioDevice *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_UnlockAudio_proc = procedure ; cdecl; +Var + SDL_UnlockAudio : TSDL_UnlockAudio_proc = Nil; +{$else} procedure SDL_UnlockAudio; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Unlock' {$ENDIF} {$ENDIF}; - + {$endif} {** * Use this function to unlock the audio callback function for a specified * device. @@ -1683,9 +1722,15 @@ procedure SDL_UnlockAudioDevice(dev: TSDL_AudioDeviceID); cdecl; * * \sa SDL_OpenAudio *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_CloseAudio_proc = procedure ; cdecl; +Var + SDL_CloseAudio : TSDL_CloseAudio_proc = Nil; +{$else} procedure SDL_CloseAudio; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CloseAudio' {$ENDIF} {$ENDIF}; - +{$endif} {** * Use this function to shut down audio processing and close the audio device. * diff --git a/units/sdlcpuinfo.inc b/units/sdlcpuinfo.inc index 40e811cd..30062a96 100644 --- a/units/sdlcpuinfo.inc +++ b/units/sdlcpuinfo.inc @@ -28,6 +28,9 @@ function SDL_GetCPUCount(): cint; cdecl; * This is useful for determining multi-threaded structure padding * or SIMD prefetch sizes. *} + {$ifdef SDL_RUNTIME_LOADING} + // TODO: Portieren + {$else} function SDL_GetCPUCacheLineSize(): cint; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCPUCacheLineSize' {$ENDIF} {$ENDIF}; @@ -221,3 +224,4 @@ function SDL_SIMDRealloc(mem: Pointer; const len: csize_t): Pointer; cdecl; procedure SDL_SIMDFree(mem: Pointer); cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SIMDFree' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlerror.inc b/units/sdlerror.inc index 8ac52f2a..b06f393e 100644 --- a/units/sdlerror.inc +++ b/units/sdlerror.inc @@ -35,8 +35,15 @@ function SDL_SetError(const fmt: PAnsiChar; args: array of const): cint; cdecl; * * \return a pointer to the last error message that was set *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_GetError_func = function (): PAnsiChar; cdecl; +Var + SDL_GetError : TSDL_GetError_func = Nil; +{$else} function SDL_GetError: PAnsiChar; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetError' {$ENDIF} {$ENDIF}; +{$endif} {** * \brief Get the last error message that was set for the current thread @@ -64,7 +71,14 @@ function SDL_GetErrorMsg(const errstr: PAnsiChar; maxlen: cint): PAnsiChar; cdec {** * \brief Clear the error message for the current thread *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_ClearError_proc = procedure () cdecl; +Var + SDL_ClearError : TSDL_ClearError_proc = Nil; +{$else} procedure SDL_ClearError cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ClearError' {$ENDIF} {$ENDIF}; +{$endif} {*Internal error functions*} {** diff --git a/units/sdlevents.inc b/units/sdlevents.inc index 5f4fe6d1..c1521fa5 100644 --- a/units/sdlevents.inc +++ b/units/sdlevents.inc @@ -677,7 +677,12 @@ type * * This should only be run in the thread that sets the video mode. *} + {$ifdef SDL_RUNTIME_LOADING} + // TODO: Portieren + {$else} + procedure SDL_PumpEvents cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PumpEvents' {$ENDIF} {$ENDIF}; + {$endif} const SDL_ADDEVENT = 0; @@ -707,6 +712,9 @@ type * * This function is thread-safe. *} + {$ifdef SDL_RUNTIME_LOADING} + // TODO: Portieren + {$else} function SDL_PeepEvents(events: PSDL_Event; numevents: cint32; action: TSDL_EventAction; minType, maxType: TSDL_EventType): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PeepEvents' {$ENDIF} {$ENDIF}; @@ -732,9 +740,21 @@ type * event - If not nil, the next event is removed from the queue and * stored in that area. *} + {$endif} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_PollEvent_func = function (event: PSDL_Event): cint32 cdecl; +Var + SDL_PollEvent : TSDL_PollEvent_func = Nil; +{$else} function SDL_PollEvent(event: PSDL_Event): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PollEvent' {$ENDIF} {$ENDIF}; +{$endif} + + {$ifdef SDL_RUNTIME_LOADING} + // TODO: Portieren + {$else} {** * Waits indefinitely for the next available event. * @@ -766,6 +786,7 @@ type *} function SDL_PushEvent(event: PSDL_Event): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PumpEvents' {$ENDIF} {$ENDIF}; + {$endif} type PPSDL_EventFilter = ^PSDL_EventFilter; @@ -796,7 +817,11 @@ type * If the quit event is generated by an interrupt signal, it will bypass the * internal queue and be delivered to the application at the next event poll. *} - + {$ifdef SDL_RUNTIME_LOADING} + // TODO: Portieren + {$else} + + procedure SDL_SetEventFilter(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetEventFilter' {$ENDIF} {$ENDIF}; {** @@ -824,7 +849,7 @@ type *} procedure SDL_FilterEvents(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FilterEvents' {$ENDIF} {$ENDIF}; - + {$endif} const SDL_QUERY = -1; @@ -841,8 +866,17 @@ const * - If state is set to SDL_QUERY, SDL_EventState() will return the * current processing state of the specified event. *} + {$ifdef SDL_RUNTIME_LOADING} + Type + TSDL_EventState_func = function (type_: TSDL_EventType; state: cint32): cuint8 cdecl; + Var + SDL_EventState : TSDL_EventState_func = Nil; - function SDL_EventState(type_: TSDL_EventType; state: cint32): cuint8 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EventState' {$ENDIF} {$ENDIF}; + {$else} + + function SDL_EventState(type_: TSDL_EventType; state: cint32): cuint8 cdecl; +external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EventState' {$ENDIF} {$ENDIF}; + {$endif} function SDL_GetEventState(type_: TSDL_EventType): cuint8; @@ -853,5 +887,10 @@ const * If there aren't enough user-defined events left, this function * returns (Uint32)-1 *} + {$ifdef SDL_RUNTIME_LOADING} + // TODO: Portieren + {$else} + function SDL_RegisterEvents(numevents: cint32): cuint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RegisterEvents' {$ENDIF} {$ENDIF}; + {$endif} diff --git a/units/sdlgamecontroller.inc b/units/sdlgamecontroller.inc index da6ff91b..f7c330ad 100644 --- a/units/sdlgamecontroller.inc +++ b/units/sdlgamecontroller.inc @@ -96,9 +96,11 @@ type * Add or update an existing mapping configuration * * 1 if mapping is added, 0 if updated, -1 on error - *} + *} {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} function SDL_GameControllerAddMapping( mappingString: PAnsiChar ): cint cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerAddMapping' {$ENDIF} {$ENDIF}; - + {$endif} {** * Load a set of mappings from a seekable SDL data stream (memory or file), filtered by the current SDL_GetPlatform() * A community sourced database of controllers is available at https://raw.github.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt @@ -138,8 +140,12 @@ function SDL_GameControllerNumMappings():cint; cdecl; * * the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available *} +{$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} function SDL_GameControllerMappingForGUID( guid: TSDL_JoystickGUID ): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerMappingForGUID' {$ENDIF} {$ENDIF}; - + +{$endif} {** * Get the mapping at a particular index. * @@ -161,7 +167,9 @@ function SDL_GameControllerMappingForIndex(mapping_index: cint): PAnsiChar; cdec * Get a mapping string for an open GameController * * the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available - *} + *} {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} function SDL_GameControllerMapping( gamecontroller: PSDL_GameController ): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerMapping' {$ENDIF} {$ENDIF}; {** @@ -175,7 +183,7 @@ function SDL_IsGameController(joystick_index: cint): TSDL_Bool cdecl; external S * If no name can be found, this function returns NULL. *} function SDL_GameControllerNameForIndex(joystick_index: cint): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerNameForIndex' {$ENDIF} {$ENDIF}; - + {$endif} {** * Get the implementation dependent path for the game controller. * @@ -244,9 +252,11 @@ function SDL_GameControllerMappingForDeviceIndex(joystick_index: cint): PAnsiCha * events. * * A controller identifier, or NULL if an error occurred. - *} + *} {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} function SDL_GameControllerOpen(joystick_index: cint): PSDL_GameController cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerOpen' {$ENDIF} {$ENDIF}; - + {$endif} {** * Return the SDL_GameController associated with an instance id. *} @@ -281,9 +291,11 @@ function SDL_GameControllerFromPlayerIndex(player_index: cint): PSDL_GameControl {** * Return the name for this currently opened controller - *} + *} {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} function SDL_GameControllerName(gamecontroller: PSDL_GameController): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerName' {$ENDIF} {$ENDIF}; - + {$endif} {** * Get the implementation-dependent path for an opened game controller. * @@ -472,7 +484,9 @@ function SDL_GameControllerGetSteamHandle(gamecontroller: PSDL_GameController): {** * Returns SDL_TRUE if the controller has been opened and currently connected, * or SDL_FALSE if it has not. - *} + *} {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} function SDL_GameControllerGetAttached(gamecontroller: PSDL_GameController): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetAttached' {$ENDIF} {$ENDIF}; {** @@ -498,7 +512,7 @@ function SDL_GameControllerEventState(state: cint): cint cdecl; external SDL_Lib * events are enabled. *} procedure SDL_GameControllerUpdate() cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerUpdate' {$ENDIF} {$ENDIF}; - + {$endif} {** * The list of axes available from a controller *} @@ -516,7 +530,9 @@ const SDL_CONTROLLER_AXIS_TRIGGERLEFT = TSDL_GameControllerAxis(4); SDL_CONTROLLER_AXIS_TRIGGERRIGHT = TSDL_GameControllerAxis(5); SDL_CONTROLLER_AXIS_MAX = TSDL_GameControllerAxis(6); - + {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} {** * turn this string into a axis mapping *} @@ -531,7 +547,7 @@ function SDL_GameControllerGetStringForAxis(axis: TSDL_GameControllerAxis): PAns * Get the SDL joystick layer binding for this controller button mapping *} function SDL_GameControllerGetBindForAxis(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): TSDL_GameControllerButtonBind cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetBindForAxis' {$ENDIF} {$ENDIF}; - + {$endif} {** * Query whether a game controller has a given axis. * @@ -555,9 +571,11 @@ function SDL_GameControllerHasAxis(gamecontroller: PSDL_GameController; axis: TS * The state is a value ranging from -32768 to 32767. * * The axis indices start at index 0. - *} + *} {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} function SDL_GameControllerGetAxis(gamecontroller: PSDL_GameController; axis: TSDL_GameControllerAxis): cint16 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetAxis' {$ENDIF} {$ENDIF}; - + {$endif} {** * The list of buttons available from a controller *} @@ -589,7 +607,9 @@ const SDL_CONTROLLER_BUTTON_PADDLE4 = TSDL_GameControllerButton(19); {**< Xbox Elite paddle P4 *} SDL_CONTROLLER_BUTTON_TOUCHPAD = TSDL_GameControllerButton(20); {**< PS4/PS5 touchpad button *} SDL_CONTROLLER_BUTTON_MAX = TSDL_GameControllerButton(21); - + {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} {** * turn this string into a button mapping *} @@ -604,7 +624,7 @@ function SDL_GameControllerGetStringForButton(button: TSDL_GameControllerButton) * Get the SDL joystick layer binding for this controller button mapping *} function SDL_GameControllerGetBindForButton(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): TSDL_GameControllerButtonBind cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetBindForButton' {$ENDIF} {$ENDIF}; - + {$endif} {** * Query whether a game controller has a given button. * @@ -626,9 +646,11 @@ function SDL_GameControllerHasButton(gamecontroller: PSDL_GameController; button * Get the current state of a button on a game controller. * * The button indices start at index 0. - *} + *} {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} function SDL_GameControllerGetButton(gamecontroller: PSDL_GameController; button: TSDL_GameControllerButton): cuint8 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerGetButton' {$ENDIF} {$ENDIF}; - + {$endif} {** * Get the number of touchpads on a game controller. *} @@ -935,9 +957,11 @@ function SDL_GameControllerSendEffect(gamecontroller: PSDL_GameController; data: {** * Close a controller previously opened with SDL_GameControllerOpen(). - *} + *} {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} procedure SDL_GameControllerClose(gamecontroller: PSDL_GameController) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GameControllerClose' {$ENDIF} {$ENDIF}; - + {$endif} {** * Return the sfSymbolsName for a given axis on a game controller * on Apple platforms. diff --git a/units/sdlhaptic.inc b/units/sdlhaptic.inc index 5dafc467..edab4514 100644 --- a/units/sdlhaptic.inc +++ b/units/sdlhaptic.inc @@ -801,10 +801,12 @@ type * \since This function is available since SDL 2.0.0. * * \sa SDL_HapticName - *} + *} {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} function SDL_NumHaptics: cint; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_NumHaptics' {$ENDIF} {$ENDIF}; - + {$endif} {** * Get the implementation dependent name of a haptic device. * @@ -920,7 +922,9 @@ function SDL_HapticIndex(haptic: PSDL_Haptic): cint; cdecl; * \since This function is available since SDL 2.0.0. * * \sa SDL_HapticOpenFromMouse - *} + *} {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} function SDL_MouseIsHaptic: cint; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_MouseInHaptic' {$ENDIF} {$ENDIF}; @@ -937,7 +941,7 @@ function SDL_MouseIsHaptic: cint; cdecl; *} function SDL_HapticOpenFromMouse: PSDL_Haptic; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HapticOpenFromMouse' {$ENDIF} {$ENDIF}; - + {$endif} {** * Query if a joystick has haptic features. * diff --git a/units/sdlhidapi.inc b/units/sdlhidapi.inc index 570d2c70..79d91073 100644 --- a/units/sdlhidapi.inc +++ b/units/sdlhidapi.inc @@ -104,7 +104,9 @@ type * \since This function is available since SDL 2.0.18. * * \sa SDL_hid_exit - *) + *) {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} function SDL_hid_init(): cint; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_init' {$ENDIF} {$ENDIF}; @@ -424,3 +426,4 @@ function SDL_hid_get_indexed_string(dev: PSDL_hid_device; string_index: cint; st *) procedure SDL_hid_ble_scan(active: TSDL_bool); cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_hid_ble_scan' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlkeyboard.inc b/units/sdlkeyboard.inc index 7750487f..4ca62e57 100644 --- a/units/sdlkeyboard.inc +++ b/units/sdlkeyboard.inc @@ -38,9 +38,15 @@ type * * \since This function is available since SDL 2.0.0. } -function SDL_GetKeyboardFocus: PSDL_Window; cdecl; + {$ifdef SDL_RUNTIME_LOADING} + Type + TSDL_GetKeyboardFocus_func = function : PSDL_Window; cdecl; + Var + SDL_GetKeyboardFocus : TSDL_GetKeyboardFocus_func = Nil; + {$else} + function SDL_GetKeyboardFocus: PSDL_Window; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyboardFocus' {$ENDIF} {$ENDIF}; - + {$endif} {* * Get a snapshot of the current state of the keyboard. * @@ -90,9 +96,15 @@ function SDL_GetKeyboardState(numkeys: pcint): pcuint8; cdecl; * * \sa SDL_GetKeyboardState } +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_ResetKeyboard_proc =procedure ; cdecl; +Var + SDL_ResetKeyboard : TSDL_ResetKeyboard_proc = Nil; +{$else} procedure SDL_ResetKeyboard; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ResetKeyboard' {$ENDIF} {$ENDIF}; - +{$endif} {* * Get the current key modifier state for the keyboard. * @@ -104,9 +116,15 @@ procedure SDL_ResetKeyboard; cdecl; * \sa SDL_GetKeyboardState * \sa SDL_SetModState } +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_GetModState_func = function : TSDL_Keymod; cdecl; +Var + SDL_GetModState : TSDL_GetModState_func = Nil; +{$else} function SDL_GetModState: TSDL_Keymod; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetModState' {$ENDIF} {$ENDIF}; - + {$endif} {* * Set the current key modifier state for the keyboard. * @@ -310,9 +328,15 @@ function SDL_GetKeyFromName(name: PAnsiChar): TSDL_Keycode; cdecl; * \sa SDL_SetTextInputRect * \sa SDL_StopTextInput } +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_StartTextInput_proc =procedure ; cdecl; +Var + SDL_StartTextInput : TSDL_StartTextInput_proc = Nil; +{$else} procedure SDL_StartTextInput; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_StartTextInput' {$ENDIF} {$ENDIF}; - +{$endif} {* * Check whether or not Unicode text input events are enabled. * @@ -322,9 +346,15 @@ procedure SDL_StartTextInput; cdecl; * * \sa SDL_StartTextInput } +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_IsTextInputActive_func = function : TSDL_bool; cdecl; +Var + SDL_IsTextInputActive : TSDL_IsTextInputActive_func = Nil; +{$else} function SDL_IsTextInputActive: TSDL_bool; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsTextInputActive' {$ENDIF} {$ENDIF}; - +{$endif} {* * Stop receiving any text input events. * @@ -332,9 +362,15 @@ function SDL_IsTextInputActive: TSDL_bool; cdecl; * * \sa SDL_StartTextInput } +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_StopTextInput_proc =procedure ; cdecl; +Var + SDL_StopTextInput : TSDL_StopTextInput_proc = Nil; +{$else} procedure SDL_StopTextInput; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_StopTextInput' {$ENDIF} {$ENDIF}; - +{$endif} {* * Dismiss the composition window/IME without disabling the subsystem. * @@ -343,17 +379,29 @@ procedure SDL_StopTextInput; cdecl; * \sa SDL_StartTextInput * \sa SDL_StopTextInput } +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_ClearComposition_proc = procedure ; cdecl; +Var + SDL_ClearComposition : TSDL_ClearComposition_proc = Nil; +{$else} procedure SDL_ClearComposition; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ClearComposition' {$ENDIF} {$ENDIF}; - +{$endif} {* * Returns if an IME Composite or Candidate window is currently shown. * * \since This function is available since SDL 2.0.22. } +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_IsTextInputShown_func = function : TSDL_bool; cdecl; +Var + SDL_IsTextInputShown : TSDL_IsTextInputShown_func = Nil; +{$else} function SDL_IsTextInputShown: TSDL_bool; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsTextInputShown' {$ENDIF} {$ENDIF}; - +{$endif} {* * Set the rectangle used to type Unicode text inputs. * @@ -394,9 +442,15 @@ procedure SDL_SetTextInputRect(rect: PSDL_Rect); cdecl; * \sa SDL_StartTextInput * \sa SDL_IsScreenKeyboardShown } +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_HasScreenKeyboardSupport_func = function : TSDL_bool; cdecl; +Var + SDL_HasScreenKeyboardSupport : TSDL_HasScreenKeyboardSupport_func = Nil; +{$else} function SDL_HasScreenKeyboardSupport: TSDL_bool; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasScreenKeyboardSupport' {$ENDIF} {$ENDIF}; - +{$endif} {* * Check whether the screen keyboard is shown for given window. * diff --git a/units/sdlloadso.inc b/units/sdlloadso.inc index 8d8a3eca..c80fe465 100644 --- a/units/sdlloadso.inc +++ b/units/sdlloadso.inc @@ -67,9 +67,15 @@ function SDL_LoadObject(sofile: PAnsiChar): Pointer; cdecl; * \sa SDL_LoadObject * \sa SDL_UnloadObject } + {$ifdef SDL_RUNTIME_LOADING} + Type + TSDL_LoadFunctions_func = function (handle: Pointer; name: PAnsiChar): Pointer; cdecl; + Var + SDL_LoadFunction : TSDL_LoadFunctions_func = Nil; + {$else} function SDL_LoadFunction(handle: Pointer; name: PAnsiChar): Pointer; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadFunction' {$ENDIF} {$ENDIF}; - + {$endif} {* * Unload a shared object from memory. * diff --git a/units/sdllocale.inc b/units/sdllocale.inc index 9230152b..68007c99 100644 --- a/units/sdllocale.inc +++ b/units/sdllocale.inc @@ -50,5 +50,9 @@ type * \return array of locales, terminated with a locale with a NIL language * field. Will return NIL on error. *} + {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} function SDL_GetPreferredLocales(): PSDL_Locale; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPreferredLocales' {$ENDIF} {$ENDIF}; + {$endif} diff --git a/units/sdllog.inc b/units/sdllog.inc index 006e1f6c..aa60ccab 100644 --- a/units/sdllog.inc +++ b/units/sdllog.inc @@ -264,6 +264,9 @@ type {** * \brief Get the current log output function. *} + {$ifdef SDL_RUNTIME_LOADING} + // TODO: Portieren + {$else} procedure SDL_LogGetOutputFunction(callback: PSDL_LogOutputFunction; userdata: PPointer); cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogGetOutputFunction' {$ENDIF} {$ENDIF}; @@ -273,5 +276,5 @@ procedure SDL_LogGetOutputFunction(callback: PSDL_LogOutputFunction; userdata: P *} procedure SDL_LogSetOutputFunction(callback: TSDL_LogOutputFunction; userdata: Pointer); cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LogSetOutputFunction' {$ENDIF} {$ENDIF}; - + {$ENDIF} {$ENDIF} diff --git a/units/sdlmisc.inc b/units/sdlmisc.inc index a975c072..17260271 100644 --- a/units/sdlmisc.inc +++ b/units/sdlmisc.inc @@ -25,5 +25,9 @@ * \param url A valid URL to open. * \return 0 on success, or -1 on error. *} +{$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} function SDL_OpenURL(const url: PAnsiChar): cint; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_OpenURL' {$ENDIF} {$ENDIF}; + {$endif} diff --git a/units/sdlmouse.inc b/units/sdlmouse.inc index 54760dc6..e646ccab 100644 --- a/units/sdlmouse.inc +++ b/units/sdlmouse.inc @@ -44,10 +44,12 @@ const * \returns the window with mouse focus. * * \since This function is available since SDL 2.0.0. - *} + *} {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} function SDL_GetMouseFocus: PSDL_Window; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetMouseFocus' {$ENDIF}{$ENDIF}; - + {$endif} {** * Retrieve the current state of the mouse. * @@ -305,10 +307,12 @@ Var * \since This function is available since SDL 2.0.0. * * \sa SDL_SetRelativeMouseMode - *} + *} {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} function SDL_GetRelativeMouseMode: TSDL_Bool; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRelativeMouseMode' {$ENDIF}{$ENDIF}; - + {$endif} {** * Create a cursor using the specified bitmap data and mask (in MSB format). * @@ -460,7 +464,9 @@ procedure SDL_SetCursor(cursor: PSDL_Cursor); cdecl; * \since This function is available since SDL 2.0.0. * * \sa SDL_SetCursor - *} + *} {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} function SDL_GetCursor: PSDL_Cursor; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCursor' {$ENDIF}{$ENDIF}; @@ -475,7 +481,7 @@ function SDL_GetCursor: PSDL_Cursor; cdecl; *} function SDL_GetDefaultCursor: PSDL_Cursor; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetDefaultCursor' {$ENDIF}{$ENDIF}; - + {$endif} {** * Free a previously-created cursor. * diff --git a/units/sdlmutex.inc b/units/sdlmutex.inc index 410ae7fe..a6894188 100644 --- a/units/sdlmutex.inc +++ b/units/sdlmutex.inc @@ -33,9 +33,15 @@ type * * \since This function is available since SDL 2.0.0. *} -function SDL_CreateMutex: PSDL_Mutex; cdecl; + {$ifdef SDL_RUNTIME_LOADING} + Type + TSDL_CreateMutex_func = function (): PSDL_Mutex; cdecl; + Var + SDL_CreateMutex : TSDL_CreateMutex_func = Nil; + {$else} + function SDL_CreateMutex: PSDL_Mutex; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateMutex' {$ENDIF} {$ENDIF}; - + {$endif} {** * Lock the mutex. * @@ -364,9 +370,15 @@ type * * \since This function is available since SDL 2.0.0. *} -function SDL_CreateCond: PSDL_Cond; cdecl; + {$ifdef SDL_RUNTIME_LOADING} + Type + TSDL_CreateCond_func = function (): PSDL_Cond; cdecl; + Var + SDL_CreateCond : TSDL_CreateCond_func = Nil; + {$else} + function SDL_CreateCond: PSDL_Cond; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateCond' {$ENDIF} {$ENDIF}; - + {$endif} {** * Destroy a condition variable. * diff --git a/units/sdlplatform.inc b/units/sdlplatform.inc index 0b5eb625..d3554d22 100644 --- a/units/sdlplatform.inc +++ b/units/sdlplatform.inc @@ -9,5 +9,13 @@ {** * Gets the name of the platform. *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_GetPlatform_func = function (): PAnsiChar; cdecl; +Var + SDL_GetPlatform : TSDL_GetPlatform_func = Nil; +{$else} function SDL_GetPlatform: PAnsiChar; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPlatform' {$ENDIF} {$ENDIF}; +{$endif} + diff --git a/units/sdlrenderer.inc b/units/sdlrenderer.inc index 973da577..fdd06909 100644 --- a/units/sdlrenderer.inc +++ b/units/sdlrenderer.inc @@ -117,7 +117,11 @@ type * SDL_GetRenderDriverInfo() * SDL_CreateRenderer() *} -function SDL_GetNumRenderDrivers: cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumRenderDrivers' {$ENDIF} {$ENDIF}; + {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} +function SDL_GetNumRenderDrivers: cint32 cdecl; +external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumRenderDrivers' {$ENDIF} {$ENDIF}; {** * Get information about a specific 2D rendering driver for the current @@ -131,7 +135,8 @@ function SDL_GetNumRenderDrivers: cint32 cdecl; external SDL_LibName {$IFDEF DEL * * SDL_CreateRenderer() *} -function SDL_GetRenderDriverInfo(index: cint32; info: PSDL_RendererInfo): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderDriverInfo' {$ENDIF} {$ENDIF}; +function SDL_GetRenderDriverInfo(index: cint32; info: PSDL_RendererInfo): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderDriverInfo' {$ENDIF} {$ENDIF}; {** * Create a window and default renderer @@ -144,7 +149,8 @@ function SDL_GetRenderDriverInfo(index: cint32; info: PSDL_RendererInfo): cint32 * * 0 on success, or -1 on error *} -function SDL_CreateWindowAndRenderer(width: cint32; height: cint32; window_flags: cuint32; window: PPSDL_Window; renderer: PPSDL_Renderer): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateWindowAndRenderer' {$ENDIF} {$ENDIF}; +function SDL_CreateWindowAndRenderer(width: cint32; height: cint32; window_flags: cuint32; window: PPSDL_Window; renderer: PPSDL_Renderer): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateWindowAndRenderer' {$ENDIF} {$ENDIF}; {** * Create a 2D rendering context for a window. @@ -160,7 +166,8 @@ function SDL_CreateWindowAndRenderer(width: cint32; height: cint32; window_flags * SDL_GetRendererInfo() * SDL_DestroyRenderer() *} -function SDL_CreateRenderer(window: PSDL_Window; index: cint32; flags: cuint32): PSDL_Renderer cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRenderer' {$ENDIF} {$ENDIF}; +function SDL_CreateRenderer(window: PSDL_Window; index: cint32; flags: cuint32): PSDL_Renderer cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateRenderer' {$ENDIF} {$ENDIF}; {** * Create a 2D software rendering context for a surface. @@ -172,12 +179,14 @@ function SDL_CreateRenderer(window: PSDL_Window; index: cint32; flags: cuint32): * SDL_CreateRenderer() * SDL_DestroyRenderer() *} -function SDL_CreateSoftwareRenderer(surface: PSDL_Surface): PSDL_Renderer cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateSoftwareRenderer' {$ENDIF} {$ENDIF}; +function SDL_CreateSoftwareRenderer(surface: PSDL_Surface): PSDL_Renderer cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateSoftwareRenderer' {$ENDIF} {$ENDIF}; {** * Get the renderer associated with a window. *} -function SDL_GetRenderer(window: PSDL_Window): PSDL_Renderer cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderer' {$ENDIF} {$ENDIF}; +function SDL_GetRenderer(window: PSDL_Window): PSDL_Renderer cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderer' {$ENDIF} {$ENDIF}; {** * Get the window associated with a renderer. @@ -188,12 +197,14 @@ function SDL_RenderGetWindow(renderer: PSDL_Renderer): PSDL_Window; cdecl; {** * Get information about a rendering context. *} -function SDL_GetRendererInfo(renderer: PSDL_Renderer; info: PSDL_RendererInfo): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRendererInfo' {$ENDIF} {$ENDIF}; +function SDL_GetRendererInfo(renderer: PSDL_Renderer; info: PSDL_RendererInfo): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRendererInfo' {$ENDIF} {$ENDIF}; {** * Get the output size of a rendering context. *} -function SDL_GetRendererOutputSize(renderer: PSDL_Renderer; w: pcint; h: pcint): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRendererOutputSize' {$ENDIF} {$ENDIF}; +function SDL_GetRendererOutputSize(renderer: PSDL_Renderer; w: pcint; h: pcint): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRendererOutputSize' {$ENDIF} {$ENDIF}; {** * Create a texture for a rendering context. @@ -212,7 +223,8 @@ function SDL_GetRendererOutputSize(renderer: PSDL_Renderer; w: pcint; h: pcint): * SDL_UpdateTexture() * SDL_DestroyTexture() *} -function SDL_CreateTexture(renderer: PSDL_Renderer; format: cuint32; access: cint32; w: cint32; h: cint32): PSDL_Texture cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateTexture' {$ENDIF} {$ENDIF}; +function SDL_CreateTexture(renderer: PSDL_Renderer; format: cuint32; access: cint32; w: cint32; h: cint32): PSDL_Texture cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateTexture' {$ENDIF} {$ENDIF}; {** * Create a texture from an existing surface. @@ -227,7 +239,8 @@ function SDL_CreateTexture(renderer: PSDL_Renderer; format: cuint32; access: cin * SDL_QueryTexture() * SDL_DestroyTexture() *} -function SDL_CreateTextureFromSurface(renderer: PSDL_Renderer; surface: PSDL_Surface): PSDL_Texture cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateTextureFromSurface' {$ENDIF} {$ENDIF}; +function SDL_CreateTextureFromSurface(renderer: PSDL_Renderer; surface: PSDL_Surface): PSDL_Texture cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateTextureFromSurface' {$ENDIF} {$ENDIF}; {** * Query the attributes of a texture @@ -242,7 +255,8 @@ function SDL_CreateTextureFromSurface(renderer: PSDL_Renderer; surface: PSDL_Sur * * 0 on success, or -1 if the texture is not valid. *} -function SDL_QueryTexture(texture: PSDL_Texture; format: pcuint32; access: pcint; w: pcint; h: pcint): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_QueryTexture' {$ENDIF} {$ENDIF}; +function SDL_QueryTexture(texture: PSDL_Texture; format: pcuint32; access: pcint; w: pcint; h: pcint): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_QueryTexture' {$ENDIF} {$ENDIF}; {** * Set an additional color value used in render copy operations. @@ -257,7 +271,8 @@ function SDL_QueryTexture(texture: PSDL_Texture; format: pcuint32; access: pcint * * SDL_GetTextureColorMod() *} -function SDL_SetTextureColorMod(texture: PSDL_Texture; r: cuint8; g: cuint8; b: cuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureColorMod' {$ENDIF} {$ENDIF}; +function SDL_SetTextureColorMod(texture: PSDL_Texture; r: cuint8; g: cuint8; b: cuint8): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureColorMod' {$ENDIF} {$ENDIF}; {** * Get the additional color value used in render copy operations. @@ -271,7 +286,8 @@ function SDL_SetTextureColorMod(texture: PSDL_Texture; r: cuint8; g: cuint8; b: * * SDL_SetTextureColorMod() *} -function SDL_GetTextureColorMod(texture: PSDL_Texture; r: pcuint8; g: pcuint8; b: pcuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureColorMod' {$ENDIF} {$ENDIF}; +function SDL_GetTextureColorMod(texture: PSDL_Texture; r: pcuint8; g: pcuint8; b: pcuint8): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureColorMod' {$ENDIF} {$ENDIF}; {** * Set an additional alpha value used in render copy operations. @@ -284,7 +300,8 @@ function SDL_GetTextureColorMod(texture: PSDL_Texture; r: pcuint8; g: pcuint8; b * * SDL_GetTextureAlphaMod() *} -function SDL_SetTextureAlphaMod(texture: PSDL_Texture; alpha: cuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureAlphaMod' {$ENDIF} {$ENDIF}; +function SDL_SetTextureAlphaMod(texture: PSDL_Texture; alpha: cuint8): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureAlphaMod' {$ENDIF} {$ENDIF}; {** * Get the additional alpha value used in render copy operations. @@ -296,7 +313,8 @@ function SDL_SetTextureAlphaMod(texture: PSDL_Texture; alpha: cuint8): cint32 cd * * SDL_SetTextureAlphaMod() *} -function SDL_GetTextureAlphaMod(texture: PSDL_Texture; alpha: pcuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureAlphaMod' {$ENDIF} {$ENDIF}; +function SDL_GetTextureAlphaMod(texture: PSDL_Texture; alpha: pcuint8): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureAlphaMod' {$ENDIF} {$ENDIF}; {** * Set the blend mode used for texture copy operations. @@ -312,7 +330,8 @@ function SDL_GetTextureAlphaMod(texture: PSDL_Texture; alpha: pcuint8): cint32 c * * SDL_GetTextureBlendMode() *} -function SDL_SetTextureBlendMode(texture: PSDL_Texture; blendMode: TSDL_BlendMode): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureBlendMode' {$ENDIF} {$ENDIF}; +function SDL_SetTextureBlendMode(texture: PSDL_Texture; blendMode: TSDL_BlendMode): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextureBlendMode' {$ENDIF} {$ENDIF}; {** * Get the blend mode used for texture copy operations. @@ -324,7 +343,8 @@ function SDL_SetTextureBlendMode(texture: PSDL_Texture; blendMode: TSDL_BlendMod * * SDL_SetTextureBlendMode() *} -function SDL_GetTextureBlendMode(texture: PSDL_Texture; blendMode: PSDL_BlendMode): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureBlendMode' {$ENDIF} {$ENDIF}; +function SDL_GetTextureBlendMode(texture: PSDL_Texture; blendMode: PSDL_BlendMode): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTextureBlendMode' {$ENDIF} {$ENDIF}; {** * Set the scale mode used for texture scale operations. @@ -364,8 +384,9 @@ function SDL_GetTextureUserData(texture: PSDL_Texture): Pointer; cdecl; * * This is a fairly slow function. *} -function SDL_UpdateTexture(texture: PSDL_Texture; rect: PSDL_Rect; pixels: Pointer; pitch: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateTexture' {$ENDIF} {$ENDIF}; - +function SDL_UpdateTexture(texture: PSDL_Texture; rect: PSDL_Rect; pixels: Pointer; pitch: cint32): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateTexture' {$ENDIF} {$ENDIF}; + {$endif} {** * Lock a portion of the texture for write-only pixel access. * @@ -423,7 +444,11 @@ function SDL_LockTextureToSurface(texture: PSDL_Texture; const rect: PSDL_Rect; * * SDL_LockTexture() *} -procedure SDL_UnlockTexture(texture: PSDL_Texture) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockTexture' {$ENDIF} {$ENDIF}; +{$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} +procedure SDL_UnlockTexture(texture: PSDL_Texture) cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockTexture' {$ENDIF} {$ENDIF}; {** * Determines whether a window supports the use of render targets @@ -432,7 +457,8 @@ procedure SDL_UnlockTexture(texture: PSDL_Texture) cdecl; external SDL_LibName { * * SDL_TRUE if supported, SDL_FALSE if not. *} -function SDL_RenderTargetSupported(renderer: PSDL_Renderer): Boolean cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderTargetSupported' {$ENDIF} {$ENDIF}; +function SDL_RenderTargetSupported(renderer: PSDL_Renderer): Boolean cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderTargetSupported' {$ENDIF} {$ENDIF}; {** * Set a texture as the current rendering target. @@ -444,7 +470,8 @@ function SDL_RenderTargetSupported(renderer: PSDL_Renderer): Boolean cdecl; exte * * SDL_GetRenderTarget() *} -function SDL_SetRenderTarget(renderer: PSDL_Renderer; texture: PSDL_Texture): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRenderTarget' {$ENDIF} {$ENDIF}; +function SDL_SetRenderTarget(renderer: PSDL_Renderer; texture: PSDL_Texture): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRenderTarget' {$ENDIF} {$ENDIF}; {** * Get the current render target or NULL for the default render target. @@ -453,7 +480,8 @@ function SDL_SetRenderTarget(renderer: PSDL_Renderer; texture: PSDL_Texture): ci * * SDL_SetRenderTarget() *} -function SDL_GetRenderTarget(renderer: PSDL_Renderer): PSDL_Texture cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderTarget' {$ENDIF} {$ENDIF}; +function SDL_GetRenderTarget(renderer: PSDL_Renderer): PSDL_Texture cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderTarget' {$ENDIF} {$ENDIF}; {** * Set device independent resolution for rendering @@ -478,7 +506,8 @@ function SDL_GetRenderTarget(renderer: PSDL_Renderer): PSDL_Texture cdecl; exter * SDL_RenderSetScale() * SDL_RenderSetViewport() *} -function SDL_RenderSetLogicalSize(renderer: PSDL_Renderer; w: cint32; h: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetLogicalSize' {$ENDIF} {$ENDIF}; +function SDL_RenderSetLogicalSize(renderer: PSDL_Renderer; w: cint32; h: cint32): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetLogicalSize' {$ENDIF} {$ENDIF}; {** * Get device independent resolution for rendering @@ -489,7 +518,8 @@ function SDL_RenderSetLogicalSize(renderer: PSDL_Renderer; w: cint32; h: cint32) * * SDL_RenderSetLogicalSize() *} -procedure SDL_RenderGetLogicalSize(renderer: PSDL_Renderer; w: pcint; h: pcint) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetLogicalSize' {$ENDIF} {$ENDIF}; +procedure SDL_RenderGetLogicalSize(renderer: PSDL_Renderer; w: pcint; h: pcint) cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetLogicalSize' {$ENDIF} {$ENDIF}; {** * \brief Set whether to force integer scales for resolution-independent rendering @@ -503,7 +533,8 @@ procedure SDL_RenderGetLogicalSize(renderer: PSDL_Renderer; w: pcint; h: pcint) * * \sa SDL_RenderSetLogicalSize() *} -function SDL_RenderSetIntegerScale(renderer: PSDL_Renderer; enable : TSDL_bool): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetIntegerScale' {$ENDIF} {$ENDIF}; +function SDL_RenderSetIntegerScale(renderer: PSDL_Renderer; enable : TSDL_bool): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetIntegerScale' {$ENDIF} {$ENDIF}; {** * \brief Get whether integer scales are forced for resolution-independent rendering @@ -512,7 +543,8 @@ function SDL_RenderSetIntegerScale(renderer: PSDL_Renderer; enable : TSDL_bool): * * \sa SDL_RenderSetIntegerScale() *} -function SDL_RenderGetIntegerScale(renderer: PSDL_Renderer): TSDL_bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetIntegerScale' {$ENDIF} {$ENDIF}; +function SDL_RenderGetIntegerScale(renderer: PSDL_Renderer): TSDL_bool cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetIntegerScale' {$ENDIF} {$ENDIF}; {** * Set the drawing area for rendering on the current target. @@ -529,14 +561,16 @@ function SDL_RenderGetIntegerScale(renderer: PSDL_Renderer): TSDL_bool cdecl; ex * SDL_RenderGetViewport() * SDL_RenderSetLogicalSize() *} -function SDL_RenderSetViewport(renderer: PSDL_Renderer; const rect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetViewport' {$ENDIF} {$ENDIF}; +function SDL_RenderSetViewport(renderer: PSDL_Renderer; const rect: PSDL_Rect): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetViewport' {$ENDIF} {$ENDIF}; {** * Get the drawing area for the current target. * * SDL_RenderSetViewport() *} -procedure SDL_RenderGetViewport(renderer: PSDL_Renderer; rect: PSDL_Rect) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetViewport' {$ENDIF} {$ENDIF}; +procedure SDL_RenderGetViewport(renderer: PSDL_Renderer; rect: PSDL_Rect) cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetViewport' {$ENDIF} {$ENDIF}; {** * Set the clip rectangle for the current target. @@ -549,7 +583,8 @@ procedure SDL_RenderGetViewport(renderer: PSDL_Renderer; rect: PSDL_Rect) cdecl; * * SDL_RenderGetClipRect() *} -function SDL_RenderSetClipRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetClipRect' {$ENDIF} {$ENDIF}; +function SDL_RenderSetClipRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetClipRect' {$ENDIF} {$ENDIF}; {** * Get the clip rectangle for the current target. @@ -560,8 +595,9 @@ function SDL_RenderSetClipRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 * * SDL_RenderSetClipRect() *} -procedure SDL_RenderGetClipRect(renderer: PSDL_Renderer; rect: PSDL_Rect) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetClipRect' {$ENDIF} {$ENDIF}; - +procedure SDL_RenderGetClipRect(renderer: PSDL_Renderer; rect: PSDL_Rect) cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetClipRect' {$ENDIF} {$ENDIF}; + {$endif} {** * \brief Get whether clipping is enabled on the given renderer. * @@ -598,7 +634,11 @@ function SDL_RenderIsClipEnabled(renderer: PSDL_Renderer): TSDL_Bool; cdecl; * SDL_RenderGetScale() * SDL_RenderSetLogicalSize() *} -function SDL_RenderSetScale(renderer: PSDL_Renderer; scaleX: cfloat; scaleY: cfloat): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetScale' {$ENDIF} {$ENDIF}; +{$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} +function SDL_RenderSetScale(renderer: PSDL_Renderer; scaleX: cfloat; scaleY: cfloat): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetScale' {$ENDIF} {$ENDIF}; {** * Get the drawing scale for the current target. @@ -609,7 +649,8 @@ function SDL_RenderSetScale(renderer: PSDL_Renderer; scaleX: cfloat; scaleY: cfl * * SDL_RenderSetScale() *} -procedure SDL_RenderGetScale(renderer: PSDL_Renderer; scaleX: pcfloat; scaleY: pcfloat) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetScale' {$ENDIF} {$ENDIF}; +procedure SDL_RenderGetScale(renderer: PSDL_Renderer; scaleX: pcfloat; scaleY: pcfloat) cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderGetScale' {$ENDIF} {$ENDIF}; {** * Get logical coordinates of point in renderer when given real coordinates of @@ -639,7 +680,8 @@ procedure SDL_RenderLogicalToWindow(renderer: PSDL_Renderer; logicalX, logicalY: * * 0 on success, or -1 on error *} -function SDL_SetRenderDrawColor(renderer: PSDL_Renderer; r: cuint8; g: cuint8; b: cuint8; a: cuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRenderDrawColor' {$ENDIF} {$ENDIF}; +function SDL_SetRenderDrawColor(renderer: PSDL_Renderer; r: cuint8; g: cuint8; b: cuint8; a: cuint8): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRenderDrawColor' {$ENDIF} {$ENDIF}; {** * Get the color used for drawing operations (Rect, Line and Clear). @@ -653,7 +695,8 @@ function SDL_SetRenderDrawColor(renderer: PSDL_Renderer; r: cuint8; g: cuint8; b * * 0 on success, or -1 on error *} -function SDL_GetRenderDrawColor(renderer: PSDL_Renderer; r: pcuint8; g: pcuint8; b: pcuint8; a: pcuint8): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderDrawColor' {$ENDIF} {$ENDIF}; +function SDL_GetRenderDrawColor(renderer: PSDL_Renderer; r: pcuint8; g: pcuint8; b: pcuint8; a: pcuint8): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderDrawColor' {$ENDIF} {$ENDIF}; {** * Set the blend mode used for drawing operations (Fill and Line). @@ -668,7 +711,8 @@ function SDL_GetRenderDrawColor(renderer: PSDL_Renderer; r: pcuint8; g: pcuint8; * * SDL_GetRenderDrawBlendMode() *} -function SDL_SetRenderDrawBlendMode(renderer: PSDL_Renderer; blendMode: TSDL_BlendMode): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRenderDrawBlendMode' {$ENDIF} {$ENDIF}; +function SDL_SetRenderDrawBlendMode(renderer: PSDL_Renderer; blendMode: TSDL_BlendMode): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRenderDrawBlendMode' {$ENDIF} {$ENDIF}; {** * Get the blend mode used for drawing operations. @@ -680,7 +724,8 @@ function SDL_SetRenderDrawBlendMode(renderer: PSDL_Renderer; blendMode: TSDL_Ble * * SDL_SetRenderDrawBlendMode() *} -function SDL_GetRenderDrawBlendMode(renderer: PSDL_Renderer; blendMode: PSDL_BlendMode): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderDrawBlendMode' {$ENDIF} {$ENDIF}; +function SDL_GetRenderDrawBlendMode(renderer: PSDL_Renderer; blendMode: PSDL_BlendMode): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRenderDrawBlendMode' {$ENDIF} {$ENDIF}; {** * Clear the current rendering target with the drawing color @@ -689,7 +734,8 @@ function SDL_GetRenderDrawBlendMode(renderer: PSDL_Renderer; blendMode: PSDL_Ble * * 0 on success, or -1 on error *} -function SDL_RenderClear(renderer: PSDL_Renderer): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderClear' {$ENDIF} {$ENDIF}; +function SDL_RenderClear(renderer: PSDL_Renderer): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderClear' {$ENDIF} {$ENDIF}; {** * Draw a point on the current rendering target. @@ -700,8 +746,9 @@ function SDL_RenderClear(renderer: PSDL_Renderer): cint32 cdecl; external SDL_Li * * 0 on success, or -1 on error *} -function SDL_RenderDrawPoint(renderer: PSDL_Renderer; x: cint32; y: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPoint' {$ENDIF} {$ENDIF}; - +function SDL_RenderDrawPoint(renderer: PSDL_Renderer; x: cint32; y: cint32): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPoint' {$ENDIF} {$ENDIF}; + {$endif} {** * Draw a point on the current rendering target. * @@ -731,8 +778,12 @@ function SDL_RenderDrawPointF(renderer: PSDL_Renderer; x, y: single): cint32 cde * * 0 on success, or -1 on error *} -function SDL_RenderDrawPoints(renderer: PSDL_Renderer; points: PSDL_Point; count: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPoints' {$ENDIF} {$ENDIF}; - +{$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} +function SDL_RenderDrawPoints(renderer: PSDL_Renderer; points: PSDL_Point; count: cint32): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPoints' {$ENDIF} {$ENDIF}; + {$endif} {** * Draw multiple points on the current rendering target. * @@ -764,8 +815,12 @@ function SDL_RenderDrawPointsF(renderer: PSDL_Renderer; points: PSDL_FPoint; cou * * 0 on success, or -1 on error *} -function SDL_RenderDrawLine(renderer: PSDL_Renderer; x1: cint32; y1: cint32; x2: cint32; y2: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLine' {$ENDIF} {$ENDIF}; - +{$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} +function SDL_RenderDrawLine(renderer: PSDL_Renderer; x1: cint32; y1: cint32; x2: cint32; y2: cint32): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLine' {$ENDIF} {$ENDIF}; + {$endif} {** * Draw a line on the current rendering target. * @@ -797,8 +852,12 @@ function SDL_RenderDrawLineF(renderer: PSDL_Renderer; x1, y1, x2, y2: single): c * * \return 0 on success, or -1 on error *} -function SDL_RenderDrawLines(renderer: PSDL_Renderer; points: PSDL_Point; count: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLines' {$ENDIF} {$ENDIF}; - +{$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} +function SDL_RenderDrawLines(renderer: PSDL_Renderer; points: PSDL_Point; count: cint32): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLines' {$ENDIF} {$ENDIF}; + {$endif} {** * Draw a series of connected lines on the current rendering target. * @@ -827,8 +886,12 @@ function SDL_RenderDrawLinesF(renderer: PSDL_Renderer; points: PSDL_FPoint; coun * * 0 on success, or -1 on error *} -function SDL_RenderDrawRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRect' {$ENDIF} {$ENDIF}; - +{$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} +function SDL_RenderDrawRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRect' {$ENDIF} {$ENDIF}; + {$endif} {** * Draw a rectangle on the current rendering target. * @@ -857,8 +920,12 @@ function SDL_RenderDrawRectF(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 * * 0 on success, or -1 on error *} -function SDL_RenderDrawRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRects' {$ENDIF} {$ENDIF}; - +{$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} +function SDL_RenderDrawRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: cint32): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRects' {$ENDIF} {$ENDIF}; + {$endif} {** * Draw some number of rectangles on the current rendering target. * @@ -888,8 +955,12 @@ function SDL_RenderDrawRectsF(renderer: PSDL_Renderer; rects: PSDL_FRect; count: * * 0 on success, or -1 on error *} -function SDL_RenderFillRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRect' {$ENDIF} {$ENDIF}; - +{$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} +function SDL_RenderFillRect(renderer: PSDL_Renderer; rect: PSDL_Rect): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRect' {$ENDIF} {$ENDIF}; + {$endif} {** * Fill a rectangle on the current rendering target with the drawing color. * @@ -918,8 +989,12 @@ function SDL_RenderFillRectF(renderer: PSDL_Renderer; rect: PSDL_FRect): cint32 * * 0 on success, or -1 on error *} -function SDL_RenderFillRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRects' {$ENDIF} {$ENDIF}; - +{$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} +function SDL_RenderFillRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: cint32): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRects' {$ENDIF} {$ENDIF}; + {$endif} {** * Fill some number of rectangles on the current rendering target with the drawing color. * @@ -952,8 +1027,12 @@ function SDL_RenderFillRectsF(renderer: PSDL_Renderer; rects: PSDL_FRect; count: * * 0 on success, or -1 on error *} -function SDL_RenderCopy(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: PSDL_Rect; dstrect: PSDL_Rect): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopy' {$ENDIF} {$ENDIF}; - +{$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} +function SDL_RenderCopy(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: PSDL_Rect; dstrect: PSDL_Rect): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopy' {$ENDIF} {$ENDIF}; + {$endif} {** * Copy a portion of the texture to the current rendering target. * @@ -989,9 +1068,11 @@ function SDL_RenderCopyF(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect * flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture * * 0 on success, or -1 on error - *} + *} {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} function SDL_RenderCopyEx(renderer: PSDL_Renderer; texture: PSDL_Texture; const srcrect: PSDL_Rect; dstrect: PSDL_Rect; angle: cdouble; center: PSDL_Point; flip: TSDL_RenderFlip): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopyEx' {$ENDIF} {$ENDIF}; - + {$endif} {** * Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center * @@ -1020,7 +1101,9 @@ function SDL_RenderCopyExF(renderer: PSDL_Renderer; texture: PSDL_Texture; const * Render a list of triangles, optionally using a texture and indices into the * vertex array. Color and alpha modulation is done per vertex. * SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored. - *} + *} {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} function SDL_RenderGeometry( renderer: PSDL_Renderer; texture: PSDL_Texture; @@ -1060,12 +1143,14 @@ function SDL_RenderGeometryRaw( * * This is a very slow operation, and should not be used frequently. *} -function SDL_RenderReadPixels(renderer: PSDL_Renderer; rect: PSDL_Rect; format: cuint32; pixels: Pointer; pitch: cint32): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderReadPixels' {$ENDIF} {$ENDIF}; +function SDL_RenderReadPixels(renderer: PSDL_Renderer; rect: PSDL_Rect; format: cuint32; pixels: Pointer; pitch: cint32): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderReadPixels' {$ENDIF} {$ENDIF}; {** * Update the screen with rendering performed. *} -procedure SDL_RenderPresent(renderer: PSDL_Renderer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderPresent' {$ENDIF} {$ENDIF}; +procedure SDL_RenderPresent(renderer: PSDL_Renderer) cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderPresent' {$ENDIF} {$ENDIF}; {** * Destroy the specified texture. @@ -1073,7 +1158,8 @@ procedure SDL_RenderPresent(renderer: PSDL_Renderer) cdecl; external SDL_LibName * SDL_CreateTexture() * SDL_CreateTextureFromSurface() *} -procedure SDL_DestroyTexture(texture: PSDL_Texture) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyTexture' {$ENDIF} {$ENDIF}; +procedure SDL_DestroyTexture(texture: PSDL_Texture) cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyTexture' {$ENDIF} {$ENDIF}; {** * Destroy the rendering context for a window and free associated @@ -1081,7 +1167,8 @@ procedure SDL_DestroyTexture(texture: PSDL_Texture) cdecl; external SDL_LibName * * SDL_CreateRenderer() *} -procedure SDL_DestroyRenderer(renderer: PSDL_Renderer) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyRenderer' {$ENDIF} {$ENDIF}; +procedure SDL_DestroyRenderer(renderer: PSDL_Renderer) cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DestroyRenderer' {$ENDIF} {$ENDIF}; {** * Force the rendering context to flush any pending commands to the underlying @@ -1119,7 +1206,8 @@ function SDL_RenderFlush(renderer: PSDL_Renderer): cint; cdecl; * * 0 on success, or -1 if the operation is not supported *} -function SDL_GL_BindTexture(texture: PSDL_Texture; texw: pcfloat; texh: pcfloat): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_BindTexture' {$ENDIF} {$ENDIF}; +function SDL_GL_BindTexture(texture: PSDL_Texture; texw: pcfloat; texh: pcfloat): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_BindTexture' {$ENDIF} {$ENDIF}; {** * Unbind a texture from the current OpenGL/ES/ES2 context. @@ -1128,8 +1216,9 @@ function SDL_GL_BindTexture(texture: PSDL_Texture; texw: pcfloat; texh: pcfloat) * * 0 on success, or -1 if the operation is not supported *} -function SDL_GL_UnbindTexture(texture: PSDL_Texture): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_UnbindTexture' {$ENDIF} {$ENDIF}; - +function SDL_GL_UnbindTexture(texture: PSDL_Texture): cint32 cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_UnbindTexture' {$ENDIF} {$ENDIF}; + {$endif} {** * Get the CAMetalLayer associated with the given Metal renderer. * @@ -1172,10 +1261,12 @@ function SDL_RenderGetMetalCommandEncoder(renderer: PSDL_Renderer): Pointer; cde {** * Toggle VSync of the given renderer. - *} + *} {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} function SDL_RenderSetVSync(renderer: PSDL_Renderer; vsync: cint): cint; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderSetVSync' {$ENDIF} {$ENDIF}; - + {$endif} {** * Update a rectangle within a planar YV12 or IYUV texture with new pixel data. * @@ -1212,7 +1303,9 @@ function SDL_UpdateYUVTexture(texture: PSDL_Texture; rect: PSDL_Rect; Yplane: pc * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous * block of NV12/21 planes in the proper order, but this function is available * if your pixel data is not contiguous. - *} + *} {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} function SDL_UpdateNVTexture( texture: PSDL_Texture; Const rect: PSDL_Rect; @@ -1220,3 +1313,4 @@ function SDL_UpdateNVTexture( Const UVplane: Pcuint8; UVpitch: cint ): cint; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateNVTexture' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdlrwops.inc b/units/sdlrwops.inc index 7e3dd73a..43ab845e 100644 --- a/units/sdlrwops.inc +++ b/units/sdlrwops.inc @@ -179,8 +179,15 @@ function SDL_RWFromConstMem(const mem: Pointer; size: cint): PSDL_RWops; cdecl; {$endif} {*RWFrom functions*} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_AllocRW_func =function : PSDL_RWops; cdecl; +Var + SDL_AllocRW : TSDL_AllocRW_func = Nil; +{$else} function SDL_AllocRW: PSDL_RWops; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_AllocRW' {$ENDIF} {$ENDIF}; +{$endif} {$ifdef SDL_RUNTIME_LOADING} Type diff --git a/units/sdlsensor.inc b/units/sdlsensor.inc index 995fa7d1..652e4671 100644 --- a/units/sdlsensor.inc +++ b/units/sdlsensor.inc @@ -108,7 +108,9 @@ const * events will not be delivered. * * \since This function is available since SDL 2.0.14. - *} + *} {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} procedure SDL_LockSensors(); cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LockSensors' {$ENDIF} {$ENDIF}; procedure SDL_UnlockSensors(); cdecl; @@ -293,3 +295,4 @@ procedure SDL_SensorClose(sensor: PSDL_Sensor); cdecl; *} procedure SDL_SensorUpdate(); cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SensorUpdate' {$ENDIF} {$ENDIF}; + {$endif} diff --git a/units/sdlstdinc.inc b/units/sdlstdinc.inc index 4f908e8b..b00bf9b6 100644 --- a/units/sdlstdinc.inc +++ b/units/sdlstdinc.inc @@ -71,6 +71,18 @@ type * * \since This function is available since SDL 2.24.0. *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_GetOriginalMemoryFunctions_proc = procedure ( + malloc_func: PSDL_malloc_func; + calloc_func: PSDL_calloc_func; + realloc_func: PSDL_realloc_func; + free_func: PSDL_free_func +); cdecl; +Var + SDL_GetOriginalMemoryFunctions : TSDL_GetOriginalMemoryFunctions_proc = Nil; + +{$else} procedure SDL_GetOriginalMemoryFunctions( malloc_func: PSDL_malloc_func; calloc_func: PSDL_calloc_func; @@ -78,12 +90,24 @@ procedure SDL_GetOriginalMemoryFunctions( free_func: PSDL_free_func ); cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetOriginalMemoryFunctions' {$ENDIF} {$ENDIF}; +{$endif} (** * Get the current set of SDL memory functions * * \since This function is available since SDL 2.0.7. *) +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_GetMemoryFunctions_proc = procedure ( + malloc_func: PSDL_malloc_func; + calloc_func: PSDL_calloc_func; + realloc_func: PSDL_realloc_func; + free_func: PSDL_free_func +); cdecl; +Var + SDL_GetMemoryFunctions : TSDL_GetMemoryFunctions_proc = Nil; +{$else} procedure SDL_GetMemoryFunctions( malloc_func: PSDL_malloc_func; calloc_func: PSDL_calloc_func; @@ -91,12 +115,25 @@ procedure SDL_GetMemoryFunctions( free_func: PSDL_free_func ); cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetMemoryFunctions' {$ENDIF} {$ENDIF}; +{$endif} (** * Replace SDL's memory allocation functions with a custom set * * \since This function is available since SDL 2.0.7. *) +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_SetMemoryFunctions_func = function ( + malloc_func: TSDL_malloc_func; + calloc_func: TSDL_calloc_func; + realloc_func: TSDL_realloc_func; + free_func: TSDL_free_func +): cint; cdecl; + +Var + SDL_SetMemoryFunctions : TSDL_SetMemoryFunctions_func = Nil; +{$else} function SDL_SetMemoryFunctions( malloc_func: TSDL_malloc_func; calloc_func: TSDL_calloc_func; @@ -104,6 +141,7 @@ function SDL_SetMemoryFunctions( free_func: TSDL_free_func ): cint; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetMemoryFunctions' {$ENDIF} {$ENDIF}; +{$endif} (** * Get the number of outstanding (unfreed) allocations diff --git a/units/sdlsurface.inc b/units/sdlsurface.inc index 878f0e66..6c320fad 100644 --- a/units/sdlsurface.inc +++ b/units/sdlsurface.inc @@ -829,9 +829,15 @@ procedure SDL_SetYUVConversionMode(mode: TSDL_YUV_CONVERSION_MODE); cdecl; {** * \brief Get the YUV conversion mode *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_GetYUVConversionMode_func = function : TSDL_YUV_CONVERSION_MODE; cdecl; +Var + SDL_GetYUVConversionMode : TSDL_GetYUVConversionMode_func = Nil; +{$else} function SDL_GetYUVConversionMode: TSDL_YUV_CONVERSION_MODE; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetYUVConversionMode' {$ENDIF} {$ENDIF}; - +{$endif} {** * \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC *} diff --git a/units/sdlsystem.inc b/units/sdlsystem.inc index ef3279c8..7bcc6f0f 100644 --- a/units/sdlsystem.inc +++ b/units/sdlsystem.inc @@ -740,7 +740,9 @@ function SDL_IsTablet(): TSDL_Bool; cdecl; external SDL_LibName; {$endif} - + {$ifdef SDL_RUNTIME_LOADING} +// TODO: Portieren +{$else} { Functions used by iOS application delegates to notify SDL about state changes } procedure SDL_OnApplicationWillTerminate(); cdecl; external SDL_LibName; procedure SDL_OnApplicationDidReceiveMemoryWarning(); cdecl; external SDL_LibName; @@ -751,3 +753,4 @@ procedure SDL_OnApplicationDidBecomeActive(); cdecl; external SDL_LibName; {$IFDEF __IPHONEOS__} procedure SDL_OnApplicationDidChangeStatusBarOrientation(); cdecl; external SDL_LibName; {$ENDIF} +{$endif} diff --git a/units/sdlthread.inc b/units/sdlthread.inc index 5eaf73f6..05a15e7e 100644 --- a/units/sdlthread.inc +++ b/units/sdlthread.inc @@ -280,9 +280,15 @@ function SDL_GetThreadName(thread: PSDL_Thread): PAnsiChar; cdecl; * * \sa SDL_GetThreadID *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_ThreadID_func = function (): TSDL_ThreadID; cdecl; +Var + SDL_ThreadID : TSDL_ThreadID_func = Nil; +{$else} function SDL_ThreadID: TSDL_ThreadID; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ThreadID' {$ENDIF}{$ENDIF}; - +{$endif} {** * Get the thread identifier for the specified thread. * @@ -435,8 +441,15 @@ procedure SDL_DetachThread(thread:PSDL_Thread); cdecl; * \sa SDL_TLSGet * \sa SDL_TLSSet *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_TLSCreate_func = function : TSDL_TLSID; cdecl; +Var + SDL_TLSCreate : TSDL_TLSCreate_func = Nil; +{$else} function SDL_TLSCreate: TSDL_TLSID; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TLSCreate' {$ENDIF} {$ENDIF}; +{$endif} {** * Get the current thread's value associated with a thread local storage ID. @@ -509,6 +522,13 @@ function SDL_TLSSet(id: TSDL_TLSID; const value: Pointer; destructor_: TTLSDestr * * \since This function is available since SDL 2.0.16. *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_TLSCleanup_proc = procedure (); cdecl; +Var + SDL_TLSCleanup : TSDL_TLSCleanup_proc = Nil; +{$else} procedure SDL_TLSCleanup; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_TLSCleanup' {$ENDIF} {$ENDIF}; +{$endif} diff --git a/units/sdltimer.inc b/units/sdltimer.inc index 559e4235..7fab2323 100644 --- a/units/sdltimer.inc +++ b/units/sdltimer.inc @@ -5,8 +5,15 @@ * * This value wraps if the program runs for more than ~49 days. *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_GetTicks_func = function : cuint32; cdecl; +Var + SDL_GetTicks : TSDL_GetTicks_func = Nil; +{$else} function SDL_GetTicks: cuint32; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTicks' {$ENDIF} {$ENDIF}; + {$endif} {** * Get the number of milliseconds since SDL library initialization. @@ -16,8 +23,15 @@ function SDL_GetTicks: cuint32; cdecl; * the 32-bit overflow every ~49 days that SDL_GetTicks() suffers from. 64-bit * values from this function can be safely compared directly. *} -function SDL_GetTicks64: cuint64; cdecl; + {$ifdef SDL_RUNTIME_LOADING} + Type + TSDL_GetTicks64_func = function : cuint64; cdecl; + Var + SDL_GetTicks64 : TSDL_GetTicks64_func = Nil; + {$else} + function SDL_GetTicks64: cuint64; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetTicks64' {$ENDIF} {$ENDIF}; + {$endif} {** * \brief Compare SDL ticks values, and return true if A has passed B @@ -35,14 +49,28 @@ function SDL_TICKS_PASSED(const A, B: cint32): Boolean; {** * Get the current value of the high resolution counter *} + {$ifdef SDL_RUNTIME_LOADING} + Type + TSDL_GetPerformanceCounter_func = function : cuint64; cdecl; + Var + SDL_GetPerformanceCounter : TSDL_GetPerformanceCounter_func = Nil; + {$else} function SDL_GetPerformanceCounter: cuint64; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPerformanceCounter' {$ENDIF} {$ENDIF}; + {$endif} {** * Get the count per second of the high resolution counter *} + {$ifdef SDL_RUNTIME_LOADING} + Type + TSDL_GetPerformanceFrequency_func = function : cuint64; cdecl; + Var + SDL_GetPerformanceFrequency : TSDL_GetPerformanceFrequency_func = Nil; + {$else} function SDL_GetPerformanceFrequency: cuint64; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetPerformanceFrequency' {$ENDIF} {$ENDIF}; + {$endif} {** * Wait a specified number of milliseconds before returning. diff --git a/units/sdlversion.inc b/units/sdlversion.inc index 084078fa..1b25ed46 100644 --- a/units/sdlversion.inc +++ b/units/sdlversion.inc @@ -120,8 +120,15 @@ procedure SDL_GetVersion(ver: PSDL_Version); cdecl; * exact revision of the SDL library in use, and is only useful in comparing * against other revisions. It is NOT an incrementing number. *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_GetRevision_func = function (): PAnsiChar; cdecl; +Var + SDL_GetRevision : TSDL_GetRevision_func = Nil; +{$else} function SDL_GetRevision: PAnsiChar; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRevision' {$ENDIF} {$ENDIF}; +{$endif} {** * Get the revision number of SDL that is linked against your program. @@ -130,5 +137,13 @@ function SDL_GetRevision: PAnsiChar; cdecl; * library in use. It is an incrementing number based on commits to * hg.libsdl.org. *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_GetRevisionNumber_func = function (): cint; cdecl; +Var + SDL_GetRevisionNumber : TSDL_GetRevisionNumber_func = Nil; +{$else} function SDL_GetRevisionNumber: cint; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRevisionNumber' {$ENDIF} {$ENDIF}; +{$endif} + diff --git a/units/sdlvideo.inc b/units/sdlvideo.inc index 05a768da..bfda4694 100644 --- a/units/sdlvideo.inc +++ b/units/sdlvideo.inc @@ -241,10 +241,15 @@ const * * SDL_GetVideoDriver() *} - + {$ifdef SDL_RUNTIME_LOADING} + Type + TSDL_GetNumVideoDrivers_func =function : cint; cdecl; + Var + SDL_GetNumVideoDrivers : TSDL_GetNumVideoDrivers_func = Nil; + {$else} function SDL_GetNumVideoDrivers: cint; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumVideoDrivers' {$ENDIF} {$ENDIF}; - + {$endif} {** * Get the name of a built in video driver. * @@ -298,9 +303,15 @@ function SDL_VideoInit(const driver_name: PAnsiChar): cint; cdecl; * * SDL_VideoInit() *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_VideoQuit_proc =Procedure ; cdecl; +Var + SDL_VideoQuit : TSDL_VideoQuit_proc = Nil; +{$else} procedure SDL_VideoQuit; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_VideoQuit' {$ENDIF} {$ENDIF}; - + {$endif} {** * Returns the name of the currently initialized video driver. * @@ -310,19 +321,31 @@ procedure SDL_VideoQuit; cdecl; * SDL_GetNumVideoDrivers() * SDL_GetVideoDriver() *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_GetCurrentVideoDriver_func = function : PAnsiChar; cdecl; +Var + SDL_GetCurrentVideoDriver : TSDL_GetCurrentVideoDriver_func = Nil; +{$else} function SDL_GetCurrentVideoDriver: PAnsiChar; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCurrentVideoDriver' {$ENDIF} {$ENDIF}; - +{$endif} {** * Returns the number of available video displays. * * SDL_GetDisplayBounds() *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_GetNumVideoDisplays_func =function : cint; cdecl; +Var + SDL_GetNumVideoDisplays : TSDL_GetNumVideoDisplays_func = Nil; +{$else} function SDL_GetNumVideoDisplays: cint; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetNumVideoDisplays' {$ENDIF} {$ENDIF}; - +{$endif} {** * Get the name of a display in UTF-8 encoding * @@ -1931,30 +1954,45 @@ procedure SDL_DestroyWindow(window: PSDL_Window); cdecl; * SDL_EnableScreenSaver() * SDL_DisableScreenSaver() *} - +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_IsScreenSaverEnabled_func = function : TSDL_Bool; cdecl; +Var + SDL_IsScreenSaverEnabled : TSDL_IsScreenSaverEnabled_func = Nil; +{$else} function SDL_IsScreenSaverEnabled: TSDL_Bool; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsScreenSaverEnabled' {$ENDIF} {$ENDIF}; - +{$endif} {** * Allow the screen to be blanked by a screensaver * * SDL_IsScreenSaverEnabled() * SDL_DisableScreenSaver() *} - +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_EnableScreenSaver_proc = procedure ; cdecl; +Var + SDL_EnableScreenSaver : TSDL_EnableScreenSaver_proc = Nil; +{$else} procedure SDL_EnableScreenSaver; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_EnableScreenSaver' {$ENDIF} {$ENDIF}; - + {$endif} {** * Prevent the screen from being blanked by a screensaver * * SDL_IsScreenSaverEnabled() * SDL_EnableScreenSaver() *} - +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_DisableScreenSaver_proc =procedure ; cdecl; +Var + SDL_DisableScreenSaver : TSDL_DisableScreenSaver_proc = Nil; +{$else} procedure SDL_DisableScreenSaver; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_DisableScreenSaver' {$ENDIF} {$ENDIF}; - + {$endif} {** * OpenGL support functions *} @@ -2009,10 +2047,16 @@ function SDL_GL_GetProcAddress(const proc: PAnsiChar): Pointer; cdecl; * * SDL_GL_LoadLibrary() *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_GL_UnloadLibrary_proc = procedure ; cdecl; +Var + SDL_GL_UnloadLibrary : TSDL_GL_UnloadLibrary_proc = Nil; +{$else} procedure SDL_GL_UnloadLibrary; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_UnloadLibrary' {$ENDIF} {$ENDIF}; - + {$endif} {** * Return true if an OpenGL extension is supported for the current * context. @@ -2111,15 +2155,27 @@ function SDL_GL_MakeCurrent(window: PSDL_Window; context: TSDL_GLContext): cint; {** * Get the currently active OpenGL window. *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_GL_GetCurrentWindow_func = function : PSDL_Window; cdecl; +Var + SDL_GL_GetCurrentWindow : TSDL_GL_GetCurrentWindow_func = Nil; +{$else} function SDL_GL_GetCurrentWindow: PSDL_Window; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetCurrentWindow' {$ENDIF} {$ENDIF}; - + {$endif} {** * Get the currently active OpenGL context. *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_GL_GetCurrentContext_func = function : TSDL_GLContext; cdecl; +Var + SDL_GL_GetCurrentContext : TSDL_GL_GetCurrentContext_func = Nil; +{$else} function SDL_GL_GetCurrentContext: TSDL_GLContext; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetCurrentContext' {$ENDIF} {$ENDIF}; - + {$endif} {** * Get the size of a window's underlying drawable in pixels (for use * with glViewport). @@ -2184,9 +2240,15 @@ function SDL_GL_SetSwapInterval(interval: cint): cint; cdecl; * SDL_GL_SetSwapInterval() *} +{$ifdef SDL_RUNTIME_LOADING} +Type + TSDL_GL_GetSwapInterval_func = function : cint; cdecl; +Var + SDL_GL_GetSwapInterval : TSDL_GL_GetSwapInterval_func = Nil; +{$else} function SDL_GL_GetSwapInterval: cint; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GL_GetSwapInterval' {$ENDIF} {$ENDIF}; - +{$endif} {** * Swap the OpenGL buffers for a window, if double-buffering is * supported. From 150761fca32242a12cb5f454687a1095cf0d590d Mon Sep 17 00:00:00 2001 From: PascalCorpsman Date: Mon, 13 Jan 2025 11:30:16 +0100 Subject: [PATCH 8/8] ADD: SDL_PumpEvents to port --- units/sdl_runtime_linking.inc | 2 ++ units/sdlevents.inc | 23 ++++++++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/units/sdl_runtime_linking.inc b/units/sdl_runtime_linking.inc index 5e56b7cf..a791e68e 100644 --- a/units/sdl_runtime_linking.inc +++ b/units/sdl_runtime_linking.inc @@ -911,6 +911,8 @@ Begin {$ENDIF} SDL_IsTablet := TSDL_IsTablet_func(GetProcAddress(LibHandle, 'SDL_IsTablet')); If Not assigned(SDL_IsTablet) Then result := false; + SDL_PumpEvents := TSDL_PumpEvents_proc(GetProcAddress(LibHandle, 'SDL_PumpEvents')); + If Not assigned(SDL_PumpEvents) Then result := false; SDL_PollEvent := TSDL_PollEvent_func(GetProcAddress(LibHandle, 'SDL_PollEvent')); If Not assigned(SDL_PollEvent) Then result := false; SDL_EventState := TSDL_EventState_func(GetProcAddress(LibHandle, 'SDL_EventState')); diff --git a/units/sdlevents.inc b/units/sdlevents.inc index c1521fa5..82e8dbad 100644 --- a/units/sdlevents.inc +++ b/units/sdlevents.inc @@ -678,7 +678,9 @@ type * This should only be run in the thread that sets the video mode. *} {$ifdef SDL_RUNTIME_LOADING} - // TODO: Portieren +Type + TSDL_PumpEvents_proc = Procedure (); cdecl; + var SDL_PumpEvents: TSDL_PumpEvents_proc = Nil; {$else} procedure SDL_PumpEvents cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PumpEvents' {$ENDIF} {$ENDIF}; @@ -741,16 +743,15 @@ type * stored in that area. *} {$endif} -{$ifdef SDL_RUNTIME_LOADING} -Type - TSDL_PollEvent_func = function (event: PSDL_Event): cint32 cdecl; -Var - SDL_PollEvent : TSDL_PollEvent_func = Nil; -{$else} - - function SDL_PollEvent(event: PSDL_Event): cint32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PollEvent' {$ENDIF} {$ENDIF}; - -{$endif} + {$ifdef SDL_RUNTIME_LOADING} + Type + TSDL_PollEvent_func = function (event: PSDL_Event): cint32 cdecl; + Var + SDL_PollEvent : TSDL_PollEvent_func = Nil; + {$else} + function SDL_PollEvent(event: PSDL_Event): cint32 cdecl; +external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_PollEvent' {$ENDIF} {$ENDIF}; + {$endif} {$ifdef SDL_RUNTIME_LOADING} // TODO: Portieren