SDL standard library

Dependents:   H261_encoder

Committer:
miruga27
Date:
Wed Sep 07 18:46:53 2016 +0000
Revision:
0:dda4f4550403
7/09/2016;

Who changed what in which revision?

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