Skip to content

Commit 66b3046

Browse files
committed
Merge branch 'master' of https://github.com/piXelicidio/Pascal-SDL-2-Headers into updates2
# Conflicts: # sdl.inc
2 parents f0a505b + 31c6fb2 commit 66b3046

File tree

8 files changed

+227
-116
lines changed

8 files changed

+227
-116
lines changed
File renamed without changes.

README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1-
Pascal-SDL-2-Headers
2-
====================
1+
# Pascal-SDL-2-Headers
32

4-
This are the Pascal SDL 2 Headers.
3+
These are the Pascal SDL 2 Headers.
4+
5+
## Installation
6+
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
12+
13+
## Bugs / Contributions
14+
15+
If you have any contributions, feel free to drop a pull request or send in a patch.
16+
17+
Same goes for bugs, please use the github issue tracker.
18+
19+
## License
20+
21+
You may license the Pascal SDL 2 Headers either with the MPL license or with the zlib license, both included.

sdl.inc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@ const
66
{$EXTERNALSYM SDL_INIT_TIMER}
77
SDL_INIT_AUDIO = $00000010;
88
{$EXTERNALSYM SDL_INIT_AUDIO}
9-
SDL_INIT_VIDEO = $00000020;
9+
SDL_INIT_VIDEO = $00000020; // SDL_INIT_VIDEO implies SDL_INIT_EVENTS
1010
{$EXTERNALSYM SDL_INIT_VIDEO}
11-
SDL_INIT_JOYSTICK = $00000200;
11+
SDL_INIT_JOYSTICK = $00000200; // SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS
1212
{$EXTERNALSYM SDL_INIT_JOYSTICK}
1313
SDL_INIT_HAPTIC = $00001000;
1414
{$EXTERNALSYM SDL_INIT_HAPTIC}
1515
SDL_INIT_GAMECONTROLLER = $00002000; //turn on game controller also implicitly does JOYSTICK
16-
{$EXTERNALSYM SDL_INIT_GAMECONTROLLER}
16+
{$EXTERNALSYM SDL_INIT_GAMECONTROLLER}// SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK
1717
SDL_INIT_EVENTS = $00004000;
1818
{$EXTERNALSYM SDL_INIT_EVENTS}
1919
SDL_INIT_NOPARACHUTE = $00100000; //Don't catch fatal signals
20-
{$EXTERNALSYM SDL_INIT_NOPARACHUTE}
20+
{$EXTERNALSYM SDL_INIT_NOPARACHUTE} // compatibility; this flag is ignored.
2121
SDL_INIT_EVERYTHING = SDL_INIT_TIMER or
22-
SDL_INIT_AUDIO or
23-
SDL_INIT_VIDEO or
24-
SDL_INIT_JOYSTICK or
25-
SDL_INIT_HAPTIC or
26-
SDL_INIT_GAMECONTROLLER OR
27-
SDL_INIT_EVENTS;
22+
SDL_INIT_AUDIO or
23+
SDL_INIT_VIDEO or
24+
SDL_INIT_EVENTS or
25+
SDL_INIT_JOYSTICK or
26+
SDL_INIT_HAPTIC or
27+
SDL_INIT_GAMECONTROLLER;
2828
{$EXTERNALSYM SDL_INIT_EVERYTHING}
2929

