37 |
37 |
38 /** @name Version Number |
38 /** @name Version Number |
39 * Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL |
39 * Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL |
40 */ |
40 */ |
41 /*@{*/ |
41 /*@{*/ |
42 #define SDL_MAJOR_VERSION 1 |
42 #define SDL_MAJOR_VERSION 1 |
43 #define SDL_MINOR_VERSION 2 |
43 #define SDL_MINOR_VERSION 2 |
44 #define SDL_PATCHLEVEL 15 |
44 #define SDL_PATCHLEVEL 15 |
45 /*@}*/ |
45 /*@}*/ |
46 |
46 |
47 typedef struct SDL_version { |
47 typedef struct SDL_version { |
48 Uint8 major; |
48 Uint8 major; |
49 Uint8 minor; |
49 Uint8 minor; |
50 Uint8 patch; |
50 Uint8 patch; |
51 } SDL_version; |
51 } SDL_version; |
52 |
52 |
53 /** |
53 /** |
54 * This macro can be used to fill a version structure with the compile-time |
54 * This macro can be used to fill a version structure with the compile-time |
55 * version of the SDL library. |
55 * version of the SDL library. |
56 */ |
56 */ |
57 #define SDL_VERSION(X) \ |
57 #define SDL_VERSION(X) \ |
58 { \ |
58 { \ |
59 (X)->major = SDL_MAJOR_VERSION; \ |
59 (X)->major = SDL_MAJOR_VERSION; \ |
60 (X)->minor = SDL_MINOR_VERSION; \ |
60 (X)->minor = SDL_MINOR_VERSION; \ |
61 (X)->patch = SDL_PATCHLEVEL; \ |
61 (X)->patch = SDL_PATCHLEVEL; \ |
62 } |
62 } |
63 |
63 |
64 /** This macro turns the version numbers into a numeric value: |
64 /** This macro turns the version numbers into a numeric value: |
65 * (1,2,3) -> (1203) |
65 * (1,2,3) -> (1203) |
66 * This assumes that there will never be more than 100 patchlevels |
66 * This assumes that there will never be more than 100 patchlevels |
67 */ |
67 */ |
68 #define SDL_VERSIONNUM(X, Y, Z) \ |
68 #define SDL_VERSIONNUM(X, Y, Z) \ |
69 ((X)*1000 + (Y)*100 + (Z)) |
69 ((X)*1000 + (Y)*100 + (Z)) |
70 |
70 |
71 /** This is the version number macro for the current SDL version */ |
71 /** This is the version number macro for the current SDL version */ |
72 #define SDL_COMPILEDVERSION \ |
72 #define SDL_COMPILEDVERSION \ |
73 SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) |
73 SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) |
74 |
74 |
75 /** This macro will evaluate to true if compiled with SDL at least X.Y.Z */ |
75 /** This macro will evaluate to true if compiled with SDL at least X.Y.Z */ |
76 #define SDL_VERSION_ATLEAST(X, Y, Z) \ |
76 #define SDL_VERSION_ATLEAST(X, Y, Z) \ |
77 (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) |
77 (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) |
78 |
78 |
79 /** This function gets the version of the dynamically linked SDL library. |
79 /** This function gets the version of the dynamically linked SDL library. |
80 * it should NOT be used to fill a version structure, instead you should |
80 * it should NOT be used to fill a version structure, instead you should |
81 * use the SDL_Version() macro. |
81 * use the SDL_Version() macro. |
82 */ |
82 */ |