Skip to content

Commit 408a13e

Browse files
committed
Sync branch 'enums-as-seperate-integer-types-instead-of-aliases' with 'master'
Merge conflicts: - sdlblendmode.inc
2 parents d88fd00 + 2fe252f commit 408a13e

File tree

5 files changed

+74
-10
lines changed

5 files changed

+74
-10
lines changed

README.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
1-
# Pascal-SDL-2-Headers
1+
# SDL2-for-Pascal
22

3-
These are the Pascal SDL 2 Headers.
3+
Unit files for building
4+
[Free Pascal](https://freepascal.org/) / [Delphi](https://www.embarcadero.com/products/delphi) applications
5+
using the [SDL2 library](https://libsdl.org).
6+
7+
This repository is a community-maintained fork of the [Pascal-SDL-2-Headers](https://github.com/ev1313/Pascal-SDL-2-Headers) repo.
48

59
## Installation
610

7-
Just add the headers to your include path. Include sdl2.pas for the main SDL2 library (should be always needed). Furthermore headers for the other SDL2 libraries are provided:
8-
- sdl2_image.pas
9-
- sdl2_mixer.pas
10-
- sdl2_net.pas
11-
- sdl2_ttf.pas
11+
Simply add the units to your include path. You can achieve this by:
12+
- (FPC) using the `{$UNITPATH XXX}` directive in your source code;
13+
- (FPC) using the `-FuXXX` command-line argument to the compiler;
14+
- just copying & pasting the units into the same directory as your main source code.
15+
16+
Use the `sdl2` unit for the main SDL2 library (should be always needed). Units for the other SDL2 libraries are also provided:
17+
- [`sdl2_gfx`](https://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/)
18+
- [`sdl2_image`](https://www.libsdl.org/projects/SDL_image/)
19+
- [`sdl2_mixer`](https://www.libsdl.org/projects/SDL_mixer/)
20+
- [`sdl2_net`](https://www.libsdl.org/projects/SDL_net/)
21+
- [`sdl2_ttf`](https://www.libsdl.org/projects/SDL_ttf/)
1222

1323
## Bugs / Contributions
1424

1525
If you have any contributions, feel free to drop a pull request or send in a patch.
1626

17-
Same goes for bugs, please use the github issue tracker.
27+
Same goes for bugs, please use the GitHub issue tracker.
1828

1929
## License
2030

21-
You may license the Pascal SDL 2 Headers either with the MPL license or with the zlib license, both included.
31+
You may license the Pascal SDL2 units either
32+
with the [MPL license](blob/master/MPL-LICENSE) or
33+
with the [zlib license](blob/master/zlib-LICENSE).

sdl2.pas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ interface
208208
{$I sdlfilesystem.inc}
209209
{$I sdllog.inc}
210210
{$I sdlsystem.inc}
211+
{$I sdlstdinc.inc}
211212
{$I sdl.inc}
212213

213214
implementation

sdlblendmode.inc

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,48 @@ const
1313
SDL_BLENDMODE_BLEND = TSDL_BlendMode($00000001); {**< dst = (src * A) + (dst * (1-A)) *}
1414
SDL_BLENDMODE_ADD = TSDL_BlendMode($00000002); {**< dst = (src * A) + dst *}
1515
SDL_BLENDMODE_MOD = TSDL_BlendMode($00000004); {**< dst = src * dst *}
16+
17+
type
18+
PSDL_BlendOperation = ^TSDL_BlendOperation;
19+
TSDL_BlendOperation = type DWord;
20+
21+
const
22+
SDL_BLENDOPERATION_ADD = TSDL_BlendOperation($1); {**< dst + src: supported by all renderers *}
23+
SDL_BLENDOPERATION_SUBTRACT = TSDL_BlendOperation($2); {**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES}
24+
SDL_BLENDOPERATION_REV_SUBTRACT = TSDL_BlendOperation($3); {**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES}
25+
SDL_BLENDOPERATION_MINIMUM = TSDL_BlendOperation($4); {**< min(dst, src) : supported by D3D11 *}
26+
SDL_BLENDOPERATION_MAXIMUM = TSDL_BlendOperation($5); {**< max(dst, src) : supported by D3D11 *}
27+
28+
type
29+
PSDL_BlendFactor = ^TSDL_BlendFactor;
30+
TSDL_BlendFactor = type DWord;
31+
32+
const
33+
SDL_BLENDFACTOR_ZERO = TSDL_BlendFactor($1); {**< 0, 0, 0, 0 *}
34+
SDL_BLENDFACTOR_ONE = TSDL_BlendFactor($2); {**< 1, 1, 1, 1 *}
35+
SDL_BLENDFACTOR_SRC_COLOR = TSDL_BlendFactor($3); {**< srcR, srcG, srcB, srcA *}
36+
SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = TSDL_BlendFactor($4); {**< 1-srcR, 1-srcG, 1-srcB, 1-srcA *}
37+
SDL_BLENDFACTOR_SRC_ALPHA = TSDL_BlendFactor($5); {**< srcA, srcA, srcA, srcA *}
38+
SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = TSDL_BlendFactor($6); {**< 1-srcA, 1-srcA, 1-srcA, 1-srcA *}
39+
SDL_BLENDFACTOR_DST_COLOR = TSDL_BlendFactor($7); {**< dstR, dstG, dstB, dstA *}
40+
SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = TSDL_BlendFactor($8); {**< 1-dstR, 1-dstG, 1-dstB, 1-dstA *}
41+
SDL_BLENDFACTOR_DST_ALPHA = TSDL_BlendFactor($9); {**< dstA, dstA, dstA, dstA *}
42+
SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = TSDL_BlendFactor($A); {**< 1-dstA, 1-dstA, 1-dstA, 1-dstA *}
43+
44+
{**
45+
* \brief Create a custom blend mode, which may or may not be supported by a given renderer
46+
*
47+
* \param srcColorFactor source color factor
48+
* \param dstColorFactor destination color factor
49+
* \param colorOperation color operation
50+
* \param srcAlphaFactor source alpha factor
51+
* \param dstAlphaFactor destination alpha factor
52+
* \param alphaOperation alpha operation
53+
*
54+
* The result of the blend mode operation will be:
55+
* dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor
56+
* and
57+
* dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor
58+
*}
59+
Function SDL_ComposeCustomBlendMode(srcColorFactor, dstColorFactor : TSDL_BlendFactor; colorOperation : TSDL_BlendOperation; srcAlphaFactor, dstAlphaFactor : TSDL_BlendFactor; alphaOperation : TSDL_BlendOperation) : TSDL_BlendMode cdecl;
60+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ComposeCustomBlendMode' {$ENDIF} {$ENDIF};

sdlrenderer.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,5 +771,5 @@ function SDL_GL_UnbindTexture(texture: PSDL_Texture): SInt32 cdecl; external SDL
771771
* a contiguous block of Y and U/V planes in the proper order, but
772772
* this function is available if your pixel data is not contiguous.
773773
*}
774-
function SDL_UpdateYUVTexture(texture: PSDL_Texture; rect: PSDL_Rect; Yplane: PUInt8; Ypitch: SInt32; Uplane: PUInt8; UPitch: SInt32; Vplane: UInt8; VPitch: SInt32):SInt32;
774+
function SDL_UpdateYUVTexture(texture: PSDL_Texture; rect: PSDL_Rect; Yplane: PUInt8; Ypitch: SInt32; Uplane: PUInt8; UPitch: SInt32; Vplane: PUInt8; VPitch: SInt32):SInt32;
775775
cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UpdateYUVTexture' {$ENDIF} {$ENDIF};

sdlstdinc.inc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//from sdl_stdinc.h
2+
3+
{**
4+
* Free memory returned by functions like SDL_GetBasePath(), SDL_GetPrefPath(), etc.
5+
*}
6+
Procedure SDL_free(mem: Pointer); cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_free' {$ENDIF} {$ENDIF};

0 commit comments

Comments
 (0)