3030
{**

sdl2.pas

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,11 @@ interface
141141
{$IF DEFINED(UNIX) AND NOT DEFINED(ANDROID)}
142142
uses
143143
{$IFDEF DARWIN}
144-
CocoaAll,
145-
{$ENDIF}
144+
CocoaAll;
145+
{$ELSE}
146146
X,
147147
XLib;
148+
{$ENDIF}
148149
{$ENDIF}
149150

150151
const
@@ -212,7 +213,7 @@ interface
212213
implementation
213214

214215
//from "sdl_version.h"
215-
procedure SDL_VERSION(Out x: TSDL_Version);
216+
procedure SDL_VERSION(out x: TSDL_Version);
216217
begin
217218
x.major := SDL_MAJOR_VERSION;
218219
x.minor := SDL_MINOR_VERSION;
@@ -384,26 +385,45 @@ function SDL_LoadBMP(_file: PAnsiChar): PSDL_Surface;
384385
Result := SDL_LoadBMP_RW(SDL_RWFromFile(_file, 'rb'), 1);
385386
end;
386387

387-
function SDL_SaveBMP(Const surface:PSDL_Surface; Const filename:AnsiString):sInt32;
388+
function SDL_SaveBMP(const surface: PSDL_Surface; const filename: AnsiString
389+
): sInt32;
388390
begin
389391
Result := SDL_SaveBMP_RW(surface, SDL_RWFromFile(PAnsiChar(filename), 'wb'), 1)
390392
end;
391393

392394
{**
393395
* Evaluates to true if the surface needs to be locked before access.
394396
*}
395-
function SDL_MUSTLOCK(Const S:PSDL_Surface):Boolean;
397+
function SDL_MUSTLOCK(const S: PSDL_Surface): Boolean;
396398
begin
397399
Result := ((S^.flags and SDL_RLEACCEL) <> 0)
398400
end;
399401

402+
//from "sdl_sysvideo.h"
403+
404+
function FULLSCREEN_VISIBLE(W: PSDL_Window): Variant;
405+
begin
406+
Result := ((W^.flags and SDL_WINDOW_FULLSCREEN) and (W^.flags and SDL_WINDOW_SHOWN) and not (W^.flags and SDL_WINDOW_MINIMIZED));
407+
end;
408+
400409
//from "sdl_video.h"
401-
function SDL_WindowPos_IsUndefined(X: Variant): Variant;
410+
411+
function SDL_WINDOWPOS_UNDEFINED_DISPLAY(X: Variant): Variant;
412+
begin
413+
Result := (SDL_WINDOWPOS_UNDEFINED_MASK or X);
414+
end;
415+
416+
function SDL_WINDOWPOS_ISUNDEFINED(X: Variant): Variant;
402417
begin
403418
Result := (X and $FFFF0000) = SDL_WINDOWPOS_UNDEFINED_MASK;
404419
end;
405420

406-
function SDL_WindowPos_IsCentered(X: Variant): Variant;
421+
function SDL_WINDOWPOS_CENTERED_DISPLAY(X: Variant): Variant;
422+
begin
423+
Result := (SDL_WINDOWPOS_CENTERED_MASK or X);
424+
end;
425+
426+
function SDL_WINDOWPOS_ISCENTERED(X: Variant): Variant;
407427
begin
408428
Result := (X and $FFFF0000) = SDL_WINDOWPOS_CENTERED_MASK;
409429
end;
@@ -416,7 +436,7 @@ function SDL_GetEventState(type_: UInt32): UInt8;
416436
end;
417437

418438
// from "sdl_timer.h"
419-
function SDL_TICKS_PASSED(Const A, B:UInt32):Boolean;
439+
function SDL_TICKS_PASSED(const A, B: UInt32): Boolean;
420440
begin
421441
Result := ((Int64(B) - Int64(A)) <= 0)
422442
end;
@@ -425,7 +445,8 @@ function SDL_TICKS_PASSED(Const A, B:UInt32):Boolean;
425445
{**
426446
* Load a set of mappings from a file, filtered by the current SDL_GetPlatform()
427447
*}
428-
function SDL_GameControllerAddMappingsFromFile(Const FilePath:PAnsiChar):SInt32;
448+
function SDL_GameControllerAddMappingsFromFile(const FilePath: PAnsiChar
449+
): SInt32;
429450
begin
430451
Result := SDL_GameControllerAddMappingsFromRW(SDL_RWFromFile(FilePath, 'rb'), 1)
431452
end;

sdl2_ttf.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ function TTF_RenderGlyph_Shaded(font: PTTF_Font; ch: UInt16; fg, bg: TSDL_Color)
227227
*}
228228
function TTF_RenderText_Blended(font: PTTF_Font; text: PAnsiChar; fg: TSDL_Color): PSDL_Surface cdecl; external TTF_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_TTF_RenderText_Blended' {$ENDIF} {$ENDIF};
229229
function TTF_RenderUTF8_Blended(font: PTTF_Font; text: PAnsiChar; fg: TSDL_Color): PSDL_Surface cdecl; external TTF_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_TTF_RenderUTF8_Blended' {$ENDIF} {$ENDIF};
230-
function TTF_RenderUNICODE_Blended(font: PTTF_Font; text: UInt16; fg: TSDL_Color): PSDL_Surface cdecl; external TTF_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_TTF_RenderUNICODE_Blended' {$ENDIF} {$ENDIF};
230+
function TTF_RenderUNICODE_Blended(font: PTTF_Font; text: PUInt16; fg: TSDL_Color): PSDL_Surface cdecl; external TTF_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_TTF_RenderUNICODE_Blended' {$ENDIF} {$ENDIF};
231231

232232
{* Create a 32-bit ARGB surface and render the given text at high quality,
233233
using alpha blending to dither the font with the given color.

sdlsyswm.inc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
{$ENDIF}
66

77
{$IF DEFINED (LINUX) OR DEFINED(UNIX) AND NOT DEFINED(ANDROID)}
8-
{$DEFINE SDL_VIDEO_DRIVER_X11}
8+
{$IFNDEF DARWIN}
9+
{$DEFINE SDL_VIDEO_DRIVER_X11}
10+
{$ENDIF}
911
{$IFEND}
1012

1113
{$IFDEF DARWIN}

0 commit comments

Comments
 (0)