This repository has been archived by the owner on Feb 11, 2021. It is now read-only.
/
SDL_version.h
155 lines (136 loc) · 4.43 KB
1
2
/*
SDL - Simple DirectMedia Layer
3
Copyright (C) 1997-2009 Sam Lantinga
4
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Lesser General Public
7
License as published by the Free Software Foundation; either
8
version 2.1 of the License, or (at your option) any later version.
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
13
Lesser General Public License for more details.
14
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
18
19
Sam Lantinga
20
slouken@libsdl.org
21
22
*/
23
/**
24
25
26
* \file SDL_version.h
*
* This header defines the current SDL version.
27
*/
28
29
30
31
#ifndef _SDL_version_h
#define _SDL_version_h
32
#include "SDL_stdinc.h"
33
#include "SDL_revision.h"
34
35
36
37
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
38
/* *INDENT-OFF* */
39
extern "C" {
40
/* *INDENT-ON* */
41
42
#endif
43
/**
44
45
46
* \brief Information the version of SDL in use.
*
* Represents the library's version as three levels: major revision
47
48
49
50
* (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).
51
52
53
*
* \sa SDL_VERSION
* \sa SDL_GetVersion
54
55
56
57
58
59
60
61
*/
typedef struct SDL_version
{
Uint8 major; /**< major version */
Uint8 minor; /**< minor version */
Uint8 patch; /**< update version */
} SDL_version;
62
63
64
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
*/
#define SDL_MAJOR_VERSION 1
65
66
67
68
#define SDL_MINOR_VERSION 3
#define SDL_PATCHLEVEL 0
/**
69
70
71
* \brief Macro to determine SDL version program was compiled against.
*
* This macro fills in a SDL_version structure with the version of the
72
73
74
* 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
75
* determined with SDL_GetVersion(), which, unlike SDL_VERSION(),
76
* is not a macro.
77
78
79
80
81
*
* \param x A pointer to a SDL_version struct to initialize.
*
* \sa SDL_version
* \sa SDL_GetVersion
82
*/
83
#define SDL_VERSION(x) \
84
{ \
85
86
87
(x)->major = SDL_MAJOR_VERSION; \
(x)->minor = SDL_MINOR_VERSION; \
(x)->patch = SDL_PATCHLEVEL; \
88
89
}
90
91
92
93
94
95
96
97
/**
* 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.
*/
98
#define SDL_VERSIONNUM(X, Y, Z) \
99
((X)*1000 + (Y)*100 + (Z))
100
101
102
103
/**
* This is the version number macro for the current SDL version.
*/
104
105
106
#define SDL_COMPILEDVERSION \
SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
107
108
109
/**
* This macro will evaluate to true if compiled with SDL at least X.Y.Z.
*/
110
111
112
#define SDL_VERSION_ATLEAST(X, Y, Z) \
(SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
113
/**
114
115
116
* \brief Get the version of SDL that is linked against your program.
*
* If you are using a shared library (DLL) version of SDL, then it is
117
118
* possible that it will be different than the version you compiled against.
*
119
* This is a real function; the macro SDL_VERSION() tells you what version
120
* of SDL you compiled against:
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
*
* \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
137
*/
138
extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver);
139
140
/**
141
* \brief Get the code revision of SDL that is linked against your program.
142
*/
143
extern DECLSPEC int SDLCALL SDL_GetRevision(void);
144
145
146
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
147
/* *INDENT-OFF* */
148
}
149
/* *INDENT-ON* */
150
151
152
153
#endif
#include "close_code.h"
#endif /* _SDL_version_h */
154
155
/* vi: set ts=4 sw=4 expandtab: */