Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions sdlrect.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,41 @@

type
{**
* The structure that defines a point
*
* SDL_EnclosePoints
* The structure that defines a point (integer)
*}

PSDL_Point = ^TSDL_Point;
TSDL_Point = record
x: SInt32;
y: SInt32;
end;

{**
* A rectangle, with the origin at the upper left.
*
* SDL_RectEmpty
* SDL_RectEquals
* SDL_HasIntersection
* SDL_IntersectRect
* SDL_UnionRect
* SDL_EnclosePoints
* The structure that defines a point (floating point)
*}
PSDL_FPoint = ^TSDL_FPoint;
TSDL_FPoint = record
x: Single;
y: Single;
end;

{**
* A rectangle, with the origin at the upper left. (integer)
*}
PSDL_Rect = ^TSDL_Rect;
TSDL_Rect = record
x,y: SInt32;
w,h: SInt32;
end;

{**
* A rectangle, with the origin at the upper left. (floating point)
*}
PSDL_FRect = ^TSDL_FRect;
TSDL_FRect = record
x,y: Single;
w,h: Single;
end;

{**
* \brief Returns true if point resides inside a rectangle.
*}
Expand Down
125 changes: 125 additions & 0 deletions sdlrenderer.inc
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,18 @@ function SDL_RenderClear(renderer: PSDL_Renderer): SInt32 cdecl; external SDL_Li
*}
function SDL_RenderDrawPoint(renderer: PSDL_Renderer; x: SInt32; y: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPoint' {$ENDIF} {$ENDIF};

{**
* Draw a point on the current rendering target.
*
* renderer The renderer which should draw a point.
* x The x coordinate of the point.
* y The y coordinate of the point.
*
* 0 on success, or -1 on error
*}
function SDL_RenderDrawPointF(renderer: PSDL_Renderer; x, y: single): SInt32 cdecl;
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPointF' {$ENDIF} {$ENDIF};

{**
* Draw multiple points on the current rendering target.
*
Expand All @@ -596,6 +608,18 @@ function SDL_RenderDrawPoint(renderer: PSDL_Renderer; x: SInt32; y: SInt32): SIn
*}
function SDL_RenderDrawPoints(renderer: PSDL_Renderer; points: PSDL_Point; count: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPoints' {$ENDIF} {$ENDIF};

{**
* Draw multiple points on the current rendering target.
*
* renderer The renderer which should draw multiple points.
* points The points to draw
* count The number of points to draw
*
* 0 on success, or -1 on error
*}
function SDL_RenderDrawPointsF(renderer: PSDL_Renderer; points: PSDL_FPoint; count: SInt32): SInt32 cdecl;
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawPointsF' {$ENDIF} {$ENDIF};

{**
* Draw a line on the current rendering target.
*
Expand All @@ -609,6 +633,20 @@ function SDL_RenderDrawPoints(renderer: PSDL_Renderer; points: PSDL_Point; count
*}
function SDL_RenderDrawLine(renderer: PSDL_Renderer; x1: SInt32; y1: SInt32; x2: SInt32; y2: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLine' {$ENDIF} {$ENDIF};

{**
* Draw a line on the current rendering target.
*
* renderer The renderer which should draw a line.
* x1 The x coordinate of the start point.
* y1 The y coordinate of the start point.
* x2 The x coordinate of the end point.
* y2 The y coordinate of the end point.
*
* 0 on success, or -1 on error
*}
function SDL_RenderDrawLineF(renderer: PSDL_Renderer; x1, y1, x2, y2: single): SInt32 cdecl;
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLineF' {$ENDIF} {$ENDIF};

{**
* \brief Draw a series of connected lines on the current rendering target.
*
Expand All @@ -620,6 +658,18 @@ function SDL_RenderDrawLine(renderer: PSDL_Renderer; x1: SInt32; y1: SInt32; x2:
*}
function SDL_RenderDrawLines(renderer: PSDL_Renderer; points: PSDL_Point; count: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLines' {$ENDIF} {$ENDIF};

{**
* Draw a series of connected lines on the current rendering target.
*
* renderer The renderer which should draw multiple lines.
* points The points along the lines
* count The number of points, drawing count-1 lines
*
* 0 on success, or -1 on error
*}
function SDL_RenderDrawLinesF(renderer: PSDL_Renderer; points: PSDL_FPoint; count: SInt32): SInt32 cdecl;
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawLinesF' {$ENDIF} {$ENDIF};

{**
* Draw a rectangle on the current rendering target.
*
Expand All @@ -630,6 +680,17 @@ function SDL_RenderDrawLines(renderer: PSDL_Renderer; points: PSDL_Point; count:
*}
function SDL_RenderDrawRect(renderer: PSDL_Renderer; rect: PSDL_Rect): SInt32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRect' {$ENDIF} {$ENDIF};

{**
* Draw a rectangle on the current rendering target.
*
* renderer The renderer which should draw a rectangle.
* rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
*
* 0 on success, or -1 on error
*}
function SDL_RenderDrawRectF(renderer: PSDL_Renderer; rect: PSDL_FRect): SInt32 cdecl;
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRectF' {$ENDIF} {$ENDIF};

{**
* Draw some number of rectangles on the current rendering target.
*
Expand All @@ -641,6 +702,18 @@ function SDL_RenderDrawRect(renderer: PSDL_Renderer; rect: PSDL_Rect): SInt32 cd
*}
function SDL_RenderDrawRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRects' {$ENDIF} {$ENDIF};

{**
* Draw some number of rectangles on the current rendering target.
*
* renderer The renderer which should draw multiple rectangles.
* rects A pointer to an array of destination rectangles.
* count The number of rectangles.
*
* 0 on success, or -1 on error
*}
function SDL_RenderDrawRectsF(renderer: PSDL_Renderer; rects: PSDL_FRect; count: SInt32): SInt32 cdecl;
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderDrawRectsF' {$ENDIF} {$ENDIF};

{**
* Fill a rectangle on the current rendering target with the drawing color.
*
Expand All @@ -652,6 +725,17 @@ function SDL_RenderDrawRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: S
*}
function SDL_RenderFillRect(renderer: PSDL_Renderer; rect: PSDL_Rect): SInt32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRect' {$ENDIF} {$ENDIF};

{**
* Fill a rectangle on the current rendering target with the drawing color.
*
* renderer The renderer which should fill a rectangle.
* rect A pointer to the destination rectangle, or NULL for the entire rendering target.
*
* 0 on success, or -1 on error
*}
function SDL_RenderFillRectF(renderer: PSDL_Renderer; rect: PSDL_FRect): SInt32 cdecl;
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRectF' {$ENDIF} {$ENDIF};

{**
* Fill some number of rectangles on the current rendering target with the drawing color.
*
Expand All @@ -663,6 +747,18 @@ function SDL_RenderFillRect(renderer: PSDL_Renderer; rect: PSDL_Rect): SInt32 cd
*}
function SDL_RenderFillRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRects' {$ENDIF} {$ENDIF};

{**
* Fill some number of rectangles on the current rendering target with the drawing color.
*
* renderer The renderer which should fill multiple rectangles.
* rects A pointer to an array of destination rectangles.
* count The number of rectangles.
*
* 0 on success, or -1 on error
*}
function SDL_RenderFillRectsF(renderer: PSDL_Renderer; rects: PSDL_FRect; count: SInt32): SInt32 cdecl;
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderFillRectsF' {$ENDIF} {$ENDIF};

{**
* Copy a portion of the texture to the current rendering target.
*
Expand All @@ -677,6 +773,19 @@ function SDL_RenderFillRects(renderer: PSDL_Renderer; rects: PSDL_Rect; count: S
*}
function SDL_RenderCopy(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: PSDL_Rect; dstrect: PSDL_Rect): SInt32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopy' {$ENDIF} {$ENDIF};

{**
* Copy a portion of the texture to the current rendering target.
*
* renderer The renderer which should copy parts of a texture.
* texture The source texture.
* srcrect A pointer to the source rectangle, or NIL for the entire texture.
* dstrect A pointer to the destination rectangle, or NIL for the entire rendering target.
*
* 0 on success, or -1 on error
*}
function SDL_RenderCopyF(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect: PSDL_Rect; dstrect: PSDL_FRect): SInt32 cdecl;
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopyF' {$ENDIF} {$ENDIF};

{**
* Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center
*
Expand All @@ -694,6 +803,22 @@ function SDL_RenderCopy(renderer: PSDL_Renderer; texture: PSDL_Texture; srcrect:
*}
function SDL_RenderCopyEx(renderer: PSDL_Renderer; texture: PSDL_Texture; const srcrect: PSDL_Rect; dstrect: PSDL_Rect; angle: Double; center: PSDL_Point; flip: Integer): SInt32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopyEx' {$ENDIF} {$ENDIF};

{**
* Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center
*
* renderer The renderer which should copy parts of a texture.
* texture The source texture.
* srcrect A pointer to the source rectangle, or NIL for the entire texture.
* dstrect A pointer to the destination rectangle, or NIL for the entire rendering target.
* angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction
* center A pointer to a point indicating the point around which dstrect will be rotated (if NIL, rotation will be done around dstrect.w/2, dstrect.h/2).
* flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture
*
* 0 on success, or -1 on error
*}
function SDL_RenderCopyExF(renderer: PSDL_Renderer; texture: PSDL_Texture; const srcrect: PSDL_Rect; dstrect: PSDL_FRect; angle: Double; center: PSDL_FPoint; flip: Integer): SInt32 cdecl;
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_RenderCopyExF' {$ENDIF} {$ENDIF};

{**
* Read pixels from the current rendering target.
*
Expand Down
7 changes: 5 additions & 2 deletions sdlversion.inc
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ type
patch: UInt8; {**< update version *}
end;

{* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
{*
Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL

Last updated when TSDL_FPoint and TSDL_FRect were added.
*}
const
SDL_MAJOR_VERSION = 2;
SDL_MINOR_VERSION = 0;
SDL_PATCHLEVEL = 4;
SDL_PATCHLEVEL = 10;

{**
* Macro to determine SDL version program was compiled against.
Expand Down