Mercurial > sdl-ios-xcode
annotate include/SDL_version.h @ 3505:a1bf34bc2a58
Ensure that the main display is picked up first
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 01 Dec 2009 10:41:58 +0000 |
parents | d3baf5ac4e37 |
children | f7b03b6838cb |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
2859 | 3 Copyright (C) 1997-2009 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1222
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0 | 7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1222
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0 | 9 |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1222
diff
changeset
|
13 Lesser General Public License for more details. |
0 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1222
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1222
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1222
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 18 |
19 Sam Lantinga | |
251
b8688cfdc232
Updated the headers with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
241
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
22 | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
23 /** |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
24 * \file SDL_version.h |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
25 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
26 * This header defines the current SDL version. |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
27 */ |
0 | 28 |
29 #ifndef _SDL_version_h | |
30 #define _SDL_version_h | |
31 | |
1356
67114343400d
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
32 #include "SDL_stdinc.h" |
2982
b64c1d23039b
Make the current revision number available
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
33 #include "SDL_revision.h" |
0 | 34 |
35 #include "begin_code.h" | |
36 /* Set up for C function definitions, even when using C++ */ | |
37 #ifdef __cplusplus | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
38 /* *INDENT-OFF* */ |
0 | 39 extern "C" { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
40 /* *INDENT-ON* */ |
0 | 41 #endif |
42 | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
43 /** |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
44 * \brief Information the version of SDL in use. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
45 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
46 * Represents the library's version as three levels: major revision |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
47 * (increments with massive changes, additions, and enhancements), |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
48 * minor revision (increments with backwards-compatible changes to the |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
49 * major revision), and patchlevel (increments with fixes to the minor |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
50 * revision). |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
51 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
52 * \sa SDL_VERSION |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
53 * \sa SDL_GetVersion |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
54 */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
55 typedef struct SDL_version |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
56 { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
57 Uint8 major; /**< major version */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
58 Uint8 minor; /**< minor version */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
59 Uint8 patch; /**< update version */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
60 } SDL_version; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
61 |
0 | 62 /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL |
63 */ | |
64 #define SDL_MAJOR_VERSION 1 | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
65 #define SDL_MINOR_VERSION 3 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
66 #define SDL_PATCHLEVEL 0 |
0 | 67 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
68 /** |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
69 * \brief Macro to determine SDL version program was compiled against. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
70 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
71 * This macro fills in a SDL_version structure with the version of the |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
72 * library you compiled against. This is determined by what header the |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
73 * compiler uses. Note that if you dynamically linked the library, you might |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
74 * have a slightly newer or older version at runtime. That version can be |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
75 * determined with SDL_GetVersion(), which, unlike SDL_VERSION(), |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
76 * is not a macro. |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
77 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
78 * \param x A pointer to a SDL_version struct to initialize. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
79 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
80 * \sa SDL_version |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
81 * \sa SDL_GetVersion |
0 | 82 */ |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
83 #define SDL_VERSION(x) \ |
0 | 84 { \ |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
85 (x)->major = SDL_MAJOR_VERSION; \ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
86 (x)->minor = SDL_MINOR_VERSION; \ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
87 (x)->patch = SDL_PATCHLEVEL; \ |
0 | 88 } |
89 | |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
90 /** |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
91 * This macro turns the version numbers into a numeric value: |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
92 * \verbatim |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
93 (1,2,3) -> (1203) |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
94 \endverbatim |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
95 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
96 * This assumes that there will never be more than 100 patchlevels. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
97 */ |
0 | 98 #define SDL_VERSIONNUM(X, Y, Z) \ |
1046
f09d5edfc7a3
Added some parentheses for a little more macro safety. Recommended by Petri
Ryan C. Gordon <icculus@icculus.org>
parents:
1024
diff
changeset
|
99 ((X)*1000 + (Y)*100 + (Z)) |
0 | 100 |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
101 /** |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
102 * This is the version number macro for the current SDL version. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
103 */ |
0 | 104 #define SDL_COMPILEDVERSION \ |
105 SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) | |
106 | |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
107 /** |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
108 * This macro will evaluate to true if compiled with SDL at least X.Y.Z. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
109 */ |
0 | 110 #define SDL_VERSION_ATLEAST(X, Y, Z) \ |
111 (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) | |
112 | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
113 /** |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
114 * \brief Get the version of SDL that is linked against your program. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
115 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
116 * If you are using a shared library (DLL) version of SDL, then it is |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
117 * possible that it will be different than the version you compiled against. |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
118 * |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
119 * This is a real function; the macro SDL_VERSION() tells you what version |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
120 * of SDL you compiled against: |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
121 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
122 * \code |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
123 * SDL_version compiled; |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
124 * SDL_version linked; |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
125 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
126 * SDL_VERSION(&compiled); |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
127 * SDL_GetVersion(&linked); |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
128 * printf("We compiled against SDL version %d.%d.%d ...\n", |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
129 * compiled.major, compiled.minor, compiled.patch); |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
130 * printf("But we linked against SDL version %d.%d.%d.\n", |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
131 * linked.major, linked.minor, linked.patch); |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
132 * \endcode |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
133 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
134 * This function may be called safely at any time, even before SDL_Init(). |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
135 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
136 * \sa SDL_VERSION |
0 | 137 */ |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
138 extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver); |
0 | 139 |
2982
b64c1d23039b
Make the current revision number available
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
140 /** |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2996
diff
changeset
|
141 * \brief Get the code revision of SDL that is linked against your program. |
2982
b64c1d23039b
Make the current revision number available
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
142 */ |
2996 | 143 extern DECLSPEC int SDLCALL SDL_GetRevision(void); |
2982
b64c1d23039b
Make the current revision number available
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
144 |
0 | 145 /* Ends C function definitions when using C++ */ |
146 #ifdef __cplusplus | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
147 /* *INDENT-OFF* */ |
0 | 148 } |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
149 /* *INDENT-ON* */ |
0 | 150 #endif |
151 #include "close_code.h" | |
152 | |
153 #endif /* _SDL_version_h */ | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
154 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1886
diff
changeset
|
155 /* vi: set ts=4 sw=4 expandtab: */ |