|
| 1 | +{ |
| 2 | + This file is part of: |
| 3 | +
|
| 4 | + SDL3 for Pascal |
| 5 | + (https://github.com/PascalGameDevelopment/SDL3-for-Pascal) |
| 6 | + SPDX-License-Identifier: Zlib |
| 7 | +} |
| 8 | + |
| 9 | +{* |
| 10 | + * # CategoryVersion |
| 11 | + * |
| 12 | + * Functionality to query the current SDL version, both as headers the app was |
| 13 | + * compiled against, and a library the app is linked to. |
| 14 | + } |
| 15 | + |
| 16 | +{* |
| 17 | + * The current major version of SDL headers. |
| 18 | + * |
| 19 | + * If this were SDL version 3.2.1, this value would be 3. |
| 20 | + * |
| 21 | + * \since This macro is available since SDL 3.1.3. |
| 22 | + } |
| 23 | +const |
| 24 | + SDL_MAJOR_VERSION = 3; |
| 25 | + |
| 26 | +{* |
| 27 | + * The current minor version of the SDL headers. |
| 28 | + * |
| 29 | + * If this were SDL version 3.2.1, this value would be 2. |
| 30 | + * |
| 31 | + * \since This macro is available since SDL 3.1.3. |
| 32 | + } |
| 33 | + SDL_MINOR_VERSION = 1; |
| 34 | + |
| 35 | +{* |
| 36 | + * The current micro (or patchlevel) version of the SDL headers. |
| 37 | + * |
| 38 | + * If this were SDL version 3.2.1, this value would be 1. |
| 39 | + * |
| 40 | + * \since This macro is available since SDL 3.1.3. |
| 41 | + } |
| 42 | + SDL_MICRO_VERSION = 6; |
| 43 | + |
| 44 | +{* |
| 45 | + * This macro turns the version numbers into a numeric value. |
| 46 | + * |
| 47 | + * (1,2,3) becomes 1002003. |
| 48 | + * |
| 49 | + * \param major the major version number. |
| 50 | + * \param minor the minorversion number. |
| 51 | + * \param patch the patch version number. |
| 52 | + * |
| 53 | + * \since This macro is available since SDL 3.1.3. |
| 54 | + } |
| 55 | +function SDL_VERSIONNUM(major,minor,patch: Integer): Integer; |
| 56 | + |
| 57 | +{* |
| 58 | + * This macro extracts the major version from a version number |
| 59 | + * |
| 60 | + * 1002003 becomes 1. |
| 61 | + * |
| 62 | + * \param version the version number. |
| 63 | + * |
| 64 | + * \since This macro is available since SDL 3.1.3. |
| 65 | + } |
| 66 | +function SDL_VERSIONNUM_MAJOR(version: Integer): Integer; |
| 67 | + |
| 68 | +{* |
| 69 | + * This macro extracts the minor version from a version number |
| 70 | + * |
| 71 | + * 1002003 becomes 2. |
| 72 | + * |
| 73 | + * \param version the version number. |
| 74 | + * |
| 75 | + * \since This macro is available since SDL 3.1.3. |
| 76 | + } |
| 77 | +function SDL_VERSIONNUM_MINOR(version: Integer): Integer; |
| 78 | + |
| 79 | +{* |
| 80 | + * This macro extracts the micro version from a version number |
| 81 | + * |
| 82 | + * 1002003 becomes 3. |
| 83 | + * |
| 84 | + * \param version the version number. |
| 85 | + * |
| 86 | + * \since This macro is available since SDL 3.1.3. |
| 87 | + } |
| 88 | +function SDL_VERSIONNUM_MICRO(version: Integer): Integer; |
| 89 | + |
| 90 | +{* |
| 91 | + * This is the version number macro for the current SDL version. |
| 92 | + * |
| 93 | + * \since This macro is available since SDL 3.1.3. |
| 94 | + * |
| 95 | + * \sa SDL_GetVersion |
| 96 | + } |
| 97 | +function SDL_VERSION: Integer; |
| 98 | + |
| 99 | +{* |
| 100 | + * This macro will evaluate to true if compiled with SDL at least X.Y.Z. |
| 101 | + * |
| 102 | + * \since This macro is available since SDL 3.1.3. |
| 103 | + } |
| 104 | +function SDL_VERSION_ATLEAST(X, Y, Z: Integer): Boolean; |
| 105 | + |
| 106 | +{* |
| 107 | + * Get the version of SDL that is linked against your program. |
| 108 | + * |
| 109 | + * If you are linking to SDL dynamically, then it is possible that the current |
| 110 | + * version will be different than the version you compiled against. This |
| 111 | + * function returns the current version, while SDL_VERSION is the version you |
| 112 | + * compiled with. |
| 113 | + * |
| 114 | + * This function may be called safely at any time, even before SDL_Init(). |
| 115 | + * |
| 116 | + * \returns the version of the linked library. |
| 117 | + * |
| 118 | + * \since This function is available since SDL 3.1.3. |
| 119 | + * |
| 120 | + * \sa SDL_GetRevision |
| 121 | + } |
| 122 | +function SDL_GetVersion: cint; cdecl; |
| 123 | + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetVersion' {$ENDIF} {$ENDIF}; |
| 124 | + |
| 125 | +{* |
| 126 | + * Get the code revision of SDL that is linked against your program. |
| 127 | + * |
| 128 | + * This value is the revision of the code you are linked with and may be |
| 129 | + * different from the code you are compiling with, which is found in the |
| 130 | + * constant SDL_REVISION. |
| 131 | + * |
| 132 | + * The revision is arbitrary string (a hash value) uniquely identifying the |
| 133 | + * exact revision of the SDL library in use, and is only useful in comparing |
| 134 | + * against other revisions. It is NOT an incrementing number. |
| 135 | + * |
| 136 | + * If SDL wasn't built from a git repository with the appropriate tools, this |
| 137 | + * will return an empty string. |
| 138 | + * |
| 139 | + * You shouldn't use this function for anything but logging it for debugging |
| 140 | + * purposes. The string is not intended to be reliable in any way. |
| 141 | + * |
| 142 | + * \returns an arbitrary string, uniquely identifying the exact revision of |
| 143 | + * the SDL library in use. |
| 144 | + * |
| 145 | + * \since This function is available since SDL 3.1.3. |
| 146 | + * |
| 147 | + * \sa SDL_GetVersion |
| 148 | + } |
| 149 | +function SDL_GetRevision: PAnsiChar; cdecl; |
| 150 | + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRevision' {$ENDIF} {$ENDIF}; |
| 151 | + |
0 commit comments