Adding some missing version functions

svn path=/trunk/tao/; revision=60906
This commit is contained in:
David Hudson 2006-05-21 04:54:24 +00:00
Родитель 88c43c270a
Коммит a52c4da8ca
6 изменённых файлов: 315 добавлений и 18 удалений

Просмотреть файл

@ -4944,12 +4944,12 @@ namespace Tao.Sdl
public IntPtr vfmt;
/// <summary>
/// Value: The current video mode width
/// The current video mode width
/// </summary>
public int current_w;
/// <summary>
/// Value: The current video mode height
/// The current video mode height
/// </summary>
public int current_h;

Просмотреть файл

@ -128,6 +128,21 @@ namespace Tao.Sdl
CallingConvention.Cdecl;
#endregion CallingConvention CALLING_CONVENTION
#endregion Private Constants
#region Public Constants
/// <summary>
/// Major Version
/// </summary>
public const int SDL_IMAGE_MAJOR_VERSION = 1;
/// <summary>
/// Minor Version
/// </summary>
public const int SDL_IMAGE_MINOR_VERSION = 2;
/// <summary>
/// Patch Version
/// </summary>
public const int SDL_IMAGE_PATCHLEVEL = 5;
#endregion Public Constants
#region Constructors & Destructors
#region SdlImage()
@ -141,6 +156,65 @@ namespace Tao.Sdl
#endregion Constructors & Destructors
#region SdlImage Methods
#region SDL_version SDL_IMAGE_VERSION()
/// <summary>
/// This method can be used to fill a version structure with the compile-time
/// version of the SDL_image library.
/// </summary>
/// <returns>
/// This function returns a <see cref="Sdl.SDL_version"/> struct containing the
/// compiled version number
/// </returns>
/// <remarks>
/// <p>
/// Binds to C-function call in SDL_image.h:
/// <code>#define SDL_IMAGE_VERSION(X)
/// {
/// (X)->major = SDL_IMAGE_MAJOR_VERSION;
/// (X)->minor = SDL_IMAGE_MINOR_VERSION;
/// (X)->patch = SDL_IMAGE_PATCHLEVEL;
/// }</code>
/// </p>
/// </remarks>
public static Sdl.SDL_version SDL_IMAGE_VERSION()
{
Sdl.SDL_version sdlVersion = new Sdl.SDL_version();
sdlVersion.major = SDL_IMAGE_MAJOR_VERSION;
sdlVersion.minor = SDL_IMAGE_MINOR_VERSION;
sdlVersion.patch = SDL_IMAGE_PATCHLEVEL;
return sdlVersion;
}
#endregion SDL_version SDL_IMAGE_VERSION()
#region IntPtr IMG_Linked_VersionInternal()
// const SDL_version * IMG_Linked_Version(void)
[DllImport(SDL_IMAGE_NATIVE_LIBRARY, CallingConvention=CALLING_CONVENTION, EntryPoint="IMG_Linked_Version"), SuppressUnmanagedCodeSecurity]
private static extern IntPtr IMG_Linked_VersionInternal();
#endregion IntPtr IMG_Linked_VersionInternal()
#region SDL_version IMG_Linked_Version()
/// <summary>
/// Using this you can compare the runtime version to the
/// version that you compiled with.
/// </summary>
/// <returns>
/// This function gets the version of the dynamically
/// linked SDL_image library in an <see cref="Sdl.SDL_version"/> struct.
/// </returns>
/// <remarks>
/// <p>
/// Binds to C-function call in SDL_image.h:
/// <code>const SDL_version * IMG_Linked_Version(void)</code>
/// </p>
/// </remarks>
public static Sdl.SDL_version IMG_Linked_Version()
{
return (Sdl.SDL_version)Marshal.PtrToStructure(
IMG_Linked_VersionInternal(),
typeof(Sdl.SDL_version));
}
#endregion SDL_version IMG_Linked_Version()
#region IntPtr IMG_LoadTyped_RW(IntPtr src, int freesrc, string type)
/// <summary>
/// Load an image from an SDL data source.
@ -445,7 +519,7 @@ namespace Tao.Sdl
/// // Test sample.xv to see if it is a XV
/// SDL_RWops *rwop;
/// rwop=SDL_RWFromFile("sample.xv", "rb");
/// if(IMG_isXPM(rwop))
/// if(IMG_isXV(rwop))
/// printf("sample.xpm is a XV file.\n");
/// else
/// printf("sample.xpm is not a XV file, or XV support is not available.\n");

