From 281ce130e0fd7c43a3c17aaeb3ef9321b31ef07b Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Mon, 8 Apr 2013 12:09:41 -0400 Subject: [PATCH] Remove 2 from class names to prevent namespace ambiguity. --- src/SDL2.cs | 27 ++++++- src/SDL2_image.cs | 20 +++--- src/SDL2_mixer.cs | 14 ++-- src/SDL2_ttf.cs | 174 +++++++++++++++++++++++----------------------- 4 files changed, 130 insertions(+), 105 deletions(-) diff --git a/src/SDL2.cs b/src/SDL2.cs index e05fb3b..a2040af 100644 --- a/src/SDL2.cs +++ b/src/SDL2.cs @@ -36,7 +36,7 @@ using System.Runtime.InteropServices; namespace SDL2 { - public static class SDL2 + public static class SDL { #region SDL2# Variables @@ -451,6 +451,31 @@ namespace SDL2 SDL_WINDOW_FOREIGN = 0x00000800, } + public const int SDL_WINDOWPOS_UNDEFINED_MASK = 0x1FFF0000; + public const int SDL_WINDOWPOS_CENTERED_MASK = 0x2FFF0000; + public const int SDL_WINDOWPOS_UNDEFINED = 0x1FFF0000; + public const int SDL_WINDOWPOS_CENTERED = 0x2FFF0000; + + public static int SDL_WINDOWPOS_UNDEFINED_DISPLAY(int X) + { + return (SDL_WINDOWPOS_UNDEFINED_MASK | X); + } + + public static bool SDL_WINDOWPOS_ISUNDEFINED(int X) + { + return (X & 0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK; + } + + public static int SDL_WINDOWPOS_CENTERED_DISPLAY(int X) + { + return (SDL_WINDOWPOS_CENTERED_MASK | X); + } + + public static bool SDL_WINDOWPOS_ISCENTERED(int X) + { + return (X & 0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK; + } + [StructLayout(LayoutKind.Sequential)] public struct SDL_DisplayMode { diff --git a/src/SDL2_image.cs b/src/SDL2_image.cs index 9f82b61..ed02c10 100644 --- a/src/SDL2_image.cs +++ b/src/SDL2_image.cs @@ -33,7 +33,7 @@ using System.Runtime.InteropServices; namespace SDL2 { - public static class SDL2_image + public static class SDL_image { #region SDL2# Variables @@ -55,11 +55,11 @@ namespace SDL2 [DllImport(nativeLibName, EntryPoint = "IMG_LinkedVersion")] private static extern IntPtr INTERNAL_IMG_LinkedVersion(); - public static SDL2.SDL_version IMG_LinkedVersion() + public static SDL.SDL_version IMG_LinkedVersion() { - SDL2.SDL_version result; + SDL.SDL_version result; IntPtr result_ptr = INTERNAL_IMG_LinkedVersion(); - result = (SDL2.SDL_version) Marshal.PtrToStructure( + result = (SDL.SDL_version) Marshal.PtrToStructure( result_ptr, result.GetType() ); @@ -77,11 +77,11 @@ namespace SDL2 [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string file ); - public static SDL2.SDL_Surface IMG_Load(string file) + public static SDL.SDL_Surface IMG_Load(string file) { - SDL2.SDL_Surface result; + SDL.SDL_Surface result; IntPtr result_ptr = INTERNAL_IMG_Load(file); - result = (SDL2.SDL_Surface) Marshal.PtrToStructure( + result = (SDL.SDL_Surface) Marshal.PtrToStructure( result_ptr, result.GetType() ); @@ -103,11 +103,11 @@ namespace SDL2 private static extern IntPtr INTERNAL_IMG_ReadXPMFromArray( ref char[] xpm ); - public static SDL2.SDL_Surface IMG_ReadXPMFromArray(ref char[] xpm) + public static SDL.SDL_Surface IMG_ReadXPMFromArray(ref char[] xpm) { - SDL2.SDL_Surface result; + SDL.SDL_Surface result; IntPtr result_ptr = INTERNAL_IMG_ReadXPMFromArray(ref xpm); - result = (SDL2.SDL_Surface) Marshal.PtrToStructure( + result = (SDL.SDL_Surface) Marshal.PtrToStructure( result_ptr, result.GetType() ); diff --git a/src/SDL2_mixer.cs b/src/SDL2_mixer.cs index 3c7e1fc..e62afb4 100644 --- a/src/SDL2_mixer.cs +++ b/src/SDL2_mixer.cs @@ -33,7 +33,7 @@ using System.Runtime.InteropServices; namespace SDL2 { - public static class SDL2_mixer + public static class SDL_mixer { #region SDL2# Variables @@ -48,8 +48,8 @@ namespace SDL2 public const int MIX_CHANNELS = 8; public const int MIX_DEFAULT_FREQUENCY = 22050; - // FIXME: ASSUMING LITTLE ENDIAN!!! Big endian: SDL2.AUDIO_S16MSB - public const ushort MIX_DEFAULT_FORMAT = SDL2.AUDIO_S16LSB; + // FIXME: ASSUMING LITTLE ENDIAN!!! Big endian: SDL.AUDIO_S16MSB + public const ushort MIX_DEFAULT_FORMAT = SDL.AUDIO_S16LSB; public const int MIX_DEFAULT_CHANNELS = 2; public const byte MIX_MAX_VOLUME = 128; @@ -122,11 +122,11 @@ namespace SDL2 [DllImport(nativeLibName, EntryPoint = "MIX_Linked_Version")] private static extern IntPtr INTERNAL_MIX_Linked_Version(); - public static SDL2.SDL_version MIX_Linked_Version() + public static SDL.SDL_version MIX_Linked_Version() { - SDL2.SDL_version result; + SDL.SDL_version result; IntPtr result_ptr = INTERNAL_MIX_Linked_Version(); - result = (SDL2.SDL_version) Marshal.PtrToStructure( + result = (SDL.SDL_version) Marshal.PtrToStructure( result_ptr, result.GetType() ); @@ -168,7 +168,7 @@ namespace SDL2 public static Mix_Chunk Mix_LoadWAV(string file) { Mix_Chunk result; - IntPtr rwops = SDL2.INTERNAL_SDL_RWFromFile(file, "rb"); + IntPtr rwops = SDL.INTERNAL_SDL_RWFromFile(file, "rb"); IntPtr result_ptr = INTERNAL_Mix_LoadWAV_RW(rwops, 1); result = (Mix_Chunk) Marshal.PtrToStructure( result_ptr, diff --git a/src/SDL2_ttf.cs b/src/SDL2_ttf.cs index a5002e0..8dac26c 100644 --- a/src/SDL2_ttf.cs +++ b/src/SDL2_ttf.cs @@ -33,7 +33,7 @@ using System.Runtime.InteropServices; namespace SDL2 { - public static class SDL2_ttf + public static class SDL_ttf { #region SDL2# Variables @@ -60,11 +60,11 @@ namespace SDL2 [DllImport(nativeLibName, EntryPoint = "TTF_LinkedVersion")] private static extern IntPtr INTERNAL_TTF_LinkedVersion(); - public static SDL2.SDL_version TTF_LinkedVersion() + public static SDL.SDL_version TTF_LinkedVersion() { - SDL2.SDL_version result; + SDL.SDL_version result; IntPtr result_ptr = INTERNAL_TTF_LinkedVersion(); - result = (SDL2.SDL_version) Marshal.PtrToStructure( + result = (SDL.SDL_version) Marshal.PtrToStructure( result_ptr, result.GetType() ); @@ -225,20 +225,20 @@ namespace SDL2 IntPtr font, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string text, - SDL2.SDL_Color fg + SDL.SDL_Color fg ); - public static SDL2.SDL_Surface TTF_RenderText_Solid( + public static SDL.SDL_Surface TTF_RenderText_Solid( IntPtr font, string text, - SDL2.SDL_Color fg + SDL.SDL_Color fg ) { - SDL2.SDL_Surface result; + SDL.SDL_Surface result; IntPtr result_ptr = INTERNAL_TTF_RenderText_Solid( font, text, fg ); - result = (SDL2.SDL_Surface) Marshal.PtrToStructure( + result = (SDL.SDL_Surface) Marshal.PtrToStructure( result_ptr, result.GetType() ); @@ -251,20 +251,20 @@ namespace SDL2 IntPtr font, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string text, - SDL2.SDL_Color fg + SDL.SDL_Color fg ); - public static SDL2.SDL_Surface TTF_RenderUTF8_Solid( + public static SDL.SDL_Surface TTF_RenderUTF8_Solid( IntPtr font, string text, - SDL2.SDL_Color fg + SDL.SDL_Color fg ) { - SDL2.SDL_Surface result; + SDL.SDL_Surface result; IntPtr result_ptr = INTERNAL_TTF_RenderUTF8_Solid( font, text, fg ); - result = (SDL2.SDL_Surface) Marshal.PtrToStructure( + result = (SDL.SDL_Surface) Marshal.PtrToStructure( result_ptr, result.GetType() ); @@ -276,20 +276,20 @@ namespace SDL2 private static extern IntPtr INTERNAL_TTF_RenderUNICODE_Solid( IntPtr font, ushort[] text, - SDL2.SDL_Color fg + SDL.SDL_Color fg ); - public static SDL2.SDL_Surface TTF_RenderUNICODE_Solid( + public static SDL.SDL_Surface TTF_RenderUNICODE_Solid( IntPtr font, ushort[] text, - SDL2.SDL_Color fg + SDL.SDL_Color fg ) { - SDL2.SDL_Surface result; + SDL.SDL_Surface result; IntPtr result_ptr = INTERNAL_TTF_RenderUNICODE_Solid( font, text, fg ); - result = (SDL2.SDL_Surface) Marshal.PtrToStructure( + result = (SDL.SDL_Surface) Marshal.PtrToStructure( result_ptr, result.GetType() ); @@ -301,20 +301,20 @@ namespace SDL2 private static extern IntPtr INTERNAL_TTF_RenderGlyph_Solid( IntPtr font, ushort ch, - SDL2.SDL_Color fg + SDL.SDL_Color fg ); - public static SDL2.SDL_Surface TTF_RenderGlyph_Solid( + public static SDL.SDL_Surface TTF_RenderGlyph_Solid( IntPtr font, ushort ch, - SDL2.SDL_Color fg + SDL.SDL_Color fg ) { - SDL2.SDL_Surface result; + SDL.SDL_Surface result; IntPtr result_ptr = INTERNAL_TTF_RenderGlyph_Solid( font, ch, fg ); - result = (SDL2.SDL_Surface) Marshal.PtrToStructure( + result = (SDL.SDL_Surface) Marshal.PtrToStructure( result_ptr, result.GetType() ); @@ -327,23 +327,23 @@ namespace SDL2 IntPtr font, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string text, - SDL2.SDL_Color fg, - SDL2.SDL_Color bg + SDL.SDL_Color fg, + SDL.SDL_Color bg ); - public static SDL2.SDL_Surface TTF_RenderText_Shaded( + public static SDL.SDL_Surface TTF_RenderText_Shaded( IntPtr font, string text, - SDL2.SDL_Color fg, - SDL2.SDL_Color bg + SDL.SDL_Color fg, + SDL.SDL_Color bg ) { - SDL2.SDL_Surface result; + SDL.SDL_Surface result; IntPtr result_ptr = INTERNAL_TTF_RenderText_Shaded( font, text, fg, bg ); - result = (SDL2.SDL_Surface) Marshal.PtrToStructure( + result = (SDL.SDL_Surface) Marshal.PtrToStructure( result_ptr, result.GetType() ); @@ -356,23 +356,23 @@ namespace SDL2 IntPtr font, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string text, - SDL2.SDL_Color fg, - SDL2.SDL_Color bg + SDL.SDL_Color fg, + SDL.SDL_Color bg ); - public static SDL2.SDL_Surface TTF_RenderUTF8_Shaded( + public static SDL.SDL_Surface TTF_RenderUTF8_Shaded( IntPtr font, string text, - SDL2.SDL_Color fg, - SDL2.SDL_Color bg + SDL.SDL_Color fg, + SDL.SDL_Color bg ) { - SDL2.SDL_Surface result; + SDL.SDL_Surface result; IntPtr result_ptr = INTERNAL_TTF_RenderUTF8_Shaded( font, text, fg, bg ); - result = (SDL2.SDL_Surface) Marshal.PtrToStructure( + result = (SDL.SDL_Surface) Marshal.PtrToStructure( result_ptr, result.GetType() ); @@ -384,23 +384,23 @@ namespace SDL2 private static extern IntPtr INTERNAL_TTF_RenderUNICODE_Shaded( IntPtr font, ushort[] text, - SDL2.SDL_Color fg, - SDL2.SDL_Color bg + SDL.SDL_Color fg, + SDL.SDL_Color bg ); - public static SDL2.SDL_Surface TTF_RenderUNICODE_Shaded( + public static SDL.SDL_Surface TTF_RenderUNICODE_Shaded( IntPtr font, ushort[] text, - SDL2.SDL_Color fg, - SDL2.SDL_Color bg + SDL.SDL_Color fg, + SDL.SDL_Color bg ) { - SDL2.SDL_Surface result; + SDL.SDL_Surface result; IntPtr result_ptr = INTERNAL_TTF_RenderUNICODE_Shaded( font, text, fg, bg ); - result = (SDL2.SDL_Surface) Marshal.PtrToStructure( + result = (SDL.SDL_Surface) Marshal.PtrToStructure( result_ptr, result.GetType() ); @@ -412,23 +412,23 @@ namespace SDL2 private static extern IntPtr INTERNAL_TTF_RenderGlyph_Shaded( IntPtr font, ushort ch, - SDL2.SDL_Color fg, - SDL2.SDL_Color bg + SDL.SDL_Color fg, + SDL.SDL_Color bg ); - public static SDL2.SDL_Surface TTF_RenderGlyph_Shaded( + public static SDL.SDL_Surface TTF_RenderGlyph_Shaded( IntPtr font, ushort ch, - SDL2.SDL_Color fg, - SDL2.SDL_Color bg + SDL.SDL_Color fg, + SDL.SDL_Color bg ) { - SDL2.SDL_Surface result; + SDL.SDL_Surface result; IntPtr result_ptr = INTERNAL_TTF_RenderGlyph_Shaded( font, ch, fg, bg ); - result = (SDL2.SDL_Surface) Marshal.PtrToStructure( + result = (SDL.SDL_Surface) Marshal.PtrToStructure( result_ptr, result.GetType() ); @@ -441,20 +441,20 @@ namespace SDL2 IntPtr font, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string text, - SDL2.SDL_Color fg + SDL.SDL_Color fg ); - public static SDL2.SDL_Surface TTF_RenderText_Blended( + public static SDL.SDL_Surface TTF_RenderText_Blended( IntPtr font, string text, - SDL2.SDL_Color fg + SDL.SDL_Color fg ) { - SDL2.SDL_Surface result; + SDL.SDL_Surface result; IntPtr result_ptr = INTERNAL_TTF_RenderText_Blended( font, text, fg ); - result = (SDL2.SDL_Surface) Marshal.PtrToStructure( + result = (SDL.SDL_Surface) Marshal.PtrToStructure( result_ptr, result.GetType() ); @@ -467,20 +467,20 @@ namespace SDL2 IntPtr font, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string text, - SDL2.SDL_Color fg + SDL.SDL_Color fg ); - public static SDL2.SDL_Surface TTF_RenderUTF8_Blended( + public static SDL.SDL_Surface TTF_RenderUTF8_Blended( IntPtr font, string text, - SDL2.SDL_Color fg + SDL.SDL_Color fg ) { - SDL2.SDL_Surface result; + SDL.SDL_Surface result; IntPtr result_ptr = INTERNAL_TTF_RenderUTF8_Blended( font, text, fg ); - result = (SDL2.SDL_Surface) Marshal.PtrToStructure( + result = (SDL.SDL_Surface) Marshal.PtrToStructure( result_ptr, result.GetType() ); @@ -492,20 +492,20 @@ namespace SDL2 private static extern IntPtr INTERNAL_TTF_RenderUNICODE_Blended( IntPtr font, ushort[] text, - SDL2.SDL_Color fg + SDL.SDL_Color fg ); - public static SDL2.SDL_Surface TTF_RenderUNICODE_Blended( + public static SDL.SDL_Surface TTF_RenderUNICODE_Blended( IntPtr font, ushort[] text, - SDL2.SDL_Color fg + SDL.SDL_Color fg ) { - SDL2.SDL_Surface result; + SDL.SDL_Surface result; IntPtr result_ptr = INTERNAL_TTF_RenderUNICODE_Blended( font, text, fg ); - result = (SDL2.SDL_Surface) Marshal.PtrToStructure( + result = (SDL.SDL_Surface) Marshal.PtrToStructure( result_ptr, result.GetType() ); @@ -518,23 +518,23 @@ namespace SDL2 IntPtr font, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string text, - SDL2.SDL_Color fg, + SDL.SDL_Color fg, uint wrapped ); - public static SDL2.SDL_Surface TTF_RenderText_Blended_Wrapped( + public static SDL.SDL_Surface TTF_RenderText_Blended_Wrapped( IntPtr font, string text, - SDL2.SDL_Color fg, + SDL.SDL_Color fg, uint wrapped ) { - SDL2.SDL_Surface result; + SDL.SDL_Surface result; IntPtr result_ptr = INTERNAL_TTF_RenderText_Blended_Wrapped( font, text, fg, wrapped ); - result = (SDL2.SDL_Surface) Marshal.PtrToStructure( + result = (SDL.SDL_Surface) Marshal.PtrToStructure( result_ptr, result.GetType() ); @@ -547,23 +547,23 @@ namespace SDL2 IntPtr font, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string text, - SDL2.SDL_Color fg, + SDL.SDL_Color fg, uint wrapped ); - public static SDL2.SDL_Surface TTF_RenderUTF8_Blended_Wrapped( + public static SDL.SDL_Surface TTF_RenderUTF8_Blended_Wrapped( IntPtr font, string text, - SDL2.SDL_Color fg, + SDL.SDL_Color fg, uint wrapped ) { - SDL2.SDL_Surface result; + SDL.SDL_Surface result; IntPtr result_ptr = INTERNAL_TTF_RenderUTF8_Blended_Wrapped( font, text, fg, wrapped ); - result = (SDL2.SDL_Surface) Marshal.PtrToStructure( + result = (SDL.SDL_Surface) Marshal.PtrToStructure( result_ptr, result.GetType() ); @@ -575,23 +575,23 @@ namespace SDL2 private static extern IntPtr INTERNAL_TTF_RenderUNICODE_Blended_Wrapped( IntPtr font, ushort[] text, - SDL2.SDL_Color fg, + SDL.SDL_Color fg, uint wrapped ); - public static SDL2.SDL_Surface TTF_RenderUNICODE_Blended_Wrapped( + public static SDL.SDL_Surface TTF_RenderUNICODE_Blended_Wrapped( IntPtr font, ushort[] text, - SDL2.SDL_Color fg, + SDL.SDL_Color fg, uint wrapped ) { - SDL2.SDL_Surface result; + SDL.SDL_Surface result; IntPtr result_ptr = INTERNAL_TTF_RenderUNICODE_Blended_Wrapped( font, text, fg, wrapped ); - result = (SDL2.SDL_Surface) Marshal.PtrToStructure( + result = (SDL.SDL_Surface) Marshal.PtrToStructure( result_ptr, result.GetType() ); @@ -603,20 +603,20 @@ namespace SDL2 private static extern IntPtr INTERNAL_TTF_RenderGlyph_Blended( IntPtr font, ushort ch, - SDL2.SDL_Color fg + SDL.SDL_Color fg ); - public static SDL2.SDL_Surface TTF_RenderGlyph_Blended( + public static SDL.SDL_Surface TTF_RenderGlyph_Blended( IntPtr font, ushort ch, - SDL2.SDL_Color fg + SDL.SDL_Color fg ) { - SDL2.SDL_Surface result; + SDL.SDL_Surface result; IntPtr result_ptr = INTERNAL_TTF_RenderGlyph_Blended( font, ch, fg ); - result = (SDL2.SDL_Surface) Marshal.PtrToStructure( + result = (SDL.SDL_Surface) Marshal.PtrToStructure( result_ptr, result.GetType() );