Unit files for building Free Pascal / Delphi applications using the SDL2 library.
This repository is a community-maintained fork of the Pascal-SDL-2-Headers repo.
Simply add the units to your include path. You can achieve this by:
- (FPC) using the
{$UNITPATH XXX}
directive in your source code; - (FPC) using the
-FuXXX
command-line argument to the compiler; - just copying & pasting the units into the same directory as your main source code.
Use the sdl2
unit for the main SDL2 library (should be always needed). Units for the other SDL2 libraries are also provided:
If you have any contributions or bugfixes, feel free to drop a pull request or send in a patch.
Please use the GitHub issue tracker for bug reports.
- (Continously) Update files by new SDL2 functions and types which are present in more recent SDL2 versions.
- (Continously atm.) Translate integer aliases into typed enums. See PR #4 for reference.
- (Continously) Check FPC/Delphi compatibility.
The main principle is to stay as tight as possible at the names in the C headers. These guidelines aim to have better consistency in this community project and make it easier to find certain code parts in the C headers/Pascal includes. Feel free to discuss or extend these guidelines, use the issue tracker.
-
Names of C defines (constants) and function parameters shall not be modified or "pascalified" Ex:
SDL_INIT_VIDEO
does not change intoSDLInitVideo
. -
Names corresponding to reserved key words are kept and an underscore is added. Ex.:
type
in C functionSDL_HasEvent(Uint32 type)
changes intotype_
in Pascal functionSDL_HasEvent(type_: TSDL_EventType)
. -
Use C data types like
UInt8
,UInt16
,UInt32
,SInt8
,SInt16
,SInt32
,Float
and so on as often as possible if it is used in the original code. Do not replace them by Pascal equivalents. Ex.: UseUInt32
(if used in the original code) instead ofCardinal
,LongWord
orDWord
.
The version tag (see tags) refers to the version of this translation package SDL2 for Pascal, not the SDL2 library
.
- be up-to-date with version 2.0.14 of the
SDL2 library
- replaced all aliases by typed enums
- improve Delphi-compatibility (and even more important, DO NOT break it)
- first official release of the PGD community fork of the Pascal-SDL-2-Headers
- its latest version git tag is 1.72, in the sdl2.pas it goes even up to version 1.80; hence starting with v2.0 for this fork is a senseful distinction
- this ia a highly Delphi-compatible and stable fallback package
- loosely is up-to-date with version 2.0.4 of the
SDL2 library
You may license the Pascal SDL2 units either with the MPL license or with the zlib license.