Просмотреть файл

@ -125,6 +125,18 @@ namespace Tao.Sdl
#region Public Constants
/// <summary>
/// Major Version
/// </summary>
public const int MIX_MAJOR_VERSION = 1;
/// <summary>
/// Minor Version
/// </summary>
public const int MIX_MINOR_VERSION = 2;
/// <summary>
/// Patch Version
/// </summary>
public const int MIX_PATCHLEVEL = 7;
/// <summary>
/// The default mixer has this many simultaneous mixing
/// channels after the first call to Mix_OpenAudio.
/// </summary>
@ -154,7 +166,6 @@ namespace Tao.Sdl
}
}
/// <summary>
/// Stereo sound is a good default.
/// </summary>
@ -269,7 +280,7 @@ namespace Tao.Sdl
/// and the volume to use when mixing the sample.
/// <p>Struct in SDL_mixer.h
/// <code>
/// typedef struct {
/// typedef struct Mix_Chunk {
/// int allocated;
/// Uint8 *abuf;
/// Uint32 alen;
@ -417,6 +428,36 @@ namespace Tao.Sdl
#endregion Public Delegates
#region SdlMixer Methods
#region SDL_version MIX_VERSION()
/// <summary>
/// This method can be used to fill a version structure with the compile-time
/// version of the SDL_mixer library.
/// </summary>
/// <returns>
/// This function returns a <see cref="Sdl.SDL_version"/> struct containing the
/// compiled version number
/// </returns>
/// <remarks>
/// <p>
/// Binds to C-function call in SDL_mixer.h:
/// <code>#define SDL_MIX_VERSION(X)
/// {
/// (X)->major = SDL_MIX_MAJOR_VERSION;
/// (X)->minor = SDL_MIX_MINOR_VERSION;
/// (X)->patch = SDL_MIX_PATCHLEVEL;
/// }</code>
/// </p>
/// </remarks>
public static Sdl.SDL_version MIX_VERSION()
{
Sdl.SDL_version sdlVersion = new Sdl.SDL_version();
sdlVersion.major = MIX_MAJOR_VERSION;
sdlVersion.minor = MIX_MINOR_VERSION;
sdlVersion.patch = MIX_PATCHLEVEL;
return sdlVersion;
}
#endregion SDL_version MIX_VERSION()
#region IntPtr Mix_Linked_VersionInternal()
// const SDL_version * Mix_Linked_Version(void)
[DllImport(SDL_MIXER_NATIVE_LIBRARY, CallingConvention=CALLING_CONVENTION, EntryPoint="Mix_Linked_Version"), SuppressUnmanagedCodeSecurity]
@ -943,7 +984,7 @@ namespace Tao.Sdl
public static extern void Mix_FreeChunk(IntPtr chunk);
#endregion void Mix_FreeChunk(IntPtr chunk)
#region Mix_FreeMusic(IntPtr music)
#region void Mix_FreeMusic(IntPtr music)
/// <summary>
/// Free a Mix_Music
/// </summary>
@ -970,7 +1011,7 @@ namespace Tao.Sdl
CallingConvention=CALLING_CONVENTION),
SuppressUnmanagedCodeSecurity]
public static extern void Mix_FreeMusic(IntPtr music);
#endregion Mix_FreeMusic(IntPtr music)
#endregion void Mix_FreeMusic(IntPtr music)
#region Mix_MusicType Mix_GetMusicType(IntPtr music)
/// <summary>
@ -3283,8 +3324,8 @@ namespace Tao.Sdl
/// <remarks>
/// This is the same as SDL_GetError, which returns the last error set
/// as a string which you may use to tell the user what happened when
/// an error status has been returned from an SDL_ttf function call.
/// <p>Binds to C-function in SDL_ttf.h
/// an error status has been returned from an SDL_mixer function call.
/// <p>Binds to C-function in SDL_mixer.h
/// <code>
/// char *Mix_GetError()
/// </code>

