From 2fb17f01a69a6dc2861ea87b244ea22dc43b1885 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 11 Sep 2021 15:16:17 +0200 Subject: [PATCH] Add units folder and move pas and inc files into that --- jedi.inc => units/jedi.inc | 0 sdl.inc => units/sdl.inc | 0 sdl2.pas => units/sdl2.pas | 0 sdl2_gfx.pas => units/sdl2_gfx.pas | 1118 ++++++++--------- sdl2_image.pas => units/sdl2_image.pas | 0 sdl2_mixer.pas => units/sdl2_mixer.pas | 0 sdl2_net.pas => units/sdl2_net.pas | 0 sdl2_ttf.pas => units/sdl2_ttf.pas | 0 sdlaudio.inc => units/sdlaudio.inc | 0 sdlblendmode.inc => units/sdlblendmode.inc | 0 sdlclipboard.inc => units/sdlclipboard.inc | 0 sdlcpuinfo.inc => units/sdlcpuinfo.inc | 0 sdlerror.inc => units/sdlerror.inc | 0 sdlevents.inc => units/sdlevents.inc | 0 sdlfilesystem.inc => units/sdlfilesystem.inc | 0 .../sdlgamecontroller.inc | 0 sdlgesture.inc => units/sdlgesture.inc | 0 sdlhaptic.inc => units/sdlhaptic.inc | 0 sdlhints.inc => units/sdlhints.inc | 0 sdljoystick.inc => units/sdljoystick.inc | 0 sdlkeyboard.inc => units/sdlkeyboard.inc | 0 sdlloadso.inc => units/sdlloadso.inc | 0 sdllog.inc => units/sdllog.inc | 0 sdlmessagebox.inc => units/sdlmessagebox.inc | 0 sdlmouse.inc => units/sdlmouse.inc | 0 sdlmutex.inc => units/sdlmutex.inc | 0 sdlpixels.inc => units/sdlpixels.inc | 0 sdlplatform.inc => units/sdlplatform.inc | 0 sdlpower.inc => units/sdlpower.inc | 0 sdlrect.inc => units/sdlrect.inc | 0 sdlrenderer.inc => units/sdlrenderer.inc | 0 sdlrwops.inc => units/sdlrwops.inc | 0 sdlscancode.inc => units/sdlscancode.inc | 0 sdlsensor.inc => units/sdlsensor.inc | 0 sdlshape.inc => units/sdlshape.inc | 0 sdlstdinc.inc => units/sdlstdinc.inc | 0 sdlsurface.inc => units/sdlsurface.inc | 0 sdlsystem.inc => units/sdlsystem.inc | 210 ++-- sdlsyswm.inc => units/sdlsyswm.inc | 594 ++++----- sdlthread.inc => units/sdlthread.inc | 0 sdltimer.inc => units/sdltimer.inc | 0 sdltouch.inc => units/sdltouch.inc | 0 sdltypes.inc => units/sdltypes.inc | 0 sdlversion.inc => units/sdlversion.inc | 0 sdlvideo.inc => units/sdlvideo.inc | 0 45 files changed, 961 insertions(+), 961 deletions(-) rename jedi.inc => units/jedi.inc (100%) rename sdl.inc => units/sdl.inc (100%) rename sdl2.pas => units/sdl2.pas (100%) rename sdl2_gfx.pas => units/sdl2_gfx.pas (97%) rename sdl2_image.pas => units/sdl2_image.pas (100%) rename sdl2_mixer.pas => units/sdl2_mixer.pas (100%) rename sdl2_net.pas => units/sdl2_net.pas (100%) rename sdl2_ttf.pas => units/sdl2_ttf.pas (100%) rename sdlaudio.inc => units/sdlaudio.inc (100%) rename sdlblendmode.inc => units/sdlblendmode.inc (100%) rename sdlclipboard.inc => units/sdlclipboard.inc (100%) rename sdlcpuinfo.inc => units/sdlcpuinfo.inc (100%) rename sdlerror.inc => units/sdlerror.inc (100%) rename sdlevents.inc => units/sdlevents.inc (100%) rename sdlfilesystem.inc => units/sdlfilesystem.inc (100%) rename sdlgamecontroller.inc => units/sdlgamecontroller.inc (100%) rename sdlgesture.inc => units/sdlgesture.inc (100%) rename sdlhaptic.inc => units/sdlhaptic.inc (100%) rename sdlhints.inc => units/sdlhints.inc (100%) rename sdljoystick.inc => units/sdljoystick.inc (100%) rename sdlkeyboard.inc => units/sdlkeyboard.inc (100%) rename sdlloadso.inc => units/sdlloadso.inc (100%) rename sdllog.inc => units/sdllog.inc (100%) rename sdlmessagebox.inc => units/sdlmessagebox.inc (100%) rename sdlmouse.inc => units/sdlmouse.inc (100%) rename sdlmutex.inc => units/sdlmutex.inc (100%) rename sdlpixels.inc => units/sdlpixels.inc (100%) rename sdlplatform.inc => units/sdlplatform.inc (100%) rename sdlpower.inc => units/sdlpower.inc (100%) rename sdlrect.inc => units/sdlrect.inc (100%) rename sdlrenderer.inc => units/sdlrenderer.inc (100%) rename sdlrwops.inc => units/sdlrwops.inc (100%) rename sdlscancode.inc => units/sdlscancode.inc (100%) rename sdlsensor.inc => units/sdlsensor.inc (100%) rename sdlshape.inc => units/sdlshape.inc (100%) rename sdlstdinc.inc => units/sdlstdinc.inc (100%) rename sdlsurface.inc => units/sdlsurface.inc (100%) rename sdlsystem.inc => units/sdlsystem.inc (97%) rename sdlsyswm.inc => units/sdlsyswm.inc (96%) rename sdlthread.inc => units/sdlthread.inc (100%) rename sdltimer.inc => units/sdltimer.inc (100%) rename sdltouch.inc => units/sdltouch.inc (100%) rename sdltypes.inc => units/sdltypes.inc (100%) rename sdlversion.inc => units/sdlversion.inc (100%) rename sdlvideo.inc => units/sdlvideo.inc (100%) diff --git a/jedi.inc b/units/jedi.inc similarity index 100% rename from jedi.inc rename to units/jedi.inc diff --git a/sdl.inc b/units/sdl.inc similarity index 100% rename from sdl.inc rename to units/sdl.inc diff --git a/sdl2.pas b/units/sdl2.pas similarity index 100% rename from sdl2.pas rename to units/sdl2.pas diff --git a/sdl2_gfx.pas b/units/sdl2_gfx.pas similarity index 97% rename from sdl2_gfx.pas rename to units/sdl2_gfx.pas index 0b43cc71..dd75033a 100644 --- a/sdl2_gfx.pas +++ b/units/sdl2_gfx.pas @@ -1,559 +1,559 @@ -unit sdl2_gfx; - -(* - -SDL2_framerate.h: framerate manager -SDL2_gfxPrimitives.h: graphics primitives for SDL -SDL2_imageFilter.h: byte-image "filter" routines -SDL2_rotozoom.h: rotozoomer, zoomer and shrinker for 32bit or 8bit surfaces - -Copyright (C) 2001-2012 Andreas Schiffler - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not -claim that you wrote the original software. If you use this software -in a product, an acknowledgment in the product documentation would be -appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and must not be -misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. - -Andreas Schiffler -- aschiffler at ferzkopp dot net - -*) - -{$INCLUDE jedi.inc} - -interface - uses SDL2; - -const - {$IFDEF WINDOWS} - GFX_LibName = 'SDL2_gfx.dll'; - {$ENDIF} - - {$IFDEF UNIX} - {$IFDEF DARWIN} - GFX_LibName = 'libSDL2_gfx.dylib'; - {$ELSE} - {$IFDEF FPC} - GFX_LibName = 'libSDL2_gfx.so'; - {$ELSE} - GFX_LibName = 'libSDL2_gfx.so.0'; - {$ENDIF} - {$ENDIF} - {$ENDIF} - - {$IFDEF MACOS} - GFX_LibName = 'SDL2_gfx'; - {$IFDEF FPC} - {$linklib libSDL2_gfx} - {$ENDIF} - {$ENDIF} - - {$IF DEFINED(DELPHI) AND DEFINED(MACOS)} - {$DEFINE DELMAC} - {$ENDIF} - -Procedure SDL_GFX_VERSION(Out X: TSDL_Version); - -{---< SDL2_framerate.h >---} - -Const - {*! - \brief Highest possible rate supported by framerate controller in Hz (1/s). - *} - FPS_UPPER_LIMIT = 200; - - {*! - \brief Lowest possible rate supported by framerate controller in Hz (1/s). - *} - FPS_LOWER_LIMIT = 1; - - {*! - \brief Default rate of framerate controller in Hz (1/s). - *} - FPS_DEFAULT = 30; - -Type - {*! - \brief Structure holding the state and timing information of the framerate controller. - *} - - TFPSManager = record - framecount : uInt32; - rateticks : Single; // float rateticks; - baseticks : uInt32; - lastticks : uInt32; - rate : uInt32; - end; - - PFPSManager = ^TFPSManager; - -Procedure SDL_initFramerate(manager: PFPSManager); - external GFX_LibName {$IFDEF DELMAC} name '_SDL_initFramerate' {$ENDIF}; - -Function SDL_setFramerate(manager: PFPSManager; rate: uInt32):sInt32; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_setFramerate' {$ENDIF}; - -Function SDL_getFramerate(manager: PFPSManager):sInt32; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_getFramerate' {$ENDIF}; - -Function SDL_getFramecount(manager: PFPSManager):sInt32; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_getFramecount' {$ENDIF}; - -Function SDL_framerateDelay(manager: PFPSManager):uInt32; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_framerateDelay' {$ENDIF}; - - -{---< SDL2_gfxPrimitives.h >---} - -Const - SDL2_GFXPRIMITIVES_MAJOR = 1; - SDL2_GFXPRIMITIVES_MINOR = 0; - SDL2_GFXPRIMITIVES_MICRO = 1; - -(* Note: all ___Color routines expect the colour to be in format 0xRRGGBBAA *) - - -{* Pixel *} - -Function pixelColor(renderer: PSDL_Renderer; x, y: sInt16; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_pixelColor' {$ENDIF}; - -Function pixelRGBA(renderer: PSDL_Renderer; x, y: sInt16; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_pixelRGBA' {$ENDIF}; - -{ Horizontal line } - -Function hlineColor(renderer: PSDL_Renderer; x1, x2, y: sInt16; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_hlineColor' {$ENDIF}; - -Function hlineRGBA(renderer: PSDL_Renderer; x1, x2, y:sInt16; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_hlineRGBA' {$ENDIF}; - -{ Vertical line } - -Function vlineColor(renderer: PSDL_Renderer; x, y1, y2: sInt16; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_vlineColor' {$ENDIF}; - -Function vlineRGBA(renderer: PSDL_Renderer; x, y1, y2: sInt16; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_vlineRGBA' {$ENDIF}; - -{ Rectangle } - -Function rectangleColor(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_rectangleColor' {$ENDIF}; - -Function rectangleRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_rectangleRGBA' {$ENDIF}; - -{ Rounded-Corner Rectangle } - -Function roundedRectangleColor(renderer: PSDL_Renderer; x1, y1, x2, y2, rad: sInt16; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_roundedRectangleColor' {$ENDIF}; - -Function roundedRectangleRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2, rad: sInt16; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_roundedRectangleRGBA' {$ENDIF}; - -{ Filled rectangle (Box) } - -Function boxColor(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_boxColor' {$ENDIF}; - -Function boxRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_boxRGBA' {$ENDIF}; - -{ Rounded-Corner Filled rectangle (Box) } - -Function roundedBoxColor(renderer: PSDL_Renderer; x1, y1, x2, y2, rad: sInt16; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_roundedBoxColor' {$ENDIF}; - -Function roundedBoxRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2, rad: sInt16; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_roundedBoxRGBA' {$ENDIF}; - -{ Line } - -Function lineColor(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_lineColor' {$ENDIF}; - -Function lineRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_lineRGBA' {$ENDIF}; - -{ AA Line } - -Function aalineColor(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_aalineColor' {$ENDIF}; - -Function aalineRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_aalineRGBA' {$ENDIF}; - -{ Thick Line } -Function thickLineColor(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; width: uInt8; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_thickLineColor' {$ENDIF}; - -Function thickLineRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; width, r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_thickLineRGBA' {$ENDIF}; - -{ Circle } - -Function circleColor(renderer: PSDL_Renderer; x, y, rad: sInt16; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_circleColor' {$ENDIF}; - -Function circleRGBA(renderer: PSDL_Renderer; x, y, rad: sInt16; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_circleRGBA' {$ENDIF}; - -{ Arc } - -Function arcColor(renderer: PSDL_Renderer; x, y, rad, start, finish: sInt16; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_arcColor' {$ENDIF}; - -Function arcRGBA(renderer: PSDL_Renderer; x, y, rad, start, finish: sInt16; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_arcRGBA' {$ENDIF}; - -{ AA Circle } - -Function aacircleColor(renderer: PSDL_Renderer; x, y, rad: sInt16; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_aacircleColor' {$ENDIF}; - -Function aacircleRGBA(renderer: PSDL_Renderer; x, y, rad: sInt16; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_aacircleRGBA' {$ENDIF}; - -{ Filled Circle } - -Function filledCircleColor(renderer: PSDL_Renderer; x, y, rad: sInt16; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_filledCircleColor' {$ENDIF}; - -Function filledCircleRGBA(renderer: PSDL_Renderer; x, y, rad: sInt16; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_filledCircleRGBA' {$ENDIF}; - -{ Ellipse } - -Function ellipseColor(renderer: PSDL_Renderer; x, y, rx, ry: sInt16; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_ellipseColor' {$ENDIF}; - -Function ellipseRGBA(renderer: PSDL_Renderer; x, y, rx, ry: sInt16; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_ellipseRGBA' {$ENDIF}; - -{ AA Ellipse } - -Function aaellipseColor(renderer: PSDL_Renderer; x, y, rx, ry: sInt16; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_aaellipseColor' {$ENDIF}; - -Function aaellipseRGBA(renderer: PSDL_Renderer; x, y, rx, ry: sInt16; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_aaellipseRGBA' {$ENDIF}; - -{ Filled Ellipse } - -Function filledEllipseColor(renderer: PSDL_Renderer; x, y, rx, ry: sInt16; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_filledEllipseColor' {$ENDIF}; - -Function filledEllipseRGBA(renderer: PSDL_Renderer; x, y, rx, ry: sInt16; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_filledEllipseRGBA' {$ENDIF}; - -{ Pie } - -Function pieColor(renderer: PSDL_Renderer; x, y, rad, start, finish: sInt16; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_pieColor' {$ENDIF}; - -Function pieRGBA(renderer: PSDL_Renderer; x, y, rad, start, finish: sInt16; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_pieRGBA' {$ENDIF}; - -{ Filled Pie } - -Function filledPieColor(renderer: PSDL_Renderer; x, y, rad, start, finish: sInt16; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_filledPieColor' {$ENDIF}; - -Function filledPieRGBA(renderer: PSDL_Renderer; x, y, rad, start, finish: sInt16; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_filledPieRGBA' {$ENDIF}; - -{ Trigon } - -Function trigonColor(renderer: PSDL_Renderer; x1, y1, x2, y2, x3, y3: sInt16; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_trigonColor' {$ENDIF}; - -Function trigonRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2, x3, y3: sInt16; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_trigonRGBA' {$ENDIF}; - -{ AA-Trigon } - -Function aatrigonColor(renderer: PSDL_Renderer; x1, y1, x2, y2, x3, y3: sInt16; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_aatrigonColor' {$ENDIF}; - -Function aatrigonRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2, x3, y3: sInt16; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_aatrigonRGBA' {$ENDIF}; - -{ Filled Trigon } - -Function filledTrigonColor(renderer: PSDL_Renderer; x1, y1, x2, y2, x3, y3: sInt16; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_filledTrigonColor' {$ENDIF}; - -Function filledTrigonRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2, x3, y3: sInt16; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_filledTrigonRGBA' {$ENDIF}; - -{ Polygon } - -Function polygonColor(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n: sInt32; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_polygonColor' {$ENDIF}; - -Function polygonRGBA(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n: sInt32; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_polugonRGBA' {$ENDIF}; - -{ AA-Polygon } - -Function aapolygonColor(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n: sInt32; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_aapolygonColor' {$ENDIF}; - -Function aapolygonRGBA(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n: sInt32; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_aapolygonRGBA' {$ENDIF}; - -{ Filled Polygon } - -Function filledPolygonColor(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n: sInt32; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_filledPolygonColor' {$ENDIF}; - -Function filledPolygonRGBA(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n: sInt32; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_filledPolygonRGBA' {$ENDIF}; - -{ Textured Polygon } - -Function texturedPolygon(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n: sInt32; texture: PSDL_Surface; texture_dx, texture_dy: sInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_texturedPolygon' {$ENDIF}; - -{ Bezier } - -Function bezierColor(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n, s: sInt32; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_bezierColor' {$ENDIF}; - -Function bezierRGBA(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n, s: sInt32; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_bezierRGBA' {$ENDIF}; - -{ Characters/Strings } - -Procedure gfxPrimitivesSetFont(Const fontdata: Pointer; cw, ch: uInt32); cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_gfxPrimitivesSetFont' {$ENDIF}; - -Procedure gfxPrimitivesSetFontRotation(rotation: uInt32); cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_gfxPrimitivesSetFontRotation' {$ENDIF}; - - -Function characterColor(renderer: PSDL_Renderer; x, y: sInt16; c: Char; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_characterColor' {$ENDIF}; - -Function characterRGBA(renderer: PSDL_Renderer; x, y: sInt16; c: Char; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_characterRGBA' {$ENDIF}; - - -Function stringColor(renderer: PSDL_Renderer; x, y: sInt16; Const str: PChar; colour: uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_stringColor' {$ENDIF}; - -Function stringRGBA(renderer: PSDL_Renderer; x, y: sInt16; Const syt: PChar; r, g, b, a: uInt8):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_stringRGBA' {$ENDIF}; - - - -{---< SDL2_imageFilter.h >---} - -(* Comments: * - * 1.) MMX functions work best if all data blocks are aligned on a 32 bytes boundary. * - * 2.) Data that is not within an 8 byte boundary is processed using the C routine. * - * 3.) Convolution routines do not have C routines at this time. *) - -// Detect MMX capability in CPU -Function SDL_imageFilterMMXdetect():sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMMXdetect' {$ENDIF}; - -// Force use of MMX off (or turn possible use back on) -Procedure SDL_imageFilterMMXoff(); cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMMXoff' {$ENDIF}; - -Procedure SDL_imageFilterMMXon(); cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMMXon' {$ENDIF}; - - -// SDL_imageFilterAdd: D = saturation255(S1 + S2) -Function SDL_imageFilterAdd(Src1, Src2, Dest : PuInt8; Length : uInt32):sInt32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterAdd' {$ENDIF}; - -// SDL_imageFilterMean: D = S1/2 + S2/2 -Function SDL_imageFilterMean(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMean' {$ENDIF}; - -// SDL_imageFilterSub: D = saturation0(S1 - S2) -Function SDL_imageFilterSub(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterSub' {$ENDIF}; - -// SDL_imageFilterAbsDiff: D = | S1 - S2 | -Function SDL_imageFilterAbsDiff(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterAbsDiff' {$ENDIF}; - - -// SDL_imageFilterMult: D = saturation(S1 * S2) -Function SDL_imageFilterMult(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMult' {$ENDIF}; - -// SDL_imageFilterMultNor: D = S1 * S2 (non-MMX) -Function SDL_imageFilterMultNor(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMultNor' {$ENDIF}; - -// SDL_imageFilterMultDivby2: D = saturation255(S1/2 * S2) -Function SDL_imageFilterMultDivby2(Src1, Src2, Dest : PuInt8; Length: uInt32):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMultDivby2' {$ENDIF}; - -// SDL_imageFilterMultDivby4: D = saturation255(S1/2 * S2/2) -Function SDL_imageFilterMultDivby4(Src1, Src2, Dest : PuInt8; Length : uInt32):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMultDivby4' {$ENDIF}; - - -// SDL_imageFilterBitAnd: D = S1 & S2 -Function SDL_imageFilterBitAnd(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterBitAnd' {$ENDIF}; - -// SDL_imageFilterBitOr: D = S1 | S2 -Function SDL_imageFilterBitOr(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterBitOr' {$ENDIF}; - - -// SDL_imageFilterDiv: D = S1 / S2 (non-MMX) -Function SDL_imageFilterDiv(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterDiv' {$ENDIF}; - -// SDL_imageFilterBitNegation: D = !S -Function SDL_imageFilterBitNegation(Src1, Dest : PuInt8; Length:uInt32):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterBitNegation' {$ENDIF}; - - -// SDL_imageFilterAddByte: D = saturation255(S + C) -Function SDL_imageFilterAddByte(Src1, Dest : PuInt8; Length:uInt32; C : uInt8):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterAddByte' {$ENDIF}; - -// SDL_imageFilterAddUsInt32: D = saturation255(S + (usInt32)C) -Function SDL_imageFilterAddUsInt32(Src1, Dest : PuInt8; Length:uInt32; C : uInt32):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterAddUsInt32' {$ENDIF}; - -// SDL_imageFilterAddByteToHalf: D = saturation255(S/2 + C) -Function SDL_imageFilterAddByteToHalf(Src1, Dest : PuInt8; Length:uInt32; C : uInt8):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterAddByteToHalf' {$ENDIF}; - - -// SDL_imageFilterSubByte: D = saturation0(S - C) -Function SDL_imageFilterSubByte(Src1, Dest : PuInt8; Length:uInt32; C : uInt8):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterSubByte' {$ENDIF}; - -// SDL_imageFilterSubUsInt32: D = saturation0(S - (usInt32)C) -Function SDL_imageFilterSubUsInt32(Src1, Dest : PuInt8; Length:uInt32; C : uInt32):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterSubUsInt32' {$ENDIF}; - - -// SDL_imageFilterShiftRight: D = saturation0(S >> N) -Function SDL_imageFilterShiftRight(Src1, Dest : PuInt8; Length:uInt32; N : uInt8):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterShiftRight' {$ENDIF}; - -// SDL_imageFilterShiftRightUsInt32: D = saturation0((usInt32)S >> N) -Function SDL_imageFilterShiftRightUsInt32(Src1, Dest : PuInt8; Length:uInt32; N : uInt8):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterShiftRightUsInt32' {$ENDIF}; - - -// SDL_imageFilterMultByByte: D = saturation255(S * C) -Function SDL_imageFilterMultByByte(Src1, Dest : PuInt8; Length:uInt32; C : uInt8):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMultByByte' {$ENDIF}; - -// SDL_imageFilterShiftRightAndMultByByte: D = saturation255((S >> N) * C) -Function SDL_imageFilterShiftRightAndMultByByte(Src1, Dest : PuInt8; Length:uInt32; N, C : uInt8):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterShiftRightAndMultByByte' {$ENDIF}; - - -// SDL_imageFilterShiftLeftByte: D = (S << N) -Function SDL_imageFilterShiftLeftByte(Src1, Dest : PuInt8; Length:uInt32; N: uInt8):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterShiftLeftByte' {$ENDIF}; - -// SDL_imageFilterShiftLeftUsInt32: D = ((usInt32)S << N) -Function SDL_imageFilterShiftLeftUsInt32(Src1, Dest : PuInt8; Length:uInt32; N:uInt8):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterShiftLeftUsInt32' {$ENDIF}; - -// SDL_imageFilterShiftLeft: D = saturation255(S << N) -Function SDL_imageFilterShiftLeft(Src1, Dest : PuInt8; Length:uInt32; N : uInt8):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterShiftLeft' {$ENDIF}; - - -// SDL_imageFilterBinarizeUsingThreshold: D = S >= T ? 255:0 -Function SDL_imageFilterBinarizeUsingThreshold(Src1, Dest : PuInt8; Length:uInt32; T: uInt8):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterBinarizeUsingThreshold' {$ENDIF}; - -// SDL_imageFilterClipToRange: D = (S >= Tmin) & (S <= Tmax) 255:0 -Function SDL_imageFilterClipToRange(Src1, Dest : PuInt8; Length:uInt32; Tmin, Tmax: uInt8):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterClipToRange' {$ENDIF}; - -// SDL_imageFilterNormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin) -Function SDL_imageFilterNormalizeLinear(Src, Dest: PuInt8; Length, Cmin, Cmax, Nmin, Nmax: sInt32):Sint32; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterNormalizeLinear' {$ENDIF}; - - -{---< SDL2_rotozoom.h >---} - -Const - {*! - \brief Disable anti-aliasing (no smoothing). - *} - SMOOTHING_OFF = 0; - - {*! - \brief Enable anti-aliasing (smoothing). - *} - SMOOTHING_ON = 1; - -{ Rotozoom functions } - -Function rotozoomSurface(src: PSDL_Surface; angle, zoom: Double; smooth: sInt32):PSDL_Surface; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_rotozoomSurface' {$ENDIF}; - -Function rotozoomSurfaceXY(src: PSDL_Surface; angle, zoomx, zoomy: Double; smooth: sInt32):PSDL_Surface; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_rotozoomSurfaceXY' {$ENDIF}; - - -Procedure rotozoomSurfaceSize(width, height: sInt32; angle, zoom: Double; dstwidth, dstheight: PuInt32); cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_rotozoomSurfaceSize' {$ENDIF}; - -Procedure rotozoomSurfaceSizeXY(width, height: sInt32; angle, zoomx, zoomy: Double; dstwidth, dstheight:PuInt32); cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_rotozoomSurfaceSizeXY' {$ENDIF}; - - -{ Zooming functions } - -Function zoomSurface(src: PSDL_Surface; zoomx, zoomy: Double; smooth: sInt32):PSDL_Surface; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_zoomSurface' {$ENDIF}; - -Procedure zoomSurfaceSize(width, height: sInt32; zoomx, zoomy: Double; dstwidth, dstheight: PuInt32); cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_zoomSurfaceSize' {$ENDIF}; - -{ Shrinking functions } - -Function shrinkSurface(src: PSDL_Surface; factorx, factory: sInt32):PSDL_Surface; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_shrinkSurface' {$ENDIF}; - -{ Specialized rotation functions } - -Function rotateSurface90Degrees(src: PSDL_Surface; numClockwiseTurns: sInt32):PSDL_Surface; cdecl; - external GFX_LibName {$IFDEF DELMAC} name '_rotateSurface90Degrees' {$ENDIF}; - - -implementation - -Procedure SDL_GFX_VERSION(Out X: TSDL_Version); -begin - X.Major := SDL2_GFXPRIMITIVES_MAJOR; - X.Minor := SDL2_GFXPRIMITIVES_MINOR; - X.Patch := SDL2_GFXPRIMITIVES_MICRO -end; - -end. +unit sdl2_gfx; + +(* + +SDL2_framerate.h: framerate manager +SDL2_gfxPrimitives.h: graphics primitives for SDL +SDL2_imageFilter.h: byte-image "filter" routines +SDL2_rotozoom.h: rotozoomer, zoomer and shrinker for 32bit or 8bit surfaces + +Copyright (C) 2001-2012 Andreas Schiffler + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not +claim that you wrote the original software. If you use this software +in a product, an acknowledgment in the product documentation would be +appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and must not be +misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. + +Andreas Schiffler -- aschiffler at ferzkopp dot net + +*) + +{$INCLUDE jedi.inc} + +interface + uses SDL2; + +const + {$IFDEF WINDOWS} + GFX_LibName = 'SDL2_gfx.dll'; + {$ENDIF} + + {$IFDEF UNIX} + {$IFDEF DARWIN} + GFX_LibName = 'libSDL2_gfx.dylib'; + {$ELSE} + {$IFDEF FPC} + GFX_LibName = 'libSDL2_gfx.so'; + {$ELSE} + GFX_LibName = 'libSDL2_gfx.so.0'; + {$ENDIF} + {$ENDIF} + {$ENDIF} + + {$IFDEF MACOS} + GFX_LibName = 'SDL2_gfx'; + {$IFDEF FPC} + {$linklib libSDL2_gfx} + {$ENDIF} + {$ENDIF} + + {$IF DEFINED(DELPHI) AND DEFINED(MACOS)} + {$DEFINE DELMAC} + {$ENDIF} + +Procedure SDL_GFX_VERSION(Out X: TSDL_Version); + +{---< SDL2_framerate.h >---} + +Const + {*! + \brief Highest possible rate supported by framerate controller in Hz (1/s). + *} + FPS_UPPER_LIMIT = 200; + + {*! + \brief Lowest possible rate supported by framerate controller in Hz (1/s). + *} + FPS_LOWER_LIMIT = 1; + + {*! + \brief Default rate of framerate controller in Hz (1/s). + *} + FPS_DEFAULT = 30; + +Type + {*! + \brief Structure holding the state and timing information of the framerate controller. + *} + + TFPSManager = record + framecount : uInt32; + rateticks : Single; // float rateticks; + baseticks : uInt32; + lastticks : uInt32; + rate : uInt32; + end; + + PFPSManager = ^TFPSManager; + +Procedure SDL_initFramerate(manager: PFPSManager); + external GFX_LibName {$IFDEF DELMAC} name '_SDL_initFramerate' {$ENDIF}; + +Function SDL_setFramerate(manager: PFPSManager; rate: uInt32):sInt32; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_setFramerate' {$ENDIF}; + +Function SDL_getFramerate(manager: PFPSManager):sInt32; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_getFramerate' {$ENDIF}; + +Function SDL_getFramecount(manager: PFPSManager):sInt32; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_getFramecount' {$ENDIF}; + +Function SDL_framerateDelay(manager: PFPSManager):uInt32; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_framerateDelay' {$ENDIF}; + + +{---< SDL2_gfxPrimitives.h >---} + +Const + SDL2_GFXPRIMITIVES_MAJOR = 1; + SDL2_GFXPRIMITIVES_MINOR = 0; + SDL2_GFXPRIMITIVES_MICRO = 1; + +(* Note: all ___Color routines expect the colour to be in format 0xRRGGBBAA *) + + +{* Pixel *} + +Function pixelColor(renderer: PSDL_Renderer; x, y: sInt16; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_pixelColor' {$ENDIF}; + +Function pixelRGBA(renderer: PSDL_Renderer; x, y: sInt16; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_pixelRGBA' {$ENDIF}; + +{ Horizontal line } + +Function hlineColor(renderer: PSDL_Renderer; x1, x2, y: sInt16; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_hlineColor' {$ENDIF}; + +Function hlineRGBA(renderer: PSDL_Renderer; x1, x2, y:sInt16; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_hlineRGBA' {$ENDIF}; + +{ Vertical line } + +Function vlineColor(renderer: PSDL_Renderer; x, y1, y2: sInt16; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_vlineColor' {$ENDIF}; + +Function vlineRGBA(renderer: PSDL_Renderer; x, y1, y2: sInt16; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_vlineRGBA' {$ENDIF}; + +{ Rectangle } + +Function rectangleColor(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_rectangleColor' {$ENDIF}; + +Function rectangleRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_rectangleRGBA' {$ENDIF}; + +{ Rounded-Corner Rectangle } + +Function roundedRectangleColor(renderer: PSDL_Renderer; x1, y1, x2, y2, rad: sInt16; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_roundedRectangleColor' {$ENDIF}; + +Function roundedRectangleRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2, rad: sInt16; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_roundedRectangleRGBA' {$ENDIF}; + +{ Filled rectangle (Box) } + +Function boxColor(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_boxColor' {$ENDIF}; + +Function boxRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_boxRGBA' {$ENDIF}; + +{ Rounded-Corner Filled rectangle (Box) } + +Function roundedBoxColor(renderer: PSDL_Renderer; x1, y1, x2, y2, rad: sInt16; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_roundedBoxColor' {$ENDIF}; + +Function roundedBoxRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2, rad: sInt16; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_roundedBoxRGBA' {$ENDIF}; + +{ Line } + +Function lineColor(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_lineColor' {$ENDIF}; + +Function lineRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_lineRGBA' {$ENDIF}; + +{ AA Line } + +Function aalineColor(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_aalineColor' {$ENDIF}; + +Function aalineRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_aalineRGBA' {$ENDIF}; + +{ Thick Line } +Function thickLineColor(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; width: uInt8; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_thickLineColor' {$ENDIF}; + +Function thickLineRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2: sInt16; width, r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_thickLineRGBA' {$ENDIF}; + +{ Circle } + +Function circleColor(renderer: PSDL_Renderer; x, y, rad: sInt16; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_circleColor' {$ENDIF}; + +Function circleRGBA(renderer: PSDL_Renderer; x, y, rad: sInt16; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_circleRGBA' {$ENDIF}; + +{ Arc } + +Function arcColor(renderer: PSDL_Renderer; x, y, rad, start, finish: sInt16; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_arcColor' {$ENDIF}; + +Function arcRGBA(renderer: PSDL_Renderer; x, y, rad, start, finish: sInt16; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_arcRGBA' {$ENDIF}; + +{ AA Circle } + +Function aacircleColor(renderer: PSDL_Renderer; x, y, rad: sInt16; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_aacircleColor' {$ENDIF}; + +Function aacircleRGBA(renderer: PSDL_Renderer; x, y, rad: sInt16; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_aacircleRGBA' {$ENDIF}; + +{ Filled Circle } + +Function filledCircleColor(renderer: PSDL_Renderer; x, y, rad: sInt16; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_filledCircleColor' {$ENDIF}; + +Function filledCircleRGBA(renderer: PSDL_Renderer; x, y, rad: sInt16; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_filledCircleRGBA' {$ENDIF}; + +{ Ellipse } + +Function ellipseColor(renderer: PSDL_Renderer; x, y, rx, ry: sInt16; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_ellipseColor' {$ENDIF}; + +Function ellipseRGBA(renderer: PSDL_Renderer; x, y, rx, ry: sInt16; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_ellipseRGBA' {$ENDIF}; + +{ AA Ellipse } + +Function aaellipseColor(renderer: PSDL_Renderer; x, y, rx, ry: sInt16; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_aaellipseColor' {$ENDIF}; + +Function aaellipseRGBA(renderer: PSDL_Renderer; x, y, rx, ry: sInt16; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_aaellipseRGBA' {$ENDIF}; + +{ Filled Ellipse } + +Function filledEllipseColor(renderer: PSDL_Renderer; x, y, rx, ry: sInt16; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_filledEllipseColor' {$ENDIF}; + +Function filledEllipseRGBA(renderer: PSDL_Renderer; x, y, rx, ry: sInt16; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_filledEllipseRGBA' {$ENDIF}; + +{ Pie } + +Function pieColor(renderer: PSDL_Renderer; x, y, rad, start, finish: sInt16; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_pieColor' {$ENDIF}; + +Function pieRGBA(renderer: PSDL_Renderer; x, y, rad, start, finish: sInt16; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_pieRGBA' {$ENDIF}; + +{ Filled Pie } + +Function filledPieColor(renderer: PSDL_Renderer; x, y, rad, start, finish: sInt16; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_filledPieColor' {$ENDIF}; + +Function filledPieRGBA(renderer: PSDL_Renderer; x, y, rad, start, finish: sInt16; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_filledPieRGBA' {$ENDIF}; + +{ Trigon } + +Function trigonColor(renderer: PSDL_Renderer; x1, y1, x2, y2, x3, y3: sInt16; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_trigonColor' {$ENDIF}; + +Function trigonRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2, x3, y3: sInt16; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_trigonRGBA' {$ENDIF}; + +{ AA-Trigon } + +Function aatrigonColor(renderer: PSDL_Renderer; x1, y1, x2, y2, x3, y3: sInt16; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_aatrigonColor' {$ENDIF}; + +Function aatrigonRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2, x3, y3: sInt16; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_aatrigonRGBA' {$ENDIF}; + +{ Filled Trigon } + +Function filledTrigonColor(renderer: PSDL_Renderer; x1, y1, x2, y2, x3, y3: sInt16; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_filledTrigonColor' {$ENDIF}; + +Function filledTrigonRGBA(renderer: PSDL_Renderer; x1, y1, x2, y2, x3, y3: sInt16; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_filledTrigonRGBA' {$ENDIF}; + +{ Polygon } + +Function polygonColor(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n: sInt32; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_polygonColor' {$ENDIF}; + +Function polygonRGBA(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n: sInt32; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_polugonRGBA' {$ENDIF}; + +{ AA-Polygon } + +Function aapolygonColor(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n: sInt32; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_aapolygonColor' {$ENDIF}; + +Function aapolygonRGBA(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n: sInt32; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_aapolygonRGBA' {$ENDIF}; + +{ Filled Polygon } + +Function filledPolygonColor(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n: sInt32; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_filledPolygonColor' {$ENDIF}; + +Function filledPolygonRGBA(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n: sInt32; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_filledPolygonRGBA' {$ENDIF}; + +{ Textured Polygon } + +Function texturedPolygon(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n: sInt32; texture: PSDL_Surface; texture_dx, texture_dy: sInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_texturedPolygon' {$ENDIF}; + +{ Bezier } + +Function bezierColor(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n, s: sInt32; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_bezierColor' {$ENDIF}; + +Function bezierRGBA(renderer: PSDL_Renderer; Const vx, vy: PsInt16; n, s: sInt32; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_bezierRGBA' {$ENDIF}; + +{ Characters/Strings } + +Procedure gfxPrimitivesSetFont(Const fontdata: Pointer; cw, ch: uInt32); cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_gfxPrimitivesSetFont' {$ENDIF}; + +Procedure gfxPrimitivesSetFontRotation(rotation: uInt32); cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_gfxPrimitivesSetFontRotation' {$ENDIF}; + + +Function characterColor(renderer: PSDL_Renderer; x, y: sInt16; c: Char; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_characterColor' {$ENDIF}; + +Function characterRGBA(renderer: PSDL_Renderer; x, y: sInt16; c: Char; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_characterRGBA' {$ENDIF}; + + +Function stringColor(renderer: PSDL_Renderer; x, y: sInt16; Const str: PChar; colour: uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_stringColor' {$ENDIF}; + +Function stringRGBA(renderer: PSDL_Renderer; x, y: sInt16; Const syt: PChar; r, g, b, a: uInt8):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_stringRGBA' {$ENDIF}; + + + +{---< SDL2_imageFilter.h >---} + +(* Comments: * + * 1.) MMX functions work best if all data blocks are aligned on a 32 bytes boundary. * + * 2.) Data that is not within an 8 byte boundary is processed using the C routine. * + * 3.) Convolution routines do not have C routines at this time. *) + +// Detect MMX capability in CPU +Function SDL_imageFilterMMXdetect():sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMMXdetect' {$ENDIF}; + +// Force use of MMX off (or turn possible use back on) +Procedure SDL_imageFilterMMXoff(); cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMMXoff' {$ENDIF}; + +Procedure SDL_imageFilterMMXon(); cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMMXon' {$ENDIF}; + + +// SDL_imageFilterAdd: D = saturation255(S1 + S2) +Function SDL_imageFilterAdd(Src1, Src2, Dest : PuInt8; Length : uInt32):sInt32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterAdd' {$ENDIF}; + +// SDL_imageFilterMean: D = S1/2 + S2/2 +Function SDL_imageFilterMean(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMean' {$ENDIF}; + +// SDL_imageFilterSub: D = saturation0(S1 - S2) +Function SDL_imageFilterSub(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterSub' {$ENDIF}; + +// SDL_imageFilterAbsDiff: D = | S1 - S2 | +Function SDL_imageFilterAbsDiff(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterAbsDiff' {$ENDIF}; + + +// SDL_imageFilterMult: D = saturation(S1 * S2) +Function SDL_imageFilterMult(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMult' {$ENDIF}; + +// SDL_imageFilterMultNor: D = S1 * S2 (non-MMX) +Function SDL_imageFilterMultNor(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMultNor' {$ENDIF}; + +// SDL_imageFilterMultDivby2: D = saturation255(S1/2 * S2) +Function SDL_imageFilterMultDivby2(Src1, Src2, Dest : PuInt8; Length: uInt32):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMultDivby2' {$ENDIF}; + +// SDL_imageFilterMultDivby4: D = saturation255(S1/2 * S2/2) +Function SDL_imageFilterMultDivby4(Src1, Src2, Dest : PuInt8; Length : uInt32):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMultDivby4' {$ENDIF}; + + +// SDL_imageFilterBitAnd: D = S1 & S2 +Function SDL_imageFilterBitAnd(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterBitAnd' {$ENDIF}; + +// SDL_imageFilterBitOr: D = S1 | S2 +Function SDL_imageFilterBitOr(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterBitOr' {$ENDIF}; + + +// SDL_imageFilterDiv: D = S1 / S2 (non-MMX) +Function SDL_imageFilterDiv(Src1, Src2, Dest : PuInt8; Length:uInt32):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterDiv' {$ENDIF}; + +// SDL_imageFilterBitNegation: D = !S +Function SDL_imageFilterBitNegation(Src1, Dest : PuInt8; Length:uInt32):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterBitNegation' {$ENDIF}; + + +// SDL_imageFilterAddByte: D = saturation255(S + C) +Function SDL_imageFilterAddByte(Src1, Dest : PuInt8; Length:uInt32; C : uInt8):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterAddByte' {$ENDIF}; + +// SDL_imageFilterAddUsInt32: D = saturation255(S + (usInt32)C) +Function SDL_imageFilterAddUsInt32(Src1, Dest : PuInt8; Length:uInt32; C : uInt32):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterAddUsInt32' {$ENDIF}; + +// SDL_imageFilterAddByteToHalf: D = saturation255(S/2 + C) +Function SDL_imageFilterAddByteToHalf(Src1, Dest : PuInt8; Length:uInt32; C : uInt8):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterAddByteToHalf' {$ENDIF}; + + +// SDL_imageFilterSubByte: D = saturation0(S - C) +Function SDL_imageFilterSubByte(Src1, Dest : PuInt8; Length:uInt32; C : uInt8):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterSubByte' {$ENDIF}; + +// SDL_imageFilterSubUsInt32: D = saturation0(S - (usInt32)C) +Function SDL_imageFilterSubUsInt32(Src1, Dest : PuInt8; Length:uInt32; C : uInt32):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterSubUsInt32' {$ENDIF}; + + +// SDL_imageFilterShiftRight: D = saturation0(S >> N) +Function SDL_imageFilterShiftRight(Src1, Dest : PuInt8; Length:uInt32; N : uInt8):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterShiftRight' {$ENDIF}; + +// SDL_imageFilterShiftRightUsInt32: D = saturation0((usInt32)S >> N) +Function SDL_imageFilterShiftRightUsInt32(Src1, Dest : PuInt8; Length:uInt32; N : uInt8):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterShiftRightUsInt32' {$ENDIF}; + + +// SDL_imageFilterMultByByte: D = saturation255(S * C) +Function SDL_imageFilterMultByByte(Src1, Dest : PuInt8; Length:uInt32; C : uInt8):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterMultByByte' {$ENDIF}; + +// SDL_imageFilterShiftRightAndMultByByte: D = saturation255((S >> N) * C) +Function SDL_imageFilterShiftRightAndMultByByte(Src1, Dest : PuInt8; Length:uInt32; N, C : uInt8):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterShiftRightAndMultByByte' {$ENDIF}; + + +// SDL_imageFilterShiftLeftByte: D = (S << N) +Function SDL_imageFilterShiftLeftByte(Src1, Dest : PuInt8; Length:uInt32; N: uInt8):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterShiftLeftByte' {$ENDIF}; + +// SDL_imageFilterShiftLeftUsInt32: D = ((usInt32)S << N) +Function SDL_imageFilterShiftLeftUsInt32(Src1, Dest : PuInt8; Length:uInt32; N:uInt8):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterShiftLeftUsInt32' {$ENDIF}; + +// SDL_imageFilterShiftLeft: D = saturation255(S << N) +Function SDL_imageFilterShiftLeft(Src1, Dest : PuInt8; Length:uInt32; N : uInt8):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterShiftLeft' {$ENDIF}; + + +// SDL_imageFilterBinarizeUsingThreshold: D = S >= T ? 255:0 +Function SDL_imageFilterBinarizeUsingThreshold(Src1, Dest : PuInt8; Length:uInt32; T: uInt8):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterBinarizeUsingThreshold' {$ENDIF}; + +// SDL_imageFilterClipToRange: D = (S >= Tmin) & (S <= Tmax) 255:0 +Function SDL_imageFilterClipToRange(Src1, Dest : PuInt8; Length:uInt32; Tmin, Tmax: uInt8):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterClipToRange' {$ENDIF}; + +// SDL_imageFilterNormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin) +Function SDL_imageFilterNormalizeLinear(Src, Dest: PuInt8; Length, Cmin, Cmax, Nmin, Nmax: sInt32):Sint32; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_SDL_imageFilterNormalizeLinear' {$ENDIF}; + + +{---< SDL2_rotozoom.h >---} + +Const + {*! + \brief Disable anti-aliasing (no smoothing). + *} + SMOOTHING_OFF = 0; + + {*! + \brief Enable anti-aliasing (smoothing). + *} + SMOOTHING_ON = 1; + +{ Rotozoom functions } + +Function rotozoomSurface(src: PSDL_Surface; angle, zoom: Double; smooth: sInt32):PSDL_Surface; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_rotozoomSurface' {$ENDIF}; + +Function rotozoomSurfaceXY(src: PSDL_Surface; angle, zoomx, zoomy: Double; smooth: sInt32):PSDL_Surface; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_rotozoomSurfaceXY' {$ENDIF}; + + +Procedure rotozoomSurfaceSize(width, height: sInt32; angle, zoom: Double; dstwidth, dstheight: PuInt32); cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_rotozoomSurfaceSize' {$ENDIF}; + +Procedure rotozoomSurfaceSizeXY(width, height: sInt32; angle, zoomx, zoomy: Double; dstwidth, dstheight:PuInt32); cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_rotozoomSurfaceSizeXY' {$ENDIF}; + + +{ Zooming functions } + +Function zoomSurface(src: PSDL_Surface; zoomx, zoomy: Double; smooth: sInt32):PSDL_Surface; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_zoomSurface' {$ENDIF}; + +Procedure zoomSurfaceSize(width, height: sInt32; zoomx, zoomy: Double; dstwidth, dstheight: PuInt32); cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_zoomSurfaceSize' {$ENDIF}; + +{ Shrinking functions } + +Function shrinkSurface(src: PSDL_Surface; factorx, factory: sInt32):PSDL_Surface; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_shrinkSurface' {$ENDIF}; + +{ Specialized rotation functions } + +Function rotateSurface90Degrees(src: PSDL_Surface; numClockwiseTurns: sInt32):PSDL_Surface; cdecl; + external GFX_LibName {$IFDEF DELMAC} name '_rotateSurface90Degrees' {$ENDIF}; + + +implementation + +Procedure SDL_GFX_VERSION(Out X: TSDL_Version); +begin + X.Major := SDL2_GFXPRIMITIVES_MAJOR; + X.Minor := SDL2_GFXPRIMITIVES_MINOR; + X.Patch := SDL2_GFXPRIMITIVES_MICRO +end; + +end. diff --git a/sdl2_image.pas b/units/sdl2_image.pas similarity index 100% rename from sdl2_image.pas rename to units/sdl2_image.pas diff --git a/sdl2_mixer.pas b/units/sdl2_mixer.pas similarity index 100% rename from sdl2_mixer.pas rename to units/sdl2_mixer.pas diff --git a/sdl2_net.pas b/units/sdl2_net.pas similarity index 100% rename from sdl2_net.pas rename to units/sdl2_net.pas diff --git a/sdl2_ttf.pas b/units/sdl2_ttf.pas similarity index 100% rename from sdl2_ttf.pas rename to units/sdl2_ttf.pas diff --git a/sdlaudio.inc b/units/sdlaudio.inc similarity index 100% rename from sdlaudio.inc rename to units/sdlaudio.inc diff --git a/sdlblendmode.inc b/units/sdlblendmode.inc similarity index 100% rename from sdlblendmode.inc rename to units/sdlblendmode.inc diff --git a/sdlclipboard.inc b/units/sdlclipboard.inc similarity index 100% rename from sdlclipboard.inc rename to units/sdlclipboard.inc diff --git a/sdlcpuinfo.inc b/units/sdlcpuinfo.inc similarity index 100% rename from sdlcpuinfo.inc rename to units/sdlcpuinfo.inc diff --git a/sdlerror.inc b/units/sdlerror.inc similarity index 100% rename from sdlerror.inc rename to units/sdlerror.inc diff --git a/sdlevents.inc b/units/sdlevents.inc similarity index 100% rename from sdlevents.inc rename to units/sdlevents.inc diff --git a/sdlfilesystem.inc b/units/sdlfilesystem.inc similarity index 100% rename from sdlfilesystem.inc rename to units/sdlfilesystem.inc diff --git a/sdlgamecontroller.inc b/units/sdlgamecontroller.inc similarity index 100% rename from sdlgamecontroller.inc rename to units/sdlgamecontroller.inc diff --git a/sdlgesture.inc b/units/sdlgesture.inc similarity index 100% rename from sdlgesture.inc rename to units/sdlgesture.inc diff --git a/sdlhaptic.inc b/units/sdlhaptic.inc similarity index 100% rename from sdlhaptic.inc rename to units/sdlhaptic.inc diff --git a/sdlhints.inc b/units/sdlhints.inc similarity index 100% rename from sdlhints.inc rename to units/sdlhints.inc diff --git a/sdljoystick.inc b/units/sdljoystick.inc similarity index 100% rename from sdljoystick.inc rename to units/sdljoystick.inc diff --git a/sdlkeyboard.inc b/units/sdlkeyboard.inc similarity index 100% rename from sdlkeyboard.inc rename to units/sdlkeyboard.inc diff --git a/sdlloadso.inc b/units/sdlloadso.inc similarity index 100% rename from sdlloadso.inc rename to units/sdlloadso.inc diff --git a/sdllog.inc b/units/sdllog.inc similarity index 100% rename from sdllog.inc rename to units/sdllog.inc diff --git a/sdlmessagebox.inc b/units/sdlmessagebox.inc similarity index 100% rename from sdlmessagebox.inc rename to units/sdlmessagebox.inc diff --git a/sdlmouse.inc b/units/sdlmouse.inc similarity index 100% rename from sdlmouse.inc rename to units/sdlmouse.inc diff --git a/sdlmutex.inc b/units/sdlmutex.inc similarity index 100% rename from sdlmutex.inc rename to units/sdlmutex.inc diff --git a/sdlpixels.inc b/units/sdlpixels.inc similarity index 100% rename from sdlpixels.inc rename to units/sdlpixels.inc diff --git a/sdlplatform.inc b/units/sdlplatform.inc similarity index 100% rename from sdlplatform.inc rename to units/sdlplatform.inc diff --git a/sdlpower.inc b/units/sdlpower.inc similarity index 100% rename from sdlpower.inc rename to units/sdlpower.inc diff --git a/sdlrect.inc b/units/sdlrect.inc similarity index 100% rename from sdlrect.inc rename to units/sdlrect.inc diff --git a/sdlrenderer.inc b/units/sdlrenderer.inc similarity index 100% rename from sdlrenderer.inc rename to units/sdlrenderer.inc diff --git a/sdlrwops.inc b/units/sdlrwops.inc similarity index 100% rename from sdlrwops.inc rename to units/sdlrwops.inc diff --git a/sdlscancode.inc b/units/sdlscancode.inc similarity index 100% rename from sdlscancode.inc rename to units/sdlscancode.inc diff --git a/sdlsensor.inc b/units/sdlsensor.inc similarity index 100% rename from sdlsensor.inc rename to units/sdlsensor.inc diff --git a/sdlshape.inc b/units/sdlshape.inc similarity index 100% rename from sdlshape.inc rename to units/sdlshape.inc diff --git a/sdlstdinc.inc b/units/sdlstdinc.inc similarity index 100% rename from sdlstdinc.inc rename to units/sdlstdinc.inc diff --git a/sdlsurface.inc b/units/sdlsurface.inc similarity index 100% rename from sdlsurface.inc rename to units/sdlsurface.inc diff --git a/sdlsystem.inc b/units/sdlsystem.inc similarity index 97% rename from sdlsystem.inc rename to units/sdlsystem.inc index e7510139..f0cfecd9 100644 --- a/sdlsystem.inc +++ b/units/sdlsystem.inc @@ -1,105 +1,105 @@ -// from "SDL_system.h" - -(* Platform specific functions for Windows *) -{$IF DEFINED(WIN32) OR DEFINED(WIN64)} - - {** - * \brief Set a function that is called for every windows message, before TranslateMessage() - *} -Type - TSDL_WindowsMessageHook = Procedure(userdata, hWnd: Pointer; mesage: UInt32; wParam: UInt64; lParam: SInt64); cdecl; - -Procedure SDL_SetWindowsMessageHook(callback: TSDL_WindowsMessageHook; userdata: Pointer); cdecl; - external SDL_LibName; - - {* Returns the D3D9 adapter index that matches the specified display index. - * This adapter index can be passed to IDirect3D9::CreateDevice and controls - * on which monitor a full screen application will appear. - *} -Function SDL_Direct3D9GetAdapterIndex(displayIndex:SInt32):SInt32; - cdecl; external SDL_LibName; - - {* Returns the D3D device associated with a renderer, or NULL if it's not a D3D renderer. - * Once you are done using the device, you should release it to avoid a resource leak. - *} -Type PIDirect3DDevice9 = Pointer; -Function SDL_RenderGetD3D9Device(renderer:PSDL_Renderer):PIDirect3DDevice9; - cdecl; external SDL_LibName; - -{* Returns the DXGI Adapter and Output indices for the specified display index. - * These can be passed to EnumAdapters and EnumOutputs respectively to get the objects - * required to create a DX10 or DX11 device and swap chain. - *} -function SDL_DXGIGetOutputInfo(displayIndex :SInt32; adapterIndex, outputIndex :PSInt32): TSDL_Bool; - cdecl; external SDL_LibName; - -{$IFEND} - - -(* Platform specific functions for WinRT *) -{$IFDEF __WINRT__} - - {** - * \brief WinRT / Windows Phone path types - *} -Type - TSDL_WinRT_Path = ( - - {** \brief The installed app's root directory. - Files here are likely to be read-only. *} - SDL_WINRT_PATH_INSTALLED_LOCATION = 0, - - {** \brief The app's local data store. Files may be written here *} - SDL_WINRT_PATH_LOCAL_FOLDER = 1, - - {** \brief The app's roaming data store. Unsupported on Windows Phone. - Files written here may be copied to other machines via a network - connection. - *} - SDL_WINRT_PATH_ROAMING_FOLDER = 2, - - {** \brief The app's temporary data store. Unsupported on Windows Phone. - Files written here may be deleted at any time. *} - SDL_WINRT_PATH_TEMP_FOLDER = 3 - - ); - - - {** - * \brief Retrieves a WinRT defined path on the local file system - * - * \note Documentation on most app-specific path types on WinRT - * can be found on MSDN, at the URL: - * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx - * - * \param pathType The type of path to retrieve. - * \ret A UCS-2 string (16-bit, wide-char) containing the path, or NULL - * if the path is not available for any reason. Not all paths are - * available on all versions of Windows. This is especially true on - * Windows Phone. Check the documentation for the given - * SDL_WinRT_Path for more information on which path types are - * supported where. - *} -Function SDL_WinRTGetFSPathUNICODE(pathType :TSDL_WinRT_Path):PWideChar; - cdecl; external SDL_LibName; - - - {** - * \brief Retrieves a WinRT defined path on the local file system - * - * \note Documentation on most app-specific path types on WinRT - * can be found on MSDN, at the URL: - * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx - * - * \param pathType The type of path to retrieve. - * \ret A UTF-8 string (8-bit, multi-byte) containing the path, or NULL - * if the path is not available for any reason. Not all paths are - * available on all versions of Windows. This is especially true on - * Windows Phone. Check the documentation for the given - * SDL_WinRT_Path for more information on which path types are - * supported where. - *} -Function SDL_WinRTGetFSPathUTF8(pathType :TSDL_WinRT_Path):PChar; - cdecl; external SDL_LibName; - -{$ENDIF} +// from "SDL_system.h" + +(* Platform specific functions for Windows *) +{$IF DEFINED(WIN32) OR DEFINED(WIN64)} + + {** + * \brief Set a function that is called for every windows message, before TranslateMessage() + *} +Type + TSDL_WindowsMessageHook = Procedure(userdata, hWnd: Pointer; mesage: UInt32; wParam: UInt64; lParam: SInt64); cdecl; + +Procedure SDL_SetWindowsMessageHook(callback: TSDL_WindowsMessageHook; userdata: Pointer); cdecl; + external SDL_LibName; + + {* Returns the D3D9 adapter index that matches the specified display index. + * This adapter index can be passed to IDirect3D9::CreateDevice and controls + * on which monitor a full screen application will appear. + *} +Function SDL_Direct3D9GetAdapterIndex(displayIndex:SInt32):SInt32; + cdecl; external SDL_LibName; + + {* Returns the D3D device associated with a renderer, or NULL if it's not a D3D renderer. + * Once you are done using the device, you should release it to avoid a resource leak. + *} +Type PIDirect3DDevice9 = Pointer; +Function SDL_RenderGetD3D9Device(renderer:PSDL_Renderer):PIDirect3DDevice9; + cdecl; external SDL_LibName; + +{* Returns the DXGI Adapter and Output indices for the specified display index. + * These can be passed to EnumAdapters and EnumOutputs respectively to get the objects + * required to create a DX10 or DX11 device and swap chain. + *} +function SDL_DXGIGetOutputInfo(displayIndex :SInt32; adapterIndex, outputIndex :PSInt32): TSDL_Bool; + cdecl; external SDL_LibName; + +{$IFEND} + + +(* Platform specific functions for WinRT *) +{$IFDEF __WINRT__} + + {** + * \brief WinRT / Windows Phone path types + *} +Type + TSDL_WinRT_Path = ( + + {** \brief The installed app's root directory. + Files here are likely to be read-only. *} + SDL_WINRT_PATH_INSTALLED_LOCATION = 0, + + {** \brief The app's local data store. Files may be written here *} + SDL_WINRT_PATH_LOCAL_FOLDER = 1, + + {** \brief The app's roaming data store. Unsupported on Windows Phone. + Files written here may be copied to other machines via a network + connection. + *} + SDL_WINRT_PATH_ROAMING_FOLDER = 2, + + {** \brief The app's temporary data store. Unsupported on Windows Phone. + Files written here may be deleted at any time. *} + SDL_WINRT_PATH_TEMP_FOLDER = 3 + + ); + + + {** + * \brief Retrieves a WinRT defined path on the local file system + * + * \note Documentation on most app-specific path types on WinRT + * can be found on MSDN, at the URL: + * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx + * + * \param pathType The type of path to retrieve. + * \ret A UCS-2 string (16-bit, wide-char) containing the path, or NULL + * if the path is not available for any reason. Not all paths are + * available on all versions of Windows. This is especially true on + * Windows Phone. Check the documentation for the given + * SDL_WinRT_Path for more information on which path types are + * supported where. + *} +Function SDL_WinRTGetFSPathUNICODE(pathType :TSDL_WinRT_Path):PWideChar; + cdecl; external SDL_LibName; + + + {** + * \brief Retrieves a WinRT defined path on the local file system + * + * \note Documentation on most app-specific path types on WinRT + * can be found on MSDN, at the URL: + * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx + * + * \param pathType The type of path to retrieve. + * \ret A UTF-8 string (8-bit, multi-byte) containing the path, or NULL + * if the path is not available for any reason. Not all paths are + * available on all versions of Windows. This is especially true on + * Windows Phone. Check the documentation for the given + * SDL_WinRT_Path for more information on which path types are + * supported where. + *} +Function SDL_WinRTGetFSPathUTF8(pathType :TSDL_WinRT_Path):PChar; + cdecl; external SDL_LibName; + +{$ENDIF} diff --git a/sdlsyswm.inc b/units/sdlsyswm.inc similarity index 96% rename from sdlsyswm.inc rename to units/sdlsyswm.inc index 6c29df63..e17f8393 100644 --- a/sdlsyswm.inc +++ b/units/sdlsyswm.inc @@ -1,297 +1,297 @@ -// from sdl_syswm.h - -{$IFDEF WINDOWS} - {$DEFINE SDL_VIDEO_DRIVER_WINDOWS} -{$ENDIF} - -{$IF DEFINED (LINUX) OR DEFINED(UNIX)} - {$IF NOT (DEFINED(DARWIN) OR DEFINED(ANDROID))} - {$DEFINE SDL_VIDEO_DRIVER_X11} - {$ENDIF} -{$IFEND} - -(* - * Disabled because FPC does not ship a DirectFB unit. - * If you have some working DirectDB bindings, feel welcome to enable this and check if it breaks anything. - *) -{$UNDEF SDL_VIDEO_DRIVER_DIRECTFB} - -{$IFDEF DARWIN} - {$DEFINE SDL_VIDEO_DRIVER_COCOA} -{$ENDIF} - -(* - * Disabled because it's a Mac-specific video driver and we have no means of testing it. - * If you own a Mac, feel welcome to enable this and check if it actually compiles and doesn't break anything. - *) -{$UNDEF SDL_VIDEO_DRIVER_UIKIT} - -(* - * Disabled because FPC does not ship a Wayland unit. - * If you have some working Wayland bindings, feel welcome to enable this, - * check if it actually compiles and doesn't break anything. - *) -{$UNDEF SDL_VIDEO_DRIVER_WAYLAND} - -(* - * Disabled because FPC does not ship a Mir unit. - * Also, support for Mir has been removed in SDL 2.0.10. - *) -{$UNDEF SDL_VIDEO_DRIVER_MIR} - -(* - * Disabled because FPC does not support WinRT. - *) -{$UNDEF SDL_VIDEO_DRIVER_WINRT} - -{$IFDEF ANDROID} - {$DEFINE SDL_VIDEO_DRIVER_ANDROID} -{$ENDIF} - -(* - * Disabled because this is an embedded platform and we have no means of testing this. - * If you're actually working with Vivante, feel welcome to enable this - * and check if it compiles and works properly. - *) -{$UNDEF SDL_VIDEO_DRIVER_VIVANTE} - -{$IFDEF OS2} - {$DEFINE SDL_VIDEO_DRIVER_OS2} -{$ENDIF} - -{$IFDEF HAIKU} - {$DEFINE SDL_VIDEO_DRIVER_HAIKU} -{$ENDIF} - - -{** - * These are the various supported windowing subsystems - *} -Type - TSDL_SYSWM_TYPE = ( - SDL_SYSWM_UNKNOWN, - SDL_SYSWM_WINDOWS, - SDL_SYSWM_X11, - SDL_SYSWM_DIRECTFB, - SDL_SYSWM_COCOA, - SDL_SYSWM_UIKIT, - SDL_SYSWM_WAYLAND, // Since SDL 2.0.2 - REMOVED in SDL 2.0.10! - SDL_SYSWM_MIR, // Since SDL 2.0.2 - SDL_SYSWM_WINRT, // Since SDL 2.0.3 - SDL_SYSWM_ANDROID, // Since SDL 2.0.4 - SDL_SYSWM_VIVANTE, // Since SDL 2.0.5 - SDL_SYSWM_OS2, // Since SDL 2.0.6 - SDL_SYSWM_HAIKU // Since SDL 2.0.12 - ); - -/// sdl_syswm.h uses anonymous structs, declared right in SDL_SysWMmsg and SDL_SysWMinfo. -/// Since Pascal does not allow this, we workaround by introducing named types. -{$IFDEF SDL_VIDEO_DRIVER_WINDOWS} - __SYSWM_WINDOWS = record - hwnd: HWND; {**< The window for the message } - msg: uInt; {**< The type of message *} - wParam: WPARAM; {**< WORD message parameter *} - lParam: LPARAM; {**< WORD message parameter *} - end; - __WMINFO_WINDOWS = record - window: HWND; {**< The window handle *} - hdc: HDC; {**< The window device context *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_X11} - __SYSWM_X11 = record - event: {$IFDEF FPC} TXEvent {$ELSE} XEvent {$ENDIF}; - end; - __WMINFO_X11 = record - display: PDisplay; {**< The X11 display *} - window: TWindow; {**< The X11 window *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_DIRECTFB} - __SYSWM_DIRECTFB = record - event: DFBEvent; - end; - __WMINFO_DIRECTFB = record - dfb: IDirectFB; {**< The directfb main interface *} - window: IDirectFBWindow; {**< The directfb window handle *} - surface: IDirectFBSurface; {**< The directfb client surface *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_COCOA} - __SYSWM_COCOA = record - (* No Cocoa window events yet *) - dummy: integer; - end; - __WMINFO_COCOA = record - window: NSWindow; {* The Cocoa window *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_UIKIT} - __SYSWM_UIKIT = record - (* No UIKit window events yet *) - dummy: integer; - end; - __WMINFO_UIKIT = record - window: UIWindow; {* The UIKit window *} - framebuffer: GLuint; {* The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. *} - colorbuffer: GLuint; {* The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. *} - resolveFramebuffer: GLuint; {* The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_WAYLAND} - __WMINFO_WAYLAND = record - display: wl_display; {**< Wayland display *} - surface: wl_surface; {**< Wayland surface *} - shell_surface: wl_shell_surface; {**< Wayland shell_surface (window manager handle) *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_MIR} - __WMINFO_MIR = record - connection: PMirConnection; {**< Mir display server connection *} - surface: PMirSurface; {**< Mir surface *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_WINRT} - __WMINFO_WINRT = record - window: IInspectable; {**< The WinRT CoreWindow *} - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_ANDROID} - __WMINFO_ANDROID = record - window: Pointer; // PANativeWindow; - surface: Pointer; // PEGLSurface; - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_VIVANTE} - __SYSWM_VIVANTE = record - (* No Vivante window events yet *) - dummy: integer; - end; - __WMINFO_VIVANTE = record - display: EGLNativeDisplayType; - window: EGLNativeWindowType; - end; -{$ENDIF} - -{$IFDEF SDL_VIDEO_DRIVER_OS2} - __SYSWM_OS2 = record - fFrame: Boolean; {**< TRUE if hwnd is a frame window *} - hwnd: HWND; {**< The window receiving the message *} - msg: uInt; {**< The message identifier *} - mp1: MPARAM; {**< The first first message parameter *} - mp2: MPARAM; {**< The second first message parameter *} - end; - __WMINFO_OS2 = record - hwnd: HWND; {**< The window handle *} - hwndFrame: HWND; {**< The frame window handle *} - end; -{$ENDIF} - - -{** - * The custom event structure. - *} - PSDL_SysWMmsg = ^TSDL_SysWMmsg; - TSDL_SysWMmsg = record - version: TSDL_version; - case subsystem: TSDL_SYSWM_TYPE of - {$IFDEF SDL_VIDEO_DRIVER_WINDOWS} - SDL_SYSWM_WINDOWS: (win: __SYSWM_WINDOWS); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_X11} - SDL_SYSWM_X11: (x11: __SYSWM_X11); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_DIRECTFB} - SDL_SYSWM_DIRECTFB: (dfb: __SYSWM_DIRECTFB); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_COCOA} - SDL_SYSWM_COCOA: (cocoa: __SYSWM_COCOA); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_UIKIT} - SDL_SYSWM_UIKIT: (uikit: __SYSWM_UIKIT); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_VIVANTE} - SDL_SYSWM_VIVANTE: (vivante: __SYSWM_VIVANTE); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_OS2} - SDL_SYSWM_OS2: (os2: __SYSWM_OS2); - {$ENDIF} - SDL_SYSWM_UNKNOWN: (dummy: integer); - end; - -{** - * The custom window manager information structure. - * - * When this structure is returned, it holds information about which - * low level system it is using, and will be one of SDL_SYSWM_TYPE. - *} - PSDL_SysWMinfo = ^TSDL_SysWMinfo; - TSDL_SysWMinfo = record - version: TSDL_version; - case subsystem: TSDL_SYSWM_TYPE of - {$IFDEF SDL_VIDEO_DRIVER_WINDOWS} - SDL_SYSWM_WINDOWS: (win : __WMINFO_WINDOWS); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_WINRT} - SDL_SYSWM_WINRT: (winrt : __WMINFO_WINRT); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_X11} - SDL_SYSWM_X11: (x11 : __WMINFO_X11); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_DIRECTFB} - SDL_SYSWM_DIRECTFB: (dfb : __WMINFO_DIRECTFB); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_COCOA} - SDL_SYSWM_COCOA: (cocoa : __WMINFO_COCOA); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_UIKIT} - SDL_SYSWM_UIKIT: (uikit : __WMINFO_UIKIT); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_WAYLAND} - SDL_SYSWM_WAYLAND: (wl : __WMINFO_WAYLAND); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_MIR} - SDL_SYSWM_MIR: (mir : __WMINFO_MIR); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_ANDROID} - SDL_SYSWM_ANDROID: (android: __WMINFO_ANDROID); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_VIVANTE} - SDL_SYSWM_VIVANTE: (vivante: __WMINFO_VIVANTE); - {$ENDIF} - {$IFDEF SDL_VIDEO_DRIVER_OS2} - SDL_SYSWM_OS2: (os2: __WMINFO_OS2); - {$ENDIF} - (* Ensure this union is always 64 bytes (8 64-bit pointers) *) - SDL_SYSWM_UNKNOWN: (dummy: array[0..63] of Byte); - end; - -{* Function prototypes *} -(** - * \brief This function allows access to driver-dependent window information. - * - * \param window The window about which information is being requested - * \param info This structure must be initialized with the SDL version, and is - * then filled in with information about the given window. - * - * \return SDL_TRUE if the function is implemented and the version member of - * the \c info struct is valid, SDL_FALSE otherwise. - * - * You typically use this function like this: - * \code - * SDL_SysWMinfo info; - * SDL_VERSION(&info.version); - * if ( SDL_GetWindowWMInfo(window, &info) ) { ... } - * \endcode - *) -Function SDL_GetWindowWMInfo(window:PSDL_Window; info : PSDL_SysWMinfo):TSDL_bool; cdecl; - external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowWMInfo' {$ENDIF} {$ENDIF}; +// from sdl_syswm.h + +{$IFDEF WINDOWS} + {$DEFINE SDL_VIDEO_DRIVER_WINDOWS} +{$ENDIF} + +{$IF DEFINED (LINUX) OR DEFINED(UNIX)} + {$IF NOT (DEFINED(DARWIN) OR DEFINED(ANDROID))} + {$DEFINE SDL_VIDEO_DRIVER_X11} + {$ENDIF} +{$IFEND} + +(* + * Disabled because FPC does not ship a DirectFB unit. + * If you have some working DirectDB bindings, feel welcome to enable this and check if it breaks anything. + *) +{$UNDEF SDL_VIDEO_DRIVER_DIRECTFB} + +{$IFDEF DARWIN} + {$DEFINE SDL_VIDEO_DRIVER_COCOA} +{$ENDIF} + +(* + * Disabled because it's a Mac-specific video driver and we have no means of testing it. + * If you own a Mac, feel welcome to enable this and check if it actually compiles and doesn't break anything. + *) +{$UNDEF SDL_VIDEO_DRIVER_UIKIT} + +(* + * Disabled because FPC does not ship a Wayland unit. + * If you have some working Wayland bindings, feel welcome to enable this, + * check if it actually compiles and doesn't break anything. + *) +{$UNDEF SDL_VIDEO_DRIVER_WAYLAND} + +(* + * Disabled because FPC does not ship a Mir unit. + * Also, support for Mir has been removed in SDL 2.0.10. + *) +{$UNDEF SDL_VIDEO_DRIVER_MIR} + +(* + * Disabled because FPC does not support WinRT. + *) +{$UNDEF SDL_VIDEO_DRIVER_WINRT} + +{$IFDEF ANDROID} + {$DEFINE SDL_VIDEO_DRIVER_ANDROID} +{$ENDIF} + +(* + * Disabled because this is an embedded platform and we have no means of testing this. + * If you're actually working with Vivante, feel welcome to enable this + * and check if it compiles and works properly. + *) +{$UNDEF SDL_VIDEO_DRIVER_VIVANTE} + +{$IFDEF OS2} + {$DEFINE SDL_VIDEO_DRIVER_OS2} +{$ENDIF} + +{$IFDEF HAIKU} + {$DEFINE SDL_VIDEO_DRIVER_HAIKU} +{$ENDIF} + + +{** + * These are the various supported windowing subsystems + *} +Type + TSDL_SYSWM_TYPE = ( + SDL_SYSWM_UNKNOWN, + SDL_SYSWM_WINDOWS, + SDL_SYSWM_X11, + SDL_SYSWM_DIRECTFB, + SDL_SYSWM_COCOA, + SDL_SYSWM_UIKIT, + SDL_SYSWM_WAYLAND, // Since SDL 2.0.2 - REMOVED in SDL 2.0.10! + SDL_SYSWM_MIR, // Since SDL 2.0.2 + SDL_SYSWM_WINRT, // Since SDL 2.0.3 + SDL_SYSWM_ANDROID, // Since SDL 2.0.4 + SDL_SYSWM_VIVANTE, // Since SDL 2.0.5 + SDL_SYSWM_OS2, // Since SDL 2.0.6 + SDL_SYSWM_HAIKU // Since SDL 2.0.12 + ); + +/// sdl_syswm.h uses anonymous structs, declared right in SDL_SysWMmsg and SDL_SysWMinfo. +/// Since Pascal does not allow this, we workaround by introducing named types. +{$IFDEF SDL_VIDEO_DRIVER_WINDOWS} + __SYSWM_WINDOWS = record + hwnd: HWND; {**< The window for the message } + msg: uInt; {**< The type of message *} + wParam: WPARAM; {**< WORD message parameter *} + lParam: LPARAM; {**< WORD message parameter *} + end; + __WMINFO_WINDOWS = record + window: HWND; {**< The window handle *} + hdc: HDC; {**< The window device context *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_X11} + __SYSWM_X11 = record + event: {$IFDEF FPC} TXEvent {$ELSE} XEvent {$ENDIF}; + end; + __WMINFO_X11 = record + display: PDisplay; {**< The X11 display *} + window: TWindow; {**< The X11 window *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_DIRECTFB} + __SYSWM_DIRECTFB = record + event: DFBEvent; + end; + __WMINFO_DIRECTFB = record + dfb: IDirectFB; {**< The directfb main interface *} + window: IDirectFBWindow; {**< The directfb window handle *} + surface: IDirectFBSurface; {**< The directfb client surface *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_COCOA} + __SYSWM_COCOA = record + (* No Cocoa window events yet *) + dummy: integer; + end; + __WMINFO_COCOA = record + window: NSWindow; {* The Cocoa window *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_UIKIT} + __SYSWM_UIKIT = record + (* No UIKit window events yet *) + dummy: integer; + end; + __WMINFO_UIKIT = record + window: UIWindow; {* The UIKit window *} + framebuffer: GLuint; {* The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. *} + colorbuffer: GLuint; {* The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. *} + resolveFramebuffer: GLuint; {* The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_WAYLAND} + __WMINFO_WAYLAND = record + display: wl_display; {**< Wayland display *} + surface: wl_surface; {**< Wayland surface *} + shell_surface: wl_shell_surface; {**< Wayland shell_surface (window manager handle) *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_MIR} + __WMINFO_MIR = record + connection: PMirConnection; {**< Mir display server connection *} + surface: PMirSurface; {**< Mir surface *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_WINRT} + __WMINFO_WINRT = record + window: IInspectable; {**< The WinRT CoreWindow *} + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_ANDROID} + __WMINFO_ANDROID = record + window: Pointer; // PANativeWindow; + surface: Pointer; // PEGLSurface; + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_VIVANTE} + __SYSWM_VIVANTE = record + (* No Vivante window events yet *) + dummy: integer; + end; + __WMINFO_VIVANTE = record + display: EGLNativeDisplayType; + window: EGLNativeWindowType; + end; +{$ENDIF} + +{$IFDEF SDL_VIDEO_DRIVER_OS2} + __SYSWM_OS2 = record + fFrame: Boolean; {**< TRUE if hwnd is a frame window *} + hwnd: HWND; {**< The window receiving the message *} + msg: uInt; {**< The message identifier *} + mp1: MPARAM; {**< The first first message parameter *} + mp2: MPARAM; {**< The second first message parameter *} + end; + __WMINFO_OS2 = record + hwnd: HWND; {**< The window handle *} + hwndFrame: HWND; {**< The frame window handle *} + end; +{$ENDIF} + + +{** + * The custom event structure. + *} + PSDL_SysWMmsg = ^TSDL_SysWMmsg; + TSDL_SysWMmsg = record + version: TSDL_version; + case subsystem: TSDL_SYSWM_TYPE of + {$IFDEF SDL_VIDEO_DRIVER_WINDOWS} + SDL_SYSWM_WINDOWS: (win: __SYSWM_WINDOWS); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_X11} + SDL_SYSWM_X11: (x11: __SYSWM_X11); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_DIRECTFB} + SDL_SYSWM_DIRECTFB: (dfb: __SYSWM_DIRECTFB); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_COCOA} + SDL_SYSWM_COCOA: (cocoa: __SYSWM_COCOA); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_UIKIT} + SDL_SYSWM_UIKIT: (uikit: __SYSWM_UIKIT); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_VIVANTE} + SDL_SYSWM_VIVANTE: (vivante: __SYSWM_VIVANTE); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_OS2} + SDL_SYSWM_OS2: (os2: __SYSWM_OS2); + {$ENDIF} + SDL_SYSWM_UNKNOWN: (dummy: integer); + end; + +{** + * The custom window manager information structure. + * + * When this structure is returned, it holds information about which + * low level system it is using, and will be one of SDL_SYSWM_TYPE. + *} + PSDL_SysWMinfo = ^TSDL_SysWMinfo; + TSDL_SysWMinfo = record + version: TSDL_version; + case subsystem: TSDL_SYSWM_TYPE of + {$IFDEF SDL_VIDEO_DRIVER_WINDOWS} + SDL_SYSWM_WINDOWS: (win : __WMINFO_WINDOWS); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_WINRT} + SDL_SYSWM_WINRT: (winrt : __WMINFO_WINRT); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_X11} + SDL_SYSWM_X11: (x11 : __WMINFO_X11); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_DIRECTFB} + SDL_SYSWM_DIRECTFB: (dfb : __WMINFO_DIRECTFB); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_COCOA} + SDL_SYSWM_COCOA: (cocoa : __WMINFO_COCOA); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_UIKIT} + SDL_SYSWM_UIKIT: (uikit : __WMINFO_UIKIT); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_WAYLAND} + SDL_SYSWM_WAYLAND: (wl : __WMINFO_WAYLAND); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_MIR} + SDL_SYSWM_MIR: (mir : __WMINFO_MIR); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_ANDROID} + SDL_SYSWM_ANDROID: (android: __WMINFO_ANDROID); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_VIVANTE} + SDL_SYSWM_VIVANTE: (vivante: __WMINFO_VIVANTE); + {$ENDIF} + {$IFDEF SDL_VIDEO_DRIVER_OS2} + SDL_SYSWM_OS2: (os2: __WMINFO_OS2); + {$ENDIF} + (* Ensure this union is always 64 bytes (8 64-bit pointers) *) + SDL_SYSWM_UNKNOWN: (dummy: array[0..63] of Byte); + end; + +{* Function prototypes *} +(** + * \brief This function allows access to driver-dependent window information. + * + * \param window The window about which information is being requested + * \param info This structure must be initialized with the SDL version, and is + * then filled in with information about the given window. + * + * \return SDL_TRUE if the function is implemented and the version member of + * the \c info struct is valid, SDL_FALSE otherwise. + * + * You typically use this function like this: + * \code + * SDL_SysWMinfo info; + * SDL_VERSION(&info.version); + * if ( SDL_GetWindowWMInfo(window, &info) ) { ... } + * \endcode + *) +Function SDL_GetWindowWMInfo(window:PSDL_Window; info : PSDL_SysWMinfo):TSDL_bool; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowWMInfo' {$ENDIF} {$ENDIF}; diff --git a/sdlthread.inc b/units/sdlthread.inc similarity index 100% rename from sdlthread.inc rename to units/sdlthread.inc diff --git a/sdltimer.inc b/units/sdltimer.inc similarity index 100% rename from sdltimer.inc rename to units/sdltimer.inc diff --git a/sdltouch.inc b/units/sdltouch.inc similarity index 100% rename from sdltouch.inc rename to units/sdltouch.inc diff --git a/sdltypes.inc b/units/sdltypes.inc similarity index 100% rename from sdltypes.inc rename to units/sdltypes.inc diff --git a/sdlversion.inc b/units/sdlversion.inc similarity index 100% rename from sdlversion.inc rename to units/sdlversion.inc diff --git a/sdlvideo.inc b/units/sdlvideo.inc similarity index 100% rename from sdlvideo.inc rename to units/sdlvideo.inc