SDL_version.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. SDL - Simple DirectMedia Layer
  3. Copyright (C) 1997-2009 Sam Lantinga
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with this library; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  15. Sam Lantinga
  16. slouken@libsdl.org
  17. */
  18. /** @file SDL_version.h
  19. * This header defines the current SDL version
  20. */
  21. #ifndef _SDL_version_h
  22. #define _SDL_version_h
  23. #include "SDL_stdinc.h"
  24. #include "begin_code.h"
  25. /* Set up for C function definitions, even when using C++ */
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. /** @name Version Number
  30. * Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
  31. */
  32. /*@{*/
  33. #define SDL_MAJOR_VERSION 1
  34. #define SDL_MINOR_VERSION 2
  35. #define SDL_PATCHLEVEL 14
  36. /*@}*/
  37. typedef struct SDL_version {
  38. Uint8 major;
  39. Uint8 minor;
  40. Uint8 patch;
  41. } SDL_version;
  42. /**
  43. * This macro can be used to fill a version structure with the compile-time
  44. * version of the SDL library.
  45. */
  46. #define SDL_VERSION(X) \
  47. { \
  48. (X)->major = SDL_MAJOR_VERSION; \
  49. (X)->minor = SDL_MINOR_VERSION; \
  50. (X)->patch = SDL_PATCHLEVEL; \
  51. }
  52. /** This macro turns the version numbers into a numeric value:
  53. * (1,2,3) -> (1203)
  54. * This assumes that there will never be more than 100 patchlevels
  55. */
  56. #define SDL_VERSIONNUM(X, Y, Z) \
  57. ((X)*1000 + (Y)*100 + (Z))
  58. /** This is the version number macro for the current SDL version */
  59. #define SDL_COMPILEDVERSION \
  60. SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
  61. /** This macro will evaluate to true if compiled with SDL at least X.Y.Z */
  62. #define SDL_VERSION_ATLEAST(X, Y, Z) \
  63. (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
  64. /** This function gets the version of the dynamically linked SDL library.
  65. * it should NOT be used to fill a version structure, instead you should
  66. * use the SDL_Version() macro.
  67. */
  68. extern DECLSPEC const SDL_version * SDLCALL SDL_Linked_Version(void);
  69. /* Ends C function definitions when using C++ */
  70. #ifdef __cplusplus
  71. }
  72. #endif
  73. #include "close_code.h"
  74. #endif /* _SDL_version_h */