Просмотреть файл

@ -67,27 +67,39 @@ namespace Tao.Sdl
#region Public Constants
/// <summary>
/// Major Version
/// </summary>
public const int SDL_NET_MAJOR_VERSION = 1;
/// <summary>
/// Minor Version
/// </summary>
public const int SDL_NET_MINOR_VERSION = 2;
/// <summary>
/// Patch Version
/// </summary>
public const int SDL_NET_PATCHLEVEL = 6;
/// <summary>
/// Used for listening on all network interfaces.
/// </summary>
public const Byte INADDR_ANY = unchecked((Byte)0x00000000);
public const byte INADDR_ANY = unchecked((byte)0x00000000);
/// <summary>
/// Which has limited applications.
/// </summary>
public const Byte INADDR_NONE = unchecked((Byte)0xFFFFFFFF);
public const byte INADDR_NONE = unchecked((byte)0xFFFFFFFF);
/// <summary>
/// Used as destination when sending a message to all clients on
/// a subnet that allows broadcasts.
/// </summary>
public const Byte INADDR_BROADCAST = unchecked((Byte)0xFFFFFFFF);
public const byte INADDR_BROADCAST = unchecked((byte)0xFFFFFFFF);
/// <summary>
/// The maximum number of channels on a UDP socket.
/// </summary>
public const Byte SDLNET_MAX_UDPCHANNELS = 32;
public const byte SDLNET_MAX_UDPCHANNELS = 32;
/// <summary>
/// The maximum number of addresses bound to a single UDP socket
/// channel.
/// </summary>
public const Byte SDLNET_MAX_UDPADDRESSES = 4;
public const byte SDLNET_MAX_UDPADDRESSES = 4;
#endregion Public Constants
#region Public Structs
@ -293,6 +305,36 @@ namespace Tao.Sdl
#region SdlNet Methods
#region General
#region SDL_version SDL_NET_VERSION()
/// <summary>
/// This method can be used to fill a version structure with the compile-time
/// version of the SDL_net library.
/// </summary>
/// <returns>
/// This function returns a <see cref="Sdl.SDL_version"/> struct containing the
/// compiled version number
/// </returns>
/// <remarks>
/// <p>
/// Binds to C-function call in SDL_net.h:
/// <code>#define SDL_NET_VERSION(X)
/// {
/// (X)->major = SDL_NET_MAJOR_VERSION;
/// (X)->minor = SDL_NET_MINOR_VERSION;
/// (X)->patch = SDL_NET_PATCHLEVEL;
/// }</code>
/// </p>
/// </remarks>
public static Sdl.SDL_version SDL_NET_VERSION()
{
Sdl.SDL_version sdlVersion = new Sdl.SDL_version();
sdlVersion.major = SDL_NET_MAJOR_VERSION;
sdlVersion.minor = SDL_NET_MINOR_VERSION;
sdlVersion.patch = SDL_NET_PATCHLEVEL;
return sdlVersion;
}
#endregion SDL_version SDL_NET_VERSION()
#region IntPtr SDLNet_Linked_VersionInternal()
// const SDL_version * SDLNet_Linked_Version(void)
[DllImport(SDL_NET_NATIVE_LIBRARY, CallingConvention=CALLING_CONVENTION, EntryPoint="SDLNet_Linked_Version"), SuppressUnmanagedCodeSecurity]
@ -2191,5 +2233,98 @@ namespace Tao.Sdl
#endregion void SDLNet_FreeSocketSet(SDLNet_SocketSet set)
#endregion Socket Sets
#endregion SdlNet Methods
// Not Yet implemented
// /* Inline macro functions to read/write network data */
//
// /* Warning, some systems have data access alignment restrictions */
//#if defined(sparc) || defined(mips)
//#define SDL_DATA_ALIGNED 1
//#endif
//#ifndef SDL_DATA_ALIGNED
//#define SDL_DATA_ALIGNED 0
//#endif
//
// /* Write a 16 bit value to network packet buffer */
//#if !SDL_DATA_ALIGNED
//#define SDLNet_Write16(value, areap) \
// (*(Uint16 *)(areap) = SDL_SwapBE16(value))
//#else
//#if SDL_BYTEORDER == SDL_BIG_ENDIAN
//#define SDLNet_Write16(value, areap) \
//do \
//{ \
// Uint8 *area = (Uint8 *)(areap); \
// area[0] = (value >> 8) & 0xFF; \
// area[1] = value & 0xFF; \
//} while ( 0 )
//#else
//#define SDLNet_Write16(value, areap) \
//do \
//{ \
// Uint8 *area = (Uint8 *)(areap); \
// area[1] = (value >> 8) & 0xFF; \
// area[0] = value & 0xFF; \
//} while ( 0 )
//#endif
//#endif /* !SDL_DATA_ALIGNED */
//
// /* Write a 32 bit value to network packet buffer */
//#if !SDL_DATA_ALIGNED
//#define SDLNet_Write32(value, areap) \
// *(Uint32 *)(areap) = SDL_SwapBE32(value);
//#else
//#if SDL_BYTEORDER == SDL_BIG_ENDIAN
//#define SDLNet_Write32(value, areap) \
//do \
//{ \
// Uint8 *area = (Uint8 *)(areap); \
// area[0] = (value >> 24) & 0xFF; \
// area[1] = (value >> 16) & 0xFF; \
// area[2] = (value >> 8) & 0xFF; \
// area[3] = value & 0xFF; \
//} while ( 0 )
//#else
//#define SDLNet_Write32(value, areap) \
//do \
//{ \
// Uint8 *area = (Uint8 *)(areap); \
// area[3] = (value >> 24) & 0xFF; \
// area[2] = (value >> 16) & 0xFF; \
// area[1] = (value >> 8) & 0xFF; \
// area[0] = value & 0xFF; \
//} while ( 0 )
//#endif
//#endif /* !SDL_DATA_ALIGNED */
//
// /* Read a 16 bit value from network packet buffer */
//#if !SDL_DATA_ALIGNED
//#define SDLNet_Read16(areap) \
// (SDL_SwapBE16(*(Uint16 *)(areap)))
//#else
//#if SDL_BYTEORDER == SDL_BIG_ENDIAN
//#define SDLNet_Read16(areap) \
// ((((Uint8 *)areap)[0] << 8) | ((Uint8 *)areap)[1] << 0)
//#else
//#define SDLNet_Read16(areap) \
// ((((Uint8 *)areap)[1] << 8) | ((Uint8 *)areap)[0] << 0)
//#endif
//#endif /* !SDL_DATA_ALIGNED */
//
// /* Read a 32 bit value from network packet buffer */
//#if !SDL_DATA_ALIGNED
//#define SDLNet_Read32(areap) \
// (SDL_SwapBE32(*(Uint32 *)(areap)))
//#else
//#if SDL_BYTEORDER == SDL_BIG_ENDIAN
//#define SDLNet_Read32(areap) \
// ((((Uint8 *)areap)[0] << 24) | (((Uint8 *)areap)[1] << 16) | \
// (((Uint8 *)areap)[2] << 8) | ((Uint8 *)areap)[3] << 0)
//#else
//#define SDLNet_Read32(areap) \
// ((((Uint8 *)areap)[3] << 24) | (((Uint8 *)areap)[2] << 16) | \
// (((Uint8 *)areap)[1] << 8) | ((Uint8 *)areap)[0] << 0)
//#endif
//#endif /* !SDL_DATA_ALIGNED */
}
}

