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

Latest commit

 

History

History
167 lines (146 loc) · 4.94 KB

SDL_version.h

File metadata and controls

167 lines (146 loc) · 4.94 KB
 
Apr 26, 2001
Apr 26, 2001
1
2
/*
SDL - Simple DirectMedia Layer
Feb 12, 2011
Feb 12, 2011
3
Copyright (C) 1997-2011 Sam Lantinga
Apr 26, 2001
Apr 26, 2001
4
5
This library is free software; you can redistribute it and/or
Feb 1, 2006
Feb 1, 2006
6
modify it under the terms of the GNU Lesser General Public
Apr 26, 2001
Apr 26, 2001
7
License as published by the Free Software Foundation; either
Feb 1, 2006
Feb 1, 2006
8
version 2.1 of the License, or (at your option) any later version.
Apr 26, 2001
Apr 26, 2001
9
10
11
12
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Feb 1, 2006
Feb 1, 2006
13
Lesser General Public License for more details.
Apr 26, 2001
Apr 26, 2001
14
Feb 1, 2006
Feb 1, 2006
15
16
17
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Apr 26, 2001
Apr 26, 2001
18
19
Sam Lantinga
Dec 14, 2001
Dec 14, 2001
20
slouken@libsdl.org
Apr 26, 2001
Apr 26, 2001
21
22
*/
Jul 10, 2006
Jul 10, 2006
23
/**
Oct 19, 2009
Oct 19, 2009
24
25
26
* \file SDL_version.h
*
* This header defines the current SDL version.
Jul 10, 2006
Jul 10, 2006
27
*/
Apr 26, 2001
Apr 26, 2001
28
29
30
31
#ifndef _SDL_version_h
#define _SDL_version_h
Feb 10, 2006
Feb 10, 2006
32
#include "SDL_stdinc.h"
Apr 26, 2001
Apr 26, 2001
33
34
35
36
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
Jul 10, 2006
Jul 10, 2006
37
/* *INDENT-OFF* */
Apr 26, 2001
Apr 26, 2001
38
extern "C" {
Jul 10, 2006
Jul 10, 2006
39
/* *INDENT-ON* */
Apr 26, 2001
Apr 26, 2001
40
41
#endif
Jul 10, 2006
Jul 10, 2006
42
/**
Oct 19, 2009
Oct 19, 2009
43
44
45
* \brief Information the version of SDL in use.
*
* Represents the library's version as three levels: major revision
Jul 10, 2006
Jul 10, 2006
46
47
48
49
* (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).
Oct 19, 2009
Oct 19, 2009
50
51
52
*
* \sa SDL_VERSION
* \sa SDL_GetVersion
Jul 10, 2006
Jul 10, 2006
53
54
55
56
57
58
59
60
*/
typedef struct SDL_version
{
Uint8 major; /**< major version */
Uint8 minor; /**< minor version */
Uint8 patch; /**< update version */
} SDL_version;
Apr 26, 2001
Apr 26, 2001
61
62
63
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
*/
#define SDL_MAJOR_VERSION 1
Jul 10, 2006
Jul 10, 2006
64
65
66
67
#define SDL_MINOR_VERSION 3
#define SDL_PATCHLEVEL 0
/**
Oct 19, 2009
Oct 19, 2009
68
69
70
* \brief Macro to determine SDL version program was compiled against.
*
* This macro fills in a SDL_version structure with the version of the
Jul 10, 2006
Jul 10, 2006
71
72
73
* 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
Oct 19, 2009
Oct 19, 2009
74
* determined with SDL_GetVersion(), which, unlike SDL_VERSION(),
Jul 10, 2006
Jul 10, 2006
75
* is not a macro.
Oct 19, 2009
Oct 19, 2009
76
77
78
79
80
*
* \param x A pointer to a SDL_version struct to initialize.
*
* \sa SDL_version
* \sa SDL_GetVersion
Apr 26, 2001
Apr 26, 2001
81
*/
Jul 10, 2006
Jul 10, 2006
82
#define SDL_VERSION(x) \
Apr 26, 2001
Apr 26, 2001
83
{ \
Jul 10, 2006
Jul 10, 2006
84
85
86
(x)->major = SDL_MAJOR_VERSION; \
(x)->minor = SDL_MINOR_VERSION; \
(x)->patch = SDL_PATCHLEVEL; \
Apr 26, 2001
Apr 26, 2001
87
88
}
Oct 19, 2009
Oct 19, 2009
89
90
91
92
93
94
95
96
/**
* This macro turns the version numbers into a numeric value:
* \verbatim
(1,2,3) -> (1203)
\endverbatim
*
* This assumes that there will never be more than 100 patchlevels.
*/
Apr 26, 2001
Apr 26, 2001
97
#define SDL_VERSIONNUM(X, Y, Z) \
Apr 17, 2005
Apr 17, 2005
98
((X)*1000 + (Y)*100 + (Z))
Apr 26, 2001
Apr 26, 2001
99
Oct 19, 2009
Oct 19, 2009
100
101
102
/**
* This is the version number macro for the current SDL version.
*/
Apr 26, 2001
Apr 26, 2001
103
104
105
#define SDL_COMPILEDVERSION \
SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
Oct 19, 2009
Oct 19, 2009
106
107
108
/**
* This macro will evaluate to true if compiled with SDL at least X.Y.Z.
*/
Apr 26, 2001
Apr 26, 2001
109
110
111
#define SDL_VERSION_ATLEAST(X, Y, Z) \
(SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
Jul 10, 2006
Jul 10, 2006
112
/**
Oct 19, 2009
Oct 19, 2009
113
* \brief Get the version of SDL that is linked against your program.
Jul 10, 2006
Jul 10, 2006
114
*
Jul 30, 2010
Jul 30, 2010
115
116
117
118
* 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.
Oct 19, 2009
Oct 19, 2009
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
*
* \code
* SDL_version compiled;
* SDL_version linked;
*
* 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
*
* This function may be called safely at any time, even before SDL_Init().
*
* \sa SDL_VERSION
Apr 26, 2001
Apr 26, 2001
135
*/
Jul 10, 2006
Jul 10, 2006
136
extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver);
Apr 26, 2001
Apr 26, 2001
137
Jan 4, 2009
Jan 4, 2009
138
/**
Oct 19, 2009
Oct 19, 2009
139
* \brief Get the code revision of SDL that is linked against your program.
Feb 28, 2010
Feb 28, 2010
140
*
Jul 30, 2010
Jul 30, 2010
141
142
143
* 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.
Jan 4, 2009
Jan 4, 2009
144
*/
Feb 28, 2010
Feb 28, 2010
145
extern DECLSPEC const char *SDLCALL SDL_GetRevision(void);
Jan 4, 2009
Jan 4, 2009
146
Feb 20, 2011
Feb 20, 2011
147
148
149
150
151
152
153
154
155
156
/**
* \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);
Apr 26, 2001
Apr 26, 2001
157
158
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
Jul 10, 2006
Jul 10, 2006
159
/* *INDENT-OFF* */
Apr 26, 2001
Apr 26, 2001
160
}
Jul 10, 2006
Jul 10, 2006
161
/* *INDENT-ON* */
Apr 26, 2001
Apr 26, 2001
162
163
164
165
#endif
#include "close_code.h"
#endif /* _SDL_version_h */
Jul 10, 2006
Jul 10, 2006
166
167
/* vi: set ts=4 sw=4 expandtab: */