Add compiled version info for SDL2 libs.

This commit is contained in:
Ethan Lee 2013-04-17 18:38:10 -04:00
parent 5440f8ad22
commit f154fc784b
4 changed files with 76 additions and 0 deletions

View file

@ -368,6 +368,20 @@ namespace SDL2
#region SDL_version.h, SDL_revision.h
/* Similar to the headers, this is the version we're expecting to be
* running with. You will likely want to check this somewhere in your
* program!
*/
public const int SDL_MAJOR_VERSION = 2;
public const int SDL_MINOR_VERSION = 0;
public const int SDL_PATCHLEVEL = 0;
public static readonly int SDL_COMPILEDVERSION = SDL_VERSIONNUM(
SDL_MAJOR_VERSION,
SDL_MINOR_VERSION,
SDL_PATCHLEVEL
);
[StructLayout(LayoutKind.Sequential)]
public struct SDL_version
{
@ -376,6 +390,23 @@ namespace SDL2
public byte patch;
}
public static void SDL_VERSION(ref SDL_version x)
{
x.major = SDL_MAJOR_VERSION;
x.minor = SDL_MINOR_VERSION;
x.patch = SDL_PATCHLEVEL;
}
public static int SDL_VERSIONNUM(int X, int Y, int Z)
{
return (X * 1000) + (Y * 100) + Z;
}
public static bool SDL_VERSION_ATLEAST(int X, int Y, int Z)
{
return SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z);
}
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
private static extern void SDL_GetVersion(ref SDL_version ver);

View file

@ -44,6 +44,14 @@ namespace SDL2
#region SDL_image.h
/* Similar to the headers, this is the version we're expecting to be
* running with. You will likely want to check this somewhere in your
* program!
*/
public const int SDL_IMAGE_MAJOR_VERSION = 2;
public const int SDL_IMAGE_MINOR_VERSION = 0;
public const int SDL_IMAGE_PATCHLEVEL = 0;
[Flags]
public enum IMG_InitFlags
{
@ -53,6 +61,13 @@ namespace SDL2
IMG_INIT_WEBP = 0x00000008
}
public static void SDL_IMAGE_VERSION(ref SDL.SDL_version X)
{
X.major = SDL_IMAGE_MAJOR_VERSION;
X.minor = SDL_IMAGE_MINOR_VERSION;
X.patch = SDL_IMAGE_PATCHLEVEL;
}
[DllImport(nativeLibName, EntryPoint = "IMG_LinkedVersion", CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr INTERNAL_IMG_LinkedVersion();
public static SDL.SDL_version IMG_LinkedVersion()

View file

@ -44,6 +44,14 @@ namespace SDL2
#region SDL_mixer.h
/* Similar to the headers, this is the version we're expecting to be
* running with. You will likely want to check this somewhere in your
* program!
*/
public const int SDL_MIXER_MAJOR_VERSION = 2;
public const int SDL_MIXER_MINOR_VERSION = 0;
public const int SDL_MIXER_PATCHLEVEL = 0;
/* In C, you can redefine this value before including SDL_mixer.h.
* We're not going to allow this in SDL2#, since the value of this
* variable is persistent and not dependent on preprocessor ordering.
@ -129,6 +137,13 @@ namespace SDL2
IntPtr b // void*
);
public static void SDL_MIXER_VERSION(ref SDL.SDL_version X)
{
X.major = SDL_MIXER_MAJOR_VERSION;
X.minor = SDL_MIXER_MINOR_VERSION;
X.patch = SDL_MIXER_PATCHLEVEL;
}
[DllImport(nativeLibName, EntryPoint = "MIX_Linked_Version", CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr INTERNAL_MIX_Linked_Version();
public static SDL.SDL_version MIX_Linked_Version()

View file

@ -44,6 +44,14 @@ namespace SDL2
#region SDL_ttf.h
/* Similar to the headers, this is the version we're expecting to be
* running with. You will likely want to check this somewhere in your
* program!
*/
public const int SDL_TTF_MAJOR_VERSION = 2;
public const int SDL_TTF_MINOR_VERSION = 2;
public const int SDL_TTF_PATCHLEVEL = 12;
public const int UNICODE_BOM_NATIVE = 0xFEFF;
public const int UNICODE_BOM_SWAPPED = 0xFFFE;
@ -58,6 +66,13 @@ namespace SDL2
public const int TTF_HINTING_MONO = 2;
public const int TTF_HINTING_NONE = 3;
public static void SDL_TTF_VERSION(ref SDL.SDL_version X)
{
X.major = SDL_TTF_MAJOR_VERSION;
X.minor = SDL_TTF_MINOR_VERSION;
X.patch = SDL_TTF_PATCHLEVEL;
}
[DllImport(nativeLibName, EntryPoint = "TTF_LinkedVersion", CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr INTERNAL_TTF_LinkedVersion();
public static SDL.SDL_version TTF_LinkedVersion()