Skip to content

TSdlVersion

Information about the version of SDL in use.

Represents the library's version as three levels: major revision (increments with massive changes, additions, and enhancements), minor revision (increments with backwards-compatible changes to the major revision), and patchlevel (increments with fixes to the minor revision).

Definition

Unit: Neslib.Sdl3.Basics

type TSdlVersion = record ... end;

Properties

Name Description
CompiledVersion The SDL version the program was compiled against.
Major The current major version of SDL headers.
Minor The current minor version of the SDL headers.
Patch The current micro (or patchlevel) version of the SDL headers.
Revision Get the code revision of SDL that is linked against your program.
RuntimeVersion The version of SDL that is linked against your program.

Constructors

Name Description
Create Creates a version instance.

Methods

Name Description
AtLeast Checks whether the program was compiled against a version of SDL with at least the given version number.
FromNumber Creates a version from a numeric value.
ToNumber Turns this version numbers into a numeric value.

Property Descriptions

CompiledVersion

The SDL version the program was compiled against.

Note that if you dynamically linked the library, you might have a slightly newer or older version at runtime. That version can be determined with RuntimeVersion.

class property CompiledVersion: TSdlVersion read GetCompiledVersion

Type: TSdlVersion


Major

The current major version of SDL headers.

If this were SDL version 3.2.1, this value would be 3.

property Major: Byte read FMajor

Type: Byte


Minor

The current minor version of the SDL headers.

If this were SDL version 3.2.1, this value would be 2.

property Minor: Byte read FMinor

Type: Byte


Patch

The current micro (or patchlevel) version of the SDL headers.

If this were SDL version 3.2.1, this value would be 1.

property Patch: Byte read FPatch

Type: Byte


Revision

Get the code revision of SDL that is linked against your program.

This value is the revision of the code you are linked with and may be different from the code you are compiling with.

The revision is arbitrary string (a hash value) uniquely identifying the exact revision of the SDL library in use, and is only useful in comparing against other revisions. It is NOT an incrementing number.

If SDL wasn't built from a git repository with the appropriate tools, this will return an empty string.

You shouldn't use this property for anything but logging it for debugging purposes. The string is not intended to be reliable in any way.

class property Revision: String read GetRevision

Type: String


RuntimeVersion

The version of SDL that is linked against your program.

If you are linking to SDL dynamically, then it is possible that the current version will be different than the version you compiled (see CompiledVersion) against.

This property may be called safely at any time, even before SdlInit.

class property RuntimeVersion: TSdlVersion read GetRuntimeVersion

Type: TSdlVersion


Constructor Descriptions

Create

Creates a version instance.

constructor Create(const AMajor: Byte; const AMinor: Byte = 0; const APatch: Byte = 0)

Parameters

AMajor: Byte : The major version number.

AMinor: Byte = 0 : (optional) Minor version number.

APatch: Byte = 0 : (optional) Patch level.


Method Descriptions

AtLeast(Byte, Byte, Byte)

Checks whether the program was compiled against a version of SDL with at least the given version number.

class function AtLeast(const AMajor: Byte; const AMinor: Byte = 0; const APatch: Byte = 0): Boolean; inline; static

Parameters

AMajor: Byte : Major version to check against.

AMinor: Byte = 0 : (optional) Minor version to check against.

APatch: Byte = 0 : (optional) Patch level to check against.

Returns

Boolean: True if the program was compiled with at least SDL version AMajor.AMinor.APatch


FromNumber(Integer)

Creates a version from a numeric value.

Turns 1002003 into (1,2,3)

class function FromNumber(const ANumber: Integer): TSdlVersion; inline; static

Parameters

ANumber: Integer

Returns

TSdlVersion


ToNumber

Turns this version numbers into a numeric value.

(1,2,3) becomes 1002003.

function ToNumber: Integer; inline

Returns

Integer