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

Latest commit

 

History

History
166 lines (146 loc) · 5.01 KB

SDL_version.h

File metadata and controls

166 lines (146 loc) · 5.01 KB
 
Apr 26, 2001
Apr 26, 2001
1
/*
Apr 8, 2011
Apr 8, 2011
2
3
Simple DirectMedia Layer
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
Apr 26, 2001
Apr 26, 2001
4
Apr 8, 2011
Apr 8, 2011
5
6
7
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.
Apr 26, 2001
Apr 26, 2001
8
Apr 8, 2011
Apr 8, 2011
9
10
11
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:
Apr 26, 2001
Apr 26, 2001
12
Apr 8, 2011
Apr 8, 2011
13
14
15
16
17
18
19
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.
Apr 26, 2001
Apr 26, 2001
20
21
*/
Jul 10, 2006
Jul 10, 2006
22
/**
Oct 19, 2009
Oct 19, 2009
23
24
25
* \file SDL_version.h
*
* This header defines the current SDL version.
Jul 10, 2006
Jul 10, 2006
26
*/
Apr 26, 2001
Apr 26, 2001
27
28
29
30
#ifndef _SDL_version_h
#define _SDL_version_h
Feb 10, 2006
Feb 10, 2006
31
#include "SDL_stdinc.h"
Apr 26, 2001
Apr 26, 2001
32
33
34
35
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
Jul 10, 2006
Jul 10, 2006
36
/* *INDENT-OFF* */
Apr 26, 2001
Apr 26, 2001
37
extern "C" {
Jul 10, 2006
Jul 10, 2006
38
/* *INDENT-ON* */
Apr 26, 2001
Apr 26, 2001
39
40
#endif
Jul 10, 2006
Jul 10, 2006
41
/**
Oct 19, 2009
Oct 19, 2009
42
43
44
* \brief Information the version of SDL in use.
*
* Represents the library's version as three levels: major revision
Jul 10, 2006
Jul 10, 2006
45
46
47
48
* (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
49
50
51
*
* \sa SDL_VERSION
* \sa SDL_GetVersion
Jul 10, 2006
Jul 10, 2006
52
53
54
55
56
57
58
59
*/
typedef struct SDL_version
{
Uint8 major; /**< major version */
Uint8 minor; /**< minor version */
Uint8 patch; /**< update version */
} SDL_version;
Apr 26, 2001
Apr 26, 2001
60
61
62
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
*/
#define SDL_MAJOR_VERSION 1
Jul 10, 2006
Jul 10, 2006
63
64
65
66
#define SDL_MINOR_VERSION 3
#define SDL_PATCHLEVEL 0
/**
Oct 19, 2009
Oct 19, 2009
67
68
69
* \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
70
71
72
* 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
73
* determined with SDL_GetVersion(), which, unlike SDL_VERSION(),
Jul 10, 2006
Jul 10, 2006
74
* is not a macro.
Oct 19, 2009
Oct 19, 2009
75
76
77
78
79
*
* \param x A pointer to a SDL_version struct to initialize.
*
* \sa SDL_version
* \sa SDL_GetVersion
Apr 26, 2001
Apr 26, 2001
80
*/
Jul 10, 2006
Jul 10, 2006
81
#define SDL_VERSION(x) \
Apr 26, 2001
Apr 26, 2001
82
{ \
Jul 10, 2006
Jul 10, 2006
83
84
85
(x)->major = SDL_MAJOR_VERSION; \
(x)->minor = SDL_MINOR_VERSION; \
(x)->patch = SDL_PATCHLEVEL; \
Apr 26, 2001
Apr 26, 2001
86
87
}
Oct 19, 2009
Oct 19, 2009
88
89
90
91
92
93
94
95
/**
* 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
96
#define SDL_VERSIONNUM(X, Y, Z) \
Apr 17, 2005
Apr 17, 2005
97
((X)*1000 + (Y)*100 + (Z))
Apr 26, 2001
Apr 26, 2001
98
Oct 19, 2009
Oct 19, 2009
99
100
101
/**
* This is the version number macro for the current SDL version.
*/
Apr 26, 2001
Apr 26, 2001
102
103
104
#define SDL_COMPILEDVERSION \
SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
Oct 19, 2009
Oct 19, 2009
105
106
107
/**
* This macro will evaluate to true if compiled with SDL at least X.Y.Z.
*/
Apr 26, 2001
Apr 26, 2001
108
109
110
#define SDL_VERSION_ATLEAST(X, Y, Z) \
(SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
Jul 10, 2006
Jul 10, 2006
111
/**
Oct 19, 2009
Oct 19, 2009
112
* \brief Get the version of SDL that is linked against your program.
Jul 10, 2006
Jul 10, 2006
113
*
Jul 30, 2010
Jul 30, 2010
114
115
116
117
* 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
*
* \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
134
*/
Jul 10, 2006
Jul 10, 2006
135
extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver);
Apr 26, 2001
Apr 26, 2001
136
Jan 4, 2009
Jan 4, 2009
137
/**
Oct 19, 2009
Oct 19, 2009
138
* \brief Get the code revision of SDL that is linked against your program.
Feb 28, 2010
Feb 28, 2010
139
*
Jul 30, 2010
Jul 30, 2010
140
141
142
* 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
143
*/
Feb 28, 2010
Feb 28, 2010
144
extern DECLSPEC const char *SDLCALL SDL_GetRevision(void);
Jan 4, 2009
Jan 4, 2009
145
Feb 20, 2011
Feb 20, 2011
146
147
148
149
150
151
152
153
154
155
/**
* \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
156
157
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
Jul 10, 2006
Jul 10, 2006
158
/* *INDENT-OFF* */
Apr 26, 2001
Apr 26, 2001
159
}
Jul 10, 2006
Jul 10, 2006
160
/* *INDENT-ON* */
Apr 26, 2001
Apr 26, 2001
161
162
163
164
#endif
#include "close_code.h"
#endif /* _SDL_version_h */
Jul 10, 2006
Jul 10, 2006
165
166
/* vi: set ts=4 sw=4 expandtab: */