Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
162 lines (142 loc) · 5.04 KB

SDL_version.h

File metadata and controls

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