SDL Library
SDL_version.h@0:7fb6877b5d7c, 2016-09-22 (annotated)
- Committer:
- miruga27
- Date:
- Thu Sep 22 00:03:09 2016 +0000
- Revision:
- 0:7fb6877b5d7c
SDL
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
miruga27 | 0:7fb6877b5d7c | 1 | /* |
miruga27 | 0:7fb6877b5d7c | 2 | Simple DirectMedia Layer |
miruga27 | 0:7fb6877b5d7c | 3 | Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> |
miruga27 | 0:7fb6877b5d7c | 4 | |
miruga27 | 0:7fb6877b5d7c | 5 | This software is provided 'as-is', without any express or implied |
miruga27 | 0:7fb6877b5d7c | 6 | warranty. In no event will the authors be held liable for any damages |
miruga27 | 0:7fb6877b5d7c | 7 | arising from the use of this software. |
miruga27 | 0:7fb6877b5d7c | 8 | |
miruga27 | 0:7fb6877b5d7c | 9 | Permission is granted to anyone to use this software for any purpose, |
miruga27 | 0:7fb6877b5d7c | 10 | including commercial applications, and to alter it and redistribute it |
miruga27 | 0:7fb6877b5d7c | 11 | freely, subject to the following restrictions: |
miruga27 | 0:7fb6877b5d7c | 12 | |
miruga27 | 0:7fb6877b5d7c | 13 | 1. The origin of this software must not be misrepresented; you must not |
miruga27 | 0:7fb6877b5d7c | 14 | claim that you wrote the original software. If you use this software |
miruga27 | 0:7fb6877b5d7c | 15 | in a product, an acknowledgment in the product documentation would be |
miruga27 | 0:7fb6877b5d7c | 16 | appreciated but is not required. |
miruga27 | 0:7fb6877b5d7c | 17 | 2. Altered source versions must be plainly marked as such, and must not be |
miruga27 | 0:7fb6877b5d7c | 18 | misrepresented as being the original software. |
miruga27 | 0:7fb6877b5d7c | 19 | 3. This notice may not be removed or altered from any source distribution. |
miruga27 | 0:7fb6877b5d7c | 20 | */ |
miruga27 | 0:7fb6877b5d7c | 21 | |
miruga27 | 0:7fb6877b5d7c | 22 | /** |
miruga27 | 0:7fb6877b5d7c | 23 | * \file SDL_version.h |
miruga27 | 0:7fb6877b5d7c | 24 | * |
miruga27 | 0:7fb6877b5d7c | 25 | * This header defines the current SDL version. |
miruga27 | 0:7fb6877b5d7c | 26 | */ |
miruga27 | 0:7fb6877b5d7c | 27 | |
miruga27 | 0:7fb6877b5d7c | 28 | #ifndef _SDL_version_h |
miruga27 | 0:7fb6877b5d7c | 29 | #define _SDL_version_h |
miruga27 | 0:7fb6877b5d7c | 30 | |
miruga27 | 0:7fb6877b5d7c | 31 | #include "SDL_stdinc.h" |
miruga27 | 0:7fb6877b5d7c | 32 | |
miruga27 | 0:7fb6877b5d7c | 33 | #include "begin_code.h" |
miruga27 | 0:7fb6877b5d7c | 34 | /* Set up for C function definitions, even when using C++ */ |
miruga27 | 0:7fb6877b5d7c | 35 | #ifdef __cplusplus |
miruga27 | 0:7fb6877b5d7c | 36 | extern "C" { |
miruga27 | 0:7fb6877b5d7c | 37 | #endif |
miruga27 | 0:7fb6877b5d7c | 38 | |
miruga27 | 0:7fb6877b5d7c | 39 | /** |
miruga27 | 0:7fb6877b5d7c | 40 | * \brief Information the version of SDL in use. |
miruga27 | 0:7fb6877b5d7c | 41 | * |
miruga27 | 0:7fb6877b5d7c | 42 | * Represents the library's version as three levels: major revision |
miruga27 | 0:7fb6877b5d7c | 43 | * (increments with massive changes, additions, and enhancements), |
miruga27 | 0:7fb6877b5d7c | 44 | * minor revision (increments with backwards-compatible changes to the |
miruga27 | 0:7fb6877b5d7c | 45 | * major revision), and patchlevel (increments with fixes to the minor |
miruga27 | 0:7fb6877b5d7c | 46 | * revision). |
miruga27 | 0:7fb6877b5d7c | 47 | * |
miruga27 | 0:7fb6877b5d7c | 48 | * \sa SDL_VERSION |
miruga27 | 0:7fb6877b5d7c | 49 | * \sa SDL_GetVersion |
miruga27 | 0:7fb6877b5d7c | 50 | */ |
miruga27 | 0:7fb6877b5d7c | 51 | typedef struct SDL_version |
miruga27 | 0:7fb6877b5d7c | 52 | { |
miruga27 | 0:7fb6877b5d7c | 53 | Uint8 major; /**< major version */ |
miruga27 | 0:7fb6877b5d7c | 54 | Uint8 minor; /**< minor version */ |
miruga27 | 0:7fb6877b5d7c | 55 | Uint8 patch; /**< update version */ |
miruga27 | 0:7fb6877b5d7c | 56 | } SDL_version; |
miruga27 | 0:7fb6877b5d7c | 57 | |
miruga27 | 0:7fb6877b5d7c | 58 | /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL |
miruga27 | 0:7fb6877b5d7c | 59 | */ |
miruga27 | 0:7fb6877b5d7c | 60 | #define SDL_MAJOR_VERSION 2 |
miruga27 | 0:7fb6877b5d7c | 61 | #define SDL_MINOR_VERSION 0 |
miruga27 | 0:7fb6877b5d7c | 62 | #define SDL_PATCHLEVEL 2 |
miruga27 | 0:7fb6877b5d7c | 63 | |
miruga27 | 0:7fb6877b5d7c | 64 | /** |
miruga27 | 0:7fb6877b5d7c | 65 | * \brief Macro to determine SDL version program was compiled against. |
miruga27 | 0:7fb6877b5d7c | 66 | * |
miruga27 | 0:7fb6877b5d7c | 67 | * This macro fills in a SDL_version structure with the version of the |
miruga27 | 0:7fb6877b5d7c | 68 | * library you compiled against. This is determined by what header the |
miruga27 | 0:7fb6877b5d7c | 69 | * compiler uses. Note that if you dynamically linked the library, you might |
miruga27 | 0:7fb6877b5d7c | 70 | * have a slightly newer or older version at runtime. That version can be |
miruga27 | 0:7fb6877b5d7c | 71 | * determined with SDL_GetVersion(), which, unlike SDL_VERSION(), |
miruga27 | 0:7fb6877b5d7c | 72 | * is not a macro. |
miruga27 | 0:7fb6877b5d7c | 73 | * |
miruga27 | 0:7fb6877b5d7c | 74 | * \param x A pointer to a SDL_version struct to initialize. |
miruga27 | 0:7fb6877b5d7c | 75 | * |
miruga27 | 0:7fb6877b5d7c | 76 | * \sa SDL_version |
miruga27 | 0:7fb6877b5d7c | 77 | * \sa SDL_GetVersion |
miruga27 | 0:7fb6877b5d7c | 78 | */ |
miruga27 | 0:7fb6877b5d7c | 79 | #define SDL_VERSION(x) \ |
miruga27 | 0:7fb6877b5d7c | 80 | { \ |
miruga27 | 0:7fb6877b5d7c | 81 | (x)->major = SDL_MAJOR_VERSION; \ |
miruga27 | 0:7fb6877b5d7c | 82 | (x)->minor = SDL_MINOR_VERSION; \ |
miruga27 | 0:7fb6877b5d7c | 83 | (x)->patch = SDL_PATCHLEVEL; \ |
miruga27 | 0:7fb6877b5d7c | 84 | } |
miruga27 | 0:7fb6877b5d7c | 85 | |
miruga27 | 0:7fb6877b5d7c | 86 | /** |
miruga27 | 0:7fb6877b5d7c | 87 | * This macro turns the version numbers into a numeric value: |
miruga27 | 0:7fb6877b5d7c | 88 | * \verbatim |
miruga27 | 0:7fb6877b5d7c | 89 | (1,2,3) -> (1203) |
miruga27 | 0:7fb6877b5d7c | 90 | \endverbatim |
miruga27 | 0:7fb6877b5d7c | 91 | * |
miruga27 | 0:7fb6877b5d7c | 92 | * This assumes that there will never be more than 100 patchlevels. |
miruga27 | 0:7fb6877b5d7c | 93 | */ |
miruga27 | 0:7fb6877b5d7c | 94 | #define SDL_VERSIONNUM(X, Y, Z) \ |
miruga27 | 0:7fb6877b5d7c | 95 | ((X)*1000 + (Y)*100 + (Z)) |
miruga27 | 0:7fb6877b5d7c | 96 | |
miruga27 | 0:7fb6877b5d7c | 97 | /** |
miruga27 | 0:7fb6877b5d7c | 98 | * This is the version number macro for the current SDL version. |
miruga27 | 0:7fb6877b5d7c | 99 | */ |
miruga27 | 0:7fb6877b5d7c | 100 | #define SDL_COMPILEDVERSION \ |
miruga27 | 0:7fb6877b5d7c | 101 | SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) |
miruga27 | 0:7fb6877b5d7c | 102 | |
miruga27 | 0:7fb6877b5d7c | 103 | /** |
miruga27 | 0:7fb6877b5d7c | 104 | * This macro will evaluate to true if compiled with SDL at least X.Y.Z. |
miruga27 | 0:7fb6877b5d7c | 105 | */ |
miruga27 | 0:7fb6877b5d7c | 106 | #define SDL_VERSION_ATLEAST(X, Y, Z) \ |
miruga27 | 0:7fb6877b5d7c | 107 | (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) |
miruga27 | 0:7fb6877b5d7c | 108 | |
miruga27 | 0:7fb6877b5d7c | 109 | /** |
miruga27 | 0:7fb6877b5d7c | 110 | * \brief Get the version of SDL that is linked against your program. |
miruga27 | 0:7fb6877b5d7c | 111 | * |
miruga27 | 0:7fb6877b5d7c | 112 | * If you are linking to SDL dynamically, then it is possible that the |
miruga27 | 0:7fb6877b5d7c | 113 | * current version will be different than the version you compiled against. |
miruga27 | 0:7fb6877b5d7c | 114 | * This function returns the current version, while SDL_VERSION() is a |
miruga27 | 0:7fb6877b5d7c | 115 | * macro that tells you what version you compiled with. |
miruga27 | 0:7fb6877b5d7c | 116 | * |
miruga27 | 0:7fb6877b5d7c | 117 | * \code |
miruga27 | 0:7fb6877b5d7c | 118 | * SDL_version compiled; |
miruga27 | 0:7fb6877b5d7c | 119 | * SDL_version linked; |
miruga27 | 0:7fb6877b5d7c | 120 | * |
miruga27 | 0:7fb6877b5d7c | 121 | * SDL_VERSION(&compiled); |
miruga27 | 0:7fb6877b5d7c | 122 | * SDL_GetVersion(&linked); |
miruga27 | 0:7fb6877b5d7c | 123 | * printf("We compiled against SDL version %d.%d.%d ...\n", |
miruga27 | 0:7fb6877b5d7c | 124 | * compiled.major, compiled.minor, compiled.patch); |
miruga27 | 0:7fb6877b5d7c | 125 | * printf("But we linked against SDL version %d.%d.%d.\n", |
miruga27 | 0:7fb6877b5d7c | 126 | * linked.major, linked.minor, linked.patch); |
miruga27 | 0:7fb6877b5d7c | 127 | * \endcode |
miruga27 | 0:7fb6877b5d7c | 128 | * |
miruga27 | 0:7fb6877b5d7c | 129 | * This function may be called safely at any time, even before SDL_Init(). |
miruga27 | 0:7fb6877b5d7c | 130 | * |
miruga27 | 0:7fb6877b5d7c | 131 | * \sa SDL_VERSION |
miruga27 | 0:7fb6877b5d7c | 132 | */ |
miruga27 | 0:7fb6877b5d7c | 133 | extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver); |
miruga27 | 0:7fb6877b5d7c | 134 | |
miruga27 | 0:7fb6877b5d7c | 135 | /** |
miruga27 | 0:7fb6877b5d7c | 136 | * \brief Get the code revision of SDL that is linked against your program. |
miruga27 | 0:7fb6877b5d7c | 137 | * |
miruga27 | 0:7fb6877b5d7c | 138 | * Returns an arbitrary string (a hash value) uniquely identifying the |
miruga27 | 0:7fb6877b5d7c | 139 | * exact revision of the SDL library in use, and is only useful in comparing |
miruga27 | 0:7fb6877b5d7c | 140 | * against other revisions. It is NOT an incrementing number. |
miruga27 | 0:7fb6877b5d7c | 141 | */ |
miruga27 | 0:7fb6877b5d7c | 142 | extern DECLSPEC const char *SDLCALL SDL_GetRevision(void); |
miruga27 | 0:7fb6877b5d7c | 143 | |
miruga27 | 0:7fb6877b5d7c | 144 | /** |
miruga27 | 0:7fb6877b5d7c | 145 | * \brief Get the revision number of SDL that is linked against your program. |
miruga27 | 0:7fb6877b5d7c | 146 | * |
miruga27 | 0:7fb6877b5d7c | 147 | * Returns a number uniquely identifying the exact revision of the SDL |
miruga27 | 0:7fb6877b5d7c | 148 | * library in use. It is an incrementing number based on commits to |
miruga27 | 0:7fb6877b5d7c | 149 | * hg.libsdl.org. |
miruga27 | 0:7fb6877b5d7c | 150 | */ |
miruga27 | 0:7fb6877b5d7c | 151 | extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void); |
miruga27 | 0:7fb6877b5d7c | 152 | |
miruga27 | 0:7fb6877b5d7c | 153 | |
miruga27 | 0:7fb6877b5d7c | 154 | /* Ends C function definitions when using C++ */ |
miruga27 | 0:7fb6877b5d7c | 155 | #ifdef __cplusplus |
miruga27 | 0:7fb6877b5d7c | 156 | } |
miruga27 | 0:7fb6877b5d7c | 157 | #endif |
miruga27 | 0:7fb6877b5d7c | 158 | #include "close_code.h" |
miruga27 | 0:7fb6877b5d7c | 159 | |
miruga27 | 0:7fb6877b5d7c | 160 | #endif /* _SDL_version_h */ |
miruga27 | 0:7fb6877b5d7c | 161 | |
miruga27 | 0:7fb6877b5d7c | 162 | /* vi: set ts=4 sw=4 expandtab: */ |