SDL standard library
Embed:
(wiki syntax)
Show/hide line numbers
SDL_version.h
Go to the documentation of this file.
00001 /* 00002 Simple DirectMedia Layer 00003 Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> 00004 00005 This software is provided 'as-is', without any express or implied 00006 warranty. In no event will the authors be held liable for any damages 00007 arising from the use of this software. 00008 00009 Permission is granted to anyone to use this software for any purpose, 00010 including commercial applications, and to alter it and redistribute it 00011 freely, subject to the following restrictions: 00012 00013 1. The origin of this software must not be misrepresented; you must not 00014 claim that you wrote the original software. If you use this software 00015 in a product, an acknowledgment in the product documentation would be 00016 appreciated but is not required. 00017 2. Altered source versions must be plainly marked as such, and must not be 00018 misrepresented as being the original software. 00019 3. This notice may not be removed or altered from any source distribution. 00020 */ 00021 00022 /** 00023 * \file SDL_version.h 00024 * 00025 * This header defines the current SDL version. 00026 */ 00027 00028 #ifndef _SDL_version_h 00029 #define _SDL_version_h 00030 00031 #include "SDL_stdinc.h" 00032 00033 #include "begin_code.h" 00034 /* Set up for C function definitions, even when using C++ */ 00035 #ifdef __cplusplus 00036 extern "C" { 00037 #endif 00038 00039 /** 00040 * \brief Information the version of SDL in use. 00041 * 00042 * Represents the library's version as three levels: major revision 00043 * (increments with massive changes, additions, and enhancements), 00044 * minor revision (increments with backwards-compatible changes to the 00045 * major revision), and patchlevel (increments with fixes to the minor 00046 * revision). 00047 * 00048 * \sa SDL_VERSION 00049 * \sa SDL_GetVersion 00050 */ 00051 typedef struct SDL_version 00052 { 00053 Uint8 major; /**< major version */ 00054 Uint8 minor; /**< minor version */ 00055 Uint8 patch; /**< update version */ 00056 } SDL_version; 00057 00058 /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL 00059 */ 00060 #define SDL_MAJOR_VERSION 2 00061 #define SDL_MINOR_VERSION 0 00062 #define SDL_PATCHLEVEL 2 00063 00064 /** 00065 * \brief Macro to determine SDL version program was compiled against. 00066 * 00067 * This macro fills in a SDL_version structure with the version of the 00068 * library you compiled against. This is determined by what header the 00069 * compiler uses. Note that if you dynamically linked the library, you might 00070 * have a slightly newer or older version at runtime. That version can be 00071 * determined with SDL_GetVersion(), which, unlike SDL_VERSION(), 00072 * is not a macro. 00073 * 00074 * \param x A pointer to a SDL_version struct to initialize. 00075 * 00076 * \sa SDL_version 00077 * \sa SDL_GetVersion 00078 */ 00079 #define SDL_VERSION(x) \ 00080 { \ 00081 (x)->major = SDL_MAJOR_VERSION; \ 00082 (x)->minor = SDL_MINOR_VERSION; \ 00083 (x)->patch = SDL_PATCHLEVEL; \ 00084 } 00085 00086 /** 00087 * This macro turns the version numbers into a numeric value: 00088 * \verbatim 00089 (1,2,3) -> (1203) 00090 \endverbatim 00091 * 00092 * This assumes that there will never be more than 100 patchlevels. 00093 */ 00094 #define SDL_VERSIONNUM(X, Y, Z) \ 00095 ((X)*1000 + (Y)*100 + (Z)) 00096 00097 /** 00098 * This is the version number macro for the current SDL version. 00099 */ 00100 #define SDL_COMPILEDVERSION \ 00101 SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) 00102 00103 /** 00104 * This macro will evaluate to true if compiled with SDL at least X.Y.Z. 00105 */ 00106 #define SDL_VERSION_ATLEAST(X, Y, Z) \ 00107 (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) 00108 00109 /** 00110 * \brief Get the version of SDL that is linked against your program. 00111 * 00112 * If you are linking to SDL dynamically, then it is possible that the 00113 * current version will be different than the version you compiled against. 00114 * This function returns the current version, while SDL_VERSION() is a 00115 * macro that tells you what version you compiled with. 00116 * 00117 * \code 00118 * SDL_version compiled; 00119 * SDL_version linked; 00120 * 00121 * SDL_VERSION(&compiled); 00122 * SDL_GetVersion(&linked); 00123 * printf("We compiled against SDL version %d.%d.%d ...\n", 00124 * compiled.major, compiled.minor, compiled.patch); 00125 * printf("But we linked against SDL version %d.%d.%d.\n", 00126 * linked.major, linked.minor, linked.patch); 00127 * \endcode 00128 * 00129 * This function may be called safely at any time, even before SDL_Init(). 00130 * 00131 * \sa SDL_VERSION 00132 */ 00133 extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver); 00134 00135 /** 00136 * \brief Get the code revision of SDL that is linked against your program. 00137 * 00138 * Returns an arbitrary string (a hash value) uniquely identifying the 00139 * exact revision of the SDL library in use, and is only useful in comparing 00140 * against other revisions. It is NOT an incrementing number. 00141 */ 00142 extern DECLSPEC const char *SDLCALL SDL_GetRevision(void); 00143 00144 /** 00145 * \brief Get the revision number of SDL that is linked against your program. 00146 * 00147 * Returns a number uniquely identifying the exact revision of the SDL 00148 * library in use. It is an incrementing number based on commits to 00149 * hg.libsdl.org. 00150 */ 00151 extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void); 00152 00153 00154 /* Ends C function definitions when using C++ */ 00155 #ifdef __cplusplus 00156 } 00157 #endif 00158 #include "close_code.h" 00159 00160 #endif /* _SDL_version_h */ 00161 00162 /* vi: set ts=4 sw=4 expandtab: */
Generated on Tue Jul 12 2022 13:56:25 by 1.7.2