Просмотреть файл

@ -92,24 +92,36 @@ namespace Tao.Sdl
#region Public Constants
/// <summary>
/// Major Version
/// </summary>
public const int TTF_MAJOR_VERSION = 2;
/// <summary>
/// Minor Version
/// </summary>
public const int TTF_MINOR_VERSION = 0;
/// <summary>
/// Patch Version
/// </summary>
public const int TTF_PATCHLEVEL = 8;
/// <summary>
/// Used to indicate regular, normal, plain rendering style.
/// </summary>
public const Byte TTF_STYLE_NORMAL = 0x00;
public const byte TTF_STYLE_NORMAL = 0x00;
/// <summary>
/// Used to indicate bold rendering style.
/// This is used a bitmask along with other styles.
/// </summary>
public const Byte TTF_STYLE_BOLD = 0x01;
public const byte TTF_STYLE_BOLD = 0x01;
/// <summary>
/// Used to indicate italicized rendering style.
/// This is used a bitmask along with other styles.
/// </summary>
public const Byte TTF_STYLE_ITALIC = 0x02;
public const byte TTF_STYLE_ITALIC = 0x02;
/// <summary>
/// Used to indicate underlined rendering style.
/// This is used a bitmask along with other styles.
/// </summary>
public const Byte TTF_STYLE_UNDERLINE = 0x04;
public const byte TTF_STYLE_UNDERLINE = 0x04;
/// <summary>
/// This allows you to switch byte-order of UNICODE text data
/// to native order, meaning the mode of your CPU. This is meant
@ -162,6 +174,36 @@ namespace Tao.Sdl
#endregion Constructors & Destructors
#region SdlTtf Methods
#region SDL_version TTF_VERSION()
/// <summary>
/// This method can be used to fill a version structure with the compile-time
/// version of the SDL_ttf library.
/// </summary>
/// <returns>
/// This function returns a <see cref="Sdl.SDL_version"/> struct containing the
/// compiled version number
/// </returns>
/// <remarks>
/// <p>
/// Binds to C-function call in SDL_ttf.h:
/// <code>#define SDL_TTF_VERSION(X)
/// {
/// (X)->major = SDL_TTF_MAJOR_VERSION;
/// (X)->minor = SDL_TTF_MINOR_VERSION;
/// (X)->patch = SDL_TTF_PATCHLEVEL;
/// }</code>
/// </p>
/// </remarks>
public static Sdl.SDL_version TTF_VERSION()
{
Sdl.SDL_version sdlVersion = new Sdl.SDL_version();
sdlVersion.major = TTF_MAJOR_VERSION;
sdlVersion.minor = TTF_MINOR_VERSION;
sdlVersion.patch = TTF_PATCHLEVEL;
return sdlVersion;
}
#endregion SDL_version TTF_VERSION()
#region IntPtr TTF_Linked_VersionInternal()
// const SDL_version * TTF_Linked_Version(void)
[DllImport(SDL_TTF_NATIVE_LIBRARY, CallingConvention=CALLING_CONVENTION, EntryPoint="TTF_Linked_Version"), SuppressUnmanagedCodeSecurity]

Просмотреть файл

@ -206,6 +206,11 @@ namespace Tao.Sdl
Sdl.SDL_VideoInfo videoInfo = (Sdl.SDL_VideoInfo)
Marshal.PtrToStructure(videoInfoPtr,
typeof(Sdl.SDL_VideoInfo));
Console.WriteLine(videoInfo.hw_available);
Console.WriteLine(videoInfo.wm_available);
Console.WriteLine(videoInfo.video_mem);
Console.WriteLine(videoInfo.current_h);
Console.WriteLine(videoInfo.current_w);
Sdl.SDL_FreeSurface(videoInfoPtr);
}