1
{*******************************************************************************
3
SDL2.pas v1.0 29/07/2013 first version for DelphiXE
4
v1.1 27/08/2013 add MACOS compability
6
Simple DirectMedia Layer
7
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
9
Pascal-Header-Conversion SDL from the JEDI-Team written by Domenique Louis and others.
10
Pascal-Header-Conversion SDL2 from the Copyright (C) 2012/13 Tim Blume aka End.
12
convert SDL/SDL2 to SDL2 for DelphiXE by Kotai 2013 www.remakesonline.com
14
The initial developer of this Pascal code was :
15
Dominqiue Louis <Dominique@SavageSoftware.com.au>
18
*******************************************************************************}
41
SDL_LibName = 'SDL2.dll';
46
SDL_LibName = 'libSDL2.dylib';
48
SDL_LibName = 'libSDL2.so';
58
////////////////////////////////////////////////////////////////////////////////////////////////////////
59
////////////////////// SDLtype_s.h / SDL_stdinc.h ////////////////////////////////////////////////////
60
////////////////////////////////////////////////////////////////////////////////////////////////////////
64
TSDL_Bool = (SDL_FALSE,SDL_TRUE);
68
PUInt8Array = ^TUInt8Array;
73
TUInt8Array = array [0..MAXINT shr 1] of UInt8;
97
PShortInt = ^ShortInt;
105
{$EXTERNALSYM UInt64}
116
{$EXTERNALSYM SInt64}
127
{$EXTERNALSYM SIZE_T}
134
////////////////////////////////////////////////////////////////////////////////////////////////////////
135
////////////////////// SDL_version.h ////////////////////////////////////////////////////
136
////////////////////////////////////////////////////////////////////////////////////////////////////////
139
* Information the version of SDL in use.
141
* Represents the library's version as three levels: major revision
142
* (increments with massive changes, additions, and enhancements),
143
* minor revision (increments with backwards-compatible changes to the
144
* major revision), and patchlevel (increments with fixes to the minor
151
PSDL_Version = ^TSDL_Version;
152
TSDL_Version = record
153
major, {**< major version *}
154
minor, {**< minor version *}
155
patch: UInt8; {**< update version *}
158
{* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
161
SDL_MAJOR_VERSION = 2;
162
SDL_MINOR_VERSION = 0;
166
* Macro to determine SDL version program was compiled against.
168
* This macro fills in a SDL_version structure with the version of the
169
* library you compiled against. This is determined by what header the
170
* compiler uses. Note that if you dynamically linked the library, you might
171
* have a slightly newer or older version at runtime. That version can be
172
* determined with SDL_GetVersion(), which, unlike SDL_VERSION(),
175
* x A pointer to a SDL_version struct to initialize.
180
procedure SDL_VERSION(x: PSDL_Version);
183
* This macro turns the version numbers into a numeric value:
188
* This assumes that there will never be more than 100 patchlevels.
190
function SDL_VERSIONNUM(X,Y,Z: UInt32): Cardinal;
193
* This is the version number macro for the current SDL version.
195
function SDL_COMPILEDVERSION: Cardinal;
198
* This macro will evaluate to true if compiled with SDL at least X.Y.Z.
200
function SDL_VERSION_ATLEAST(X,Y,Z: Cardinal): Boolean;
203
* Get the version of SDL that is linked against your program.
205
* If you are linking to SDL dynamically, then it is possible that the
206
* current version will be different than the version you compiled against.
207
* This function returns the current version, while SDL_VERSION() is a
208
* macro that tells you what version you compiled with.
211
* compiled: TSDL_Version;
212
* linked: TSDL_Version;
214
* SDL_VERSION(@compiled);
215
* SDL_GetVersion(@linked);
216
* WriteLn('We compiled against SDL version: ' +
217
* IntToStr(compiled.major) +
218
* IntToStr(compiled.minor) +
219
* IntToStr(compiled.patch));
220
* WriteLn('But we linked against SDL version:' +
221
* IntToStr(compiled.major) +
222
* IntToStr(compiled.minor) +
223
* IntToStr(compiled.patch));
226
* This function may be called safely at any time, even before SDL_Init().
230
procedure SDL_GetVersion(ver: PSDL_Version) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetVersion' {$ENDIF};
233
* Get the code revision of SDL that is linked against your program.
235
* Returns an arbitrary string (a hash value) uniquely identifying the
236
* exact revision of the SDL library in use, and is only useful in comparing
237
* against other revisions. It is NOT an incrementing number.
239
function SDL_GetRevision: PAnsiChar cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetRevision' {$ENDIF};
242
* Get the revision number of SDL that is linked against your program.
244
* Returns a number uniquely identifying the exact revision of the SDL
245
* library in use. It is an incrementing number based on commits to
248
function SDL_GetRevisionNumber: SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetRevisionNumber' {$ENDIF};
252
////////////////////////////////////////////////////////////////////////////////////////////////////////
253
////////////////////// SDL_error.h ////////////////////////////////////////////////////
254
////////////////////////////////////////////////////////////////////////////////////////////////////////
257
ERR_MAX_STRLEN = 128;
260
{* Public functions *}
262
{* SDL_SetError() unconditionally returns -1. *}
263
function SDL_SetError(const fmt: PAnsiChar): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetError' {$ENDIF};
264
function SDL_GetError: PAnsiChar cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetError' {$ENDIF};
265
procedure SDL_ClearError cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_ClearError' {$ENDIF};
266
{*Internal error functions*}
268
* Internal error functions
270
* Private error reporting function - used internally.
274
#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
275
#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
276
#define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param))
279
TSDL_ErrorCode = (SDL_ENOMEM,
287
{* This is a numeric value corresponding to the current error *}
290
{* This is a key used to index into a language hashtable containing
291
internationalized versions of the SDL error messages. If the key
292
is not in the hashtable, or no hashtable is available, the key is
293
used directly as an error message format string.
295
key: String[ERR_MAX_STRLEN];
297
{* These are the arguments for the error functions *}
300
{* What is a character anyway? (UNICODE issues) *}
302
1: (value_ptr: Pointer;);
303
2: (value_i: SInt32;);
304
3: (value_f: Double;);
305
4: (buf: String[ERR_MAX_STRLEN];);
308
{* SDL_Error() unconditionally returns -1. *}
309
function SDL_Error(code: TSDL_ErrorCode): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_Error' {$ENDIF};
313
////////////////////////////////////////////////////////////////////////////////////////////////////////
314
////////////////////// SDL_power.h ////////////////////////////////////////////////////
315
////////////////////////////////////////////////////////////////////////////////////////////////////////
318
* The basic state for the system's power supply.
321
TSDL_PowerState = (SDL_POWERSTATE_UNKNOWN, {**< cannot determine power status *}
322
SDL_POWERSTATE_ON_BATTERY, {**< Not plugged in, running on the battery *}
323
SDL_POWERSTATE_NO_BATTERY, {**< Plugged in, no battery available *}
324
SDL_POWERSTATE_CHARGING, {**< Plugged in, charging battery *}
325
SDL_POWERSTATE_CHARGED); {**< Plugged in, battery charged *}
328
* Get the current power supply details.
330
* secs Seconds of battery life left. You can pass a NULL here if
331
* you don't care. Will return -1 if we can't determine a
332
* value, or we're not running on a battery.
334
* pct Percentage of battery life left, between 0 and 100. You can
335
* pass a NULL here if you don't care. Will return -1 if we
336
* can't determine a value, or we're not running on a battery.
338
* The state of the battery (if any).
340
function SDL_GetPowerInfo(secs: PInt; pct: PInt): TSDL_PowerState cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetPowerInfo' {$ENDIF};
344
////////////////////////////////////////////////////////////////////////////////////////////////////////
345
////////////////////// SDL_thread .h ////////////////////////////////////////////////////
346
////////////////////////////////////////////////////////////////////////////////////////////////////////
348
{* The SDL thread structure, defined in SDL_thread.c *}
351
{* The SDL thread priority
353
* Note: On many systems you require special privileges to set high priority.
356
TSDL_ThreadPriority = (SDL_THREAD_PRIORITY_LOW,
357
SDL_THREAD_PRIORITY_NORMAL,
358
SDL_THREAD_PRIORITY_HIGH);
360
{* The function passed to SDL_CreateThread()
361
It is passed a void* user context parameter and returns an int.
363
PSDL_ThreadFunction = ^TSDL_ThreadFunction;
364
TSDL_ThreadFunction = function(data: Pointer): Integer; cdecl;
366
{* The SDL thread ID *}
367
TSDL_ThreadID = LongWord;
369
PSDL_Thread = Pointer;
372
PSDL_Thread = ^TSDL_Thread;
374
threadid: TSDL_ThreadID;
382
TSDL_TLSID = Cardinal;
388
* We compile SDL into a DLL. This means, that it's the DLL which
389
* creates a new thread for the calling process with the SDL_CreateThread()
390
* API. There is a problem with this, that only the RTL of the SDL.DLL will
391
* be initialized for those threads, and not the RTL of the calling
394
* To solve this, we make a little hack here.
396
* We'll always use the caller's _beginthread() and _endthread() APIs to
397
* start a new thread. This way, if it's the SDL.DLL which uses this API,
398
* then the RTL of SDL.DLL will be used to create the new thread, and if it's
399
* the application, then the RTL of the application will be used.
402
* Always use the _beginthread() and _endthread() of the calling runtime
405
{$DEFINE SDL_PASSED_BEGINTHREAD_ENDTHREAD}
409
TThreadID = Cardinal;
412
TpfnSDL_CurrentBeginThread = function(SecurityAttributes: Pointer; StackSize: LongWord; ThreadFunc: TThreadFunc; Parameter: Pointer; CreationFlags: LongWord; var ThreadId: TThreadID): Integer;
414
TpfnSDL_CurrentEndThread = procedure(ExitCode: Integer);
419
function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PAnsiChar; data: Pointer; pfnBeginThread: TpfnSDL_CurrentBeginThread; pfnEndThread: TpfnSDL_CurrentEndThread): PSDL_Thread; cdecl; overload; external SDL_LibName {$IFDEF MACOS} name '_SDL_CreateThread' {$ENDIF};
424
function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PAnsiChar; data: Pointer): PSDL_Thread; overload;
431
* Thread naming is a little complicated: Most systems have very small
432
* limits for the string length (BeOS has 32 bytes, Linux currently has 16,
433
* Visual C++ 6.0 has nine!), and possibly other arbitrary rules. You'll
434
* have to see what happens with your system's debugger. The name should be
435
* UTF-8 (but using the naming limits of C identifiers is a better bet).
436
* There are no requirements for thread naming conventions, so long as the
437
* string is null-terminated UTF-8, but these guidelines are helpful in
440
* http://stackoverflow.com/questions/149932/naming-conventions-for-threads
442
* If a system imposes requirements, SDL will try to munge the string for
443
* it (truncate, etc), but the original string contents will be available
444
* from SDL_GetThreadName().
446
function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PAnsiChar; data: Pointer): PSDL_Thread; cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_CreateThread' {$ENDIF};
451
* Get the thread name, as it was specified in SDL_CreateThread().
452
* This function returns a pointer to a UTF-8 string that names the
453
* specified thread, or NULL if it doesn't have a name. This is internal
454
* memory, not to be free()'d by the caller, and remains valid until the
455
* specified thread is cleaned up by SDL_WaitThread().
457
function SDL_GetThreadName(thread: PSDL_Thread): PAnsiChar cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetThreadName' {$ENDIF};
460
* Get the thread identifier for the current thread.
462
function SDL_ThreadID: TSDL_ThreadID cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_ThreadID' {$ENDIF};
465
* Get the thread identifier for the specified thread.
467
* Equivalent to SDL_ThreadID() if the specified thread is NULL.
469
function SDL_GetThreadID(thread: PSDL_Thread): TSDL_ThreadID cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetThreadID' {$ENDIF};
472
* Set the priority for the current thread
474
function SDL_SetThreadPriority(priority: TSDL_ThreadPriority): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetThreadPriority' {$ENDIF};
477
* Wait for a thread to finish.
479
* The return code for the thread function is placed in the area
480
* pointed to by status, if status is not NULL.
482
procedure SDL_WaitThread(thread: PSDL_Thread; status: PInt) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_WaitThread' {$ENDIF};
485
* Create an identifier that is globally visible to all threads but refers to data that is thread-specific.
487
* The newly created thread local storage identifier, or 0 on error
489
* static SDL_SpinLock tls_lock;
490
* static SDL_TLSID thread_local_storage;
492
* void SetMyThreadData(void *value)
494
* if (!thread_local_storage) {
495
* SDL_AtomicLock(&tls_lock);
496
* if (!thread_local_storage) {
497
* thread_local_storage = SDL_TLSCreate();
499
* SDL_AtomicUnLock(&tls_lock);
501
* SDL_TLSSet(thread_local_storage, value);
504
* void *GetMyThreadData(void)
506
* return SDL_TLSGet(thread_local_storage);
512
function SDL_TLSCreate: TSDL_TLSID cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_TLSCreate' {$ENDIF};
515
* Get the value associated with a thread local storage ID for the current thread.
517
* id The thread local storage ID
519
* The value associated with the ID for the current thread, or NULL if no value has been set.
524
function SDL_TLSGet(id: TSDL_TLSID): Pointer cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_TLSGet' {$ENDIF};
527
* Set the value associated with a thread local storage ID for the current thread.
529
* id The thread local storage ID
530
* value The value to associate with the ID for the current thread
531
* destructor_ A function called when the thread exits, to free the value.
533
* 0 on success, -1 on error
538
function SDL_TLSSet(id: TSDL_TLSID; value: Pointer; destructor_: Pointer): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_TLSSet' {$ENDIF};
542
////////////////////////////////////////////////////////////////////////////////////////////////////////
543
////////////////////// SDL_mutex.h ////////////////////////////////////////////////////
544
////////////////////////////////////////////////////////////////////////////////////////////////////////
547
* Synchronization functions which can time out return this value
551
SDL_MUTEX_TIMEDOUT = 1;
554
* This is the timeout value which corresponds to never time out.
556
//SDL_MUTEX_MAXWAIT (~(Uint32)0)
563
{* The SDL mutex structure, defined in SDL_mutex.c *}
564
PSDL_Mutex = Pointer; //todo!
567
* Create a mutex, initialized unlocked.
569
function SDL_CreateMutex: PSDL_Mutex cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_CreateMutex' {$ENDIF};
576
//#define SDL_mutexP(m) SDL_LockMutex(m)
577
function SDL_LockMutex(mutex: PSDL_Mutex): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_LockMutex' {$ENDIF};
580
* Try to lock the mutex
582
* 0, SDL_MUTEX_TIMEDOUT, or -1 on error
584
function SDL_TryLockMutex(mutex: PSDL_Mutex): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_TryLockMutex' {$ENDIF};
591
* It is an error to unlock a mutex that has not been locked by
592
* the current thread, and doing so results in undefined behavior.
594
//#define SDL_mutexV(m) SDL_UnlockMutex(m)
595
function SDL_UnlockMutex(mutex: PSDL_Mutex): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_UnlockMutex' {$ENDIF};
600
procedure SDL_DestroyMutex(mutex: PSDL_Mutex) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_DestroyMutex' {$ENDIF};
605
* Semaphore functions
608
{* The SDL semaphore structure, defined in SDL_sem.c *}
609
PSDL_Sem = Pointer; //todo!
612
* Create a semaphore, initialized with value, returns NULL on failure.
614
function SDL_CreateSemaphore(initial_value: UInt32): PSDL_sem cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_CreateSemaphore' {$ENDIF};
617
* Destroy a semaphore.
619
procedure SDL_DestroySemaphore(sem: PSDL_Sem) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_DestroySemaphore' {$ENDIF};
622
* This function suspends the calling thread until the semaphore pointed
623
* to by sem has a positive count. It then atomically decreases the
626
function SDL_SemWait(sem: PSDL_Sem): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SemWait' {$ENDIF};
629
* Non-blocking variant of SDL_SemWait().
631
* 0 if the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait would
632
* block, and -1 on error.
634
function SDL_SemTryWait(sem: PSDL_Sem): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SemTryWait' {$ENDIF};
637
* Variant of SDL_SemWait() with a timeout in milliseconds.
639
* 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait does not
640
* succeed in the allotted time, and -1 on error.
642
* On some platforms this function is implemented by looping with a
643
* delay of 1 ms, and so should be avoided if possible.
645
function SDL_SemWaitTimeout(sem: PSDL_Sem; ms: UInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SemWaitTimeout' {$ENDIF};
648
* Atomically increases the semaphore's count (not blocking).
652
function SDL_SemPost(sem: PSDL_Sem): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SemPost' {$ENDIF};
655
* Returns the current count of the semaphore.
657
function SDL_SemValue(sem: PSDL_Sem): UInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SemValue' {$ENDIF};
659
{*Semaphore functions*}
662
* Condition variable functions
665
{* The SDL condition variable structure, defined in SDL_cond.c *}
666
PSDL_Cond = Pointer; //todo!!
669
* Create a condition variable.
671
* Typical use of condition variables:
674
* SDL_LockMutex(lock);
675
* while ( not condition )
677
* SDL_CondWait(cond, lock);
679
* SDL_UnlockMutex(lock);
682
* SDL_LockMutex(lock);
686
* SDL_CondSignal(cond);
687
* SDL_UnlockMutex(lock);
689
* There is some discussion whether to signal the condition variable
690
* with the mutex locked or not. There is some potential performance
691
* benefit to unlocking first on some platforms, but there are some
692
* potential race conditions depending on how your code is structured.
694
* In general it's safer to signal the condition variable while the
697
function SDL_CreateCond: PSDL_Cond cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_CreateCond' {$ENDIF};
700
* Destroy a condition variable.
702
procedure SDL_DestroyCond(cond: PSDL_Cond) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_DestroyCond' {$ENDIF};
705
* Restart one of the threads that are waiting on the condition variable.
709
function SDL_CondSignal(cond: PSDL_Cond): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_CondSignal' {$ENDIF};
712
* Restart all threads that are waiting on the condition variable.
716
function SDL_CondBroadcast(cond: PSDL_Cond): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_CondBroadcast' {$ENDIF};
719
* Wait on the condition variable, unlocking the provided mutex.
721
* The mutex must be locked before entering this function!
723
* The mutex is re-locked once the condition variable is signaled.
725
* 0 when it is signaled, or -1 on error.
727
function SDL_CondWait(cond: PSDL_Cond; mutex: PSDL_Mutex): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_CondWait' {$ENDIF};
730
* Waits for at most ms milliseconds, and returns 0 if the condition
731
* variable is signaled, SDL_MUTEX_TIMEDOUT if the condition is not
732
* signaled in the allotted time, and -1 on error.
734
* On some platforms this function is implemented by looping with a
735
* delay of 1 ms, and so should be avoided if possible.
737
function SDL_CondWaitTimeout(cond: PSDL_Cond; mutex: PSDL_Mutex; ms: UInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_CondWaitTimeout' {$ENDIF};
741
////////////////////////////////////////////////////////////////////////////////////////////////////////
742
////////////////////// SDL_timer.h ////////////////////////////////////////////////////
743
////////////////////////////////////////////////////////////////////////////////////////////////////////
746
* Get the number of milliseconds since the SDL library initialization.
748
* This value wraps if the program runs for more than ~49 days.
750
function SDL_GetTicks: UInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetTicks' {$ENDIF};
753
* Get the current value of the high resolution counter
755
function SDL_GetPerformanceCounter: UInt64 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetPerformanceCounter' {$ENDIF};
758
* Get the count per second of the high resolution counter
760
function SDL_GetPerformanceFrequency: UInt64 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetPerformanceFrequency' {$ENDIF};
763
* Wait a specified number of milliseconds before returning.
765
procedure SDL_Delay(ms: UInt32) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_Delay' {$ENDIF};
768
* Function prototype for the timer callback function.
770
* The callback function is passed the current timer interval and returns
771
* the next timer interval. If the returned value is the same as the one
772
* passed in, the periodic alarm continues, otherwise a new alarm is
773
* scheduled. If the callback returns 0, the periodic alarm is cancelled.
777
TSDL_TimerCallback = function(interval: UInt32; param: Pointer): UInt32;
780
* Definition of the timer ID type.
782
TSDL_TimerID = SInt32;
785
* Add a new timer to the pool of timers already running.
787
* A timer ID, or NULL when an error occurs.
789
function SDL_AddTimer(interval: UInt32; callback: TSDL_TimerCallback; param: Pointer): TSDL_TimerID cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_AddTimer' {$ENDIF};
792
* Remove a timer knowing its ID.
794
* A boolean value indicating success or failure.
796
* It is not safe to remove a timer multiple times.
798
function SDL_RemoveTimer(id: TSDL_TimerID): Boolean cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RemoveTimer' {$ENDIF};
802
////////////////////////////////////////////////////////////////////////////////////////////////////////
803
////////////////////// SDL_pixels.h ///////////////////////////////////////////////////
804
////////////////////////////////////////////////////////////////////////////////////////////////////////
807
* Transparency definitions
809
* These define alpha as the opacity of a surface.
813
SDL_ALPHA_OPAQUE = 255;
814
SDL_ALPHA_TRANSPARENT = 0;
817
SDL_PIXELTYPE_UNKNOWN = 0;
818
SDL_PIXELTYPE_INDEX1 = 1;
819
SDL_PIXELTYPE_INDEX4 = 2;
820
SDL_PIXELTYPE_INDEX8 = 3;
821
SDL_PIXELTYPE_PACKED8 = 4;
822
SDL_PIXELTYPE_PACKED16 = 5;
823
SDL_PIXELTYPE_PACKED32 = 6;
824
SDL_PIXELTYPE_ARRAYU8 = 7;
825
SDL_PIXELTYPE_ARRAYU16 = 8;
826
SDL_PIXELTYPE_ARRAYU32 = 9;
827
SDL_PIXELTYPE_ARRAYF16 = 10;
828
SDL_PIXELTYPE_ARRAYF32 = 11;
830
{** Bitmap pixel order, high bit -> low bit. *}
831
SDL_BITMAPORDER_NONE = 0;
832
SDL_BITMAPORDER_4321 = 1;
833
SDL_BITMAPORDER_1234 = 2;
835
{** Packed component order, high bit -> low bit. *}
837
SDL_PACKEDORDER_NONE = 0;
838
SDL_PACKEDORDER_XRGB = 1;
839
SDL_PACKEDORDER_RGBX = 2;
840
SDL_PACKEDORDER_ARGB = 3;
841
SDL_PACKEDORDER_RGBA = 4;
842
SDL_PACKEDORDER_XBGR = 5;
843
SDL_PACKEDORDER_BGRX = 6;
844
SDL_PACKEDORDER_ABGR = 7;
845
SDL_PACKEDORDER_BGRA = 8;
847
{** Array component order, low byte -> high byte. *}
848
SDL_ARRAYORDER_NONE = 0;
849
SDL_ARRAYORDER_RGB = 1;
850
SDL_ARRAYORDER_RGBA = 2;
851
SDL_ARRAYORDER_ARGB = 3;
852
SDL_ARRAYORDER_BGR = 4;
853
SDL_ARRAYORDER_BGRA = 5;
854
SDL_ARRAYORDER_ABGR = 6;
856
{** Packed component layout. *}
857
SDL_PACKEDLAYOUT_NONE = 0;
858
SDL_PACKEDLAYOUT_332 = 1;
859
SDL_PACKEDLAYOUT_4444 = 2;
860
SDL_PACKEDLAYOUT_1555 = 3;
861
SDL_PACKEDLAYOUT_5551 = 4;
862
SDL_PACKEDLAYOUT_565 = 5;
863
SDL_PACKEDLAYOUT_8888 = 6;
864
SDL_PACKEDLAYOUT_2101010 = 7;
865
SDL_PACKEDLAYOUT_1010102 = 8;
869
function SDL_DEFINE_PIXELFORMAT(type, order, layour, bit, bytes: UInt32): Result;
871
function SDL_DEFINE_PIXELFOURCC(A,B,C,D: Variant): Variant;
873
#define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \
874
((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \
875
((bits) << 8) | ((bytes) << 0))
878
function SDL_PIXELFLAG(X: Cardinal): Boolean;
879
function SDL_PIXELTYPE(X: Cardinal): Boolean;
880
function SDL_PIXELORDER(X: Cardinal): Boolean;
881
function SDL_PIXELLAYOUT(X: Cardinal): Boolean;
882
function SDL_BITSPERPIXEL(X: Cardinal): Boolean;
884
#define SDL_BYTESPERPIXEL(X) \
885
(SDL_ISPIXELFORMAT_FOURCC(X) ? \
886
((((X) == SDL_PIXELFORMAT_YUY2) || \
887
((X) == SDL_PIXELFORMAT_UYVY) || \
888
((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF))
890
#define SDL_ISPIXELFORMAT_INDEXED(format) \
891
(!SDL_ISPIXELFORMAT_FOURCC(format) && \
892
((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
893
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
894
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))
896
#define SDL_ISPIXELFORMAT_ALPHA(format) \
897
(!SDL_ISPIXELFORMAT_FOURCC(format) && \
898
((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \
899
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \
900
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \
901
(SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA)))
903
function SDL_IsPixelFormat_FOURCC(format: Variant);
905
{* Note: If you modify this list, update SDL_GetPixelFormatName() *}
908
SDL_PIXELFORMAT_UNKNOWN = 0;
909
SDL_PIXELFORMAT_INDEX1LSB = (1 shl 28) or
910
(SDL_PIXELTYPE_INDEX1 shl 24) or
911
(SDL_BITMAPORDER_4321 shl 20) or
916
SDL_PIXELFORMAT_INDEX1MSB = (1 shl 28) or
917
(SDL_PIXELTYPE_INDEX1 shl 24) or
918
(SDL_BITMAPORDER_1234 shl 20) or
923
SDL_PIXELFORMAT_INDEX4LSB = (1 shl 28) or
924
(SDL_PIXELTYPE_INDEX4 shl 24) or
925
(SDL_BITMAPORDER_4321 shl 20) or
930
SDL_PIXELFORMAT_INDEX4MSB = (1 shl 28) or
931
(SDL_PIXELTYPE_INDEX4 shl 24) or
932
(SDL_BITMAPORDER_1234 shl 20) or
937
SDL_PIXELFORMAT_INDEX8 = (1 shl 28) or
938
(SDL_PIXELTYPE_PACKED8 shl 24) or
944
SDL_PIXELFORMAT_RGB332 = (1 shl 28) or
945
(SDL_PIXELTYPE_PACKED8 shl 24) or
946
(SDL_PACKEDORDER_XRGB shl 20) or
947
(SDL_PACKEDLAYOUT_332 shl 16) or
951
SDL_PIXELFORMAT_RGB444 = (1 shl 28) or
952
(SDL_PIXELTYPE_PACKED16 shl 24) or
953
(SDL_PACKEDORDER_XRGB shl 20) or
954
(SDL_PACKEDLAYOUT_4444 shl 16) or
958
SDL_PIXELFORMAT_RGB555 = (1 shl 28) or
959
(SDL_PIXELTYPE_PACKED16 shl 24) or
960
(SDL_PACKEDORDER_XRGB shl 20) or
961
(SDL_PACKEDLAYOUT_1555 shl 16) or
965
SDL_PIXELFORMAT_BGR555 = (1 shl 28) or
966
(SDL_PIXELTYPE_PACKED16 shl 24) or
967
(SDL_PACKEDORDER_XBGR shl 20) or
968
(SDL_PACKEDLAYOUT_1555 shl 16) or
972
SDL_PIXELFORMAT_ARGB4444 = (1 shl 28) or
973
(SDL_PIXELTYPE_PACKED16 shl 24) or
974
(SDL_PACKEDORDER_ARGB shl 20) or
975
(SDL_PACKEDLAYOUT_4444 shl 16) or
979
SDL_PIXELFORMAT_RGBA4444 = (1 shl 28) or
980
(SDL_PIXELTYPE_PACKED16 shl 24) or
981
(SDL_PACKEDORDER_RGBA shl 20) or
982
(SDL_PACKEDLAYOUT_4444 shl 16) or
986
SDL_PIXELFORMAT_ABGR4444 = (1 shl 28) or
987
(SDL_PIXELTYPE_PACKED16 shl 24) or
988
(SDL_PACKEDORDER_ABGR shl 20) or
989
(SDL_PACKEDLAYOUT_4444 shl 16) or
993
SDL_PIXELFORMAT_BGRA4444 = (1 shl 28) or
994
(SDL_PIXELTYPE_PACKED16 shl 24) or
995
(SDL_PACKEDORDER_BGRA shl 20) or
996
(SDL_PACKEDLAYOUT_4444 shl 16) or
1000
SDL_PIXELFORMAT_ARGB1555 = (1 shl 28) or
1001
(SDL_PIXELTYPE_PACKED16 shl 24) or
1002
(SDL_PACKEDORDER_ARGB shl 20) or
1003
(SDL_PACKEDLAYOUT_1555 shl 16) or
1007
SDL_PIXELFORMAT_RGBA5551 = (1 shl 28) or
1008
(SDL_PIXELTYPE_PACKED16 shl 24) or
1009
(SDL_PACKEDORDER_RGBA shl 20) or
1010
(SDL_PACKEDLAYOUT_5551 shl 16) or
1014
SDL_PIXELFORMAT_ABGR1555 = (1 shl 28) or
1015
(SDL_PIXELTYPE_PACKED16 shl 24) or
1016
(SDL_PACKEDORDER_ABGR shl 20) or
1017
(SDL_PACKEDLAYOUT_1555 shl 16) or
1021
SDL_PIXELFORMAT_BGRA5551 = (1 shl 28) or
1022
(SDL_PIXELTYPE_PACKED16 shl 24) or
1023
(SDL_PACKEDORDER_BGRA shl 20) or
1024
(SDL_PACKEDLAYOUT_5551 shl 16) or
1028
SDL_PIXELFORMAT_RGB565 = (1 shl 28) or
1029
(SDL_PIXELTYPE_PACKED16 shl 24) or
1030
(SDL_PACKEDORDER_XRGB shl 20) or
1031
(SDL_PACKEDLAYOUT_565 shl 16) or
1035
SDL_PIXELFORMAT_BGR565 = (1 shl 28) or
1036
(SDL_PIXELTYPE_PACKED16 shl 24) or
1037
(SDL_PACKEDORDER_XBGR shl 20) or
1038
(SDL_PACKEDLAYOUT_1555 shl 16) or
1042
SDL_PIXELFORMAT_RGB24 = (1 shl 28) or
1043
(SDL_PIXELTYPE_ARRAYU8 shl 24) or
1044
(SDL_ARRAYORDER_RGB shl 20) or
1049
SDL_PIXELFORMAT_BGR24 = (1 shl 28) or
1050
(SDL_PIXELTYPE_ARRAYU8 shl 24) or
1051
(SDL_ARRAYORDER_BGR shl 20) or
1056
SDL_PIXELFORMAT_RGB888 = (1 shl 28) or
1057
(SDL_PIXELTYPE_PACKED32 shl 24) or
1058
(SDL_PACKEDORDER_XRGB shl 20) or
1059
(SDL_PACKEDLAYOUT_8888 shl 16) or
1063
SDL_PIXELFORMAT_RGBX8888 = (1 shl 28) or
1064
(SDL_PIXELTYPE_PACKED32 shl 24) or
1065
(SDL_PACKEDORDER_RGBX shl 20) or
1066
(SDL_PACKEDLAYOUT_8888 shl 16) or
1070
SDL_PIXELFORMAT_BGR888 = (1 shl 28) or
1071
(SDL_PIXELTYPE_PACKED32 shl 24) or
1072
(SDL_PACKEDORDER_XBGR shl 20) or
1073
(SDL_PACKEDLAYOUT_8888 shl 16) or
1077
SDL_PIXELFORMAT_BGRX8888 = (1 shl 28) or
1078
(SDL_PIXELTYPE_PACKED32 shl 24) or
1079
(SDL_PACKEDORDER_BGRX shl 20) or
1080
(SDL_PACKEDLAYOUT_8888 shl 16) or
1084
SDL_PIXELFORMAT_ARGB8888 = (1 shl 28) or
1085
(SDL_PIXELTYPE_PACKED32 shl 24) or
1086
(SDL_PACKEDORDER_ARGB shl 20) or
1087
(SDL_PACKEDLAYOUT_8888 shl 16) or
1091
SDL_PIXELFORMAT_RGBA8888 = (1 shl 28) or
1092
(SDL_PIXELTYPE_PACKED32 shl 24) or
1093
(SDL_PACKEDORDER_RGBA shl 20) or
1094
(SDL_PACKEDLAYOUT_8888 shl 16) or
1098
SDL_PIXELFORMAT_ABGR8888 = (1 shl 28) or
1099
(SDL_PIXELTYPE_PACKED32 shl 24) or
1100
(SDL_PACKEDORDER_ABGR shl 20) or
1101
(SDL_PACKEDLAYOUT_8888 shl 16) or
1105
SDL_PIXELFORMAT_BGRA8888 = (1 shl 28) or
1106
(SDL_PIXELTYPE_PACKED32 shl 24) or
1107
(SDL_PACKEDORDER_RGBX shl 20) or
1108
(SDL_PACKEDLAYOUT_8888 shl 16) or
1112
SDL_PIXELFORMAT_ARGB2101010 = (1 shl 28) or
1113
(SDL_PIXELTYPE_PACKED32 shl 24) or
1114
(SDL_PACKEDORDER_ARGB shl 20) or
1115
(SDL_PACKEDLAYOUT_2101010 shl 16)or
1119
{**< Planar mode: Y + V + U (3 planes) *}
1120
SDL_PIXELFORMAT_YV12 = (Integer('Y') ) or
1121
(Integer('V') shl 8) or
1122
(Integer('1') shl 16) or
1123
(Integer('2') shl 24);
1124
{**< Planar mode: Y + U + V (3 planes) *}
1125
SDL_PIXELFORMAT_IYUV = (Integer('I') ) or
1126
(Integer('Y') shl 8) or
1127
(Integer('U') shl 16) or
1128
(Integer('V') shl 24);
1129
{**< Packed mode: Y0+U0+Y1+V0 (1 plane) *}
1130
SDL_PIXELFORMAT_YUY2 = (Integer('Y') ) or
1131
(Integer('U') shl 8) or
1132
(Integer('Y') shl 16) or
1133
(Integer('2') shl 24);
1134
{**< Packed mode: U0+Y0+V0+Y1 (1 plane) *}
1135
SDL_PIXELFORMAT_UYVY = (Integer('U') ) or
1136
(Integer('Y') shl 8) or
1137
(Integer('V') shl 16) or
1138
(Integer('Y') shl 24);
1139
{**< Packed mode: Y0+V0+Y1+U0 (1 plane) *}
1140
SDL_PIXELFORMAT_YVYU = (Integer('Y') ) or
1141
(Integer('V') shl 8) or
1142
(Integer('Y') shl 16) or
1143
(Integer('U') shl 24);
1146
PSDL_Color = ^TSDL_Color;
1154
TSDL_Colour = TSDL_Color;
1155
PSDL_Colour = ^TSDL_Colour;
1157
PSDL_Palette = ^TSDL_Palette;
1158
TSDL_Palette = record
1166
* Everything in the pixel format structure is read-only.
1169
PSDL_PixelFormat = ^TSDL_PixelFormat;
1170
TSDL_PixelFormat = record
1172
palette: PSDL_Palette;
1173
BitsPerPixel: UInt8;
1174
BytesPerPixel: UInt8;
1175
padding: array[0..1] of UInt8;
1189
next: PSDL_PixelFormat;
1193
* Get the human readable name of a pixel format
1196
function SDL_GetPixelFormatName(format: UInt32): PAnsiChar cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetPixelFormatName' {$ENDIF};
1199
* Convert one of the enumerated pixel formats to a bpp and RGBA masks.
1201
* SDL_TRUE, or SDL_FALSE if the conversion wasn't possible.
1203
* SDL_MasksToPixelFormatEnum()
1206
function SDL_PixelFormatEnumToMasks(format: UInt32; bpp: PInt; Rmask: PUInt32; Gmask: PUInt32; Bmask: PUInt32; Amask: PUInt32): TSDL_Bool cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_PixelFormatEnumToMasks' {$ENDIF};
1209
* Convert a bpp and RGBA masks to an enumerated pixel format.
1211
* The pixel format, or SDL_PIXELFORMAT_UNKNOWN if the conversion
1214
* SDL_PixelFormatEnumToMasks()
1217
function SDL_MasksToPixelFormatEnum(bpp: SInt32; Rmask: UInt32; Gmask: UInt32; Bmask: UInt32; Amask: UInt32): UInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_MasksToPixelFormatEnum' {$ENDIF};
1220
* Create an SDL_PixelFormat structure from a pixel format enum.
1223
function SDL_AllocFormat(pixel_format: UInt32): PSDL_PixelFormat cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_AllocFormat' {$ENDIF};
1226
* Free an SDL_PixelFormat structure.
1229
procedure SDL_FreeFormat(format: PSDL_PixelFormat) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_FreeFormat' {$ENDIF};
1232
* Create a palette structure with the specified number of color
1235
* A new palette, or nil if there wasn't enough memory.
1237
* The palette entries are initialized to white.
1242
function SDL_AllocPalette(ncolors: SInt32): PSDL_Palette cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_AllocPalette' {$ENDIF};
1245
* Set the palette for a pixel format structure.
1248
function SDL_SetPixelFormatPalette(format: PSDL_PixelFormat; palette: PSDL_Palette): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetPixelFormatPalette' {$ENDIF};
1251
* Set a range of colors in a palette.
1253
* palette The palette to modify.
1254
* colors An array of colors to copy into the palette.
1255
* firstcolor The index of the first palette entry to modify.
1256
* ncolors The number of entries to modify.
1258
* 0 on success, or -1 if not all of the colors could be set.
1261
function SDL_SetPaletteColors(palette: PSDL_Palette; const colors: PSDL_Color; firstcolor: SInt32; ncolors: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetPaletteColors' {$ENDIF};
1264
* Free a palette created with SDL_AllocPalette().
1266
* SDL_AllocPalette()
1269
procedure SDL_FreePalette(palette: PSDL_Palette) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_FreePalette' {$ENDIF};
1272
* Maps an RGB triple to an opaque pixel value for a given pixel format.
1277
function SDL_MapRGB(const format: PSDL_PixelFormat; r: UInt8; g: UInt8; b: UInt8): UInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_MapRGB' {$ENDIF};
1280
* Maps an RGBA quadruple to a pixel value for a given pixel format.
1285
function SDL_MapRGBA(const format: PSDL_PixelFormat; r: UInt8; g: UInt8; b: UInt8; a: UInt8): UInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_MapRGBA' {$ENDIF};
1288
* Get the RGB components from a pixel of the specified format.
1293
procedure SDL_GetRGB(pixel: UInt32; const format: PSDL_PixelFormat; r: PUInt8; g: PUInt8; b: PUInt8) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetRGB' {$ENDIF};
1296
* Get the RGBA components from a pixel of the specified format.
1301
procedure SDL_GetRGBA(pixel: UInt32; const format: PSDL_PixelFormat; r: PUInt8; g: PUInt8; b: PUInt8; a: PUInt8) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetRGBA' {$ENDIF};
1304
* Calculate a 256 entry gamma ramp for a gamma value.
1307
procedure SDL_CalculateGammaRamp(gamma: Float; ramp: PUInt16) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_CalculateGammaRamp' {$ENDIF};
1311
////////////////////////////////////////////////////////////////////////////////////////////////////////
1312
////////////////////// SDL_rect.h ////////////////////////////////////////////////////
1313
////////////////////////////////////////////////////////////////////////////////////////////////////////
1317
* The structure that defines a point
1322
PSDL_Point = ^TSDL_Point;
1329
* A rectangle, with the origin at the upper left.
1333
* SDL_HasIntersection
1339
PSDL_Rect = ^TSDL_Rect;
1346
* Returns true if the rectangle has no area.
1349
//changed from variant(b?????h!) to TSDL_Rect
1351
function SDL_RectEmpty(X: TSDL_Rect): Boolean;
1354
* Returns true if the two rectangles are equal.
1357
function SDL_RectEquals(A: TSDL_Rect; B: TSDL_Rect): Boolean;
1360
* Determine whether two rectangles intersect.
1362
* SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
1365
function SDL_HasIntersection(const A: PSDL_Rect; const B: PSDL_Rect): TSDL_Bool cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_HasIntersection' {$ENDIF};
1368
* Calculate the intersection of two rectangles.
1370
* SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
1373
function SDL_IntersectRect(const A: PSDL_Rect; const B: PSDL_Rect; result: PSDL_Rect): TSDL_Bool cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_IntersectRect' {$ENDIF};
1376
* Calculate the union of two rectangles.
1379
procedure SDL_UnionRect(const A: PSDL_Rect; const B: PSDL_Rect; result: PSDL_Rect) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_UnionRect' {$ENDIF};
1382
* Calculate a minimal rectangle enclosing a set of points
1384
* SDL_TRUE if any points were within the clipping rect
1387
function SDL_EnclosePoints(const points: PSDL_Point; count: SInt32; const clip: PSDL_Rect; result: PSDL_Rect): TSDL_Bool cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_EnclosePoints' {$ENDIF};
1390
* Calculate the intersection of a rectangle and line segment.
1392
* SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
1395
function SDL_IntersectRectAndLine(const rect: PSDL_Rect; X1: PInt; Y1: PInt; X2: PInt; Y2: PInt): TSDL_Bool cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_IntersectRectAndLine' {$ENDIF};
1399
////////////////////////////////////////////////////////////////////////////////////////////////////////
1400
////////////////////// SDL_rwops.h ////////////////////////////////////////////////////
1401
////////////////////////////////////////////////////////////////////////////////////////////////////////
1405
SDL_RWOPS_UNKNOWN = 0; {* Unknown stream type *}
1406
SDL_RWOPS_WINFILE = 1; {* Win32 file *}
1407
SDL_RWOPS_STDFILE = 2; {* Stdio file *}
1408
SDL_RWOPS_JNIFILE = 3; {* Android asset *}
1409
SDL_RWOPS_MEMORY = 4; {* Memory stream *}
1410
SDL_RWOPS_MEMORY_RO = 5; {* Read-Only memory stream *}
1413
PSDL_RWops = ^TSDL_RWops;
1416
* This is the read/write operation structure -- very basic.
1420
* Return the size of the file in this rwops, or -1 if unknown
1422
TSize = function(context: PSDL_RWops): SInt64; cdecl;
1425
* Seek to offset relative to whence, one of stdio's whence values:
1426
* RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END
1428
* the final offset in the data stream, or -1 on error.
1430
TSeek = function(context: PSDL_RWops; offset: SInt64; whence: SInt32): SInt64; cdecl;
1433
* Read up to maxnum objects each of size size from the data
1434
* stream to the area pointed at by ptr.
1436
* the number of objects read, or 0 at error or end of file.
1439
TRead = function(context: PSDL_RWops; ptr: Pointer; size: size_t; maxnum: size_t): size_t; cdecl;
1442
* Write exactly num objects each of size size from the area
1443
* pointed at by ptr to data stream.
1445
* the number of objects written, or 0 at error or end of file.
1448
TWrite = function(context: PSDL_RWops; const ptr: Pointer; size: size_t; num: size_t): size_t; cdecl;
1451
* Close and free an allocated SDL_RWops structure.
1453
* 0 if successful or -1 on write error when flushing data.
1456
TClose = function(context: PSDL_RWops): SInt32; cdecl;
1459
autoclose: TSDL_Bool;
1474
fileNameRef: Pointer;
1475
inputStreamRef: Pointer;
1476
readableByteChannelRef: Pointer;
1477
readMethod: Pointer;
1478
assetFileDescriptorRef: Pointer;
1485
TWindowsIOBuffer = record
1494
buffer: TWindowsIOBuffer;
1497
TSDL_RWops = packed record
1509
2: (unknown: TUnknown);
1511
3: (androidio: TAndroidIO);
1514
3: (windowsio: TWindowsIO);
1521
* Functions to create SDL_RWops structures from various data streams.
1524
function SDL_RWFromFile(const _file: PAnsiChar; const mode: PAnsiChar): PSDL_RWops; cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RWFromFile' {$ENDIF};
1526
{function SDL_RWFromFP(fp: file; autoclose: TSDL_Bool): PSDL_RWops; cdecl; external SDL_LibName;} //don't know if this works
1528
function SDL_RWFromFP(fp: Pointer; autoclose: TSDL_Bool): PSDL_RWops; cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RWFromFP' {$ENDIF};
1530
function SDL_RWFromMem(mem: Pointer; size: SInt32): PSDL_RWops; cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RWFromMem' {$ENDIF};
1531
function SDL_RWFromConstMem(const mem: Pointer; size: SInt32): PSDL_RWops; cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RWFromConstMem' {$ENDIF};
1536
function SDL_AllocRW: PSDL_RWops; cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_AllocRW' {$ENDIF};
1537
procedure SDL_FreeRW(area: PSDL_RWops); cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_FreeRW' {$ENDIF};
1540
RW_SEEK_SET = 0; {**< Seek from the beginning of data *}
1541
RW_SEEK_CUR = 1; {**< Seek relative to current read point *}
1542
RW_SEEK_END = 2; {**< Seek relative to the end of data *}
1547
* Macros to easily read and write from an SDL_RWops structure.
1550
function SDL_RWsize(ctx: PSDL_RWops): SInt64;
1551
function SDL_RWseek(ctx: PSDL_RWops; offset: SInt64; whence: SInt32): SInt64;
1552
function SDL_RWtell(ctx: PSDL_RWops): SInt64;
1553
function SDL_RWread(ctx: PSDL_RWops; ptr: Pointer; size: size_t; n: size_t): size_t;
1554
function SDL_RWwrite(ctx: PSDL_RWops; ptr: Pointer; size: size_t; n: size_t): size_t;
1555
function SDL_RWclose(ctx: PSDL_RWops): SInt32;
1556
{ Read/write macros }
1560
* Read endian functions
1562
* Read an item of the specified endianness and return in native format.
1565
function SDL_ReadU8(src: PSDL_RWops): UInt8 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_ReadU8' {$ENDIF};
1566
function SDL_ReadLE16(src: PSDL_RWops): UInt16 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_ReadLE16' {$ENDIF};
1567
function SDL_ReadBE16(src: PSDL_RWops): UInt16 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_ReadBE16' {$ENDIF};
1568
function SDL_ReadLE32(src: PSDL_RWops): UInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_ReadLE32' {$ENDIF};
1569
function SDL_ReadBE32(src: PSDL_RWops): UInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_ReadBE32' {$ENDIF};
1570
function SDL_ReadLE64(src: PSDL_RWops): UInt64 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_ReadLE64' {$ENDIF};
1571
function SDL_ReadBE64(src: PSDL_RWops): UInt64 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_ReadBE64' {$ENDIF};
1573
{*Read endian functions*}
1576
* Write endian functions
1578
* Write an item of native format to the specified endianness.
1581
function SDL_WriteU8(dst: PSDL_RWops; value: UInt8): size_t cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_WriteU8' {$ENDIF};
1582
function SDL_WriteLE16(dst: PSDL_RWops; value: UInt16): size_t cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_WriteLE16' {$ENDIF};
1583
function SDL_WriteBE16(dst: PSDL_RWops; value: UInt16): size_t cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_WriteBE16' {$ENDIF};
1584
function SDL_WriteLE32(dst: PSDL_RWops; value: UInt32): size_t cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_WriteLE32' {$ENDIF};
1585
function SDL_WriteBE32(dst: PSDL_RWops; value: UInt32): size_t cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_WriteBE32' {$ENDIF};
1586
function SDL_WriteLE64(dst: PSDL_RWops; value: UInt64): size_t cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_WriteLE64' {$ENDIF};
1587
function SDL_WriteBE64(dst: PSDL_RWops; value: UInt64): size_t cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_WriteBE64' {$ENDIF};
1588
{ Write endian functions }
1592
////////////////////////////////////////////////////////////////////////////////////////////////////////
1593
////////////////////// SDL_blendmode.h ////////////////////////////////////////////////////
1594
////////////////////////////////////////////////////////////////////////////////////////////////////////
1597
* The blend mode used in SDL_RenderCopy() and drawing operations.
1601
PSDL_BlendMode = ^TSDL_BlendMode;
1602
TSDL_BlendMode = DWord;
1605
SDL_BLENDMODE_NONE = $00000000; {**< No blending *}
1606
SDL_BLENDMODE_BLEND = $00000001; {**< dst = (src * A) + (dst * (1-A)) *}
1607
SDL_BLENDMODE_ADD = $00000002; {**< dst = (src * A) + dst *}
1608
SDL_BLENDMODE_MOD = $00000004; {**< dst = src * dst *}
1612
////////////////////////////////////////////////////////////////////////////////////////////////////////
1613
////////////////////// SDL_surface.h ////////////////////////////////////////////////////
1614
////////////////////////////////////////////////////////////////////////////////////////////////////////
1620
* These are the currently supported flags for the ::SDL_surface.
1622
* Used internally (read-only).
1625
SDL_SWSURFACE = 0; {**< Just here for compatibility *}
1626
SDL_PREALLOC = $00000001; {**< Surface uses preallocated memory *}
1627
SDL_RLEACCEL = $00000002; {**< Surface is RLE encoded *}
1628
SDL_DONTFREE = $00000004; {**< Surface is referenced internally *}
1633
* Evaluates to true if the surface needs to be locked before access.
1636
//SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
1640
* A collection of pixels used in software blitting.
1642
* This structure should be treated as read-only, except for \c pixels,
1643
* which, if not NULL, contains the raw pixel data for the surface.
1646
PSDL_BlitMap = ^TSDL_BlitMap;
1647
TSDL_BlitMap = record
1651
PSDL_Surface = ^TSDL_Surface;
1652
TSDL_Surface = record
1653
flags: UInt32; {**< Read-only *}
1654
format: PSDL_PixelFormat; {**< Read-only *}
1655
w, h: SInt32; {**< Read-only *}
1656
pitch: SInt32; {**< Read-only *}
1657
pixels: Pointer; {**< Read-write *}
1659
{** Application data associated with the surface *}
1660
userdata: Pointer; {**< Read-write *}
1662
{** information needed for surfaces requiring locks *}
1663
locked: SInt32; {**< Read-only *}
1664
lock_data: Pointer; {**< Read-only *}
1666
{** clipping information *}
1667
clip_rect: PSDL_Rect; {**< Read-only *}
1669
{** info for fast blit mapping to other surfaces *}
1670
map: Pointer; {**< Private *} //SDL_BlitMap
1672
{** Reference count -- used when freeing surface *}
1673
refcount: SInt32; {**< Read-mostly *}
1677
* The type of function used for surface blitting functions.
1680
TSDL_Blit = function(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): SInt32;
1683
* Allocate and free an RGB surface.
1685
* If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
1686
* If the depth is greater than 8 bits, the pixel format is set using the
1687
* flags '[RGB]mask'.
1689
* If the function runs out of memory, it will return NULL.
1691
* flags The flags are obsolete and should be set to 0.
1694
function SDL_CreateRGBSurface(flags: UInt32; width: SInt32; height: SInt32; depth: SInt32; Rmask: UInt32; Gmask: UInt32; Bmask: UInt32; Amask: UInt32): PSDL_Surface cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_CreateRGBSurface' {$ENDIF};
1695
function SDL_CreateRGBSurfaceFrom(pixels: Pointer; width: SInt32; height: SInt32; depth: SInt32; pitch: SInt32; Rmask: UInt32; Gmask: UInt32; Bmask: UInt32; Amask: UInt32): PSDL_Surface cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_CreateRGBSurfaceFrom' {$ENDIF};
1696
procedure SDL_FreeSurface(surface: PSDL_Surface) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_FreeSurface' {$ENDIF};
1699
* Set the palette used by a surface.
1701
* 0, or -1 if the surface format doesn't use a palette.
1703
* A single palette can be shared with many surfaces.
1706
function SDL_SetSurfacePalette(surface: PSDL_Surface; palette: PSDL_Palette): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetSurfacePalette' {$ENDIF};
1709
* Sets up a surface for directly accessing the pixels.
1711
* Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write
1712
* to and read from surface.pixels, using the pixel format stored in
1713
* surface.format. Once you are done accessing the surface, you should
1714
* use SDL_UnlockSurface() to release it.
1716
* Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates
1717
* to 0, then you can read and write to the surface at any time, and the
1718
* pixel format of the surface will not change.
1720
* No operating system or library calls should be made between lock/unlock
1721
* pairs, as critical system locks may be held during this time.
1723
* SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
1725
* SDL_UnlockSurface()
1728
function SDL_LockSurface(surface: PSDL_Surface): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_LockSurface' {$ENDIF};
1730
{** SDL_LockSurface() *}
1732
procedure SDL_UnlockSurface(surface: PSDL_Surface) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_UnlockSurface' {$ENDIF};
1735
* Load a surface from a seekable SDL data stream (memory or file).
1737
* If freesrc is non-zero, the stream will be closed after being read.
1739
* The new surface should be freed with SDL_FreeSurface().
1741
* the new surface, or NULL if there was an error.
1744
function SDL_LoadBMP_RW(src: PSDL_RWops; freesrc: SInt32): PSDL_Surface cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_LoadBMP_RW' {$ENDIF};
1747
* Load a surface from a file.
1749
* Convenience macro.
1752
function SDL_LoadBMP(_file: PAnsiChar): PSDL_Surface;
1755
* Save a surface to a seekable SDL data stream (memory or file).
1757
* If freedst is non-zero, the stream will be closed after being written.
1759
* 0 if successful or -1 if there was an error.
1762
function SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_LoadBMP_RW' {$ENDIF};
1765
* Save a surface to a file.
1767
* Convenience macro.
1770
#define SDL_SaveBMP(surface, file) \
1771
SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
1774
function SDL_SaveBMP(surface: PSDL_Surface; _file: PAnsiChar): SInt32;
1777
* Sets the RLE acceleration hint for a surface.
1779
* 0 on success, or -1 if the surface is not valid
1781
* If RLE is enabled, colorkey and alpha blending blits are much faster,
1782
* but the surface must be locked before directly accessing the pixels.
1785
function SDL_SetSurfaceRLE(surface: PSDL_Surface; flag: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetSurfaceRLE' {$ENDIF};
1788
* Sets the color key (transparent pixel) in a blittable surface.
1790
* surface The surface to update
1791
* flag Non-zero to enable colorkey and 0 to disable colorkey
1792
* key The transparent pixel in the native surface format
1794
* 0 on success, or -1 if the surface is not valid
1796
* You can pass SDL_RLEACCEL to enable RLE accelerated blits.
1799
function SDL_SetColorKey(surface: PSDL_Surface; flag: SInt32; key: UInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetColorKey' {$ENDIF};
1802
* Gets the color key (transparent pixel) in a blittable surface.
1804
* surface The surface to update
1805
* key A pointer filled in with the transparent pixel in the native
1808
* 0 on success, or -1 if the surface is not valid or colorkey is not
1812
function SDL_GetColorKey(surface: PSDL_Surface; key: PUInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetColorKey' {$ENDIF};
1815
* Set an additional color value used in blit operations.
1817
* surface The surface to update.
1818
* r The red color value multiplied into blit operations.
1819
* g The green color value multiplied into blit operations.
1820
* b The blue color value multiplied into blit operations.
1822
* 0 on success, or -1 if the surface is not valid.
1824
* SDL_GetSurfaceColorMod()
1827
function SDL_SetSurfaceColorMod(surface: PSDL_Surface; r: UInt8; g: UInt8; b: UInt8): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetSurfaceColorMod' {$ENDIF};
1830
* Get the additional color value used in blit operations.
1832
* surface The surface to query.
1833
* r A pointer filled in with the current red color value.
1834
* g A pointer filled in with the current green color value.
1835
* b A pointer filled in with the current blue color value.
1837
* 0 on success, or -1 if the surface is not valid.
1839
* SDL_SetSurfaceColorMod()
1842
function SDL_GetSurfaceColorMod(surface: PSDL_Surface; r: PUInt8; g: PUInt8; b: PUInt8): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetSurfaceColorMod' {$ENDIF};
1845
* Set an additional alpha value used in blit operations.
1847
* surface The surface to update.
1848
* alpha The alpha value multiplied into blit operations.
1850
* 0 on success, or -1 if the surface is not valid.
1852
* SDL_GetSurfaceAlphaMod()
1855
function SDL_SetSurfaceAlphaMod(surface: PSDL_Surface; alpha: UInt8): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetSurfaceAlphaMod' {$ENDIF};
1858
* Get the additional alpha value used in blit operations.
1860
* surface The surface to query.
1861
* alpha A pointer filled in with the current alpha value.
1863
* 0 on success, or -1 if the surface is not valid.
1865
* SDL_SetSurfaceAlphaMod()
1868
function SDL_GetSurfaceAlphaMod(surface: PSDL_Surface; alpha: PUInt8): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetSurfaceAlphaMod' {$ENDIF};
1871
* Set the blend mode used for blit operations.
1873
* surface The surface to update.
1874
* blendMode ::SDL_BlendMode to use for blit blending.
1876
* 0 on success, or -1 if the parameters are not valid.
1878
* SDL_GetSurfaceBlendMode()
1881
function SDL_SetSurfaceBlendMode(surface: PSDL_Surface; blendMode: TSDL_BlendMode): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetSurfaceBlendMode' {$ENDIF};
1884
* Get the blend mode used for blit operations.
1886
* surface The surface to query.
1887
* blendMode A pointer filled in with the current blend mode.
1889
* 0 on success, or -1 if the surface is not valid.
1891
* SDL_SetSurfaceBlendMode()
1894
function SDL_GetSurfaceBlendMode(surface: PSDL_Surface; blendMode: PSDL_BlendMode): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetSurfaceBlendMode' {$ENDIF};
1897
* Sets the clipping rectangle for the destination surface in a blit.
1899
* If the clip rectangle is NULL, clipping will be disabled.
1901
* If the clip rectangle doesn't intersect the surface, the function will
1902
* return SDL_FALSE and blits will be completely clipped. Otherwise the
1903
* function returns SDL_TRUE and blits to the surface will be clipped to
1904
* the intersection of the surface area and the clipping rectangle.
1906
* Note that blits are automatically clipped to the edges of the source
1907
* and destination surfaces.
1910
function SDL_SetClipRect(surface: PSDL_Surface; const rect: PSDL_Rect): TSDL_Bool cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetClipRect' {$ENDIF};
1913
* Gets the clipping rectangle for the destination surface in a blit.
1915
* rect must be a pointer to a valid rectangle which will be filled
1916
* with the correct values.
1919
procedure SDL_GetClipRect(surface: PSDL_Surface; rect: PSDL_Rect) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetClipRect' {$ENDIF};
1922
* Creates a new surface of the specified format, and then copies and maps
1923
* the given surface to it so the blit of the converted surface will be as
1924
* fast as possible. If this function fails, it returns NULL.
1926
* The flags parameter is passed to SDL_CreateRGBSurface() and has those
1927
* semantics. You can also pass SDL_RLEACCEL in the flags parameter and
1928
* SDL will try to RLE accelerate colorkey and alpha blits in the resulting
1932
function SDL_ConvertSurface(src: PSDL_Surface; fmt: PSDL_PixelFormat; flags: UInt32): PSDL_Surface cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_ConvertSurface' {$ENDIF};
1933
function SDL_ConvertSurfaceFormat(src: PSDL_Surface; pixel_format: UInt32; flags: UInt32): PSDL_Surface cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_ConvertSurfaceFormat' {$ENDIF};
1936
* Copy a block of pixels of one format to another format
1938
* 0 on success, or -1 if there was an error
1941
function SDL_ConvertPixels(width: SInt32; height: SInt32; src_format: UInt32; const src: Pointer; src_pitch: SInt32; dst_format: UInt32; dst: Pointer; dst_pitch: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_ConvertPixels' {$ENDIF};
1944
* Performs a fast fill of the given rectangle with color.
1946
* If rect is NULL, the whole surface will be filled with color.
1948
* The color should be a pixel of the format used by the surface, and
1949
* can be generated by the SDL_MapRGB() function.
1951
* 0 on success, or -1 on error.
1954
function SDL_FillRect(dst: PSDL_Surface; const rect: PSDL_Rect; color: UInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_FillRect' {$ENDIF};
1955
function SDL_FillRects(dst: PSDL_Surface; const rects: PSDL_Rect; count: SInt32; color: UInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_FillRects' {$ENDIF};
1958
* Performs a fast blit from the source surface to the destination surface.
1960
* This assumes that the source and destination rectangles are
1961
* the same size. If either \c srcrect or \c dstrect are NULL, the entire
1962
* surface ( src or dst) is copied. The final blit rectangles are saved
1963
* in srcrect and dstrect after all clipping is performed.
1965
* If the blit is successful, it returns 0, otherwise it returns -1.
1967
* The blit function should not be called on a locked surface.
1969
* The blit semantics for surfaces with and without alpha and colorkey
1970
* are defined as follows:
1974
alpha-blend (using alpha-channel).
1975
SDL_SRCCOLORKEY ignored.
1976
SDL_SRCALPHA not set:
1978
if SDL_SRCCOLORKEY set, only copy the pixels matching the
1979
RGB values of the source colour key, ignoring alpha in the
1984
alpha-blend (using the source per-surface alpha value);
1985
set destination alpha to opaque.
1986
SDL_SRCALPHA not set:
1987
copy RGB, set destination alpha to source per-surface alpha value.
1989
if SDL_SRCCOLORKEY set, only copy the pixels matching the
1994
alpha-blend (using the source alpha channel) the RGB values;
1995
leave destination alpha untouched. [Note: is this correct?]
1996
SDL_SRCCOLORKEY ignored.
1997
SDL_SRCALPHA not set:
1998
copy all of RGBA to the destination.
1999
if SDL_SRCCOLORKEY set, only copy the pixels matching the
2000
RGB values of the source colour key, ignoring alpha in the
2005
alpha-blend (using the source per-surface alpha value).
2006
SDL_SRCALPHA not set:
2009
if SDL_SRCCOLORKEY set, only copy the pixels matching the
2012
* You should call SDL_BlitSurface() unless you know exactly how SDL
2013
* blitting works internally and how to use the other blit functions.
2017
* This is the public blit function, SDL_BlitSurface(), and it performs
2018
* rectangle validation and clipping before passing it to SDL_LowerBlit()
2021
function SDL_UpperBlit(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_UpperBlit' {$ENDIF};
2023
//SDL_BlitSurface = SDL_UpperBlit;
2026
* This is a semi-private blit function and it performs low-level surface
2030
function SDL_LowerBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_LowerBlit' {$ENDIF};
2033
* Perform a fast, low quality, stretch blit between two surfaces of the
2034
* same pixel format.
2036
* This function uses a static buffer, and is not thread-safe.
2039
function SDL_SoftStretch(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; const dstrect: PSDL_Surface): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SoftStretch' {$ENDIF};
2041
//SDL_BlitScaled = SDL_UpperBlitScaled;
2044
* This is the public scaled blit function, SDL_BlitScaled(), and it performs
2045
* rectangle validation and clipping before passing it to SDL_LowerBlitScaled()
2048
function SDL_UpperBlitScaled(src: PSDL_Surface; const srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_UpperBlitScaled' {$ENDIF};
2051
* This is a semi-private blit function and it performs low-level surface
2052
* scaled blitting only.
2055
function SDL_LowerBlitScaled(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_LowerBlitScaled' {$ENDIF};
2059
////////////////////////////////////////////////////////////////////////////////////////////////////////
2060
////////////////////// SDL_shape.h ////////////////////////////////////////////////////
2061
////////////////////////////////////////////////////////////////////////////////////////////////////////
2065
* Header file for the shaped window API.
2068
SDL_NONSHAPEABLE_WINDOW = -1;
2069
SDL_INVALID_SHAPE_ARGUMENT = -2;
2070
SDL_WINDOW_LACKS_SHAPE = -3;
2073
PPSDL_Window = ^PSDL_Window;
2074
PSDL_Window = ^TSDL_Window;
2076
{** An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. *}
2077
TWindowShapeMode = ({** The default mode, a binarized alpha cutoff of 1. *}
2079
{** A binarized alpha cutoff with a given integer value. *}
2080
ShapeModeBinarizeAlpha,
2081
{** A binarized alpha cutoff with a given integer value, but with the opposite comparison. *}
2082
ShapeModeReverseBinarizeAlpha,
2083
{** A color key is applied. *}
2086
//#define SDL_SHAPEMODEALPHA(mode) (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha)
2088
{** A union containing parameters for shaped windows. *}
2089
TSDL_WindowShapeParams = record
2091
{** a cutoff alpha value for binarization of the window shape's alpha channel. *}
2092
0: (binarizationCutoff: UInt8;);
2093
1: (colorKey: TSDL_Color;);
2096
{** A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. *}
2097
PSDL_WindowShapeMode = ^TSDL_WindowShapeMode;
2098
TSDL_WindowShapeMode = record
2099
{** The mode of these window-shape parameters. *}
2100
mode: TWindowShapeMode;
2101
{** Window-shape parameters. *}
2102
parameters: TSDL_WindowShapeParams;
2107
////////////////////////////////////////////////////////////////////////////////////////////////////////
2108
////////////////////// SDL_video.h ////////////////////////////////////////////////////
2109
////////////////////////////////////////////////////////////////////////////////////////////////////////
2112
* The structure that defines a display mode
2114
* SDL_GetNumDisplayModes()
2115
* SDL_GetDisplayMode()
2116
* SDL_GetDesktopDisplayMode()
2117
* SDL_GetCurrentDisplayMode()
2118
* SDL_GetClosestDisplayMode()
2119
* SDL_SetWindowDisplayMode()
2120
* SDL_GetWindowDisplayMode()
2123
PSDL_DisplayMode = ^TSDL_DisplayMode;
2124
TSDL_DisplayMode = record
2125
format: UInt32; {**< pixel format *}
2126
w: SInt32; {**< width *}
2127
h: SInt32; {**< height *}
2128
refresh_rate: SInt32; {**< refresh rate (or zero for unspecified) *}
2129
driverdata: Pointer; {**< driver-specific data, initialize to 0 *}
2132
{* Define the SDL window-shaper structure *}
2133
PSDL_WindowShaper = ^TSDL_WindowShaper;
2134
TSDL_WindowShaper = record
2135
{* The window associated with the shaper *}
2136
window: PSDL_Window;
2138
{* The user's specified coordinates for the window, for once we give it a shape. *}
2139
userx,usery: UInt32;
2141
{* The parameters for shape calculation. *}
2142
mode: TSDL_WindowShapeMode;
2144
{* Has this window been assigned a shape? *}
2145
hasshape: TSDL_Bool;
2147
driverdata: Pointer;
2150
PSDL_WindowUserData = ^TSDL_WindowUserData;
2151
TSDL_WindowUserData = record
2154
next: PSDL_WindowUserData;
2157
{* Define the SDL window structure, corresponding to toplevel windows *}
2158
TSDL_Window = record
2162
fin_UTF8_title: SInt32; // esta variable est� puesta porque la �ltima versi�n SDL2.dll devuelve un caracter de m�s en el title y se desplazan todos los otros campos
2165
min_w, min_h: SInt32;
2166
max_w, max_h: SInt32;
2169
{* Stored position and size for windowed mode * }
2170
windowed: TSDL_Rect;
2172
fullscreen_mode: TSDL_DisplayMode;
2176
saved_gamma: PUInt16; {* (just offset into gamma) *}
2178
surface: PSDL_Surface;
2179
surface_valid: TSDL_Bool;
2181
shaper: PSDL_WindowShaper;
2183
data: PSDL_WindowUserData;
2185
driverdata: Pointer;
2192
* Get the shape parameters of a shaped window.
2194
* window The shaped window whose parameters should be retrieved.
2195
* shape_mode An empty shape-mode structure to fill, or NULL to check whether the window has a shape.
2197
* 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode
2198
* data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if
2199
* the SDL_Window* given is a shapeable window currently lacking a shape.
2201
* SDL_WindowShapeMode
2202
* SDL_SetWindowShape
2204
function SDL_GetShapedWindowMode(window: PSDL_Window; shape_mode: TSDL_WindowShapeMode): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetShapedWindowMode' {$ENDIF};
2207
* Set the shape and parameters of a shaped window.
2209
* window The shaped window whose parameters should be set.
2210
* shape A surface encoding the desired shape for the window.
2211
* shape_mode The parameters to set for the shaped window.
2213
* 0 on success, SDL_INVALID_SHAPE_ARGUMENT on invalid an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW
2214
* if the SDL_Window* given does not reference a valid shaped window.
2216
* SDL_WindowShapeMode
2217
* SDL_GetShapedWindowMode.
2219
function SDL_SetWindowShape(window: PSDL_Window; shape: PSDL_Surface; shape_mode: PSDL_WindowShapeMode): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetWindowShape' {$ENDIF};
2222
* Create a window that can be shaped with the specified position, dimensions, and flags.
2224
* title The title of the window, in UTF-8 encoding.
2225
* x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
2226
* ::SDL_WINDOWPOS_UNDEFINED.
2227
* y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
2228
* ::SDL_WINDOWPOS_UNDEFINED.
2229
* w The width of the window.
2230
* h The height of the window.
2231
* flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following:
2232
* SDL_WINDOW_OPENGL, SDL_WINDOW_INPUT_GRABBED,
2233
* SDL_WINDOW_SHOWN, SDL_WINDOW_RESIZABLE,
2234
* SDL_WINDOW_MAXIMIZED, SDL_WINDOW_MINIMIZED,
2235
* SDL_WINDOW_BORDERLESS is always set, and SDL_WINDOW_FULLSCREEN is always unset.
2237
* The window created, or NULL if window creation failed.
2239
* SDL_DestroyWindow()
2241
function SDL_CreateShapedWindow(title: PAnsiChar; x: UInt32; y: UInt32; w: UInt32; h: UInt32; flags: UInt32): PSDL_Window cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_CreateShapedWindow' {$ENDIF};
2244
* Return whether the given window is a shaped window.
2246
* window The window to query for being shaped.
2248
* SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL.
2249
* SDL_CreateShapedWindow
2251
function SDL_IsShapedWindow(window: PSDL_Window): TSDL_Bool cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_IsShapedWindow' {$ENDIF};
2254
* The type used to identify a window
2256
* SDL_CreateWindow()
2257
* SDL_CreateWindowFrom()
2258
* SDL_DestroyWindow()
2259
* SDL_GetWindowData()
2260
* SDL_GetWindowFlags()
2261
* SDL_GetWindowGrab()
2262
* SDL_GetWindowPosition()
2263
* SDL_GetWindowSize()
2264
* SDL_GetWindowTitle()
2266
* SDL_MaximizeWindow()
2267
* SDL_MinimizeWindow()
2269
* SDL_RestoreWindow()
2270
* SDL_SetWindowData()
2271
* SDL_SetWindowFullscreen()
2272
* SDL_SetWindowGrab()
2273
* SDL_SetWindowIcon()
2274
* SDL_SetWindowPosition()
2275
* SDL_SetWindowSize()
2276
* SDL_SetWindowBordered()
2277
* SDL_SetWindowTitle()
2283
* The flags on a window
2285
* SDL_GetWindowFlags()
2288
SDL_WINDOW_FULLSCREEN = $00000001; {**< fullscreen window *}
2289
SDL_WINDOW_OPENGL = $00000002; {**< window usable with OpenGL context *}
2290
SDL_WINDOW_SHOWN = $00000004; {**< window is visible *}
2291
SDL_WINDOW_HIDDEN = $00000008; {**< window is not visible *}
2292
SDL_WINDOW_BORDERLESS = $00000010; {**< no window decoration *}
2293
SDL_WINDOW_RESIZABLE = $00000020; {**< window can be resized *}
2294
SDL_WINDOW_MINIMIZED = $00000040; {**< window is minimized *}
2295
SDL_WINDOW_MAXIMIZED = $00000080; {**< window is maximized *}
2296
SDL_WINDOW_INPUT_GRABBED = $00000100; {**< window has grabbed input focus *}
2297
SDL_WINDOW_INPUT_FOCUS = $00000200; {**< window has input focus *}
2298
SDL_WINDOW_MOUSE_FOCUS = $00000400; {**< window has mouse focus *}
2299
SDL_WINDOW_FULLSCREEN_DESKTOP = SDL_WINDOW_FULLSCREEN or $00001000;
2300
SDL_WINDOW_FOREIGN = $00000800; {**< window not created by SDL *}
2303
TSDL_WindowFlags = DWord;
2305
function SDL_WindowPos_IsUndefined(X: Variant): Variant;
2306
function SDL_WindowPos_IsCentered(X: Variant): Variant;
2310
* Used to indicate that you don't care what the window position is.
2313
SDL_WINDOWPOS_UNDEFINED_MASK = $1FFF0000;
2314
SDL_WINDOWPOS_UNDEFINED = SDL_WINDOWPOS_UNDEFINED_MASK or 0;
2318
* Used to indicate that the window position should be centered.
2321
SDL_WINDOWPOS_CENTERED_MASK = $2FFF0000;
2322
SDL_WINDOWPOS_CENTERED = SDL_WINDOWPOS_CENTERED_MASK or 0;
2325
* Event subtype for window events
2328
SDL_WINDOWEVENT_NONE = 0; {**< Never used *}
2329
SDL_WINDOWEVENT_SHOWN = 1; {**< Window has been shown *}
2330
SDL_WINDOWEVENT_HIDDEN = 2; {**< Window has been hidden *}
2331
SDL_WINDOWEVENT_EXPOSED = 3; {**< Window has been exposed and should be redrawn *}
2332
SDL_WINDOWEVENT_MOVED = 4; {**< Window has been moved to data1; data2 *}
2333
SDL_WINDOWEVENT_RESIZED = 5; {**< Window has been resized to data1xdata2 *}
2334
SDL_WINDOWEVENT_SIZE_CHANGED = 6; {**< The window size has changed; either as a result of an API call or through the system or user changing the window size. *}
2335
SDL_WINDOWEVENT_MINIMIZED = 7; {**< Window has been minimized *}
2336
SDL_WINDOWEVENT_MAXIMIZED = 8; {**< Window has been maximized *}
2337
SDL_WINDOWEVENT_RESTORED = 9; {**< Window has been restored to normal size and position *}
2338
SDL_WINDOWEVENT_ENTER = 10; {**< Window has gained mouse focus *}
2339
SDL_WINDOWEVENT_LEAVE = 11; {**< Window has lost mouse focus *}
2340
SDL_WINDOWEVENT_FOCUS_GAINED = 12; {**< Window has gained keyboard focus *}
2341
SDL_WINDOWEVENT_FOCUS_LOST = 13; {**< Window has lost keyboard focus *}
2342
SDL_WINDOWEVENT_CLOSE = 14; {**< The window manager requests that the window be closed *}
2345
TSDL_WindowEventID = DWord;
2348
* An opaque handle to an OpenGL context.
2351
TSDL_GLContext = Pointer;
2354
* OpenGL configuration attributes
2358
SDL_GL_RED_SIZE = 0;
2359
SDL_GL_GREEN_SIZE = 1;
2360
SDL_GL_BLUE_SIZE = 2;
2361
SDL_GL_ALPHA_SIZE = 3;
2362
SDL_GL_BUFFER_SIZE = 4;
2363
SDL_GL_DOUBLEBUFFER = 5;
2364
SDL_GL_DEPTH_SIZE = 6;
2365
SDL_GL_STENCIL_SIZE = 7;
2366
SDL_GL_ACCUM_RED_SIZE = 8;
2367
SDL_GL_ACCUM_GREEN_SIZE = 9;
2368
SDL_GL_ACCUM_BLUE_SIZE = 10;
2369
SDL_GL_ACCUM_ALPHA_SIZE = 11;
2371
SDL_GL_MULTISAMPLEBUFFERS = 13;
2372
SDL_GL_MULTISAMPLESAMPLES = 14;
2373
SDL_GL_ACCELERATED_VISUAL = 15;
2374
SDL_GL_RETAINED_BACKING = 16;
2375
SDL_GL_CONTEXT_MAJOR_VERSION = 17;
2376
SDL_GL_CONTEXT_MINOR_VERSION = 18;
2377
SDL_GL_CONTEXT_EGL = 19;
2378
SDL_GL_CONTEXT_FLAGS = 20;
2379
SDL_GL_CONTEXT_PROFILE_MASK = 21;
2380
SDL_GL_SHARE_WITH_CURRENT_CONTEXT = 22;
2383
TSDL_GLattr = DWord;
2386
SDL_GL_CONTEXT_PROFILE_CORE = $0001;
2387
SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = $0002;
2388
SDL_GL_CONTEXT_PROFILE_ES = $0004;
2391
TSDL_GLprofile = DWord;
2394
SDL_GL_CONTEXT_DEBUG_FLAG = $0001;
2395
SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = $0002;
2396
SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = $0004;
2397
SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = $0008;
2400
TSDL_GLcontextFlag = DWord;
2402
{* Function prototypes *}
2405
* Get the number of video drivers compiled into SDL
2407
* SDL_GetVideoDriver()
2410
function SDL_GetNumVideoDrivers: SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetNumVideoDrivers' {$ENDIF};
2413
* Get the name of a built in video driver.
2415
* The video drivers are presented in the order in which they are
2416
* normally checked during initialization.
2418
* SDL_GetNumVideoDrivers()
2421
function SDL_GetVideoDriver(index: SInt32): PAnsiChar cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetVideoDriver' {$ENDIF};
2424
* Initialize the video subsystem, optionally specifying a video driver.
2426
* driver_name Initialize a specific driver by name, or nil for the
2427
* default video driver.
2429
* 0 on success, -1 on error
2431
* This function initializes the video subsystem; setting up a connection
2432
* to the window manager, etc, and determines the available display modes
2433
* and pixel formats, but does not initialize a window or graphics mode.
2438
function SDL_VideoInit(const driver_name: PAnsiChar): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_VideoInit' {$ENDIF};
2441
* Shuts down the video subsystem.
2443
* function closes all windows, and restores the original video mode.
2447
procedure SDL_VideoQuit cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_VideoQuit' {$ENDIF};
2450
* Returns the name of the currently initialized video driver.
2452
* The name of the current video driver or nil if no driver
2453
* has been initialized
2455
* SDL_GetNumVideoDrivers()
2456
* SDL_GetVideoDriver()
2459
function SDL_GetCurrentVideoDriver: PAnsiChar cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetCurrentVideoDriver' {$ENDIF};
2462
* Returns the number of available video displays.
2464
* SDL_GetDisplayBounds()
2467
function SDL_GetNumVideoDisplays: SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetNumVideoDisplays' {$ENDIF};
2470
* Get the name of a display in UTF-8 encoding
2472
* The name of a display, or nil for an invalid display index.
2474
* SDL_GetNumVideoDisplays()
2477
function SDL_GetDisplayName(displayIndex: SInt32): PAnsiChar cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetDisplayName' {$ENDIF};
2480
* Get the desktop area represented by a display, with the primary
2481
* display located at 0,0
2483
* 0 on success, or -1 if the index is out of range.
2485
* SDL_GetNumVideoDisplays()
2488
function SDL_GetDisplayBounds(displayIndex: SInt32; rect: PSDL_Rect): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetDisplayBounds' {$ENDIF};
2491
* Returns the number of available display modes.
2493
* SDL_GetDisplayMode()
2496
function SDL_GetNumDisplayModes(displayIndex: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetNumDisplayModes' {$ENDIF};
2499
* Fill in information about a specific display mode.
2501
* The display modes are sorted in this priority:
2502
* bits per pixel -> more colors to fewer colors
2503
* width -> largest to smallest
2504
* height -> largest to smallest
2505
* refresh rate -> highest to lowest
2507
* SDL_GetNumDisplayModes()
2510
function SDL_GetDisplayMode(displayIndex: SInt32; modeIndex: SInt32; mode: PSDL_DisplayMode): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetDisplayMode' {$ENDIF};
2513
* Fill in information about the desktop display mode.
2516
function SDL_GetDesktopDisplayMode(displayIndex: SInt32; mode: PSDL_DisplayMode): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetDesktopDisplayMode' {$ENDIF};
2519
* Fill in information about the current display mode.
2522
function SDL_GetCurrentDisplayMode(displayIndex: SInt32; mode: PSDL_DisplayMode): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetCurrentDisplayIndex' {$ENDIF};
2525
* Get the closest match to the requested display mode.
2527
* mode The desired display mode
2528
* closest A pointer to a display mode to be filled in with the closest
2529
* match of the available display modes.
2531
* The passed in value closest, or nil if no matching video mode
2534
* The available display modes are scanned, and closest is filled in with the
2535
* closest mode matching the requested mode and returned. The mode format and
2536
* refresh_rate default to the desktop mode if they are 0. The modes are
2537
* scanned with size being first priority, format being second priority, and
2538
* finally checking the refresh_rate. If all the available modes are too
2539
* small, then nil is returned.
2541
* SDL_GetNumDisplayModes()
2542
* SDL_GetDisplayMode()
2545
function SDL_GetClosestDisplayMode(displayIndex: SInt32; const mode: PSDL_DisplayMode; closest: PSDL_DisplayMode): PSDL_DisplayMode cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetClosestDisplayMode' {$ENDIF};
2548
* Get the display index associated with a window.
2550
* the display index of the display containing the center of the
2551
* window, or -1 on error.
2554
function SDL_GetWindowDisplayIndex(window: PSDL_Window): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetWindowDisplayIndex' {$ENDIF};
2557
* Set the display mode used when a fullscreen window is visible.
2559
* By default the window's dimensions and the desktop format and refresh rate
2562
* mode The mode to use, or nil for the default mode.
2564
* 0 on success, or -1 if setting the display mode failed.
2566
* SDL_GetWindowDisplayMode()
2567
* SDL_SetWindowFullscreen()
2570
function SDL_SetWindowDisplayMode(window: PSDL_Window; const mode: PSDL_DisplayMode): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetWindowDisplayMode' {$ENDIF};
2573
* Fill in information about the display mode used when a fullscreen
2574
* window is visible.
2576
* SDL_SetWindowDisplayMode()
2577
* SDL_SetWindowFullscreen()
2580
function SDL_GetWindowDisplayMode(window: PSDL_Window; mode: PSDL_DisplayMode): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetWindowDisplayMode' {$ENDIF};
2583
* Get the pixel format associated with the window.
2586
function SDL_GetWindowPixelFormat(window: PSDL_Window): UInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetWindowPixelFormat' {$ENDIF};
2589
* Create a window with the specified position, dimensions, and flags.
2591
* title The title of the window, in UTF-8 encoding.
2592
* x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
2593
* ::SDL_WINDOWPOS_UNDEFINED.
2594
* y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
2595
* ::SDL_WINDOWPOS_UNDEFINED.
2596
* w The width of the window.
2597
* h The height of the window.
2598
* flags The flags for the window, a mask of any of the following:
2599
* ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL,
2600
* ::SDL_WINDOW_SHOWN, ::SDL_WINDOW_BORDERLESS,
2601
* ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED,
2602
* ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED.
2604
* The id of the window created, or zero if window creation failed.
2606
* SDL_DestroyWindow()
2609
function SDL_CreateWindow(const title: PAnsiChar; x: SInt32; y: SInt32; w: SInt32; h: SInt32; flags: UInt32): PSDL_Window cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_CreateWindow' {$ENDIF};
2612
* Create an SDL window from an existing native window.
2614
* data A pointer to driver-dependent window creation data
2616
* The id of the window created, or zero if window creation failed.
2618
* SDL_DestroyWindow()
2621
function SDL_CreateWindowFrom(const data: Pointer): PSDL_Window cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_CreateWindowFrom' {$ENDIF};
2624
* Get the numeric ID of a window, for logging purposes.
2627
function SDL_GetWindowID(window: PSDL_Window): UInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetWindowID' {$ENDIF};
2630
* Get a window from a stored ID, or nil if it doesn't exist.
2633
function SDL_GetWindowFromID(id: UInt32): PSDL_Window cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetWindowFromID' {$ENDIF};
2636
* Get the window flags.
2639
function SDL_GetWindowFlags(window: PSDL_Window): UInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetWindowFlags' {$ENDIF};
2642
* Set the title of a window, in UTF-8 format.
2644
* SDL_GetWindowTitle()
2647
procedure SDL_SetWindowTitle(window: PSDL_Window; const title: PAnsiChar) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetWindowTitle' {$ENDIF};
2650
* Get the title of a window, in UTF-8 format.
2652
* SDL_SetWindowTitle()
2655
function SDL_GetWindowTitle(window: PSDL_Window): PAnsiChar cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetWindowTitle' {$ENDIF};
2658
* Set the icon for a window.
2660
* icon The icon for the window.
2663
procedure SDL_SetWindowIcon(window: PSDL_Window; icon: PSDL_Surface) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetWindowIcon' {$ENDIF};
2666
* Associate an arbitrary named pointer with a window.
2668
* window The window to associate with the pointer.
2669
* name The name of the pointer.
2670
* userdata The associated pointer.
2672
* The previous value associated with 'name'
2674
* The name is case-sensitive.
2676
* SDL_GetWindowData()
2679
function SDL_SetWindowData(window: PSDL_Window; const name: PAnsiChar; userdata: Pointer): Pointer cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetWindowData' {$ENDIF};
2682
* Retrieve the data pointer associated with a window.
2684
* window The window to query.
2685
* name The name of the pointer.
2687
* The value associated with 'name'
2689
* SDL_SetWindowData()
2692
function SDL_GetWindowData(window: PSDL_Window; const name: PAnsiChar): Pointer cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetWindowData' {$ENDIF};
2695
* Set the position of a window.
2697
* window The window to reposition.
2698
* x The x coordinate of the window, SDL_WINDOWPOS_CENTERED, or
2699
* SDL_WINDOWPOS_UNDEFINED.
2700
* y The y coordinate of the window, SDL_WINDOWPOS_CENTERED, or
2701
* SDL_WINDOWPOS_UNDEFINED.
2703
* The window coordinate origin is the upper left of the display.
2705
* SDL_GetWindowPosition()
2708
procedure SDL_SetWindowPosition(window: PSDL_Window; x: SInt32; y: SInt32) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetWindowPosition' {$ENDIF};
2711
* Get the position of a window.
2713
* x Pointer to variable for storing the x position, may be nil
2714
* y Pointer to variable for storing the y position, may be nil
2716
* SDL_SetWindowPosition()
2719
procedure SDL_GetWindowPosition(window: PSDL_Window; x: PInt; y: PInt) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetWindowPosition' {$ENDIF};
2722
* Set the size of a window's client area.
2724
* w The width of the window, must be >0
2725
* h The height of the window, must be >0
2727
* You can't change the size of a fullscreen window, it automatically
2728
* matches the size of the display mode.
2730
* SDL_GetWindowSize()
2733
procedure SDL_SetWindowSize(window: PSDL_Window; w: SInt32; h: SInt32) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetWindowSize' {$ENDIF};
2736
* Get the size of a window's client area.
2738
* w Pointer to variable for storing the width, may be nil
2739
* h Pointer to variable for storing the height, may be nil
2741
* SDL_SetWindowSize()
2744
procedure SDL_GetWindowSize(window: PSDL_Window; w: PInt; h: PInt) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetWindowSize' {$ENDIF};
2747
* Set the minimum size of a window's client area.
2749
* min_w The minimum width of the window, must be >0
2750
* min_h The minimum height of the window, must be >0
2752
* You can't change the minimum size of a fullscreen window, it
2753
* automatically matches the size of the display mode.
2755
* SDL_GetWindowMinimumSize()
2756
* SDL_SetWindowMaximumSize()
2759
procedure SDL_SetWindowMinimumSize(window: PSDL_Window; min_w: SInt32; min_h: SInt32) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetWindowMinimumSize' {$ENDIF};
2762
* Get the minimum size of a window's client area.
2764
* w Pointer to variable for storing the minimum width, may be nil
2765
* h Pointer to variable for storing the minimum height, may be nil
2767
* SDL_GetWindowMaximumSize()
2768
* SDL_SetWindowMinimumSize()
2771
procedure SDL_GetWindowMinimumSize(window: PSDL_Window; w: PInt; h: PInt) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetWindowMinimumSize' {$ENDIF};
2774
* Set the maximum size of a window's client area.
2776
* max_w The maximum width of the window, must be >0
2777
* max_h The maximum height of the window, must be >0
2779
* You can't change the maximum size of a fullscreen window, it
2780
* automatically matches the size of the display mode.
2782
* SDL_GetWindowMaximumSize()
2783
* SDL_SetWindowMinimumSize()
2786
procedure SDL_SetWindowMaximumSize(window: PSDL_Window; max_w: SInt32; max_h: SInt32) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetWindowMaximumSize' {$ENDIF};
2789
* Get the maximum size of a window's client area.
2791
* w Pointer to variable for storing the maximum width, may be nil
2792
* h Pointer to variable for storing the maximum height, may be nil
2794
* SDL_GetWindowMinimumSize()
2795
* SDL_SetWindowMaximumSize()
2798
procedure SDL_GetWindowMaximumSize(window: PSDL_Window; w: PInt; h: PInt) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetWindowMaximumSize' {$ENDIF};
2801
* Set the border state of a window.
2803
* This will add or remove the window's SDL_WINDOW_BORDERLESS flag and
2804
* add or remove the border from the actual window. This is a no-op if the
2805
* window's border already matches the requested state.
2807
* window The window of which to change the border state.
2808
* bordered SDL_FALSE to remove border, SDL_TRUE to add border.
2810
* You can't change the border state of a fullscreen window.
2812
* SDL_GetWindowFlags()
2815
procedure SDL_SetWindowBordered(window: PSDL_Window; bordered: TSDL_Bool) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetWindowBordered' {$ENDIF};
2823
procedure SDL_ShowWindow(window: PSDL_Window) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_ShowWindow' {$ENDIF};
2831
procedure SDL_HideWindow(window: PSDL_Window) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_HideWindow' {$ENDIF};
2834
* Raise a window above other windows and set the input focus.
2837
procedure SDL_RaiseWindow(window: PSDL_Window) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RaiseWindow' {$ENDIF};
2840
* Make a window as large as possible.
2842
* SDL_RestoreWindow()
2845
procedure SDL_MaximizeWindow(window: PSDL_Window) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_MaximizeWindow' {$ENDIF};
2848
* Minimize a window to an iconic representation.
2850
* SDL_RestoreWindow()
2853
procedure SDL_MinimizeWindow(window: PSDL_Window) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_MinimizeWindow' {$ENDIF};
2856
* Restore the size and position of a minimized or maximized window.
2858
* SDL_MaximizeWindow()
2859
* SDL_MinimizeWindow()
2862
procedure SDL_RestoreWindow(window: PSDL_Window) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RestoreWindow' {$ENDIF};
2865
* Set a window's fullscreen state.
2867
* 0 on success, or -1 if setting the display mode failed.
2869
* SDL_SetWindowDisplayMode()
2870
* SDL_GetWindowDisplayMode()
2873
function SDL_SetWindowFullscreen(window: PSDL_Window; flags: UInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetWindowFullscreen' {$ENDIF};
2876
* Get the SDL surface associated with the window.
2878
* The window's framebuffer surface, or nil on error.
2880
* A new surface will be created with the optimal format for the window,
2881
* if necessary. This surface will be freed when the window is destroyed.
2883
* You may not combine this with 3D or the rendering API on this window.
2885
* SDL_UpdateWindowSurface()
2886
* SDL_UpdateWindowSurfaceRects()
2889
function SDL_GetWindowSurface(window: PSDL_Window): PSDL_Surface cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetWindowSurface' {$ENDIF};
2892
* Copy the window surface to the screen.
2894
* 0 on success, or -1 on error.
2896
* SDL_GetWindowSurface()
2897
* SDL_UpdateWindowSurfaceRects()
2900
function SDL_UpdateWindowSurface(window: PSDL_Window): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_UpdateWindowSurface' {$ENDIF};
2903
* Copy a number of rectangles on the window surface to the screen.
2905
* 0 on success, or -1 on error.
2907
* SDL_GetWindowSurface()
2908
* SDL_UpdateWindowSurfaceRect()
2911
function SDL_UpdateWindowSurfaceRects(window: PSDL_Window; rects: PSDL_Rect; numrects: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_UpdateWindowSurfaceRects' {$ENDIF};
2914
* Set a window's input grab mode.
2916
* grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input.
2918
* SDL_GetWindowGrab()
2921
procedure SDL_SetWindowGrab(window: PSDL_Window; grabbed: TSDL_Bool) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetWindowGrab' {$ENDIF};
2924
* Get a window's input grab mode.
2926
* This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise.
2928
* SDL_SetWindowGrab()
2931
function SDL_GetWindowGrab(window: PSDL_Window): TSDL_Bool cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetWindowGrab' {$ENDIF};
2934
* Set the brightness (gamma correction) for a window.
2936
* 0 on success, or -1 if setting the brightness isn't supported.
2938
* SDL_GetWindowBrightness()
2939
* SDL_SetWindowGammaRamp()
2942
function SDL_SetWindowBrightness(window: PSDL_Window; brightness: Float): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetWindowBrightness' {$ENDIF};
2945
* Get the brightness (gamma correction) for a window.
2947
* The last brightness value passed to SDL_SetWindowBrightness()
2949
* SDL_SetWindowBrightness()
2952
function SDL_GetWindowBrightness(window: PSDL_Window): Float cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetWindowBrightness' {$ENDIF};
2955
* Set the gamma ramp for a window.
2957
* red The translation table for the red channel, or nil.
2958
* green The translation table for the green channel, or nil.
2959
* blue The translation table for the blue channel, or nil.
2961
* 0 on success, or -1 if gamma ramps are unsupported.
2963
* Set the gamma translation table for the red, green, and blue channels
2964
* of the video hardware. Each table is an array of 256 16-bit quantities,
2965
* representing a mapping between the input and output for that channel.
2966
* The input is the index into the array, and the output is the 16-bit
2967
* gamma value at that index, scaled to the output color precision.
2969
* SDL_GetWindowGammaRamp()
2972
function SDL_SetWindowGammaRamp(window: PSDL_Window; const red: PUInt16; const green: PUInt16; const blue: PUInt16): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetWindowGammaRamp' {$ENDIF};
2975
* Get the gamma ramp for a window.
2977
* red A pointer to a 256 element array of 16-bit quantities to hold
2978
* the translation table for the red channel, or nil.
2979
* green A pointer to a 256 element array of 16-bit quantities to hold
2980
* the translation table for the green channel, or nil.
2981
* blue A pointer to a 256 element array of 16-bit quantities to hold
2982
* the translation table for the blue channel, or nil.
2984
* 0 on success, or -1 if gamma ramps are unsupported.
2986
* SDL_SetWindowGammaRamp()
2989
function SDL_GetWindowGammaRamp(window: PSDL_Window; red: PUInt16; green: PUInt16; blue: PUInt16): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetWindowGammaRamp' {$ENDIF};
2995
procedure SDL_DestroyWindow(window: PSDL_Window) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_DestroyWindow' {$ENDIF};
2998
* Returns whether the screensaver is currently enabled (default on).
3000
* SDL_EnableScreenSaver()
3001
* SDL_DisableScreenSaver()
3004
function SDL_IsScreenSaverEnabled: TSDL_Bool cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_IsScreenSaverEnabled' {$ENDIF};
3007
* Allow the screen to be blanked by a screensaver
3009
* SDL_IsScreenSaverEnabled()
3010
* SDL_DisableScreenSaver()
3013
procedure SDL_EnableScreenSaver cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_EnableScreenSaver' {$ENDIF};
3016
* Prevent the screen from being blanked by a screensaver
3018
* SDL_IsScreenSaverEnabled()
3019
* SDL_EnableScreenSaver()
3022
procedure SDL_DisableScreenSaver cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_DisableScreenSaver' {$ENDIF};
3025
* OpenGL support functions
3029
* Dynamically load an OpenGL library.
3031
* path The platform dependent OpenGL library name, or nil to open the
3032
* default OpenGL library.
3034
* 0 on success, or -1 if the library couldn't be loaded.
3036
* This should be done after initializing the video driver, but before
3037
* creating any OpenGL windows. If no OpenGL library is loaded, the default
3038
* library will be loaded upon creation of the first OpenGL window.
3040
* If you do this, you need to retrieve all of the GL functions used in
3041
* your program from the dynamic library using SDL_GL_GetProcAddress().
3043
* SDL_GL_GetProcAddress()
3044
* SDL_GL_UnloadLibrary()
3047
function SDL_GL_LoadLibrary(const path: PAnsiChar): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GL_LoadLibrary' {$ENDIF};
3050
* Get the address of an OpenGL function.
3053
function SDL_GL_GetProcAddress(const proc: PAnsiChar): Pointer cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GL_GetProcAddress' {$ENDIF};
3056
* Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
3058
* SDL_GL_LoadLibrary()
3061
procedure SDL_GL_UnloadLibrary cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GL_UnloadLibrary' {$ENDIF};
3064
* Return true if an OpenGL extension is supported for the current
3068
function SDL_GL_ExtensionSupported(const extension: PAnsiChar): TSDL_Bool cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GL_ExtensionSupported' {$ENDIF};
3071
* Set an OpenGL window attribute before window creation.
3074
function SDL_GL_SetAttribute(attr: TSDL_GLattr; value: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GL_SetAttribute' {$ENDIF};
3077
* Get the actual value for an attribute from the current context.
3080
function SDL_GL_GetAttribute(attr: TSDL_GLattr; value: PInt): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GL_GetAttribute' {$ENDIF};
3083
* Create an OpenGL context for use with an OpenGL window, and make it
3086
* SDL_GL_DeleteContext()
3089
function SDL_GL_CreateContext(window: PSDL_Window): TSDL_GLContext cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GL_CreateContext' {$ENDIF};
3092
* Set up an OpenGL context for rendering into an OpenGL window.
3094
* The context must have been created with a compatible window.
3097
function SDL_GL_MakeCurrent(window: PSDL_Window; context: TSDL_GLContext): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GL_MakeCurrent' {$ENDIF};
3100
* Get the currently active OpenGL window.
3102
function SDL_GL_GetCurrentWindow: PSDL_Window cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GL_GetCurrentWindow' {$ENDIF};
3105
* Get the currently active OpenGL context.
3107
function SDL_GL_GetCurrentContext: TSDL_GLContext cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GL_GetCurrentContext' {$ENDIF};
3110
* Set the swap interval for the current OpenGL context.
3112
* interval 0 for immediate updates, 1 for updates synchronized with the
3113
* vertical retrace. If the system supports it, you may
3114
* specify -1 to allow late swaps to happen immediately
3115
* instead of waiting for the next retrace.
3117
* 0 on success, or -1 if setting the swap interval is not supported.
3119
* SDL_GL_GetSwapInterval()
3122
function SDL_GL_SetSwapInterval(interval: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GL_SetSwapInterval' {$ENDIF};
3125
* Get the swap interval for the current OpenGL context.
3127
* 0 if there is no vertical retrace synchronization, 1 if the buffer
3128
* swap is synchronized with the vertical retrace, and -1 if late
3129
* swaps happen immediately instead of waiting for the next retrace.
3130
* If the system can't determine the swap interval, or there isn't a
3131
* valid current context, this will return 0 as a safe default.
3133
* SDL_GL_SetSwapInterval()
3136
function SDL_GL_GetSwapInterval: SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GL_GetSwapInterval' {$ENDIF};
3139
* Swap the OpenGL buffers for a window, if double-buffering is
3143
procedure SDL_GL_SwapWindow(window: PSDL_Window) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GL_SwapWindow' {$ENDIF};
3146
* Delete an OpenGL context.
3148
* SDL_GL_CreateContext()
3151
procedure SDL_GL_DeleteContext(context: TSDL_GLContext) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GL_DeleteContext' {$ENDIF};
3153
{*OpenGL support functions*}
3157
////////////////////////////////////////////////////////////////////////////////////////////////////////
3158
////////////////////// SDL_renderer.h ///////////////////////////////////////////////////
3159
////////////////////////////////////////////////////////////////////////////////////////////////////////
3162
* Flags used when creating a rendering context
3165
SDL_RENDERER_SOFTWARE = $00000001; {**< The renderer is a software fallback *}
3166
SDL_RENDERER_ACCELERATED = $00000002; {**< The renderer uses hardware
3168
SDL_RENDERER_PRESENTVSYNC = $00000004; {**< Present is synchronized
3169
with the refresh rate *}
3170
SDL_RENDERER_TARGETTEXTURE = $00000008; {**< The renderer supports
3171
rendering to texture *}
3174
PSDL_RendererFlags = ^TSDL_RendererFlags;
3175
TSDL_RendererFlags = Word;
3178
* Information on the capabilities of a render driver or context.
3180
PSDL_RendererInfo = ^TSDL_RendererInfo;
3181
TSDL_RendererInfo = record
3182
name: PAnsiChar; {**< The name of the renderer *}
3183
flags: UInt32; {**< Supported ::SDL_RendererFlags *}
3184
num_texture_formats: UInt32; {**< The number of available texture formats *}
3185
texture_formats: array[0..15] of UInt32; {**< The available texture formats *}
3186
max_texture_width: SInt32; {**< The maximimum texture width *}
3187
max_texture_height: SInt32; {**< The maximimum texture height *}
3191
* The access pattern allowed for a texture.
3194
PSDL_TextureAccess = ^TSDL_TextureAccess;
3195
TSDL_TextureAccess = (
3196
SDL_TEXTUREACCESS_STATIC, {**< Changes rarely, not lockable *}
3197
SDL_TEXTUREACCESS_STREAMING, {**< Changes frequently, lockable *}
3198
SDL_TEXTUREACCESS_TARGET {**< Texture can be used as a render target *}
3202
* The texture channel modulation used in SDL_RenderCopy().
3204
PSDL_TextureModulate = ^TSDL_TextureModulate;
3205
TSDL_TextureModulate = (
3206
SDL_TEXTUREMODULATE_NONE, {**< No modulation *}
3207
SDL_TEXTUREMODULATE_COLOR, {**< srcC = srcC * color *}
3208
SDL_TEXTUREMODULATE_ALPHA {**< srcA = srcA * alpha *}
3212
* Flip constants for SDL_RenderCopyEx
3215
PSDL_RendererFlip = ^TSDL_RendererFlip;
3216
TSDL_RendererFlip = (SDL_FLIP_NONE, {**< Do not flip *}
3217
SDL_FLIP_HORIZONTAL, {**< flip horizontally *}
3218
SDL_FLIP_VERTICAL {**< flip vertically *}
3222
* A structure representing rendering state
3225
PPSDL_Renderer = ^PSDL_Renderer;
3226
PSDL_Renderer = Pointer; //todo!
3229
* An efficient driver-specific representation of pixel data
3231
PSDL_Texture = Pointer; //todo!
3233
{* Function prototypes *}
3236
* Get the number of 2D rendering drivers available for the current
3239
* A render driver is a set of code that handles rendering and texture
3240
* management on a particular display. Normally there is only one, but
3241
* some drivers may have several available with different capabilities.
3243
* SDL_GetRenderDriverInfo()
3244
* SDL_CreateRenderer()
3246
function SDL_GetNumRenderDrivers: SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetNumRenderDrivers' {$ENDIF};
3249
* Get information about a specific 2D rendering driver for the current
3252
* index The index of the driver to query information about.
3253
* info A pointer to an SDL_RendererInfo struct to be filled with
3254
* information on the rendering driver.
3256
* 0 on success, -1 if the index was out of range.
3258
* SDL_CreateRenderer()
3260
function SDL_GetRenderDriverInfo(index: SInt32; info: PSDL_RendererInfo): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetRenderDriverInfo' {$ENDIF};
3263
* Create a window and default renderer
3265
* width The width of the window
3266
* height The height of the window
3267
* window_flags The flags used to create the window
3268
* window A pointer filled with the window, or NULL on error
3269
* renderer A pointer filled with the renderer, or NULL on error
3271
* 0 on success, or -1 on error
3273
function SDL_CreateWindowAndRenderer(width: SInt32; height: SInt32; window_flags: UInt32; window: PPSDL_Window; renderer: PPSDL_Renderer): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_CreateWindowAndRenderer' {$ENDIF};
3276
* Create a 2D rendering context for a window.
3278
* window The window where rendering is displayed.
3279
* index The index of the rendering driver to initialize, or -1 to
3280
* initialize the first one supporting the requested flags.
3281
* flags ::SDL_RendererFlags.
3283
* A valid rendering context or NULL if there was an error.
3285
* SDL_CreateSoftwareRenderer()
3286
* SDL_GetRendererInfo()
3287
* SDL_DestroyRenderer()
3289
function SDL_CreateRenderer(window: PSDL_Window; index: SInt32; flags: UInt32): PSDL_Renderer cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_CreateRenderer' {$ENDIF};
3292
* Create a 2D software rendering context for a surface.
3294
* surface The surface where rendering is done.
3296
* A valid rendering context or NULL if there was an error.
3298
* SDL_CreateRenderer()
3299
* SDL_DestroyRenderer()
3301
function SDL_CreateSoftwareRenderer(surface: PSDL_Surface): PSDL_Renderer cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_CreateSoftwareRenderer' {$ENDIF};
3304
* Get the renderer associated with a window.
3306
function SDL_GetRenderer(window: PSDL_Window): PSDL_Renderer cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetRenderer' {$ENDIF};
3309
* Get information about a rendering context.
3311
function SDL_GetRendererInfo(renderer: PSDL_Renderer; info: PSDL_RendererInfo): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetRendererInfo' {$ENDIF};
3314
* Get the output size of a rendering context.
3316
function SDL_GetRendererOutputSize(renderer: PSDL_Renderer; w: PInt; h: PInt): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetRendererOutputSize' {$ENDIF};
3319
* Create a texture for a rendering context.
3321
* renderer The renderer.
3322
* format The format of the texture.
3323
* access One of the enumerated values in ::SDL_TextureAccess.
3324
* w The width of the texture in pixels.
3325
* h The height of the texture in pixels.
3327
* The created texture is returned, or 0 if no rendering context was
3328
* active, the format was unsupported, or the width or height were out
3331
* SDL_QueryTexture()
3332
* SDL_UpdateTexture()
3333
* SDL_DestroyTexture()
3335
function SDL_CreateTexture(renderer: PSDL_Renderer; format: UInt32; access: SInt32; w: SInt32; h: SInt32): PSDL_Texture cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_CreateTexture' {$ENDIF};
3338
* Create a texture from an existing surface.
3340
* renderer The renderer.
3341
* surface The surface containing pixel data used to fill the texture.
3343
* The created texture is returned, or 0 on error.
3345
* The surface is not modified or freed by this function.
3347
* SDL_QueryTexture()
3348
* SDL_DestroyTexture()
3350
function SDL_CreateTextureFromSurface(renderer: PSDL_Renderer; surface: PSDL_Surface): PSDL_Texture cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_CreateTextureFromSurface' {$ENDIF};
3353
* Query the attributes of a texture
3355
* texture A texture to be queried.
3356
* format A pointer filled in with the raw format of the texture. The
3357
* actual format may differ, but pixel transfers will use this
3359
* access A pointer filled in with the actual access to the texture.
3360
* w A pointer filled in with the width of the texture in pixels.
3361
* h A pointer filled in with the height of the texture in pixels.
3363
* 0 on success, or -1 if the texture is not valid.
3365
function SDL_QueryTexture(texture: PSDL_Texture; format: PUInt32; access: PInt; w: PInt; h: PInt): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_QueryTexture' {$ENDIF};
3368
* Set an additional color value used in render copy operations.
3370
* texture The texture to update.
3371
* r The red color value multiplied into copy operations.
3372
* g The green color value multiplied into copy operations.
3373
* b The blue color value multiplied into copy operations.
3375
* 0 on success, or -1 if the texture is not valid or color modulation
3378
* SDL_GetTextureColorMod()
3380
function SDL_SetTextureColorMod(texture: PSDL_Texture; r: UInt8; g: UInt8; b: UInt8): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetTextureColorMod' {$ENDIF};
3383
* Get the additional color value used in render copy operations.
3385
* texture The texture to query.
3386
* r A pointer filled in with the current red color value.
3387
* g A pointer filled in with the current green color value.
3388
* b A pointer filled in with the current blue color value.
3390
* 0 on success, or -1 if the texture is not valid.
3392
* SDL_SetTextureColorMod()
3394
function SDL_GetTextureColorMod(texture: PSDL_Texture; r: PUInt8; g: PUInt8; b: PUInt8): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetTextureColorMod' {$ENDIF};
3397
* Set an additional alpha value used in render copy operations.
3399
* texture The texture to update.
3400
* alpha The alpha value multiplied into copy operations.
3402
* 0 on success, or -1 if the texture is not valid or alpha modulation
3405
* SDL_GetTextureAlphaMod()
3407
function SDL_SetTextureAlphaMod(texture: PSDL_Texture; alpha: UInt8): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetTextureAlphaMod' {$ENDIF};
3410
* Get the additional alpha value used in render copy operations.
3412
* texture The texture to query.
3413
* alpha A pointer filled in with the current alpha value.
3415
* 0 on success, or -1 if the texture is not valid.
3417
* SDL_SetTextureAlphaMod()
3419
function SDL_GetTextureAlphaMod(texture: PSDL_Texture; alpha: PUInt8): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetTextureAlphaMod' {$ENDIF};
3422
* Set the blend mode used for texture copy operations.
3424
* texture The texture to update.
3425
* blendMode ::SDL_BlendMode to use for texture blending.
3427
* 0 on success, or -1 if the texture is not valid or the blend mode is
3430
* If the blend mode is not supported, the closest supported mode is
3433
* SDL_GetTextureBlendMode()
3435
function SDL_SetTextureBlendMode(texture: PSDL_Texture; blendMode: TSDL_BlendMode): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetTextureBlendMode' {$ENDIF};
3438
* Get the blend mode used for texture copy operations.
3440
* texture The texture to query.
3441
* blendMode A pointer filled in with the current blend mode.
3443
* 0 on success, or -1 if the texture is not valid.
3445
* SDL_SetTextureBlendMode()
3447
function SDL_GetTextureBlendMode(texture: PSDL_Texture; blendMode: PSDL_BlendMode): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetTextureBlendMode' {$ENDIF};
3450
* Update the given texture rectangle with new pixel data.
3452
* texture The texture to update
3453
* rect A pointer to the rectangle of pixels to update, or NULL to
3454
* update the entire texture.
3455
* pixels The raw pixel data.
3456
* pitch The number of bytes between rows of pixel data.
3458
* 0 on success, or -1 if the texture is not valid.
3460
* This is a fairly slow function.
3462
function SDL_UpdateTexture(texture: PSDL_Texture; rect: PSDL_Rect; pixels: Pointer; pitch: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_UpdateTexture' {$ENDIF};
3465
* Lock a portion of the texture for write-only pixel access.
3467
* texture The texture to lock for access, which was created with
3468
* SDL_TEXTUREACCESS_STREAMING.
3469
* rect A pointer to the rectangle to lock for access. If the rect
3470
* is NULL, the entire texture will be locked.
3471
* pixels This is filled in with a pointer to the locked pixels,
3472
* appropriately offset by the locked area.
3473
* pitch This is filled in with the pitch of the locked pixels.
3475
* 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING.
3477
* SDL_UnlockTexture()
3479
function SDL_LockTexture(texture: PSDL_Texture; rect: PSDL_Rect; pixels: PPointer; pitch: PInt): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_LockTexture' {$ENDIF};
3482
* Unlock a texture, uploading the changes to video memory, if needed.
3486
procedure SDL_UnlockTexture(texture: PSDL_Texture) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_LockTexture' {$ENDIF};
3489
* Determines whether a window supports the use of render targets
3491
* renderer The renderer that will be checked
3493
* SDL_TRUE if supported, SDL_FALSE if not.
3495
function SDL_RenderTargetSupported(renderer: PSDL_Renderer): Boolean cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RenderTargetSupported' {$ENDIF};
3498
* Set a texture as the current rendering target.
3500
* renderer The renderer.
3501
* texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target
3503
* 0 on success, or -1 on error
3505
* SDL_GetRenderTarget()
3507
function SDL_SetRenderTarget(renderer: PSDL_Renderer; texture: PSDL_Texture): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetRenderTarget' {$ENDIF};
3510
* Get the current render target or NULL for the default render target.
3512
* The current render target
3514
* SDL_SetRenderTarget()
3516
function SDL_GetRenderTarget(renderer: PSDL_Renderer): PSDL_Texture cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetRenderTarget' {$ENDIF};
3519
* Set device independent resolution for rendering
3521
* renderer The renderer for which resolution should be set.
3522
* w The width of the logical resolution
3523
* h The height of the logical resolution
3525
* This function uses the viewport and scaling functionality to allow a fixed logical
3526
* resolution for rendering, regardless of the actual output resolution. If the actual
3527
* output resolution doesn't have the same aspect ratio the output rendering will be
3528
* centered within the output display.
3530
* If the output display is a window, mouse events in the window will be filtered
3531
* and scaled so they seem to arrive within the logical resolution.
3533
* If this function results in scaling or subpixel drawing by the
3534
* rendering backend, it will be handled using the appropriate
3537
* SDL_RenderGetLogicalSize()
3538
* SDL_RenderSetScale()
3539
* SDL_RenderSetViewport()
3541
function SDL_RenderSetLogicalSize(renderer: PSDL_Renderer; w: SInt32; h: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RenderSetLogicalSize' {$ENDIF};
3544
* Get device independent resolution for rendering
3546
* renderer The renderer from which resolution should be queried.
3547
* w A pointer filled with the width of the logical resolution
3548
* h A pointer filled with the height of the logical resolution
3550
* SDL_RenderSetLogicalSize()
3552
procedure SDL_RenderGetLogicalSize(renderer: PSDL_Renderer; w: PInt; h: PInt) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RenderGetLogicalSize' {$ENDIF};
3555
* Set the drawing area for rendering on the current target.
3557
* renderer The renderer for which the drawing area should be set.
3558
* rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target.
3560
* The x,y of the viewport rect represents the origin for rendering.
3562
* 0 on success, or -1 on error
3564
* If the window associated with the renderer is resized, the viewport is automatically reset.
3566
* SDL_RenderGetViewport()
3567
* SDL_RenderSetLogicalSize()
3569
function SDL_RenderSetViewport(renderer: PSDL_Renderer; const rect: PSDL_Rect): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RenderSetViewport' {$ENDIF};
3572
* Get the drawing area for the current target.
3574
* SDL_RenderSetViewport()
3576
procedure SDL_RenderGetViewport(renderer: PSDL_Renderer; rect: PSDL_Rect) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RenderGetViewport' {$ENDIF};
3579
* Set the clip rectangle for the current target.
3581
* renderer The renderer for which clip rectangle should be set.
3582
* rect A pointer to the rectangle to set as the clip rectangle, or
3583
* NULL to disable clipping.
3585
* 0 on success, or -1 on error
3587
* SDL_RenderGetClipRect()
3589
function SDL_RenderSetClipRect(renderer: PSDL_Renderer; rect: PSDL_Rect): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RenderSetClipRect' {$ENDIF};
3592
* Get the clip rectangle for the current target.
3594
* renderer The renderer from which clip rectangle should be queried.
3595
* rect A pointer filled in with the current clip rectangle, or
3596
* an empty rectangle if clipping is disabled.
3598
* SDL_RenderSetClipRect()
3600
procedure SDL_RenderGetClipRect(renderer: PSDL_Renderer; rect: PSDL_Rect) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RenderGetClipRect' {$ENDIF};
3603
* Set the drawing scale for rendering on the current target.
3605
* renderer The renderer for which the drawing scale should be set.
3606
* scaleX The horizontal scaling factor
3607
* scaleY The vertical scaling factor
3609
* The drawing coordinates are scaled by the x/y scaling factors
3610
* before they are used by the renderer. This allows resolution
3611
* independent drawing with a single coordinate system.
3613
* If this results in scaling or subpixel drawing by the
3614
* rendering backend, it will be handled using the appropriate
3615
* quality hints. For best results use integer scaling factors.
3617
* SDL_RenderGetScale()
3618
* SDL_RenderSetLogicalSize()
3620
function SDL_RenderSetScale(renderer: PSDL_Renderer; scaleX: Float; scaleY: Float): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RenderSetScale' {$ENDIF};
3623
* Get the drawing scale for the current target.
3625
* renderer The renderer from which drawing scale should be queried.
3626
* scaleX A pointer filled in with the horizontal scaling factor
3627
* scaleY A pointer filled in with the vertical scaling factor
3629
* SDL_RenderSetScale()
3631
procedure SDL_RenderGetScale(renderer: PSDL_Renderer; scaleX: PFloat; scaleY: PFloat) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RenderGetScale' {$ENDIF};
3634
* Set the color used for drawing operations (Rect, Line and Clear).
3636
* renderer The renderer for which drawing color should be set.
3637
* r The red value used to draw on the rendering target.
3638
* g The green value used to draw on the rendering target.
3639
* b The blue value used to draw on the rendering target.
3640
* a The alpha value used to draw on the rendering target, usually
3641
* SDL_ALPHA_OPAQUE (255).
3643
* 0 on success, or -1 on error
3645
function SDL_SetRenderDrawColor(renderer: PSDL_Renderer; r: UInt8; g: UInt8; b: UInt8; a: UInt8): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetRenderDrawColor' {$ENDIF};
3648
* Get the color used for drawing operations (Rect, Line and Clear).
3650
* renderer The renderer from which drawing color should be queried.
3651
* r A pointer to the red value used to draw on the rendering target.
3652
* g A pointer to the green value used to draw on the rendering target.
3653
* b A pointer to the blue value used to draw on the rendering target.
3654
* a A pointer to the alpha value used to draw on the rendering target,
3655
* usually SDL_ALPHA_OPAQUE (255).
3657
* 0 on success, or -1 on error
3659
function SDL_GetRenderDrawColor(renderer: PSDL_Renderer; r: PUInt8; g: PUInt8; b: PUInt8; a: PUInt8): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetRenderDrawColor' {$ENDIF};
3662
* Set the blend mode used for drawing operations (Fill and Line).
3664
* renderer The renderer for which blend mode should be set.
3665
* blendMode SDL_BlendMode to use for blending.
3667
* 0 on success, or -1 on error
3669
* If the blend mode is not supported, the closest supported mode is
3672
* SDL_GetRenderDrawBlendMode()
3674
function SDL_SetRenderDrawBlendMode(renderer: PSDL_Renderer; blendMode: TSDL_BlendMode): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetRenderDrawBlendMode' {$ENDIF};
3677
* Get the blend mode used for drawing operations.
3679
* renderer The renderer from which blend mode should be queried.
3680
* blendMode A pointer filled in with the current blend mode.
3682
* 0 on success, or -1 on error
3684
* SDL_SetRenderDrawBlendMode()
3686
function SDL_GetRenderDrawBlendMode(renderer: PSDL_Renderer; blendMode: PSDL_BlendMode): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetRenderDrawBlendMode' {$ENDIF};
3689
* Clear the current rendering target with the drawing color
3691
* This function clears the entire rendering target, ignoring the viewport.
3693
* 0 on success, or -1 on error
3695
function SDL_RenderClear(renderer: PSDL_Renderer): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RenderClear' {$ENDIF};
3698
* Draw a point on the current rendering target.
3700
* renderer The renderer which should draw a point.
3701
* x The x coordinate of the point.
3702
* y The y coordinate of the point.
3704
* 0 on success, or -1 on error
3706
function SDL_RenderDrawPoint(renderer: PSDL_Renderer; x: SInt32; y: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RenderDrawPoint' {$ENDIF};
3709
* Draw multiple points on the current rendering target.
3711
* renderer The renderer which should draw multiple points.
3712
* points The points to draw
3713
* count The number of points to draw
3715
* 0 on success, or -1 on error
3717
function SDL_RenderDrawPoints(renderer: PSDL_Renderer; points: PSDL_Point; count: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RenderDrawPoints' {$ENDIF};
3720
* Draw a line on the current rendering target.
3722
* renderer The renderer which should draw a line.
3723
* x1 The x coordinate of the start point.
3724
* y1 The y coordinate of the start point.
3725
* x2 The x coordinate of the end point.
3726
* y2 The y coordinate of the end point.
3728
* 0 on success, or -1 on error
3730
function SDL_RenderDrawLine(renderer: PSDL_Renderer; x1: SInt32; y1: SInt32; x2: SInt32; y2: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RenderDrawLine' {$ENDIF};
3733
* \brief Draw a series of connected lines on the current rendering target.
3735
* \param renderer The renderer which should draw multiple lines.
3736
* \param points The points along the lines
3737
* \param count The number of points, drawing count-1 lines
3739
* \return 0 on success, or -1 on error
3741
function SDL_RenderDrawLines(renderer: PSDL_Renderer; points: PSDL_Point; count: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RenderDrawLines' {$ENDIF};
3744
* Draw a rectangle on the current rendering target.
3746
* renderer The renderer which should draw a rectangle.
3747
* rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
3749
* 0 on success, or -1 on error
3751
function SDL_RenderDrawRect(renderer: PSDL_Renderer; rect: PSDL_Rect): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RenderDrawRect' {$ENDIF};
3754
* Draw some number of rectangles on the current rendering target.
3756
* renderer The renderer which should draw multiple rectangles.
3757
* rects A pointer to an array of destination rectangles.
3758
* count The number of rectangles.
3760
* 0 on success, or -1 on error
3762
function SDL_RenderDrawRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RenderDrawRects' {$ENDIF};
3765
* Fill a rectangle on the current rendering target with the drawing color.
3767
* renderer The renderer which should fill a rectangle.
3768
* rect A pointer to the destination rectangle, or NULL for the entire
3771
* 0 on success, or -1 on error
3773
function SDL_RenderFillRect(renderer: PSDL_Renderer; rect: PSDL_Rect): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RenderFillRect' {$ENDIF};
3776
* Fill some number of rectangles on the current rendering target with the drawing color.
3778
* renderer The renderer which should fill multiple rectangles.
3779
* rects A pointer to an array of destination rectangles.
3780
* count The number of rectangles.
3782
* 0 on success, or -1 on error
3784
function SDL_RenderFillRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RenderFillRects' {$ENDIF};
3787
* Copy a portion of the texture to the current rendering target.
3789
* renderer The renderer which should copy parts of a texture.
3790
* texture The source texture.
3791
* srcrect A pointer to the source rectangle, or NULL for the entire
3793
* dstrect A pointer to the destination rectangle, or NULL for the
3794
* entire rendering target.
3796
* 0 on success, or -1 on error
3798
function SDL_RenderCopy(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: PSDL_Rect; dstrect: PSDL_Rect): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RenderCopy' {$ENDIF};
3801
* Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center
3803
* renderer The renderer which should copy parts of a texture.
3804
* texture The source texture.
3805
* srcrect A pointer to the source rectangle, or NULL for the entire
3807
* dstrect A pointer to the destination rectangle, or NULL for the
3808
* entire rendering target.
3809
* angle An angle in degrees that indicates the rotation that will be applied to dstrect
3810
* 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)
3811
* flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture
3813
* 0 on success, or -1 on error
3815
function SDL_RenderCopyEx(renderer: PSDL_Renderer; texture: PSDL_Texture; const srcrect: PSDL_Rect; dstrect: PSDL_Rect; angle: Double; center: PSDL_Point; flip: PSDL_RendererFlip): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RenderCopyEx' {$ENDIF};
3818
* Read pixels from the current rendering target.
3820
* renderer The renderer from which pixels should be read.
3821
* rect A pointer to the rectangle to read, or NULL for the entire
3823
* format The desired format of the pixel data, or 0 to use the format
3824
* of the rendering target
3825
* pixels A pointer to be filled in with the pixel data
3826
* pitch The pitch of the pixels parameter.
3828
* 0 on success, or -1 if pixel reading is not supported.
3830
* This is a very slow operation, and should not be used frequently.
3832
function SDL_RenderReadPixels(renderer: PSDL_Renderer; rect: PSDL_Rect; format: UInt32; pixels: Pointer; pitch: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RenderReadPixels' {$ENDIF};
3835
* Update the screen with rendering performed.
3837
procedure SDL_RenderPresent(renderer: PSDL_Renderer) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RenderPresent' {$ENDIF};
3840
* Destroy the specified texture.
3842
* SDL_CreateTexture()
3843
* SDL_CreateTextureFromSurface()
3845
procedure SDL_DestroyTexture(texture: PSDL_Texture) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_DestroyTexture' {$ENDIF};
3848
* Destroy the rendering context for a window and free associated
3851
* SDL_CreateRenderer()
3853
procedure SDL_DestroyRenderer(renderer: PSDL_Renderer) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_DestroyRenderer' {$ENDIF};
3856
* Bind the texture to the current OpenGL/ES/ES2 context for use with
3857
* OpenGL instructions.
3859
* texture The SDL texture to bind
3860
* texw A pointer to a float that will be filled with the texture width
3861
* texh A pointer to a float that will be filled with the texture height
3863
* 0 on success, or -1 if the operation is not supported
3865
function SDL_GL_BindTexture(texture: PSDL_Texture; texw: PFloat; texh: PFloat): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GL_BindTexture' {$ENDIF};
3868
* Unbind a texture from the current OpenGL/ES/ES2 context.
3870
* texture The SDL texture to unbind
3872
* 0 on success, or -1 if the operation is not supported
3874
function SDL_GL_UnbindTexture(texture: PSDL_Texture): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GL_UnbindTexture' {$ENDIF};
3878
////////////////////////////////////////////////////////////////////////////////////////////////////////
3879
////////////////////// SDL_scancode.h ////////////////////////////////////////////////////
3880
////////////////////////////////////////////////////////////////////////////////////////////////////////
3883
* The SDL keyboard scancode representation.
3885
* Values of this type are used to represent keyboard keys, among other places
3886
* in the SDL_Keysym.scancode key.keysym.scancode \endlink field of the
3887
* SDL_Event structure.
3889
* The values in this enumeration are based on the USB usage page standard:
3890
* http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf
3894
SDL_SCANCODE_UNKNOWN = 0;
3899
* These values are from usage page $07 (USB keyboard page).
3908
SDL_SCANCODE_G = 10;
3909
SDL_SCANCODE_H = 11;
3910
SDL_SCANCODE_I = 12;
3911
SDL_SCANCODE_J = 13;
3912
SDL_SCANCODE_K = 14;
3913
SDL_SCANCODE_L = 15;
3914
SDL_SCANCODE_M = 16;
3915
SDL_SCANCODE_N = 17;
3916
SDL_SCANCODE_O = 18;
3917
SDL_SCANCODE_P = 19;
3918
SDL_SCANCODE_Q = 20;
3919
SDL_SCANCODE_R = 21;
3920
SDL_SCANCODE_S = 22;
3921
SDL_SCANCODE_T = 23;
3922
SDL_SCANCODE_U = 24;
3923
SDL_SCANCODE_V = 25;
3924
SDL_SCANCODE_W = 26;
3925
SDL_SCANCODE_X = 27;
3926
SDL_SCANCODE_Y = 28;
3927
SDL_SCANCODE_Z = 29;
3929
SDL_SCANCODE_1 = 30;
3930
SDL_SCANCODE_2 = 31;
3931
SDL_SCANCODE_3 = 32;
3932
SDL_SCANCODE_4 = 33;
3933
SDL_SCANCODE_5 = 34;
3934
SDL_SCANCODE_6 = 35;
3935
SDL_SCANCODE_7 = 36;
3936
SDL_SCANCODE_8 = 37;
3937
SDL_SCANCODE_9 = 38;
3938
SDL_SCANCODE_0 = 39;
3940
SDL_SCANCODE_RETURN = 40;
3941
SDL_SCANCODE_ESCAPE = 41;
3942
SDL_SCANCODE_BACKSPACE = 42;
3943
SDL_SCANCODE_TAB = 43;
3944
SDL_SCANCODE_SPACE = 44;
3946
SDL_SCANCODE_MINUS = 45;
3947
SDL_SCANCODE_EQUALS = 46;
3948
SDL_SCANCODE_LEFTBRACKET = 47;
3949
SDL_SCANCODE_RIGHTBRACKET = 48;
3950
SDL_SCANCODE_BACKSLASH = 49; {**< Located at the lower left of the return
3951
* key on ISO keyboards and at the right end
3952
* of the QWERTY row on ANSI keyboards.
3953
* Produces REVERSE SOLIDUS (backslash) and
3954
* VERTICAL LINE in a US layout; REVERSE
3955
* SOLIDUS and VERTICAL LINE in a UK Mac
3956
* layout; NUMBER SIGN and TILDE in a UK
3957
* Windows layout; DOLLAR SIGN and POUND SIGN
3958
* in a Swiss German layout; NUMBER SIGN and
3959
* APOSTROPHE in a German layout; GRAVE
3960
* ACCENT and POUND SIGN in a French Mac
3961
* layout; and ASTERISK and MICRO SIGN in a
3962
* French Windows layout.
3964
SDL_SCANCODE_NONUSHASH = 50; {**< ISO USB keyboards actually use this code
3965
* instead of 49 for the same key; but all
3966
* OSes I've seen treat the two codes
3967
* identically. So; as an implementor; unless
3968
* your keyboard generates both of those
3969
* codes and your OS treats them differently;
3970
* you should generate SDL_SCANCODE_BACKSLASH
3971
* instead of this code. As a user; you
3972
* should not rely on this code because SDL
3973
* will never generate it with most (all?)
3976
SDL_SCANCODE_SEMICOLON = 51;
3977
SDL_SCANCODE_APOSTROPHE = 52;
3978
SDL_SCANCODE_GRAVE = 53; {**< Located in the top left corner (on both ANSI
3979
* and ISO keyboards). Produces GRAVE ACCENT and
3980
* TILDE in a US Windows layout and in US and UK
3981
* Mac layouts on ANSI keyboards; GRAVE ACCENT
3982
* and NOT SIGN in a UK Windows layout; SECTION
3983
* SIGN and PLUS-MINUS SIGN in US and UK Mac
3984
* layouts on ISO keyboards; SECTION SIGN and
3985
* DEGREE SIGN in a Swiss German layout (Mac:
3986
* only on ISO keyboards); CIRCUMFLEX ACCENT and
3987
* DEGREE SIGN in a German layout (Mac: only on
3988
* ISO keyboards); SUPERSCRIPT TWO and TILDE in a
3989
* French Windows layout; COMMERCIAL AT and
3990
* NUMBER SIGN in a French Mac layout on ISO
3991
* keyboards; and LESS-THAN SIGN and GREATER-THAN
3992
* SIGN in a Swiss German; German; or French Mac
3993
* layout on ANSI keyboards.
3995
SDL_SCANCODE_COMMA = 54;
3996
SDL_SCANCODE_PERIOD = 55;
3997
SDL_SCANCODE_SLASH = 56;
3999
SDL_SCANCODE_CAPSLOCK = 57;
4001
SDL_SCANCODE_F1 = 58;
4002
SDL_SCANCODE_F2 = 59;
4003
SDL_SCANCODE_F3 = 60;
4004
SDL_SCANCODE_F4 = 61;
4005
SDL_SCANCODE_F5 = 62;
4006
SDL_SCANCODE_F6 = 63;
4007
SDL_SCANCODE_F7 = 64;
4008
SDL_SCANCODE_F8 = 65;
4009
SDL_SCANCODE_F9 = 66;
4010
SDL_SCANCODE_F10 = 67;
4011
SDL_SCANCODE_F11 = 68;
4012
SDL_SCANCODE_F12 = 69;
4014
SDL_SCANCODE_PRINTSCREEN = 70;
4015
SDL_SCANCODE_SCROLLLOCK = 71;
4016
SDL_SCANCODE_PAUSE = 72;
4017
SDL_SCANCODE_INSERT = 73; {**< insert on PC; help on some Mac keyboards (but
4018
does send code 73; not 117) *}
4019
SDL_SCANCODE_HOME = 74;
4020
SDL_SCANCODE_PAGEUP = 75;
4021
SDL_SCANCODE_DELETE = 76;
4022
SDL_SCANCODE_END = 77;
4023
SDL_SCANCODE_PAGEDOWN = 78;
4024
SDL_SCANCODE_RIGHT = 79;
4025
SDL_SCANCODE_LEFT = 80;
4026
SDL_SCANCODE_DOWN = 81;
4027
SDL_SCANCODE_UP = 82;
4029
SDL_SCANCODE_NUMLOCKCLEAR = 83; {**< num lock on PC; clear on Mac keyboards
4031
SDL_SCANCODE_KP_DIVIDE = 84;
4032
SDL_SCANCODE_KP_MULTIPLY = 85;
4033
SDL_SCANCODE_KP_MINUS = 86;
4034
SDL_SCANCODE_KP_PLUS = 87;
4035
SDL_SCANCODE_KP_ENTER = 88;
4036
SDL_SCANCODE_KP_1 = 89;
4037
SDL_SCANCODE_KP_2 = 90;
4038
SDL_SCANCODE_KP_3 = 91;
4039
SDL_SCANCODE_KP_4 = 92;
4040
SDL_SCANCODE_KP_5 = 93;
4041
SDL_SCANCODE_KP_6 = 94;
4042
SDL_SCANCODE_KP_7 = 95;
4043
SDL_SCANCODE_KP_8 = 96;
4044
SDL_SCANCODE_KP_9 = 97;
4045
SDL_SCANCODE_KP_0 = 98;
4046
SDL_SCANCODE_KP_PERIOD = 99;
4048
SDL_SCANCODE_NONUSBACKSLASH = 100; {**< This is the additional key that ISO
4049
* keyboards have over ANSI ones;
4050
* located between left shift and Y.
4051
* Produces GRAVE ACCENT and TILDE in a
4052
* US or UK Mac layout; REVERSE SOLIDUS
4053
* (backslash) and VERTICAL LINE in a
4054
* US or UK Windows layout; and
4055
* LESS-THAN SIGN and GREATER-THAN SIGN
4056
* in a Swiss German; German; or French
4058
SDL_SCANCODE_APPLICATION = 101; {**< windows contextual menu; compose *}
4059
SDL_SCANCODE_POWER = 102; {**< The USB document says this is a status flag;
4060
* not a physical key - but some Mac keyboards
4061
* do have a power key. *}
4062
SDL_SCANCODE_KP_EQUALS = 103;
4063
SDL_SCANCODE_F13 = 104;
4064
SDL_SCANCODE_F14 = 105;
4065
SDL_SCANCODE_F15 = 106;
4066
SDL_SCANCODE_F16 = 107;
4067
SDL_SCANCODE_F17 = 108;
4068
SDL_SCANCODE_F18 = 109;
4069
SDL_SCANCODE_F19 = 110;
4070
SDL_SCANCODE_F20 = 111;
4071
SDL_SCANCODE_F21 = 112;
4072
SDL_SCANCODE_F22 = 113;
4073
SDL_SCANCODE_F23 = 114;
4074
SDL_SCANCODE_F24 = 115;
4075
SDL_SCANCODE_EXECUTE = 116;
4076
SDL_SCANCODE_HELP = 117;
4077
SDL_SCANCODE_MENU = 118;
4078
SDL_SCANCODE_SELECT = 119;
4079
SDL_SCANCODE_STOP = 120;
4080
SDL_SCANCODE_AGAIN = 121; {**< redo *}
4081
SDL_SCANCODE_UNDO = 122;
4082
SDL_SCANCODE_CUT = 123;
4083
SDL_SCANCODE_COPY = 124;
4084
SDL_SCANCODE_PASTE = 125;
4085
SDL_SCANCODE_FIND = 126;
4086
SDL_SCANCODE_MUTE = 127;
4087
SDL_SCANCODE_VOLUMEUP = 128;
4088
SDL_SCANCODE_VOLUMEDOWN = 129;
4089
{* not sure whether there's a reason to enable these *}
4090
{* SDL_SCANCODE_LOCKINGCAPSLOCK = 130; *}
4091
{* SDL_SCANCODE_LOCKINGNUMLOCK = 131; *}
4092
{* SDL_SCANCODE_LOCKINGSCROLLLOCK = 132; *}
4093
SDL_SCANCODE_KP_COMMA = 133;
4094
SDL_SCANCODE_KP_EQUALSAS400 = 134;
4096
SDL_SCANCODE_INTERNATIONAL1 = 135; {**< used on Asian keyboards; see footnotes in USB doc *}
4097
SDL_SCANCODE_INTERNATIONAL2 = 136;
4098
SDL_SCANCODE_INTERNATIONAL3 = 137; {**< Yen *}
4099
SDL_SCANCODE_INTERNATIONAL4 = 138;
4100
SDL_SCANCODE_INTERNATIONAL5 = 139;
4101
SDL_SCANCODE_INTERNATIONAL6 = 140;
4102
SDL_SCANCODE_INTERNATIONAL7 = 141;
4103
SDL_SCANCODE_INTERNATIONAL8 = 142;
4104
SDL_SCANCODE_INTERNATIONAL9 = 143;
4105
SDL_SCANCODE_LANG1 = 144; {**< Hangul{English toggle *}
4106
SDL_SCANCODE_LANG2 = 145; {**< Hanja conversion *}
4107
SDL_SCANCODE_LANG3 = 146; {**< Katakana *}
4108
SDL_SCANCODE_LANG4 = 147; {**< Hiragana *}
4109
SDL_SCANCODE_LANG5 = 148; {**< Zenkaku{Hankaku *}
4110
SDL_SCANCODE_LANG6 = 149; {**< reserved *}
4111
SDL_SCANCODE_LANG7 = 150; {**< reserved *}
4112
SDL_SCANCODE_LANG8 = 151; {**< reserved *}
4113
SDL_SCANCODE_LANG9 = 152; {**< reserved *}
4115
SDL_SCANCODE_ALTERASE = 153; {**< Erase-Eaze *}
4116
SDL_SCANCODE_SYSREQ = 154;
4117
SDL_SCANCODE_CANCEL = 155;
4118
SDL_SCANCODE_CLEAR = 156;
4119
SDL_SCANCODE_PRIOR = 157;
4120
SDL_SCANCODE_RETURN2 = 158;
4121
SDL_SCANCODE_SEPARATOR = 159;
4122
SDL_SCANCODE_OUT = 160;
4123
SDL_SCANCODE_OPER = 161;
4124
SDL_SCANCODE_CLEARAGAIN = 162;
4125
SDL_SCANCODE_CRSEL = 163;
4126
SDL_SCANCODE_EXSEL = 164;
4128
SDL_SCANCODE_KP_00 = 176;
4129
SDL_SCANCODE_KP_000 = 177;
4130
SDL_SCANCODE_THOUSANDSSEPARATOR = 178;
4131
SDL_SCANCODE_DECIMALSEPARATOR = 179;
4132
SDL_SCANCODE_CURRENCYUNIT = 180;
4133
SDL_SCANCODE_CURRENCYSUBUNIT = 181;
4134
SDL_SCANCODE_KP_LEFTPAREN = 182;
4135
SDL_SCANCODE_KP_RIGHTPAREN = 183;
4136
SDL_SCANCODE_KP_LEFTBRACE = 184;
4137
SDL_SCANCODE_KP_RIGHTBRACE = 185;
4138
SDL_SCANCODE_KP_TAB = 186;
4139
SDL_SCANCODE_KP_BACKSPACE = 187;
4140
SDL_SCANCODE_KP_A = 188;
4141
SDL_SCANCODE_KP_B = 189;
4142
SDL_SCANCODE_KP_C = 190;
4143
SDL_SCANCODE_KP_D = 191;
4144
SDL_SCANCODE_KP_E = 192;
4145
SDL_SCANCODE_KP_F = 193;
4146
SDL_SCANCODE_KP_XOR = 194;
4147
SDL_SCANCODE_KP_POWER = 195;
4148
SDL_SCANCODE_KP_PERCENT = 196;
4149
SDL_SCANCODE_KP_LESS = 197;
4150
SDL_SCANCODE_KP_GREATER = 198;
4151
SDL_SCANCODE_KP_AMPERSAND = 199;
4152
SDL_SCANCODE_KP_DBLAMPERSAND = 200;
4153
SDL_SCANCODE_KP_VERTICALBAR = 201;
4154
SDL_SCANCODE_KP_DBLVERTICALBAR = 202;
4155
SDL_SCANCODE_KP_COLON = 203;
4156
SDL_SCANCODE_KP_HASH = 204;
4157
SDL_SCANCODE_KP_SPACE = 205;
4158
SDL_SCANCODE_KP_AT = 206;
4159
SDL_SCANCODE_KP_EXCLAM = 207;
4160
SDL_SCANCODE_KP_MEMSTORE = 208;
4161
SDL_SCANCODE_KP_MEMRECALL = 209;
4162
SDL_SCANCODE_KP_MEMCLEAR = 210;
4163
SDL_SCANCODE_KP_MEMADD = 211;
4164
SDL_SCANCODE_KP_MEMSUBTRACT = 212;
4165
SDL_SCANCODE_KP_MEMMULTIPLY = 213;
4166
SDL_SCANCODE_KP_MEMDIVIDE = 214;
4167
SDL_SCANCODE_KP_PLUSMINUS = 215;
4168
SDL_SCANCODE_KP_CLEAR = 216;
4169
SDL_SCANCODE_KP_CLEARENTRY = 217;
4170
SDL_SCANCODE_KP_BINARY = 218;
4171
SDL_SCANCODE_KP_OCTAL = 219;
4172
SDL_SCANCODE_KP_DECIMAL = 220;
4173
SDL_SCANCODE_KP_HEXADECIMAL = 221;
4175
SDL_SCANCODE_LCTRL = 224;
4176
SDL_SCANCODE_LSHIFT = 225;
4177
SDL_SCANCODE_LALT = 226; {**< alt; option *}
4178
SDL_SCANCODE_LGUI = 227; {**< windows; command (apple); meta *}
4179
SDL_SCANCODE_RCTRL = 228;
4180
SDL_SCANCODE_RSHIFT = 229;
4181
SDL_SCANCODE_RALT = 230; {**< alt gr; option *}
4182
SDL_SCANCODE_RGUI = 231; {**< windows; command (apple); meta *}
4184
SDL_SCANCODE_MODE = 257; {**< I'm not sure if this is really not covered
4185
* by any of the above; but since there's a
4186
* special KMOD_MODE for it I'm adding it here
4194
* These values are mapped from usage page $0C (USB consumer page).
4197
SDL_SCANCODE_AUDIONEXT = 258;
4198
SDL_SCANCODE_AUDIOPREV = 259;
4199
SDL_SCANCODE_AUDIOSTOP = 260;
4200
SDL_SCANCODE_AUDIOPLAY = 261;
4201
SDL_SCANCODE_AUDIOMUTE = 262;
4202
SDL_SCANCODE_MEDIASELECT = 263;
4203
SDL_SCANCODE_WWW = 264;
4204
SDL_SCANCODE_MAIL = 265;
4205
SDL_SCANCODE_CALCULATOR = 266;
4206
SDL_SCANCODE_COMPUTER = 267;
4207
SDL_SCANCODE_AC_SEARCH = 268;
4208
SDL_SCANCODE_AC_HOME = 269;
4209
SDL_SCANCODE_AC_BACK = 270;
4210
SDL_SCANCODE_AC_FORWARD = 271;
4211
SDL_SCANCODE_AC_STOP = 272;
4212
SDL_SCANCODE_AC_REFRESH = 273;
4213
SDL_SCANCODE_AC_BOOKMARKS = 274;
4220
* These are values that Christian Walther added (for mac keyboard?).
4223
SDL_SCANCODE_BRIGHTNESSDOWN = 275;
4224
SDL_SCANCODE_BRIGHTNESSUP = 276;
4225
SDL_SCANCODE_DISPLAYSWITCH = 277; {**< display mirroring{dual display
4226
switch; video mode switch *}
4227
SDL_SCANCODE_KBDILLUMTOGGLE = 278;
4228
SDL_SCANCODE_KBDILLUMDOWN = 279;
4229
SDL_SCANCODE_KBDILLUMUP = 280;
4230
SDL_SCANCODE_EJECT = 281;
4231
SDL_SCANCODE_SLEEP = 282;
4233
SDL_SCANCODE_APP1 = 283;
4234
SDL_SCANCODE_APP2 = 284;
4238
{* Add any other keys here. *}
4240
SDL_NUM_SCANCODES = 512; {**< not a key, just marks the number of scancodes
4244
PSDL_ScanCode = ^TSDL_ScanCode;
4245
TSDL_ScanCode = DWord;
4247
//from "sdl_keycode.h"
4251
* The SDL virtual key representation.
4253
* Values of this type are used to represent keyboard keys using the current
4254
* layout of the keyboard. These values include Unicode values representing
4255
* the unmodified character that would be generated by pressing the key, or
4256
* an SDLK_* constant for those keys that do not generate characters.
4258
PSDL_KeyCode = ^TSDL_KeyCode;
4259
TSDL_KeyCode = SInt32;
4262
SDLK_SCANCODE_MASK = 1 shl 30;
4267
SDLK_ESCAPE = '\033';
4268
SDLK_BACKSPACE = '\b';
4272
SDLK_QUOTEDBL = '"';
4276
SDLK_AMPERSAND = '&';
4278
SDLK_LEFTPAREN = '(';
4279
SDLK_RIGHTPAREN = ')';
4280
SDLK_ASTERISK = '*';
4297
SDLK_SEMICOLON = ';';
4301
SDLK_QUESTION = '?';
4304
Skip uppercase letters
4306
SDLK_LEFTBRACKET = '[';
4307
SDLK_BACKSLASH = '\\';
4308
SDLK_RIGHTBRACKET = ']';
4310
SDLK_UNDERSCORE = '_';
4311
SDLK_BACKQUOTE = '`';
4339
SDLK_CAPSLOCK = SDL_SCANCODE_CAPSLOCK or SDLK_SCANCODE_MASK;
4341
SDLK_F1 = SDL_SCANCODE_F1 or SDLK_SCANCODE_MASK;
4342
SDLK_F2 = SDL_SCANCODE_F2 or SDLK_SCANCODE_MASK;
4343
SDLK_F3 = SDL_SCANCODE_F3 or SDLK_SCANCODE_MASK;
4344
SDLK_F4 = SDL_SCANCODE_F4 or SDLK_SCANCODE_MASK;
4345
SDLK_F5 = SDL_SCANCODE_F5 or SDLK_SCANCODE_MASK;
4346
SDLK_F6 = SDL_SCANCODE_F6 or SDLK_SCANCODE_MASK;
4347
SDLK_F7 = SDL_SCANCODE_F7 or SDLK_SCANCODE_MASK;
4348
SDLK_F8 = SDL_SCANCODE_F8 or SDLK_SCANCODE_MASK;
4349
SDLK_F9 = SDL_SCANCODE_F9 or SDLK_SCANCODE_MASK;
4350
SDLK_F10 = SDL_SCANCODE_F10 or SDLK_SCANCODE_MASK;
4351
SDLK_F11 = SDL_SCANCODE_F11 or SDLK_SCANCODE_MASK;
4352
SDLK_F12 = SDL_SCANCODE_F12 or SDLK_SCANCODE_MASK;
4354
SDLK_PRINTSCREEN = SDL_SCANCODE_PRINTSCREEN or SDLK_SCANCODE_MASK;
4355
SDLK_SCROLLLOCK = SDL_SCANCODE_SCROLLLOCK or SDLK_SCANCODE_MASK;
4356
SDLK_PAUSE = SDL_SCANCODE_PAUSE or SDLK_SCANCODE_MASK;
4357
SDLK_INSERT = SDL_SCANCODE_INSERT or SDLK_SCANCODE_MASK;
4358
SDLK_HOME = SDL_SCANCODE_HOME or SDLK_SCANCODE_MASK;
4359
SDLK_PAGEUP = SDL_SCANCODE_PAGEUP or SDLK_SCANCODE_MASK;
4360
SDLK_DELETE = '\177';
4361
SDLK_END = SDL_SCANCODE_END or SDLK_SCANCODE_MASK;
4362
SDLK_PAGEDOWN = SDL_SCANCODE_PAGEDOWN or SDLK_SCANCODE_MASK;
4363
SDLK_RIGHT = SDL_SCANCODE_RIGHT or SDLK_SCANCODE_MASK;
4364
SDLK_LEFT = SDL_SCANCODE_LEFT or SDLK_SCANCODE_MASK;
4365
SDLK_DOWN = SDL_SCANCODE_DOWN or SDLK_SCANCODE_MASK;
4366
SDLK_UP = SDL_SCANCODE_UP or SDLK_SCANCODE_MASK;
4368
SDLK_NUMLOCKCLEAR = SDL_SCANCODE_NUMLOCKCLEAR or SDLK_SCANCODE_MASK;
4369
SDLK_KP_DIVIDE = SDL_SCANCODE_KP_DIVIDE or SDLK_SCANCODE_MASK;
4370
SDLK_KP_MULTIPLY = SDL_SCANCODE_KP_MULTIPLY or SDLK_SCANCODE_MASK;
4371
SDLK_KP_MINUS = SDL_SCANCODE_KP_MINUS or SDLK_SCANCODE_MASK;
4372
SDLK_KP_PLUS = SDL_SCANCODE_KP_PLUS or SDLK_SCANCODE_MASK;
4373
SDLK_KP_ENTER = SDL_SCANCODE_KP_ENTER or SDLK_SCANCODE_MASK;
4374
SDLK_KP_1 = SDL_SCANCODE_KP_1 or SDLK_SCANCODE_MASK;
4375
SDLK_KP_2 = SDL_SCANCODE_KP_2 or SDLK_SCANCODE_MASK;
4376
SDLK_KP_3 = SDL_SCANCODE_KP_3 or SDLK_SCANCODE_MASK;
4377
SDLK_KP_4 = SDL_SCANCODE_KP_4 or SDLK_SCANCODE_MASK;
4378
SDLK_KP_5 = SDL_SCANCODE_KP_5 or SDLK_SCANCODE_MASK;
4379
SDLK_KP_6 = SDL_SCANCODE_KP_6 or SDLK_SCANCODE_MASK;
4380
SDLK_KP_7 = SDL_SCANCODE_KP_7 or SDLK_SCANCODE_MASK;
4381
SDLK_KP_8 = SDL_SCANCODE_KP_8 or SDLK_SCANCODE_MASK;
4382
SDLK_KP_9 = SDL_SCANCODE_KP_9 or SDLK_SCANCODE_MASK;
4383
SDLK_KP_0 = SDL_SCANCODE_KP_0 or SDLK_SCANCODE_MASK;
4384
SDLK_KP_PERIOD = SDL_SCANCODE_KP_PERIOD or SDLK_SCANCODE_MASK;
4386
SDLK_APPLICATION = SDL_SCANCODE_APPLICATION or SDLK_SCANCODE_MASK;
4387
SDLK_POWER = SDL_SCANCODE_POWER or SDLK_SCANCODE_MASK;
4388
SDLK_KP_EQUALS = SDL_SCANCODE_KP_EQUALS or SDLK_SCANCODE_MASK;
4389
SDLK_F13 = SDL_SCANCODE_F13 or SDLK_SCANCODE_MASK;
4390
SDLK_F14 = SDL_SCANCODE_F14 or SDLK_SCANCODE_MASK;
4391
SDLK_F15 = SDL_SCANCODE_F15 or SDLK_SCANCODE_MASK;
4392
SDLK_F16 = SDL_SCANCODE_F16 or SDLK_SCANCODE_MASK;
4393
SDLK_F17 = SDL_SCANCODE_F17 or SDLK_SCANCODE_MASK;
4394
SDLK_F18 = SDL_SCANCODE_F18 or SDLK_SCANCODE_MASK;
4395
SDLK_F19 = SDL_SCANCODE_F19 or SDLK_SCANCODE_MASK;
4396
SDLK_F20 = SDL_SCANCODE_F20 or SDLK_SCANCODE_MASK;
4397
SDLK_F21 = SDL_SCANCODE_F21 or SDLK_SCANCODE_MASK;
4398
SDLK_F22 = SDL_SCANCODE_F22 or SDLK_SCANCODE_MASK;
4399
SDLK_F23 = SDL_SCANCODE_F23 or SDLK_SCANCODE_MASK;
4400
SDLK_F24 = SDL_SCANCODE_F24 or SDLK_SCANCODE_MASK;
4401
SDLK_EXECUTE = SDL_SCANCODE_EXECUTE or SDLK_SCANCODE_MASK;
4402
SDLK_HELP = SDL_SCANCODE_HELP or SDLK_SCANCODE_MASK;
4403
SDLK_MENU = SDL_SCANCODE_MENU or SDLK_SCANCODE_MASK;
4404
SDLK_SELECT = SDL_SCANCODE_SELECT or SDLK_SCANCODE_MASK;
4405
SDLK_STOP = SDL_SCANCODE_STOP or SDLK_SCANCODE_MASK;
4406
SDLK_AGAIN = SDL_SCANCODE_AGAIN or SDLK_SCANCODE_MASK;
4407
SDLK_UNDO = SDL_SCANCODE_UNDO or SDLK_SCANCODE_MASK;
4408
SDLK_CUT = SDL_SCANCODE_CUT or SDLK_SCANCODE_MASK;
4409
SDLK_COPY = SDL_SCANCODE_COPY or SDLK_SCANCODE_MASK;
4410
SDLK_PASTE = SDL_SCANCODE_PASTE or SDLK_SCANCODE_MASK;
4411
SDLK_FIND = SDL_SCANCODE_FIND or SDLK_SCANCODE_MASK;
4412
SDLK_MUTE = SDL_SCANCODE_MUTE or SDLK_SCANCODE_MASK;
4413
SDLK_VOLUMEUP = SDL_SCANCODE_VOLUMEUP or SDLK_SCANCODE_MASK;
4414
SDLK_VOLUMEDOWN = SDL_SCANCODE_VOLUMEDOWN or SDLK_SCANCODE_MASK;
4415
SDLK_KP_COMMA = SDL_SCANCODE_KP_COMMA or SDLK_SCANCODE_MASK;
4416
SDLK_KP_EQUALSAS400 = SDL_SCANCODE_KP_EQUALSAS400 or SDLK_SCANCODE_MASK;
4418
SDLK_ALTERASE = SDL_SCANCODE_ALTERASE or SDLK_SCANCODE_MASK;
4419
SDLK_SYSREQ = SDL_SCANCODE_SYSREQ or SDLK_SCANCODE_MASK;
4420
SDLK_CANCEL = SDL_SCANCODE_CANCEL or SDLK_SCANCODE_MASK;
4421
SDLK_CLEAR = SDL_SCANCODE_CLEAR or SDLK_SCANCODE_MASK;
4422
SDLK_PRIOR = SDL_SCANCODE_PRIOR or SDLK_SCANCODE_MASK;
4423
SDLK_RETURN2 = SDL_SCANCODE_RETURN2 or SDLK_SCANCODE_MASK;
4424
SDLK_SEPARATOR = SDL_SCANCODE_SEPARATOR or SDLK_SCANCODE_MASK;
4425
SDLK_OUT = SDL_SCANCODE_OUT or SDLK_SCANCODE_MASK;
4426
SDLK_OPER = SDL_SCANCODE_OPER or SDLK_SCANCODE_MASK;
4427
SDLK_CLEARAGAIN = SDL_SCANCODE_CLEARAGAIN or SDLK_SCANCODE_MASK;
4428
SDLK_CRSEL = SDL_SCANCODE_CRSEL or SDLK_SCANCODE_MASK;
4429
SDLK_EXSEL = SDL_SCANCODE_EXSEL or SDLK_SCANCODE_MASK;
4431
SDLK_KP_00 = SDL_SCANCODE_KP_00 or SDLK_SCANCODE_MASK;
4432
SDLK_KP_000 = SDL_SCANCODE_KP_000 or SDLK_SCANCODE_MASK;
4433
SDLK_THOUSANDSSEPARATOR = SDL_SCANCODE_THOUSANDSSEPARATOR or SDLK_SCANCODE_MASK;
4434
SDLK_DECIMALSEPARATOR = SDL_SCANCODE_DECIMALSEPARATOR or SDLK_SCANCODE_MASK;
4435
SDLK_CURRENCYUNIT = SDL_SCANCODE_CURRENCYUNIT or SDLK_SCANCODE_MASK;
4436
SDLK_CURRENCYSUBUNIT = SDL_SCANCODE_CURRENCYSUBUNIT or SDLK_SCANCODE_MASK;
4437
SDLK_KP_LEFTPAREN = SDL_SCANCODE_KP_LEFTPAREN or SDLK_SCANCODE_MASK;
4438
SDLK_KP_RIGHTPAREN = SDL_SCANCODE_KP_RIGHTPAREN or SDLK_SCANCODE_MASK;
4439
SDLK_KP_LEFTBRACE = SDL_SCANCODE_KP_LEFTBRACE or SDLK_SCANCODE_MASK;
4440
SDLK_KP_RIGHTBRACE = SDL_SCANCODE_KP_RIGHTBRACE or SDLK_SCANCODE_MASK;
4441
SDLK_KP_TAB = SDL_SCANCODE_KP_TAB or SDLK_SCANCODE_MASK;
4442
SDLK_KP_BACKSPACE = SDL_SCANCODE_KP_BACKSPACE or SDLK_SCANCODE_MASK;
4443
SDLK_KP_A = SDL_SCANCODE_KP_A or SDLK_SCANCODE_MASK;
4444
SDLK_KP_B = SDL_SCANCODE_KP_B or SDLK_SCANCODE_MASK;
4445
SDLK_KP_C = SDL_SCANCODE_KP_C or SDLK_SCANCODE_MASK;
4446
SDLK_KP_D = SDL_SCANCODE_KP_D or SDLK_SCANCODE_MASK;
4447
SDLK_KP_E = SDL_SCANCODE_KP_E or SDLK_SCANCODE_MASK;
4448
SDLK_KP_F = SDL_SCANCODE_KP_F or SDLK_SCANCODE_MASK;
4449
SDLK_KP_XOR = SDL_SCANCODE_KP_XOR or SDLK_SCANCODE_MASK;
4450
SDLK_KP_POWER = SDL_SCANCODE_KP_POWER or SDLK_SCANCODE_MASK;
4451
SDLK_KP_PERCENT = SDL_SCANCODE_KP_PERCENT or SDLK_SCANCODE_MASK;
4452
SDLK_KP_LESS = SDL_SCANCODE_KP_LESS or SDLK_SCANCODE_MASK;
4453
SDLK_KP_GREATER = SDL_SCANCODE_KP_GREATER or SDLK_SCANCODE_MASK;
4454
SDLK_KP_AMPERSAND = SDL_SCANCODE_KP_AMPERSAND or SDLK_SCANCODE_MASK;
4455
SDLK_KP_DBLAMPERSAND = SDL_SCANCODE_KP_DBLAMPERSAND or SDLK_SCANCODE_MASK;
4456
SDLK_KP_VERTICALBAR = SDL_SCANCODE_KP_VERTICALBAR or SDLK_SCANCODE_MASK;
4457
SDLK_KP_DBLVERTICALBAR = SDL_SCANCODE_KP_DBLVERTICALBAR or SDLK_SCANCODE_MASK;
4458
SDLK_KP_COLON = SDL_SCANCODE_KP_COLON or SDLK_SCANCODE_MASK;
4459
SDLK_KP_HASH = SDL_SCANCODE_KP_HASH or SDLK_SCANCODE_MASK;
4460
SDLK_KP_SPACE = SDL_SCANCODE_KP_SPACE or SDLK_SCANCODE_MASK;
4461
SDLK_KP_AT = SDL_SCANCODE_KP_AT or SDLK_SCANCODE_MASK;
4462
SDLK_KP_EXCLAM = SDL_SCANCODE_KP_EXCLAM or SDLK_SCANCODE_MASK;
4463
SDLK_KP_MEMSTORE = SDL_SCANCODE_KP_MEMSTORE or SDLK_SCANCODE_MASK;
4464
SDLK_KP_MEMRECALL = SDL_SCANCODE_KP_MEMRECALL or SDLK_SCANCODE_MASK;
4465
SDLK_KP_MEMCLEAR = SDL_SCANCODE_KP_MEMCLEAR or SDLK_SCANCODE_MASK;
4466
SDLK_KP_MEMADD = SDL_SCANCODE_KP_MEMADD or SDLK_SCANCODE_MASK;
4467
SDLK_KP_MEMSUBTRACT = SDL_SCANCODE_KP_MEMSUBTRACT or SDLK_SCANCODE_MASK;
4468
SDLK_KP_MEMMULTIPLY = SDL_SCANCODE_KP_MEMMULTIPLY or SDLK_SCANCODE_MASK;
4469
SDLK_KP_MEMDIVIDE = SDL_SCANCODE_KP_MEMDIVIDE or SDLK_SCANCODE_MASK;
4470
SDLK_KP_PLUSMINUS = SDL_SCANCODE_KP_PLUSMINUS or SDLK_SCANCODE_MASK;
4471
SDLK_KP_CLEAR = SDL_SCANCODE_KP_CLEAR or SDLK_SCANCODE_MASK;
4472
SDLK_KP_CLEARENTRY = SDL_SCANCODE_KP_CLEARENTRY or SDLK_SCANCODE_MASK;
4473
SDLK_KP_BINARY = SDL_SCANCODE_KP_BINARY or SDLK_SCANCODE_MASK;
4474
SDLK_KP_OCTAL = SDL_SCANCODE_KP_OCTAL or SDLK_SCANCODE_MASK;
4475
SDLK_KP_DECIMAL = SDL_SCANCODE_KP_DECIMAL or SDLK_SCANCODE_MASK;
4476
SDLK_KP_HEXADECIMAL = SDL_SCANCODE_KP_HEXADECIMAL or SDLK_SCANCODE_MASK;
4478
SDLK_LCTRL = SDL_SCANCODE_LCTRL or SDLK_SCANCODE_MASK;
4479
SDLK_LSHIFT = SDL_SCANCODE_LSHIFT or SDLK_SCANCODE_MASK;
4480
SDLK_LALT = SDL_SCANCODE_LALT or SDLK_SCANCODE_MASK;
4481
SDLK_LGUI = SDL_SCANCODE_LGUI or SDLK_SCANCODE_MASK;
4482
SDLK_RCTRL = SDL_SCANCODE_RCTRL or SDLK_SCANCODE_MASK;
4483
SDLK_RSHIFT = SDL_SCANCODE_RSHIFT or SDLK_SCANCODE_MASK;
4484
SDLK_RALT = SDL_SCANCODE_RALT or SDLK_SCANCODE_MASK;
4485
SDLK_RGUI = SDL_SCANCODE_RGUI or SDLK_SCANCODE_MASK;
4487
SDLK_MODE = SDL_SCANCODE_MODE or SDLK_SCANCODE_MASK;
4489
SDLK_AUDIONEXT = SDL_SCANCODE_AUDIONEXT or SDLK_SCANCODE_MASK;
4490
SDLK_AUDIOPREV = SDL_SCANCODE_AUDIOPREV or SDLK_SCANCODE_MASK;
4491
SDLK_AUDIOSTOP = SDL_SCANCODE_AUDIOSTOP or SDLK_SCANCODE_MASK;
4492
SDLK_AUDIOPLAY = SDL_SCANCODE_AUDIOPLAY or SDLK_SCANCODE_MASK;
4493
SDLK_AUDIOMUTE = SDL_SCANCODE_AUDIOMUTE or SDLK_SCANCODE_MASK;
4494
SDLK_MEDIASELECT = SDL_SCANCODE_MEDIASELECT or SDLK_SCANCODE_MASK;
4495
SDLK_WWW = SDL_SCANCODE_WWW or SDLK_SCANCODE_MASK;
4496
SDLK_MAIL = SDL_SCANCODE_MAIL or SDLK_SCANCODE_MASK;
4497
SDLK_CALCULATOR = SDL_SCANCODE_CALCULATOR or SDLK_SCANCODE_MASK;
4498
SDLK_COMPUTER = SDL_SCANCODE_COMPUTER or SDLK_SCANCODE_MASK;
4499
SDLK_AC_SEARCH = SDL_SCANCODE_AC_SEARCH or SDLK_SCANCODE_MASK;
4500
SDLK_AC_HOME = SDL_SCANCODE_AC_HOME or SDLK_SCANCODE_MASK;
4501
SDLK_AC_BACK = SDL_SCANCODE_AC_BACK or SDLK_SCANCODE_MASK;
4502
SDLK_AC_FORWARD = SDL_SCANCODE_AC_FORWARD or SDLK_SCANCODE_MASK;
4503
SDLK_AC_STOP = SDL_SCANCODE_AC_STOP or SDLK_SCANCODE_MASK;
4504
SDLK_AC_REFRESH = SDL_SCANCODE_AC_REFRESH or SDLK_SCANCODE_MASK;
4505
SDLK_AC_BOOKMARKS = SDL_SCANCODE_AC_BOOKMARKS or SDLK_SCANCODE_MASK;
4507
SDLK_BRIGHTNESSDOWN = SDL_SCANCODE_BRIGHTNESSDOWN or SDLK_SCANCODE_MASK;
4508
SDLK_BRIGHTNESSUP = SDL_SCANCODE_BRIGHTNESSUP or SDLK_SCANCODE_MASK;
4509
SDLK_DISPLAYSWITCH = SDL_SCANCODE_DISPLAYSWITCH or SDLK_SCANCODE_MASK;
4510
SDLK_KBDILLUMTOGGLE = SDL_SCANCODE_KBDILLUMTOGGLE or SDLK_SCANCODE_MASK;
4511
SDLK_KBDILLUMDOWN = SDL_SCANCODE_KBDILLUMDOWN or SDLK_SCANCODE_MASK;
4512
SDLK_KBDILLUMUP = SDL_SCANCODE_KBDILLUMUP or SDLK_SCANCODE_MASK;
4513
SDLK_EJECT = SDL_SCANCODE_EJECT or SDLK_SCANCODE_MASK;
4514
SDLK_SLEEP = SDL_SCANCODE_SLEEP or SDLK_SCANCODE_MASK;
4517
* Enumeration of valid key mods (possibly OR'd together).
4521
KMOD_LSHIFT = $0001;
4522
KMOD_RSHIFT = $0002;
4532
KMOD_RESERVED = $8000;
4535
PSDL_KeyMod = ^TSDL_KeyMod;
4539
KMOD_CTRL = KMOD_LCTRL or KMOD_RCTRL;
4540
KMOD_SHIFT = KMOD_LSHIFT or KMOD_RSHIFT;
4541
KMOD_ALT = KMOD_LALT or KMOD_RALT;
4542
KMOD_GUI = KMOD_LGUI or KMOD_RGUI;
4546
////////////////////////////////////////////////////////////////////////////////////////////////////////
4547
////////////////////// SDL_keyboard.h ////////////////////////////////////////////////////
4548
////////////////////////////////////////////////////////////////////////////////////////////////////////
4552
* The SDL keysym structure, used in key events.
4554
PSDL_Keysym = ^TSDL_Keysym;
4555
TSDL_Keysym = record
4556
scancode: TSDL_ScanCode; // SDL physical key code - see SDL_Scancode for details
4557
sym: TSDL_KeyCode; // SDL virtual key code - see SDL_Keycode for details
4558
_mod: UInt16; // current key modifiers
4559
unicode: UInt32; // (deprecated) use SDL_TextInputEvent instead
4563
* Get the window which currently has keyboard focus.
4566
function SDL_GetKeyboardFocus: PSDL_Window cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetKeyboardFocus' {$ENDIF};
4569
* Get a snapshot of the current state of the keyboard.
4571
* numkeys if non-nil, receives the length of the returned array.
4573
* An array of key states. Indexes into this array are obtained by using SDL_Scancode values.
4577
function SDL_GetKeyboardState(numkeys: PInt): PUInt8 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetKeyboardState' {$ENDIF};
4580
* Get the current key modifier state for the keyboard.
4583
function SDL_GetModState: TSDL_KeyMod cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetModState' {$ENDIF};
4586
* Set the current key modifier state for the keyboard.
4588
* This does not change the keyboard state, only the key modifier flags.
4591
procedure SDL_SetModState(modstate: TSDL_KeyMod) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetModState' {$ENDIF};
4594
* Get the key code corresponding to the given scancode according
4595
* to the current keyboard layout.
4597
* See SDL_Keycode for details.
4602
function SDL_GetKeyFromScancode(scancode: TSDL_ScanCode): TSDL_KeyCode cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetKeyFromScancode' {$ENDIF};
4605
* Get the scancode corresponding to the given key code according to the
4606
* current keyboard layout.
4608
* See SDL_Scancode for details.
4610
* SDL_GetScancodeName()
4613
function SDL_GetScancodeFromKey(key: TSDL_KeyCode): TSDL_ScanCode cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetScancodeFromKey' {$ENDIF};
4616
* Get a human-readable name for a scancode.
4618
* A pointer to the name for the scancode.
4620
* If the scancode doesn't have a name, this function returns
4621
* an empty string ("").
4625
function SDL_GetScancodeName(scancode: TSDL_ScanCode): PAnsiChar cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetScancodeName' {$ENDIF};
4628
* Get a scancode from a human-readable name
4630
* scancode, or SDL_SCANCODE_UNKNOWN if the name wasn't recognized
4635
function SDL_GetScancodeFromName(const name: PAnsiChar): TSDL_ScanCode cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetScancodeFromName' {$ENDIF};
4638
* Get a human-readable name for a key.
4640
* A pointer to a UTF-8 string that stays valid at least until the next
4641
* call to this function. If you need it around any longer, you must
4642
* copy it. If the key doesn't have a name, this function returns an
4643
* empty string ("").
4648
function SDL_GetKeyName(key: TSDL_ScanCode): PAnsiChar cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetKeyName' {$ENDIF};
4651
* Get a key code from a human-readable name
4653
* key code, or SDLK_UNKNOWN if the name wasn't recognized
4658
function SDL_GetKeyFromName(const name: PAnsiChar): TSDL_KeyCode cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetKeyFromName' {$ENDIF};
4661
* Start accepting Unicode text input events.
4662
* This function will show the on-screen keyboard if supported.
4664
* SDL_StopTextInput()
4665
* SDL_SetTextInputRect()
4666
* SDL_HasScreenKeyboardSupport()
4669
procedure SDL_StartTextInput cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_StartTextInput' {$ENDIF};
4672
* Return whether or not Unicode text input events are enabled.
4674
* SDL_StartTextInput()
4675
* SDL_StopTextInput()
4678
function SDL_IsTextInputActive: TSDL_Bool cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_IsTextInputActive' {$ENDIF};
4681
* Stop receiving any text input events.
4682
* This function will hide the on-screen keyboard if supported.
4684
* SDL_StartTextInput()
4685
* SDL_HasScreenKeyboardSupport()
4688
procedure SDL_StopTextInput cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_StopTextInput' {$ENDIF};
4691
* Set the rectangle used to type Unicode text inputs.
4692
* This is used as a hint for IME and on-screen keyboard placement.
4694
* SDL_StartTextInput()
4697
procedure SDL_SetTextInputRect(rect: PSDL_Rect) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetTextInputRect' {$ENDIF};
4700
* Returns whether the platform has some screen keyboard support.
4702
* SDL_TRUE if some keyboard support is available else SDL_FALSE.
4704
* Not all screen keyboard functions are supported on all platforms.
4706
* SDL_IsScreenKeyboardShown()
4709
function SDL_HasScreenKeyboardSupport: TSDL_Bool cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_HasScreenKeyboardSupport' {$ENDIF};
4712
* Returns whether the screen keyboard is shown for given window.
4714
* window The window for which screen keyboard should be queried.
4716
* Result - SDL_TRUE if screen keyboard is shown else SDL_FALSE.
4718
* SDL_HasScreenKeyboardSupport()
4721
function SDL_IsScreenKeyboardShown(window: PSDL_Window): TSDL_Bool cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_IsScreenKeyboardShown' {$ENDIF};
4725
////////////////////////////////////////////////////////////////////////////////////////////////////////
4726
////////////////////// SDL_mouse.h ////////////////////////////////////////////////////
4727
////////////////////////////////////////////////////////////////////////////////////////////////////////
4730
PSDL_Cursor = Pointer;
4735
* Cursor types for SDL_CreateSystemCursor.
4738
SDL_SYSTEM_CURSOR_ARROW = 0; // Arrow
4739
SDL_SYSTEM_CURSOR_IBEAM = 1; // I-beam
4740
SDL_SYSTEM_CURSOR_WAIT = 2; // Wait
4741
SDL_SYSTEM_CURSOR_CROSSHAIR = 3; // Crosshair
4742
SDL_SYSTEM_CURSOR_WAITARROW = 4; // Small wait cursor (or Wait if not available)
4743
SDL_SYSTEM_CURSOR_SIZENWSE = 5; // Double arrow pointing northwest and southeast
4744
SDL_SYSTEM_CURSOR_SIZENESW = 6; // Double arrow pointing northeast and southwest
4745
SDL_SYSTEM_CURSOR_SIZEWE = 7; // Double arrow pointing west and east
4746
SDL_SYSTEM_CURSOR_SIZENS = 8; // Double arrow pointing north and south
4747
SDL_SYSTEM_CURSOR_SIZEALL = 9; // Four pointed arrow pointing north, south, east, and west
4748
SDL_SYSTEM_CURSOR_NO = 10; // Slashed circle or crossbones
4749
SDL_SYSTEM_CURSOR_HAND = 11; // Hand
4750
SDL_NUM_SYSTEM_CURSORS = 12;
4753
PSDL_SystemCursor = ^TSDL_SystemCursor;
4754
TSDL_SystemCursor = Word;
4756
{* Function prototypes *}
4759
* Get the window which currently has mouse focus.
4762
function SDL_GetMouseFocus: PSDL_Window cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetMouseFocus' {$ENDIF};
4765
* Retrieve the current state of the mouse.
4767
* The current button state is returned as a button bitmask, which can
4768
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
4769
* mouse cursor position relative to the focus window for the currently
4770
* selected mouse. You can pass nil for either x or y.
4772
* SDL_Button = 1 shl ((X)-1)
4775
function SDL_GetMouseState(x: PInt; y: PInt): UInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetMouseState' {$ENDIF};
4778
* Retrieve the relative state of the mouse.
4780
* The current button state is returned as a button bitmask, which can
4781
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
4782
* mouse deltas since the last call to SDL_GetRelativeMouseState().
4785
function SDL_GetRelativeMouseState(x: PInt; y: PInt): UInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetRelativeMouseState' {$ENDIF};
4788
* Moves the mouse to the given position within the window.
4790
* window The window to move the mouse into, or nil for the current mouse focus
4791
* x The x coordinate within the window
4792
* y The y coordinate within the window
4794
* This function generates a mouse motion event
4797
procedure SDL_WarpMouseInWindow(window: PSDL_Window; x: SInt32; y: SInt32) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_WarpMouseInWindow' {$ENDIF};
4800
* Set relative mouse mode.
4802
* enabled Whether or not to enable relative mode
4804
* 0 on success, or -1 if relative mode is not supported.
4806
* While the mouse is in relative mode, the cursor is hidden, and the
4807
* driver will try to report continuous motion in the current window.
4808
* Only relative motion events will be delivered, the mouse position
4811
* This function will flush any pending mouse motion.
4813
* SDL_GetRelativeMouseMode()
4816
function SDL_SetRelativeMouseMode(enabled: TSDL_Bool): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetRelativeMouseMode' {$ENDIF};
4819
* Query whether relative mouse mode is enabled.
4821
* SDL_SetRelativeMouseMode()
4824
function SDL_GetRelativeMouseMode: TSDL_Bool cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetRelativeMouseMode' {$ENDIF};
4827
* Create a cursor, using the specified bitmap data and
4828
* mask (in MSB format).
4830
* The cursor width must be a multiple of 8 bits.
4832
* The cursor is created in black and white according to the following:
4834
* <tr><td> data </td><td> mask </td><td> resulting pixel on screen </td></tr>
4835
* <tr><td> 0 </td><td> 1 </td><td> White </td></tr>
4836
* <tr><td> 1 </td><td> 1 </td><td> Black </td></tr>
4837
* <tr><td> 0 </td><td> 0 </td><td> Transparent </td></tr>
4838
* <tr><td> 1 </td><td> 0 </td><td> Inverted color if possible, black
4839
* if not. </td></tr>
4845
function SDL_CreateCursor(const data: PUInt8; const mask: PUInt8; w: SInt32; h: SInt32; hot_x: SInt32; hot_y: SInt32): PSDL_Cursor cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_CreateCursor' {$ENDIF};
4848
* Create a color cursor.
4853
function SDL_CreateColorCursor(surface: PSDL_Surface; hot_x: SInt32; hot_y: SInt32): PSDL_Cursor cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_CreateColorCursor' {$ENDIF};
4856
* Create a system cursor.
4861
function SDL_CreateSystemCursor(id: TSDL_SystemCursor): PSDL_Cursor cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_CreateSystemCursor' {$ENDIF};
4864
* Set the active cursor.
4867
procedure SDL_SetCursor(cursor: PSDL_Cursor) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetCursor' {$ENDIF};
4870
* Return the active cursor.
4873
function SDL_GetCursor: PSDL_Cursor cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetCursor' {$ENDIF};
4876
* Frees a cursor created with SDL_CreateCursor().
4878
* SDL_CreateCursor()
4881
procedure SDL_FreeCursor(cursor: PSDL_Cursor) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_FreeCursor' {$ENDIF};
4884
* Toggle whether or not the cursor is shown.
4886
* toggle 1 to show the cursor, 0 to hide it, -1 to query the current
4889
* 1 if the cursor is shown, or 0 if the cursor is hidden.
4892
function SDL_ShowCursor(toggle: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_ShowCursor' {$ENDIF};
4896
* Used as a mask when testing buttons in buttonstate.
4897
* - Button 1: Left mouse button
4898
* - Button 2: Middle mouse button
4899
* - Button 3: Right mouse button
4902
SDL_BUTTON_LEFT = 1;
4903
SDL_BUTTON_MIDDLE = 2;
4904
SDL_BUTTON_RIGHT = 3;
4907
SDL_BUTTON_LMASK = 1 shl ((SDL_BUTTON_LEFT) - 1);
4908
SDL_BUTTON_MMASK = 1 shl ((SDL_BUTTON_MIDDLE) - 1);
4909
SDL_BUTTON_RMASK = 1 shl ((SDL_BUTTON_RIGHT) - 1);
4910
SDL_BUTTON_X1MASK = 1 shl ((SDL_BUTTON_X1) - 1);
4911
SDL_BUTTON_X2MASK = 1 shl ((SDL_BUTTON_X2) - 1);
4915
////////////////////////////////////////////////////////////////////////////////////////////////////////
4916
////////////////////// SDL_joystick.h ////////////////////////////////////////////////////
4917
////////////////////////////////////////////////////////////////////////////////////////////////////////
4922
* In order to use these functions, SDL_Init() must have been called
4923
* with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system
4924
* for joysticks, and load appropriate drivers.
4929
{* The joystick structure used to identify an SDL joystick *}
4930
PSDL_Joystick = Pointer; // todo!!
4932
{* A structure that encodes the stable unique id for a joystick device *}
4934
TSDL_JoystickGUID = record
4935
data: array[0..15] of UInt8;
4938
TSDL_JoystickID = SInt32;
4940
{* Function prototypes *}
4942
* Count the number of joysticks attached to the system right now
4944
function SDL_NumJoysticks: SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_NumJoysticks' {$ENDIF};
4947
* Get the implementation dependent name of a joystick.
4948
* This can be called before any joysticks are opened.
4949
* If no name can be found, this function returns NULL.
4951
function SDL_JoystickNameForIndex(device_index: SInt32): PAnsiChar cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_JoystickNameForIndex' {$ENDIF};
4954
* Open a joystick for use.
4955
* The index passed as an argument refers tothe N'th joystick on the system.
4956
* This index is the value which will identify this joystick in future joystick
4959
* A joystick identifier, or NULL if an error occurred.
4961
function SDL_JoystickOpen(device_index: SInt32): PSDL_Joystick cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_JoystickOpen' {$ENDIF};
4964
* Return the name for this currently opened joystick.
4965
* If no name can be found, this function returns NULL.
4967
function SDL_JoystickName(joystick: PSDL_Joystick): PAnsiChar cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_JoystickName' {$ENDIF};
4970
* Return the GUID for the joystick at this index
4972
function SDL_JoystickGetDeviceGUID(device_index: SInt32): TSDL_JoystickGUID cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_JoystickGetDeviceGUID' {$ENDIF};
4975
* Return the GUID for this opened joystick
4977
function SDL_JoystickGetGUID(joystick: PSDL_Joystick): TSDL_JoystickGUID cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_JoystickGetGUID' {$ENDIF};
4980
* Return a string representation for this guid. pszGUID must point to at least 33 bytes
4981
* (32 for the string plus a NULL terminator).
4983
procedure SDL_JoystickGetGUIDString(guid: TSDL_JoystickGUId; pszGUID: PAnsiChar; cbGUID: SInt32) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_JoystickGetGUIDString' {$ENDIF};
4986
* convert a string into a joystick formatted guid
4988
function SDL_JoystickGetGUIDFromString(const pchGUID: PAnsiChar): TSDL_JoystickGUID cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_JoystickGetGUIDFromString' {$ENDIF};
4991
* Returns SDL_TRUE if the joystick has been opened and currently connected, or SDL_FALSE if it has not.
4993
function SDL_JoystickGetAttached(joystick: PSDL_Joystick): TSDL_Bool cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_JoystickGetAttached' {$ENDIF};
4996
* Get the instance ID of an opened joystick or -1 if the joystick is invalid.
4998
function SDL_JoystickInstanceID(joystick: PSDL_Joystick): TSDL_JoystickID cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_JoystickInstanceID' {$ENDIF};
5001
* Get the number of general axis controls on a joystick.
5003
function SDL_JoystickNumAxes(joystick: PSDL_Joystick): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_JoystickNumAxes' {$ENDIF};
5006
* Get the number of trackballs on a joystick.
5008
* Joystick trackballs have only relative motion events associated
5009
* with them and their state cannot be polled.
5011
function SDL_JoystickNumBalls(joystick: PSDL_Joystick): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_JoystickNumBalls' {$ENDIF};
5014
* Get the number of POV hats on a joystick.
5016
function SDL_JoystickNumHats(joystick: PSDL_Joystick): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_JoystickNumHats' {$ENDIF};
5019
* Get the number of buttons on a joystick.
5021
function SDL_JoystickNumButtons(joystick: PSDL_Joystick): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_JoystickNumButtons' {$ENDIF};
5024
* Update the current state of the open joysticks.
5026
* This is called automatically by the event loop if any joystick
5027
* events are enabled.
5029
procedure SDL_JoystickUpdate cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_JoystickUpdate' {$ENDIF};
5032
* Enable/disable joystick event polling.
5034
* If joystick events are disabled, you must call SDL_JoystickUpdate()
5035
* yourself and check the state of the joystick when you want joystick
5038
* The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE.
5040
function SDL_JoystickEventState(state: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_JoystickEventState' {$ENDIF};
5043
* Get the current state of an axis control on a joystick.
5045
* The state is a value ranging from -32768 to 32767.
5047
* The axis indices start at index 0.
5049
function SDL_JoystickGetAxis(joystick: PSDL_Joystick; axis: SInt32): SInt16 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_JoystickGetAxis' {$ENDIF};
5055
SDL_HAT_CENTERED = $00;
5057
SDL_HAT_RIGHT = $02;
5060
SDL_HAT_RIGHTUP = SDL_HAT_RIGHT or SDL_HAT_UP;
5061
SDL_HAT_RIGHTDOWN = SDL_HAT_RIGHT or SDL_HAT_DOWN;
5062
SDL_HAT_LEFTUP = SDL_HAT_LEFT or SDL_HAT_UP;
5063
SDL_HAT_LEFTDOWN = SDL_HAT_LEFT or SDL_HAT_DOWN;
5066
* Get the current state of a POV hat on a joystick.
5068
* The hat indices start at index 0.
5070
* The return value is one of the following positions:
5071
* - SDL_HAT_CENTERED
5077
* - SDL_HAT_RIGHTDOWN
5079
* - SDL_HAT_LEFTDOWN
5081
function SDL_JoystickGetHat(joystick: PSDL_Joystick; hat: SInt32): UInt8 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_JoystickGetHat' {$ENDIF};
5084
* Get the ball axis change since the last poll.
5086
* 0, or -1 if you passed it invalid parameters.
5088
* The ball indices start at index 0.
5090
function SDL_JoystickGetBall(joystick: PSDL_Joystick; ball: SInt32; dx: PInt; dy: PInt): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_JoystickGetBall' {$ENDIF};
5093
* Get the current state of a button on a joystick.
5095
* The button indices start at index 0.
5097
function SDL_JoystickGetButton(joystick: PSDL_Joystick; button: SInt32): UInt8 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_JoystickGetButton' {$ENDIF};
5099
* Close a joystick previously opened with SDL_JoystickOpen().
5101
procedure SDL_JoystickClose(joystick: PSDL_Joystick) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_JoystickClose' {$ENDIF};
5105
////////////////////////////////////////////////////////////////////////////////////////////////////////
5106
////////////////////// SDL_touch.h ////////////////////////////////////////////////////
5107
////////////////////////////////////////////////////////////////////////////////////////////////////////
5110
PSDL_TouchID = ^TSDL_TouchID;
5111
TSDL_TouchID = SInt64;
5113
PSDL_FingerID = ^TSDL_FingerID;
5114
TSDL_FingerID = SInt64;
5116
PSDL_Finger = ^TSDL_Finger;
5117
TSDL_Finger = record
5124
{* Used as the device ID for mouse events simulated with touch input *}
5126
SDL_TOUCH_MOUSEID = UInt32(-1);
5128
{* Function prototypes *}
5131
* Get the number of registered touch devices.
5133
function SDL_GetNumTouchDevices: SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetNumTouchDevices' {$ENDIF};
5136
* Get the touch ID with the given index, or 0 if the index is invalid.
5138
function SDL_GetTouchDevice(index: SInt32): TSDL_TouchID cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetTouchDevice' {$ENDIF};
5141
* Get the number of active fingers for a given touch device.
5143
function SDL_GetNumTouchFingers(touchID: TSDL_TouchID): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetNumTouchFingers' {$ENDIF};
5146
* Get the finger object of the given touch, with the given index.
5148
function SDL_GetTouchFinger(touchID: TSDL_TouchID; index: SInt32): PSDL_Finger cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetTouchFinger' {$ENDIF};
5152
////////////////////////////////////////////////////////////////////////////////////////////////////////
5153
////////////////////// SDL_gesture.h ////////////////////////////////////////////////////
5154
////////////////////////////////////////////////////////////////////////////////////////////////////////
5157
TSDL_GestureID = SInt64;
5159
{* Function prototypes *}
5162
* Begin Recording a gesture on the specified touch, or all touches (-1)
5166
function SDL_RecordGesture(touchId: TSDL_TouchID): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RecordGesture' {$ENDIF};
5169
* Save all currently loaded Dollar Gesture templates
5173
function SDL_SaveAllDollarTemplates(src: PSDL_RWops): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SaveAllDollarTemplates' {$ENDIF};
5176
* Save a currently loaded Dollar Gesture template
5180
function SDL_SaveDollarTemplate(gestureId: TSDL_GestureID; src: PSDL_RWops): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SaveDollarTemplate' {$ENDIF};
5184
* Load Dollar Gesture templates from a file
5188
function SDL_LoadDollarTemplates(touchId: TSDL_TouchID; src: PSDL_RWops): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_LoadDollarTemplates' {$ENDIF};
5192
////////////////////////////////////////////////////////////////////////////////////////////////////////
5193
////////////////////// SDL_events.h ////////////////////////////////////////////////////
5194
////////////////////////////////////////////////////////////////////////////////////////////////////////
5197
* The types of events that can be delivered.
5202
SDL_FIRSTEVENT = 0; // Unused (do not remove) (needed in pascal?)
5204
SDL_COMMONEVENT = 1; //added for pascal-compatibility
5206
{ Application events }
5207
SDL_QUITEV = $100; // User-requested quit (originally SDL_QUIT, but changed, cause theres a method called SDL_QUIT)
5210
{* These application events have special meaning on iOS, see README.iOS for details *}
5211
SDL_APP_TERMINATING = $101; {**< The application is being terminated by the OS
5212
Called on iOS in applicationWillTerminate()
5213
Called on Android in onDestroy()
5215
SDL_APP_LOWMEMORY = $102; {**< The application is low on memory, free memory if possible.
5216
Called on iOS in applicationDidReceiveMemoryWarning()
5217
Called on Android in onLowMemory()
5219
SDL_APP_WILLENTERBACKGROUND = $103; {**< The application is about to enter the background
5220
Called on iOS in applicationWillResignActive()
5221
Called on Android in onPause()
5223
SDL_APP_DIDENTERBACKGROUND = $104; {**< The application did enter the background and may not get CPU for some time
5224
Called on iOS in applicationDidEnterBackground()
5225
Called on Android in onPause()
5227
SDL_APP_WILLENTERFOREGROUND = $105; {**< The application is about to enter the foreground
5228
Called on iOS in applicationWillEnterForeground()
5229
Called on Android in onResume()
5231
SDL_APP_DIDENTERFOREGROUND = $106; {**< The application is now interactive
5232
Called on iOS in applicationDidBecomeActive()
5233
Called on Android in onResume()
5237
SDL_WINDOWEVENT = $200; // Window state change
5238
SDL_SYSWMEVENT = $201; // System specific event
5241
SDL_KEYDOWN = $300; // Key pressed
5242
SDL_KEYUP = $301; // Key released
5243
SDL_TEXTEDITING = $302; // Keyboard text editing (composition)
5244
SDL_TEXTINPUT = $303; // Keyboard text input
5247
SDL_MOUSEMOTION = $400; // Mouse moved
5248
SDL_MOUSEBUTTONDOWN = $401; // Mouse button pressed
5249
SDL_MOUSEBUTTONUP = $402; // Mouse button released
5250
SDL_MOUSEWHEEL = $403; // Mouse wheel motion
5253
SDL_JOYAXISMOTION = $600; // Joystick axis motion
5254
SDL_JOYBALLMOTION = $601; // Joystick trackball motion
5255
SDL_JOYHATMOTION = $602; // Joystick hat position change
5256
SDL_JOYBUTTONDOWN = $603; // Joystick button pressed
5257
SDL_JOYBUTTONUP = $604; // Joystick button released
5258
SDL_JOYDEVICEADDED = $605; // A new joystick has been inserted into the system
5259
SDL_JOYDEVICEREMOVED = $606; // An opened joystick has been removed
5261
{ Game controller events }
5262
SDL_CONTROLLERAXISMOTION = $650; // Game controller axis motion
5263
SDL_CONTROLLERBUTTONDOWN = $651; // Game controller button pressed
5264
SDL_CONTROLLERBUTTONUP = $652; // Game controller button released
5265
SDL_CONTROLLERDEVICEADDED = $653; // A new Game controller has been inserted into the system
5266
SDL_CONTROLLERDEVICEREMOVED = $654; // An opened Game controller has been removed
5267
SDL_CONTROLLERDEVICEREMAPPED = $655; // The controller mapping was updated
5270
SDL_FINGERDOWN = $700;
5271
SDL_FINGERUP = $701;
5272
SDL_FINGERMOTION = $702;
5275
SDL_DOLLARGESTURE = $800;
5276
SDL_DOLLARRECORD = $801;
5277
SDL_MULTIGESTURE = $802;
5279
{ Clipboard events }
5280
SDL_CLIPBOARDUPDATE = $900; // The clipboard changed
5282
{ Drag and drop events }
5283
SDL_DROPFILE = $1000; // The system requests a file open
5285
{** Events SDL_USEREVENT through SDL_LASTEVENT are for your use,
5286
* and should be allocated with SDL_RegisterEvents()
5288
SDL_USEREVENT = $8000;
5291
* This last event is only for bounding internal arrays (needed in pascal ??)
5293
SDL_LASTEVENT = $FFFF;
5297
TSDL_EventType = Word;
5300
* Fields shared by every event
5303
TSDL_CommonEvent = record
5309
* Window state change event data (event.window.*)
5312
TSDL_WindowEvent = record
5313
type_: UInt32; // SDL_WINDOWEVENT
5315
windowID: UInt32; // The associated window
5316
event: UInt8; // SDL_WindowEventID
5320
data1: SInt32; // event dependent data
5321
data2: SInt32; // event dependent data
5325
* Keyboard button event structure (event.key.*)
5327
TSDL_KeyboardEvent = record
5328
type_: UInt32; // SDL_KEYDOWN or SDL_KEYUP
5330
windowID: UInt32; // The window with keyboard focus, if any
5331
state: UInt8; // SDL_PRESSED or SDL_RELEASED
5332
_repeat: UInt8; // Non-zero if this is a key repeat
5335
keysym: TSDL_KeySym; // The key that was pressed or released
5339
SDL_TEXTEDITINGEVENT_TEXT_SIZE = 32;
5344
* Keyboard text editing event structure (event.edit.*)
5347
TSDL_TextEditingEvent = record
5348
type_: UInt32; // SDL_TEXTEDITING
5350
windowID: UInt32; // The window with keyboard focus, if any
5351
text: array[0..SDL_TEXTEDITINGEVENT_TEXT_SIZE] of Char; // The editing text
5352
start: SInt32; // The start cursor of selected editing text
5353
length: SInt32; // The length of selected editing text
5357
SDL_TEXTINPUTEVENT_TEXT_SIZE = 32;
5362
* Keyboard text input event structure (event.text.*)
5365
TSDL_TextInputEvent = record
5366
type_: UInt32; // SDL_TEXTINPUT
5368
windowID: UInt32; // The window with keyboard focus, if any
5369
text: array[0..SDL_TEXTINPUTEVENT_TEXT_SIZE] of Char; // The input text
5373
* Mouse motion event structure (event.motion.*)
5376
TSDL_MouseMotionEvent = record
5377
type_: UInt32; // SDL_MOUSEMOTION
5379
windowID: UInt32; // The window with mouse focus, if any
5380
which: UInt32; // The mouse instance id, or SDL_TOUCH_MOUSEID
5381
state: UInt8; // The current button state
5385
x: SInt32; // X coordinate, relative to window
5386
y: SInt32; // Y coordinate, relative to window
5387
xrel: SInt32; // The relative motion in the X direction
5388
yrel: SInt32; // The relative motion in the Y direction
5392
* Mouse button event structure (event.button.*)
5395
TSDL_MouseButtonEvent = record
5396
type_: UInt32; // SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP
5398
windowID: UInt32; // The window with mouse focus, if any
5399
which: UInt32; // The mouse instance id, or SDL_TOUCH_MOUSEID
5400
button: UInt8; // The mouse button index
5401
state: UInt8; // SDL_PRESSED or SDL_RELEASED
5404
x: SInt32; // X coordinate, relative to window
5405
y: SInt32; // Y coordinate, relative to window
5409
* Mouse wheel event structure (event.wheel.*)
5412
TSDL_MouseWheelEvent = record
5413
type_: UInt32; // SDL_MOUSEWHEEL
5415
windowID: UInt32; // The window with mouse focus, if any
5416
which: UInt32; // The mouse instance id, or SDL_TOUCH_MOUSEID
5417
x: SInt32; // The amount scrolled horizontally
5418
y: SInt32; // The amount scrolled vertically
5422
* Joystick axis motion event structure (event.jaxis.*)
5425
TSDL_JoyAxisEvent = record
5426
type_: UInt32; // SDL_JOYAXISMOTION
5428
which: TSDL_JoystickID; // The joystick instance id
5429
axis: UInt8; // The joystick axis index
5433
value: SInt16; // The axis value (range: -32768 to 32767)
5438
* Joystick trackball motion event structure (event.jball.*)
5441
TSDL_JoyBallEvent = record
5442
type_: UInt32; // SDL_JOYBALLMOTION
5444
which: TSDL_JoystickID; // The joystick instance id
5445
ball: UInt8; // The joystick trackball index
5449
xrel: SInt16; // The relative motion in the X direction
5450
yrel: SInt16; // The relative motion in the Y direction
5454
* Joystick hat position change event structure (event.jhat.*)
5457
TSDL_JoyHatEvent = record
5458
type_: UInt32; // SDL_JOYHATMOTION
5460
which: TSDL_JoystickID; // The joystick instance id
5461
hat: UInt8; // The joystick hat index
5462
value: UInt8; {* The hat position value.
5463
* SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP
5464
* SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT
5465
* SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN
5467
* Note that zero means the POV is centered.
5474
* Joystick button event structure (event.jbutton.*)
5477
TSDL_JoyButtonEvent = record
5478
type_: UInt32; // SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP
5480
which: TSDL_JoystickID; // The joystick instance id
5481
button: UInt8; // The joystick button index
5482
state: UInt8; // SDL_PRESSED or SDL_RELEASED
5488
* Joystick device event structure (event.jdevice.*)
5491
TSDL_JoyDeviceEvent = record
5492
type_: UInt32; // SDL_JOYDEVICEADDED or SDL_JOYDEVICEREMOVED
5494
which: SInt32; // The joystick device index for the ADDED event, instance id for the REMOVED event
5498
* Game controller axis motion event structure (event.caxis.*)
5501
TSDL_ControllerAxisEvent = record
5502
type_: UInt32; // SDL_CONTROLLERAXISMOTION
5504
which: TSDL_JoystickID; // The joystick instance id
5505
axis: UInt8; // The controller axis (SDL_GameControllerAxis)
5509
value: SInt16; // The axis value (range: -32768 to 32767)
5514
* Game controller button event structure (event.cbutton.*)
5517
TSDL_ControllerButtonEvent = record
5518
type_: UInt32; // SDL_CONTROLLERBUTTONDOWN or SDL_CONTROLLERBUTTONUP
5520
which: TSDL_JoystickID; // The joystick instance id
5521
button: UInt8; // The controller button (SDL_GameControllerButton)
5522
state: UInt8; // SDL_PRESSED or SDL_RELEASED
5529
* Controller device event structure (event.cdevice.*)
5532
TSDL_ControllerDeviceEvent = record
5533
type_: UInt32; // SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEREMOVED, or SDL_CONTROLLERDEVICEREMAPPED
5535
which: SInt32; // The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event
5539
* Touch finger event structure (event.tfinger.*)
5542
TSDL_TouchFingerEvent = record
5543
type_: UInt32; // SDL_FINGERMOTION or SDL_FINGERDOWN or SDL_FINGERUP
5545
touchId: TSDL_TouchID; // The touch device id
5546
fingerId: TSDL_FingerID;
5547
x: Float; // Normalized in the range 0...1
5548
y: Float; // Normalized in the range 0...1
5549
dx: Float; // Normalized in the range 0...1
5550
dy: Float; // Normalized in the range 0...1
5551
pressure: Float; // Normalized in the range 0...1
5555
* Multiple Finger Gesture Event (event.mgesture.*)
5557
TSDL_MultiGestureEvent = record
5558
type_: UInt32; // SDL_MULTIGESTURE
5560
touchId: TSDL_TouchID; // The touch device index
5570
{* (event.dgesture.*) *}
5571
TSDL_DollarGestureEvent = record
5572
type_: UInt32; // SDL_DOLLARGESTURE
5574
touchId: TSDL_TouchID; // The touch device id
5575
gestureId: TSDL_GestureID;
5578
x: Float; // Normalized center of gesture
5579
y: Float; // Normalized center of gesture
5584
* An event used to request a file open by the system (event.drop.*)
5585
* This event is disabled by default, you can enable it with SDL_EventState()
5586
* If you enable this event, you must free the filename in the event.
5589
TSDL_DropEvent = record
5590
type_: UInt32; // SDL_DROPFILE
5592
_file: PAnsiChar; // The file name, which should be freed with SDL_free()
5596
* The "quit requested" event
5599
TSDL_QuitEvent = record
5600
type_: UInt32; // SDL_QUIT
5605
* A user-defined event type (event.user.*)
5608
TSDL_UserEvent = record
5609
type_: UInt32; // SDL_USEREVENT through SDL_NUMEVENTS-1
5611
windowID: UInt32; // The associated window if any
5612
code: SInt32; // User defined event code
5613
data1: Pointer; // User defined data pointer
5614
data2: Pointer; // User defined data pointer
5618
//These are the various supported subsystems under UNIX
5619
TSDL_SysWm = ( SDL_SYSWM_X11 ) ;
5622
// The windows custom event structure
5624
PSDL_SysWMmsg = ^TSDL_SysWMmsg;
5625
TSDL_SysWMmsg = record
5626
version: TSDL_Version;
5627
h_wnd: HWND; // The window for the message
5628
msg: UInt32; // The type of message
5629
w_Param: WPARAM; // WORD message parameter
5630
lParam: LPARAM; // LONG message parameter
5635
{ The Linux custom event structure }
5636
PSDL_SysWMmsg = ^TSDL_SysWMmsg;
5637
TSDL_SysWMmsg = record
5638
version : TSDL_Version;
5639
subsystem : TSDL_SysWm;
5647
{ The generic custom event structure }
5648
PSDL_SysWMmsg = ^TSDL_SysWMmsg;
5649
TSDL_SysWMmsg = record
5650
version: TSDL_Version;
5657
// The Windows custom window manager information structure
5659
PSDL_SysWMinfo = ^TSDL_SysWMinfo;
5660
TSDL_SysWMinfo = record
5661
version : TSDL_Version;
5662
window : HWnd; // The display window
5665
// The Linux custom window manager information structure
5669
display : PDisplay; // The X11 display
5670
window : TWindow; // The X11 display window */
5671
{* These locking functions should be called around
5672
any X11 functions using the display variable.
5673
They lock the event thread, so should not be
5674
called around event functions or from event filters.
5676
lock_func : Pointer;
5677
unlock_func : Pointer;
5679
// Introduced in SDL 1.0.2
5680
fswindow : TWindow; // The X11 fullscreen window */
5681
wmwindow : TWindow; // The X11 managed input window */
5685
PSDL_SysWMinfo = ^TSDL_SysWMinfo;
5686
TSDL_SysWMinfo = record
5687
version : TSDL_Version;
5688
subsystem : TSDL_SysWm;
5694
// The generic custom window manager information structure
5695
PSDL_SysWMinfo = ^TSDL_SysWMinfo;
5696
TSDL_SysWMinfo = record
5697
version : TSDL_Version;
5705
* A video driver dependent system event (event.syswm.*)
5706
* This event is disabled by default, you can enable it with SDL_EventState()
5708
* If you want to use this event, you should include SDL_syswm.h.
5711
PSDL_SysWMEvent = ^TSDL_SysWMEvent;
5712
TSDL_SysWMEvent = record
5713
type_: UInt32; // SDL_SYSWMEVENT
5715
msg: PSDL_SysWMmsg; // driver dependent data (defined in SDL_syswm.h)
5719
* General event structure
5722
PSDL_Event = ^TSDL_Event;
5727
SDL_COMMONEVENT: (common: TSDL_CommonEvent);
5728
SDL_WINDOWEVENT: (window: TSDL_WindowEvent);
5731
SDL_KEYDOWN: (key: TSDL_KeyboardEvent);
5732
SDL_TEXTEDITING: (edit: TSDL_TextEditingEvent);
5733
SDL_TEXTINPUT: (text: TSDL_TextInputEvent);
5735
SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent);
5737
SDL_MOUSEBUTTONDOWN: (button: TSDL_MouseButtonEvent);
5738
SDL_MOUSEWHEEL: (wheel: TSDL_MouseWheelEvent);
5740
SDL_JOYAXISMOTION: (jaxis: TSDL_JoyAxisEvent);
5741
SDL_JOYBALLMOTION: (jball: TSDL_JoyBallEvent);
5742
SDL_JOYHATMOTION: (jhat: TSDL_JoyHatEvent);
5744
SDL_JOYBUTTONUP: (jbutton: TSDL_JoyButtonEvent);
5746
SDL_JOYDEVICEREMOVED: (jdevice: TSDL_JoyDeviceEvent);
5748
SDL_CONTROLLERAXISMOTION: (caxis: TSDL_ControllerAxisEvent);
5749
SDL_CONTROLLERBUTTONUP,
5750
SDL_CONTROLLERBUTTONDOWN: (cbutton: TSDL_ControllerButtonEvent);
5751
SDL_CONTROLLERDEVICEADDED,
5752
SDL_CONTROLLERDEVICEREMOVED,
5753
SDL_CONTROLLERDEVICEREMAPPED: (cdevice: TSDL_ControllerDeviceEvent);
5755
SDL_QUITEV: (quit: TSDL_QuitEvent);
5757
SDL_USEREVENT: (user: TSDL_UserEvent);
5758
SDL_SYSWMEVENT: (syswm: TSDL_SysWMEvent);
5762
SDL_FINGERMOTION: (tfinger: TSDL_TouchFingerEvent);
5763
SDL_MULTIGESTURE: (mgesture: TSDL_MultiGestureEvent);
5764
SDL_DOLLARGESTURE,SDL_DOLLARRECORD: (dgesture: TSDL_DollarGestureEvent);
5766
SDL_DROPFILE: (drop: TSDL_DropEvent);
5770
{* Function prototypes *}
5773
* Pumps the event loop, gathering events from the input devices.
5775
* This function updates the event queue and internal input device state.
5777
* This should only be run in the thread that sets the video mode.
5779
procedure SDL_PumpEvents cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_PumpEvents' {$ENDIF};
5787
TSDL_EventAction = Word;
5790
* Checks the event queue for messages and optionally returns them.
5792
* If action is SDL_ADDEVENT, up to numevents events will be added to
5793
* the back of the event queue.
5795
* If action is SDL_PEEKEVENT, up to numevents events at the front
5796
* of the event queue, within the specified minimum and maximum type,
5797
* will be returned and will not be removed from the queue.
5799
* If action is SDL_GETEVENT, up to numevents events at the front
5800
* of the event queue, within the specified minimum and maximum type,
5801
* will be returned and will be removed from the queue.
5803
* Result: The number of events actually stored, or -1 if there was an error.
5805
* This function is thread-safe.
5808
function SDL_PeepEvents(events: PSDL_Event; numevents: SInt32; action: TSDL_EventAction; minType: UInt32; maxType: UInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_PeepEvents' {$ENDIF};
5811
* Checks to see if certain event types are in the event queue.
5814
function SDL_HasEvent(type_: UInt32): TSDL_Bool cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_HasEvent' {$ENDIF};
5815
function SDL_HasEvents(minType: UInt32; maxType: UInt32): TSDL_Bool cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_HasEvents' {$ENDIF};
5818
* This function clears events from the event queue
5821
procedure SDL_FlushEvent(type_: UInt32) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_FlushEvent' {$ENDIF};
5822
procedure SDL_FlushEvents(minType: UInt32; maxType: UInt32) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_FlushEvents' {$ENDIF};
5825
* Polls for currently pending events.
5827
* 1 if there are any pending events, or 0 if there are none available.
5829
* event - If not nil, the next event is removed from the queue and
5830
* stored in that area.
5833
function SDL_PollEvent(event: PSDL_Event): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_PollEvent' {$ENDIF};
5836
* Waits indefinitely for the next available event.
5838
* 1, or 0 if there was an error while waiting for events.
5840
* event - If not nil, the next event is removed from the queue and
5841
* stored in that area.
5844
function SDL_WaitEvent(event: PSDL_Event): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_WaitEvent' {$ENDIF};
5847
* Waits until the specified timeout (in milliseconds) for the next
5850
* 1, or 0 if there was an error while waiting for events.
5852
* event - If not nil, the next event is removed from the queue and
5853
* stored in that area.
5856
function SDL_WaitEventTimeout(event: PSDL_Event; timeout: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_WaitEventTimeout' {$ENDIF};
5859
* Add an event to the event queue.
5861
* 1 on success, 0 if the event was filtered, or -1 if the event queue
5862
* was full or there was some other error.
5865
function SDL_PushEvent(event: PSDL_Event): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_PumpEvents' {$ENDIF};
5868
PSDL_EventFilter = ^TSDL_EventFilter;
5869
TSDL_EventFilter = function( event: PSDL_Event ): Integer; cdecl;
5872
* Sets up a filter to process all events before they change internal state and
5873
* are posted to the internal event queue.
5875
* If the filter returns 1, then the event will be added to the internal queue.
5876
* If it returns 0, then the event will be dropped from the queue, but the
5877
* internal state will still be updated. This allows selective filtering of
5878
* dynamically arriving events.
5880
* Be very careful of what you do in the event filter function, as
5881
* it may run in a different thread!
5883
* There is one caveat when dealing with the SDL_QUITEVENT event type. The
5884
* event filter is only called when the window manager desires to close the
5885
* application window. If the event filter returns 1, then the window will
5886
* be closed, otherwise the window will remain open if possible.
5888
* If the quit event is generated by an interrupt signal, it will bypass the
5889
* internal queue and be delivered to the application at the next event poll.
5892
procedure SDL_SetEventFilter(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetEventFilter' {$ENDIF};
5895
* Return the current event filter - can be used to "chain" filters.
5896
* If there is no event filter set, this function returns SDL_FALSE.
5899
function SDL_GetEventFilter(filter: PSDL_EventFilter; userdata: Pointer): TSDL_Bool cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetEventFilter' {$ENDIF};
5902
* Add a function which is called when an event is added to the queue.
5905
procedure SDL_AddEventWatch(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_AddEventWatch' {$ENDIF};
5908
* Remove an event watch function added with SDL_AddEventWatch()
5911
procedure SDL_DelEventWatch(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_DelEventWatch' {$ENDIF};
5914
* Run the filter function on the current event queue, removing any
5915
* events for which the filter returns 0.
5918
procedure SDL_FilterEvents(filter: TSDL_EventFilter; userdata: Pointer) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_FilterEvents' {$ENDIF};
5928
* This function allows you to set the state of processing certain events.
5929
* - If state is set to SDL_IGNORE, that event will be automatically
5930
* dropped from the event queue and will not event be filtered.
5931
* - If state is set to SDL_ENABLE, that event will be processed
5933
* - If state is set to SDL_QUERY, SDL_EventState() will return the
5934
* current processing state of the specified event.
5937
function SDL_EventState(type_: UInt32; state: SInt32): UInt8 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_EventState' {$ENDIF};
5939
function SDL_GetEventState(type_: UInt32): UInt8;
5942
* This function allocates a set of user-defined events, and returns
5943
* the beginning event number for that set of events.
5945
* If there aren't enough user-defined events left, this function
5946
* returns (Uint32)-1
5949
function SDL_RegisterEvents(numevents: SInt32): UInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_RegisterEvents' {$ENDIF};
5953
////////////////////////////////////////////////////////////////////////////////////////////////////////
5954
////////////////////// SDL.h ////////////////////////////////////////////////////
5955
////////////////////////////////////////////////////////////////////////////////////////////////////////
5959
SDL_INIT_TIMER = $00000001;
5960
{$EXTERNALSYM SDL_INIT_TIMER}
5961
SDL_INIT_AUDIO = $00000010;
5962
{$EXTERNALSYM SDL_INIT_AUDIO}
5963
SDL_INIT_VIDEO = $00000020;
5964
{$EXTERNALSYM SDL_INIT_VIDEO}
5965
SDL_INIT_JOYSTICK = $00000200;
5966
{$EXTERNALSYM SDL_INIT_JOYSTICK}
5967
SDL_INIT_HAPTIC = $00001000;
5968
{$EXTERNALSYM SDL_INIT_HAPTIC}
5969
SDL_INIT_GAMECONTROLLER = $00002000; //turn on game controller also implicitly does JOYSTICK
5970
{$EXTERNALSYM SDL_INIT_GAMECONTROLLER}
5971
SDL_INIT_NOPARACHUTE = $00100000; //Don't catch fatal signals
5972
{$EXTERNALSYM SDL_INIT_NOPARACHUTE}
5973
SDL_INIT_EVERYTHING = SDL_INIT_TIMER or
5976
SDL_INIT_JOYSTICK or
5978
SDL_INIT_GAMECONTROLLER;
5979
{$EXTERNALSYM SDL_INIT_EVERYTHING}
5982
* This function initializes the subsystems specified by flags
5983
* Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup
5984
* signal handlers for some commonly ignored fatal signals (like SIGSEGV).
5987
function SDL_Init(flags: UInt32): SInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_Init' {$ENDIF};
5990
* This function initializes specific SDL subsystems
5993
function SDL_InitSubSystem(flags: UInt32): SInt32; cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_InitSubSystem' {$ENDIF};
5996
* This function cleans up specific SDL subsystems
5999
procedure SDL_QuitSubSystem(flags: UInt32); cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_QuitSubSystem' {$ENDIF};
6002
* This function returns a mask of the specified subsystems which have
6003
* previously been initialized.
6005
* If flags is 0, it returns a mask of all initialized subsystems.
6008
function SDL_WasInit(flags: UInt32): UInt32; cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_WasInit' {$ENDIF};
6011
* This function cleans up all initialized subsystems. You should
6012
* call it upon all exit conditions.
6015
procedure SDL_Quit; cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_Quit' {$ENDIF};
6019
////////////////////////////////////////////////////////////////////////////////////////////////////////
6020
////////////////////// SDL_loadso.h ////////////////////////////////////////////////////
6021
////////////////////////////////////////////////////////////////////////////////////////////////////////
6024
* This function dynamically loads a shared object and returns a pointer
6025
* to the object handle (or NULL if there was an error).
6026
* The 'sofile' parameter is a system dependent name of the object file.
6028
function SDL_LoadObject(sofile: PAnsiChar): Pointer cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_LoadObject' {$ENDIF};
6031
* Given an object handle, this function looks up the address of the
6032
* named function in the shared object and returns it. This address
6033
* is no longer valid after calling SDL_UnloadObject().
6035
function SDL_LoadFunction(handle: Pointer; name: PAnsiChar): Pointer cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_LoadFunction' {$ENDIF};
6038
* Unload a shared object from memory.
6040
procedure SDL_UnloadObject(handle: Pointer) cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_UnloadObject' {$ENDIF};
6044
////////////////////////////////////////////////////////////////////////////////////////////////////////
6045
////////////////////// SDL_platform.h ////////////////////////////////////////////////////
6046
////////////////////////////////////////////////////////////////////////////////////////////////////////
6049
* Gets the name of the platform.
6051
function SDL_GetPlatform: PAnsiChar cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_GetPlatform' {$ENDIF};
6055
////////////////////////////////////////////////////////////////////////////////////////////////////////
6056
////////////////////// SDL_hints.h ////////////////////////////////////////////////////
6057
////////////////////////////////////////////////////////////////////////////////////////////////////////
6060
SDL_HINT_FRAMEBUFFER_ACCELERATION = 'SDL_FRAMEBUFFER_ACCELERATION';
6061
SDL_HINT_IDLE_TIMER_DISABLED = 'SDL_IOS_IDLE_TIMER_DISABLED';
6062
SDL_HINT_ORIENTATIONS = 'SDL_IOS_ORIENTATIONS';
6063
SDL_HINT_RENDER_DRIVER = 'SDL_RENDER_DRIVER';
6064
SDL_HINT_RENDER_OPENGL_SHADERS = 'SDL_RENDER_OPENGL_SHADERS';
6065
SDL_HINT_RENDER_SCALE_QUALITY = 'SDL_RENDER_SCALE_QUALITY';
6066
SDL_HINT_RENDER_VSYNC = 'SDL_RENDER_VSYNC';
6068
function SDL_SetHint(name : PAnsiChar; value : PAnsiChar): TSDL_Bool cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_SetHint' {$ENDIF};
6072
////////////////////////////////////////////////////////////////////////////////////////////////////////
6073
////////////////////// SDL_byteorder.h ////////////////////////////////////////////////
6074
////////////////////////////////////////////////////////////////////////////////////////////////////////
6077
// SDL_byteorder.h constants
6078
// The two types of endianness
6079
SDL_LIL_ENDIAN = 1234;
6080
{$EXTERNALSYM SDL_LIL_ENDIAN}
6081
SDL_BIG_ENDIAN = 4321;
6082
{$EXTERNALSYM SDL_BIG_ENDIAN}
6085
SDL_BYTEORDER = SDL_LIL_ENDIAN;
6086
{$EXTERNALSYM SDL_BYTEORDER}
6088
SDL_BYTEORDER = SDL_BIG_ENDIAN;
6089
{$EXTERNALSYM SDL_BYTEORDER}
6093
////////////////////////////////////////////////////////////////////////////////////////////////////////
6094
////////////////////// SDL_messagebox.h ////////////////////////////////////////////////////
6095
////////////////////////////////////////////////////////////////////////////////////////////////////////
6099
//SDL_MessageBoxFlags;
6100
SDL_MESSAGEBOX_ERROR = $00000010; //**< error dialog */
6101
SDL_MESSAGEBOX_WARNING = $00000020; //**< warning dialog */
6102
SDL_MESSAGEBOX_INFORMATION = $00000040; //**< informational dialog */
6104
//SDL_MessageBoxButtonFlags;
6105
SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = $00000001; //**< Marks the default button when return is hit */
6106
SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = $00000002; //**< Marks the default button when escape is hit */
6108
function SDL_ShowSimpleMessageBox(flags : Uint32; const title : PAnsiChar; const message : PAnsiChar; window : PSDL_Window): UInt32 cdecl; external SDL_LibName {$IFDEF MACOS} name '_SDL_ShowSimpleMessageBox' {$ENDIF};
6111
////////////////////////////////////////////////////////////////////////////////////////////////////////
6112
////////////////////// *** KTI *** ////////////////////////////////////////////////
6113
////////////////////////////////////////////////////////////////////////////////////////////////////////
6116
// SDLPantalla contiene la ventana SDL el Render donde se pinta y el zoom de los ejes X e Y
6117
PSDLPantalla = ^TSDLPantalla;
6118
TSDLPantalla = record
6119
Window : PSDL_Window;
6120
Renderer : PSDL_Renderer;
6124
EinvalidContainer=class(Exception);
6127
function SDL_Swap32(D: Uint32): Uint32;
6128
function SDLStreamSetup( stream : TStream ) : PSDL_RWops;
6129
function LoadSDLBMPFromStream( Stream : TStream ) : PSDL_Surface;
6130
procedure SaveSDLBMPToStream( SDL_Surface : PSDL_Surface; stream : TStream );
6131
procedure SDLStreamCloseRWops( SDL_RWops : PSDL_RWops );
6136
////////////////////////////////////////////////////////////////////////////////////////////////////////
6137
////////////////////// SDL_version.h ////////////////////////////////////////////////////
6138
////////////////////////////////////////////////////////////////////////////////////////////////////////
6140
procedure SDL_VERSION(x: PSDL_Version);
6142
x.major := SDL_MAJOR_VERSION;
6143
x.minor := SDL_MINOR_VERSION;
6144
x.patch := SDL_PATCHLEVEL;
6147
//******************************************************************************
6149
function SDL_VERSIONNUM(X,Y,Z: UInt32): Cardinal;
6151
Result := X*1000 + Y*100 + Z;
6154
//******************************************************************************
6156
function SDL_COMPILEDVERSION: Cardinal;
6158
Result := SDL_VERSIONNUM(SDL_MAJOR_VERSION,
6163
//******************************************************************************
6165
function SDL_VERSION_ATLEAST(X,Y,Z: Cardinal): Boolean;
6167
Result := SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X,Y,Z);
6172
////////////////////////////////////////////////////////////////////////////////////////////////////////
6173
////////////////////// SDL_thread .h ////////////////////////////////////////////////////
6174
////////////////////////////////////////////////////////////////////////////////////////////////////////
6177
function SDL_CreateThread(fn: TSDL_ThreadFunction; name: PAnsiChar; data: Pointer): PSDL_Thread; overload;
6179
Result := SDL_CreateThread(fn,name,data,nil,nil);
6183
////////////////////////////////////////////////////////////////////////////////////////////////////////
6184
////////////////////// SDL_rect.h ////////////////////////////////////////////////////
6185
////////////////////////////////////////////////////////////////////////////////////////////////////////
6187
function SDL_RectEmpty(X: TSDL_Rect): Boolean;
6189
Result := (X.w <= 0) or (X.h <= 0);
6192
//******************************************************************************
6194
function SDL_RectEquals(A: TSDL_Rect; B: TSDL_Rect): Boolean;
6196
Result := (A.x = B.x) and (A.y = B.y) and (A.w = B.w) and (A.h = B.h);
6201
////////////////////////////////////////////////////////////////////////////////////////////////////////
6202
////////////////////// SDL_rwops.h ////////////////////////////////////////////////////
6203
////////////////////////////////////////////////////////////////////////////////////////////////////////
6205
function SDL_RWsize(ctx: PSDL_RWops): SInt64;
6207
Result := ctx^.size(ctx);
6210
//******************************************************************************
6212
function SDL_RWseek(ctx: PSDL_RWops; offset: SInt64; whence: SInt32): SInt64;
6214
Result := ctx^.seek(ctx,offset,whence);
6217
//******************************************************************************
6219
function SDL_RWtell(ctx: PSDL_RWops): SInt64;
6225
Result := ctx^.seek(ctx, offset, RW_SEEK_CUR);
6228
//******************************************************************************
6230
function SDL_RWread(ctx: PSDL_RWops; ptr: Pointer; size: size_t; n: size_t): size_t;
6232
Result := ctx^.read(ctx, ptr, size, n);
6235
//******************************************************************************
6237
function SDL_RWwrite(ctx: PSDL_RWops; ptr: Pointer; size: size_t; n: size_t): size_t;
6239
Result := ctx^.write(ctx, ptr, size, n);
6242
//******************************************************************************
6244
function SDL_RWclose(ctx: PSDL_RWops): SInt32;
6246
Result := ctx^.close(ctx);
6251
////////////////////////////////////////////////////////////////////////////////////////////////////////
6252
////////////////////// SDL_pixels.h ///////////////////////////////////////////////////
6253
////////////////////////////////////////////////////////////////////////////////////////////////////////
6255
function SDL_PIXELFLAG(X: Cardinal): Boolean;
6257
Result := (X shr 28) = $0F;
6260
//******************************************************************************
6262
function SDL_PIXELTYPE(X: Cardinal): Boolean;
6264
Result := (X shr 24) = $0F;
6267
//******************************************************************************
6269
function SDL_PIXELORDER(X: Cardinal): Boolean;
6271
Result := (X shr 20) = $0F;
6274
//******************************************************************************
6276
function SDL_PIXELLAYOUT(X: Cardinal): Boolean;
6278
Result := (X shr 16) = $0F;
6281
//******************************************************************************
6283
function SDL_BITSPERPIXEL(X: Cardinal): Boolean;
6285
Result := (X shr 8) = $FF;
6288
//******************************************************************************
6290
function SDL_IsPixelFormat_FOURCC(format: Variant): Boolean;
6292
{* The flag is set to 1 because 0x1? is not in the printable ASCII range *}
6293
Result := format and SDL_PIXELFLAG(format) <> 1;
6298
////////////////////////////////////////////////////////////////////////////////////////////////////////
6299
////////////////////// SDL_surface.h //////////////////////////////////////////////////
6300
////////////////////////////////////////////////////////////////////////////////////////////////////////
6302
function SDL_LoadBMP(_file: PAnsiChar): PSDL_Surface;
6304
Result := SDL_LoadBMP_RW(SDL_RWFromFile(_file, 'rb'), 1);
6307
//******************************************************************************
6309
function SDL_SaveBMP(surface: PSDL_Surface; _file: PAnsiChar): SInt32;
6311
Result := SDL_SaveBMP_RW(surface, SDL_RWFromFile(_file, 'wb'), 1);
6314
////////////////////////////////////////////////////////////////////////////////////////////////////////
6315
////////////////////// SDL_video.h ////////////////////////////////////////////////////
6316
////////////////////////////////////////////////////////////////////////////////////////////////////////
6318
function SDL_WindowPos_IsUndefined(X: Variant): Variant;
6320
Result := (X and $FFFF0000) = SDL_WINDOWPOS_UNDEFINED_MASK;
6323
//******************************************************************************
6325
function SDL_WindowPos_IsCentered(X: Variant): Variant;
6327
Result := (X and $FFFF0000) = SDL_WINDOWPOS_CENTERED_MASK;
6330
////////////////////////////////////////////////////////////////////////////////////////////////////////
6331
////////////////////// SDL_events.h ////////////////////////////////////////////////////
6332
////////////////////////////////////////////////////////////////////////////////////////////////////////
6334
function SDL_GetEventState(type_: UInt32): UInt8;
6336
Result := SDL_EventState(type_, SDL_QUERY);
6339
////////////////////////////////////////////////////////////////////////////////////////////////////////
6340
////////////////////// *** KTI *** ////////////////////////////////////////////////
6341
////////////////////////////////////////////////////////////////////////////////////////////////////////
6343
function SDL_Swap32(D: Uint32): Uint32;
6345
Result := ((D shl 24) or ((D shl 8) and $00FF0000) or ((D shr 8) and $0000FF00) or (D shr 24));
6348
//******************************************************************************
6349
function SdlStreamSeek( context : PSDL_RWops; offset : SInt64; whence : SInt32 ) : SInt64; cdecl;
6354
stream := TStream(context.unknown);
6355
if ( stream = nil ) then
6356
raise EInvalidContainer.Create( 'SDLStreamSeek on nil' );
6358
0 : origin := soFromBeginning; //Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0.
6359
1 : origin := soFromCurrent; //Offset is from the current position in the resource. Seek moves to Position + Offset.
6360
2 : origin := soFromEnd;
6362
origin := soFromBeginning; //just in case
6364
Result.hi := stream.Seek(offset.hi, origin);
6367
//******************************************************************************
6368
function SDLStreamWrite( context : PSDL_RWops; const Ptr : Pointer; size : size_t; num : size_t ) : size_t; cdecl;
6373
stream := TStream( context.unknown );
6374
if (stream = nil) then
6375
raise EInvalidContainer.Create('SDLStreamWrite on nil');
6377
Result := stream.Write(Ptr^, Size * num) div size;
6383
//******************************************************************************
6384
function SdlStreamRead( context : PSDL_RWops; Ptr : Pointer; size : size_t; maxnum : size_t ) : size_t; cdecl;
6388
stream := TStream( context.unknown );
6389
if ( stream = nil ) then
6390
raise EInvalidContainer.Create('SDLStreamRead on nil');
6392
Result := stream.Read(Ptr^, Size * maxnum) div size;
6398
//******************************************************************************
6399
function SDLStreamClose( context : PSDL_RWops ) : Integer; cdecl;
6403
stream := TStream( context.unknown );
6404
if (stream = nil) then
6405
raise EInvalidContainer.Create( 'SDLStreamClose on nil' );
6410
//******************************************************************************
6411
function SDLStreamSetup( stream : TStream ) : PSDL_RWops;
6413
result := SDL_AllocRW;
6414
if ( result = nil ) then
6415
raise EInvalidContainer.Create( 'could not create SDLStream on nil' );
6416
result.unknown := TUnknown( stream );
6417
result.seek := SDLStreamSeek;
6418
result.read := SDLStreamRead;
6419
result.write := SDLStreamWrite;
6420
result.close := SDLStreamClose;
6421
Result._type := 2; // TUnknown
6424
//******************************************************************************
6425
procedure SDLStreamCloseRWops(SDL_RWops : PSDL_RWops);
6427
// this only closes the SDL part of the stream, not the context
6428
SDL_FreeRW(SDL_RWops);
6431
//******************************************************************************
6432
function LoadSDLBMPFromStream(stream : TStream) : PSDL_Surface;
6434
SDL_RWops : PSDL_RWops;
6436
SDL_RWops := SDLStreamSetup( stream );
6437
result := SDL_LoadBMP_RW( SDL_RWops, 0 );
6438
SDLStreamCloseRWops( SDL_RWops );
6441
//******************************************************************************
6443
procedure SaveSDLBMPToStream(SDL_Surface : PSDL_Surface; stream : TStream);
6445
SDL_RWops : PSDL_RWops;
6447
SDL_RWops := SDLStreamSetup( stream );
6448
SDL_SaveBMP_RW( SDL_Surface, SDL_RWops, 0 );
6449
SDLStreamCloseRWops( SDL_RWops );
6450
stream.Position := 0;