Mercurial > foo_out_sdl
comparison SDL3/SDL_version.h @ 1:20d02a178406 default tip
*: check in everything else
yay
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 05 Jan 2026 02:15:46 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:e9bb126753e7 | 1:20d02a178406 |
|---|---|
| 1 /* | |
| 2 Simple DirectMedia Layer | |
| 3 Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | |
| 4 | |
| 5 This software is provided 'as-is', without any express or implied | |
| 6 warranty. In no event will the authors be held liable for any damages | |
| 7 arising from the use of this software. | |
| 8 | |
| 9 Permission is granted to anyone to use this software for any purpose, | |
| 10 including commercial applications, and to alter it and redistribute it | |
| 11 freely, subject to the following restrictions: | |
| 12 | |
| 13 1. The origin of this software must not be misrepresented; you must not | |
| 14 claim that you wrote the original software. If you use this software | |
| 15 in a product, an acknowledgment in the product documentation would be | |
| 16 appreciated but is not required. | |
| 17 2. Altered source versions must be plainly marked as such, and must not be | |
| 18 misrepresented as being the original software. | |
| 19 3. This notice may not be removed or altered from any source distribution. | |
| 20 */ | |
| 21 | |
| 22 /** | |
| 23 * # CategoryVersion | |
| 24 * | |
| 25 * Functionality to query the current SDL version, both as headers the app was | |
| 26 * compiled against, and a library the app is linked to. | |
| 27 */ | |
| 28 | |
| 29 #ifndef SDL_version_h_ | |
| 30 #define SDL_version_h_ | |
| 31 | |
| 32 #include <SDL3/SDL_stdinc.h> | |
| 33 | |
| 34 #include <SDL3/SDL_begin_code.h> | |
| 35 /* Set up for C function definitions, even when using C++ */ | |
| 36 #ifdef __cplusplus | |
| 37 extern "C" { | |
| 38 #endif | |
| 39 | |
| 40 /** | |
| 41 * The current major version of SDL headers. | |
| 42 * | |
| 43 * If this were SDL version 3.2.1, this value would be 3. | |
| 44 * | |
| 45 * \since This macro is available since SDL 3.2.0. | |
| 46 */ | |
| 47 #define SDL_MAJOR_VERSION 3 | |
| 48 | |
| 49 /** | |
| 50 * The current minor version of the SDL headers. | |
| 51 * | |
| 52 * If this were SDL version 3.2.1, this value would be 2. | |
| 53 * | |
| 54 * \since This macro is available since SDL 3.2.0. | |
| 55 */ | |
| 56 #define SDL_MINOR_VERSION 4 | |
| 57 | |
| 58 /** | |
| 59 * The current micro (or patchlevel) version of the SDL headers. | |
| 60 * | |
| 61 * If this were SDL version 3.2.1, this value would be 1. | |
| 62 * | |
| 63 * \since This macro is available since SDL 3.2.0. | |
| 64 */ | |
| 65 #define SDL_MICRO_VERSION 0 | |
| 66 | |
| 67 /** | |
| 68 * This macro turns the version numbers into a numeric value. | |
| 69 * | |
| 70 * (1,2,3) becomes 1002003. | |
| 71 * | |
| 72 * \param major the major version number. | |
| 73 * \param minor the minorversion number. | |
| 74 * \param patch the patch version number. | |
| 75 * | |
| 76 * \since This macro is available since SDL 3.2.0. | |
| 77 */ | |
| 78 #define SDL_VERSIONNUM(major, minor, patch) \ | |
| 79 ((major) * 1000000 + (minor) * 1000 + (patch)) | |
| 80 | |
| 81 /** | |
| 82 * This macro extracts the major version from a version number | |
| 83 * | |
| 84 * 1002003 becomes 1. | |
| 85 * | |
| 86 * \param version the version number. | |
| 87 * | |
| 88 * \since This macro is available since SDL 3.2.0. | |
| 89 */ | |
| 90 #define SDL_VERSIONNUM_MAJOR(version) ((version) / 1000000) | |
| 91 | |
| 92 /** | |
| 93 * This macro extracts the minor version from a version number | |
| 94 * | |
| 95 * 1002003 becomes 2. | |
| 96 * | |
| 97 * \param version the version number. | |
| 98 * | |
| 99 * \since This macro is available since SDL 3.2.0. | |
| 100 */ | |
| 101 #define SDL_VERSIONNUM_MINOR(version) (((version) / 1000) % 1000) | |
| 102 | |
| 103 /** | |
| 104 * This macro extracts the micro version from a version number | |
| 105 * | |
| 106 * 1002003 becomes 3. | |
| 107 * | |
| 108 * \param version the version number. | |
| 109 * | |
| 110 * \since This macro is available since SDL 3.2.0. | |
| 111 */ | |
| 112 #define SDL_VERSIONNUM_MICRO(version) ((version) % 1000) | |
| 113 | |
| 114 /** | |
| 115 * This is the version number macro for the current SDL version. | |
| 116 * | |
| 117 * \since This macro is available since SDL 3.2.0. | |
| 118 * | |
| 119 * \sa SDL_GetVersion | |
| 120 */ | |
| 121 #define SDL_VERSION \ | |
| 122 SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_MICRO_VERSION) | |
| 123 | |
| 124 /** | |
| 125 * This macro will evaluate to true if compiled with SDL at least X.Y.Z. | |
| 126 * | |
| 127 * \since This macro is available since SDL 3.2.0. | |
| 128 */ | |
| 129 #define SDL_VERSION_ATLEAST(X, Y, Z) \ | |
| 130 (SDL_VERSION >= SDL_VERSIONNUM(X, Y, Z)) | |
| 131 | |
| 132 /** | |
| 133 * Get the version of SDL that is linked against your program. | |
| 134 * | |
| 135 * If you are linking to SDL dynamically, then it is possible that the current | |
| 136 * version will be different than the version you compiled against. This | |
| 137 * function returns the current version, while SDL_VERSION is the version you | |
| 138 * compiled with. | |
| 139 * | |
| 140 * This function may be called safely at any time, even before SDL_Init(). | |
| 141 * | |
| 142 * \returns the version of the linked library. | |
| 143 * | |
| 144 * \since This function is available since SDL 3.2.0. | |
| 145 * | |
| 146 * \sa SDL_GetRevision | |
| 147 */ | |
| 148 extern SDL_DECLSPEC int SDLCALL SDL_GetVersion(void); | |
| 149 | |
| 150 /** | |
| 151 * Get the code revision of the SDL library that is linked against your | |
| 152 * program. | |
| 153 * | |
| 154 * This value is the revision of the code you are linking against and may be | |
| 155 * different from the code you are compiling with, which is found in the | |
| 156 * constant SDL_REVISION if you explicitly include SDL_revision.h | |
| 157 * | |
| 158 * The revision is an arbitrary string (a hash value) uniquely identifying the | |
| 159 * exact revision of the SDL library in use, and is only useful in comparing | |
| 160 * against other revisions. It is NOT an incrementing number. | |
| 161 * | |
| 162 * If SDL wasn't built from a git repository with the appropriate tools, this | |
| 163 * will return an empty string. | |
| 164 * | |
| 165 * You shouldn't use this function for anything but logging it for debugging | |
| 166 * purposes. The string is not intended to be reliable in any way. | |
| 167 * | |
| 168 * \returns an arbitrary string, uniquely identifying the exact revision of | |
| 169 * the SDL library in use. | |
| 170 * | |
| 171 * \since This function is available since SDL 3.2.0. | |
| 172 * | |
| 173 * \sa SDL_GetVersion | |
| 174 */ | |
| 175 extern SDL_DECLSPEC const char * SDLCALL SDL_GetRevision(void); | |
| 176 | |
| 177 | |
| 178 /* Ends C function definitions when using C++ */ | |
| 179 #ifdef __cplusplus | |
| 180 } | |
| 181 #endif | |
| 182 #include <SDL3/SDL_close_code.h> | |
| 183 | |
| 184 #endif /* SDL_version_h_ */ |
