home *** CD-ROM | disk | FTP | other *** search
/ ring.yamanashi.ac.jp/pub/pc/freem/action/ / action.zip / a7xpg0_11.zip / a7xpg / import / SDL_version.d < prev    next >
Text File  |  2003-09-20  |  2KB  |  76 lines

  1. /*
  2.     SDL - Simple DirectMedia Layer
  3.     Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga
  4.  
  5.     This library is free software; you can redistribute it and/or
  6.     modify it under the terms of the GNU Library General Public
  7.     License as published by the Free Software Foundation; either
  8.     version 2 of the License, or (at your option) any later version.
  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
  13.     Library General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU Library General Public
  16.     License along with this library; if not, write to the Free
  17.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18.  
  19.     Sam Lantinga
  20.     slouken@devolution.com
  21. */
  22.  
  23. /* This header defines the current SDL version */
  24.  
  25. import SDL_types;
  26.  
  27. extern(C):
  28.  
  29. /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
  30. */
  31. const uint SDL_MAJOR_VERSION    = 1;
  32. const uint SDL_MINOR_VERSION    = 2;
  33. const uint SDL_PATCHLEVEL        = 3;
  34.  
  35. struct SDL_version {
  36.     Uint8 major;
  37.     Uint8 minor;
  38.     Uint8 patch;
  39. }
  40.  
  41. /* This macro can be used to fill a version structure with the compile-time
  42.  * version of the SDL library.
  43.  */
  44. void SDL_VERSION(SDL_version* X)
  45. {
  46.     X.major = SDL_MAJOR_VERSION;
  47.     X.minor = SDL_MINOR_VERSION;
  48.     X.patch = SDL_PATCHLEVEL;
  49. }
  50.  
  51. /* This macro turns the version numbers into a numeric value:
  52.    (1,2,3) -> (1203)
  53.    This assumes that there will never be more than 100 patchlevels
  54. */
  55. uint SDL_VERSIONNUM(Uint8 X, Uint8 Y, Uint8 Z)
  56. {
  57.     return X * 1000 + Y * 100 + Z;
  58. }
  59.  
  60. /* This is the version number macro for the current SDL version */
  61. const uint SDL_COMPILEDVERSION = SDL_MAJOR_VERSION * 1000 +
  62.                                     SDL_MINOR_VERSION * 100 +
  63.                                     SDL_PATCHLEVEL;
  64.  
  65. /* This macro will evaluate to true if compiled with SDL at least X.Y.Z */
  66. bit SDL_VERSION_ATLEAST(Uint8 X, Uint8 Y, Uint8 Z)
  67. {
  68.     return (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z));
  69. }
  70.  
  71. /* This function gets the version of the dynamically linked SDL library.
  72.    it should NOT be used to fill a version structure, instead you should
  73.    use the SDL_Version() macro.
  74.  */
  75. SDL_version * SDL_Linked_Version();
  76.