From 9ab0d1d2c390d7b1b468eaa86004c3807bbc4e81 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Tue, 9 Apr 2013 23:04:37 -0400 Subject: [PATCH] Unfortunately, we need to use IntPtrs for SDL_Surface and Mix_Chunk. Otherwise we cannot free these resources. Just do a PtrToStructure in the application. --- src/SDL2.cs | 267 +++++++++++++--------------------- src/SDL2_image.cs | 32 +---- src/SDL2_mixer.cs | 86 ++++------- src/SDL2_ttf.cs | 359 ++++++---------------------------------------- 4 files changed, 176 insertions(+), 568 deletions(-) diff --git a/src/SDL2.cs b/src/SDL2.cs index b379d1e..295d232 100644 --- a/src/SDL2.cs +++ b/src/SDL2.cs @@ -678,23 +678,9 @@ namespace SDL2 ref int h ); - /* window refers to an SDL_Window* */ - [DllImport(nativeLibName, EntryPoint = "SDL_GetWindowSurface")] - private static extern IntPtr INTERNAL_SDL_GetWindowSurface( - IntPtr window - ); - public static SDL_Surface SDL_GetWindowSurface(IntPtr window) - { - SDL_Surface result; - IntPtr result_ptr = INTERNAL_SDL_GetWindowSurface( - window - ); - result = (SDL_Surface) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } + /* IntPtr refers to an SDL_Surface*, window to an SDL_Window* */ + [DllImport(nativeLibName)] + public static extern IntPtr SDL_GetWindowSurface(IntPtr window); /* window refers to an SDL_Window* */ [DllImport(nativeLibName, EntryPoint = "SDL_GetWindowTitle")] @@ -832,11 +818,11 @@ namespace SDL2 SDL_bool grabbed ); - /* window refers to an SDL_Window* */ + /* window refers to an SDL_Window*, icon to an SDL_Surface* */ [DllImport(nativeLibName)] public static extern void SDL_SetWindowIcon( IntPtr window, - ref SDL_Surface icon + IntPtr icon ); /* window refers to an SDL_Window* */ @@ -943,11 +929,9 @@ namespace SDL2 uint flags ); - /* IntPtr refers to an SDL_Renderer* */ + /* IntPtr refers to an SDL_Renderer*, surface to an SDL_Surface* */ [DllImport(nativeLibName)] - public static extern IntPtr SDL_CreateRenderer( - ref SDL_Surface surface - ); + public static extern IntPtr SDL_CreateRenderer(IntPtr surface); /* IntPtr refers to an SDL_Texture*, renderer to an SDL_Renderer* */ [DllImport(nativeLibName)] @@ -959,11 +943,14 @@ namespace SDL2 int h ); - /* IntPtr refers to an SDL_Texture*, renderer to an SDL_Renderer* */ + /* IntPtr refers to an SDL_Texture* + * renderer refers to an SDL_Renderer* + * surface refers to an SDL_Surface* + */ [DllImport(nativeLibName)] public static extern IntPtr SDL_CreateTextureFromSurface( IntPtr renderer, - ref SDL_Surface surface + IntPtr surface ); /* renderer refers to an SDL_Renderer* */ @@ -1863,16 +1850,23 @@ namespace SDL2 public int refcount; } - public static bool SDL_MUSTLOCK(ref SDL_Surface surface) + /* surface refers to an SDL_Surface* */ + public static bool SDL_MUSTLOCK(IntPtr surface) { - return (surface.flags & SDL_RLEACCEL) != 0; + SDL_Surface sur; + sur = (SDL_Surface) Marshal.PtrToStructure( + surface, + sur.GetType() + ); + return (sur.flags & SDL_RLEACCEL) != 0; } + /* src and dst refer to an SDL_Surface* */ [DllImport(nativeLibName)] public static extern int SDL_BlitSurface( - ref SDL_Surface src, + IntPtr src, ref SDL_Rect srcrect, - ref SDL_Surface dst, + IntPtr dst, ref SDL_Rect dstrect ); @@ -1889,57 +1883,28 @@ namespace SDL2 int dst_pitch ); - /* fmt refers to an SDL_PixelFormat* */ - [DllImport(nativeLibName, EntryPoint = "SDL_ConvertSurface")] - private static extern IntPtr INTERNAL_SDL_ConvertSurface( - ref SDL_Surface src, + /* IntPtr refers to an SDL_Surface* + * src refers to an SDL_Surface* + * fmt refers to an SDL_PixelFormat* + */ + [DllImport(nativeLibName)] + public static extern IntPtr SDL_ConvertSurface( + IntPtr src, IntPtr fmt, uint flags ); - public static SDL_Surface SDL_ConvertSurface( - ref SDL_Surface src, - IntPtr fmt, - uint flags - ) { - SDL_Surface result; - IntPtr result_ptr = INTERNAL_SDL_ConvertSurface( - ref src, - fmt, - flags - ); - result = (SDL_Surface) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } - [DllImport(nativeLibName, EntryPoint = "SDL_ConvertSurfaceFormat")] - private static extern IntPtr INTERNAL_SDL_ConvertSurfaceFormat( - ref SDL_Surface src, + /* IntPtr refers to an SDL_Surface*, src to an SDL_Surface* */ + [DllImport(nativeLibName)] + public static extern IntPtr SDL_ConvertSurfaceFormat( + IntPtr src, uint pixel_format, uint flags ); - public static SDL_Surface SDL_ConvertSurfaceFormat( - ref SDL_Surface src, - uint pixel_format, - uint flags - ) { - SDL_Surface result; - IntPtr result_ptr = INTERNAL_SDL_ConvertSurfaceFormat( - ref src, - pixel_format, - flags - ); - result = (SDL_Surface) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } - [DllImport(nativeLibName, EntryPoint = "SDL_CreateRGBSurface")] - private static extern IntPtr INTERNAL_SDL_CreateRGBSurface( + /* IntPtr refers to an SDL_Surface* */ + [DllImport(nativeLibName)] + public static extern IntPtr SDL_CreateRGBSurface( uint flags, int width, int height, @@ -1949,37 +1914,10 @@ namespace SDL2 uint Bmask, uint Amask ); - public static SDL_Surface SDL_CreateRGBSurface( - uint flags, - int width, - int height, - int depth, - uint Rmask, - uint Gmask, - uint Bmask, - uint Amask - ) { - SDL_Surface result; - IntPtr result_ptr = INTERNAL_SDL_CreateRGBSurface( - flags, - width, - height, - depth, - Rmask, - Gmask, - Bmask, - Amask - ); - result = (SDL_Surface) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } /* pixels refers to a void* */ - [DllImport(nativeLibName, EntryPoint = "SDL_CreateRGBSurfaceFrom")] - private static extern IntPtr INTERNAL_SDL_CreateRGBSurfaceFrom( + [DllImport(nativeLibName)] + public static extern IntPtr SDL_CreateRGBSurfaceFrom( IntPtr pixels, int width, int height, @@ -1990,202 +1928,189 @@ namespace SDL2 uint Bmask, uint Amask ); - public static SDL_Surface SDL_CreateRGBSurfaceFrom( - IntPtr pixels, - int width, - int height, - int depth, - int pitch, - uint Rmask, - uint Gmask, - uint Bmask, - uint Amask - ) { - SDL_Surface result; - IntPtr result_ptr = INTERNAL_SDL_CreateRGBSurfaceFrom( - pixels, - width, - height, - depth, - pitch, - Rmask, - Gmask, - Bmask, - Amask - ); - result = (SDL_Surface) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } + /* dst refers to an SDL_Surface* */ [DllImport(nativeLibName)] public static extern int SDL_FillRect( - ref SDL_Surface dst, + IntPtr dst, ref SDL_Rect rect, uint color ); + /* dst refers to an SDL_Surface* */ [DllImport(nativeLibName)] public static extern int SDL_FillRects( - ref SDL_Surface dst, + IntPtr dst, SDL_Rect[] rects, int count, uint color ); + /* surface refers to an SDL_Surface* */ [DllImport(nativeLibName)] - public static extern void SDL_FreeSurface(ref SDL_Surface surface); + public static extern void SDL_FreeSurface(IntPtr surface); + /* surface refers to an SDL_Surface* */ [DllImport(nativeLibName)] public static extern void SDL_GetClipRect( - ref SDL_Surface surface, + IntPtr surface, ref SDL_Rect rect ); + /* surface refers to an SDL_Surface* */ [DllImport(nativeLibName)] public static extern int SDL_GetColorKey( - ref SDL_Surface surface, + IntPtr surface, ref uint key ); + /* surface refers to an SDL_Surface* */ [DllImport(nativeLibName)] public static extern int SDL_GetSurfaceAlphaMod( - ref SDL_Surface surface, + IntPtr surface, ref byte alpha ); + /* surface refers to an SDL_Surface* */ [DllImport(nativeLibName)] public static extern int SDL_GetSurfaceBlendMode( - ref SDL_Surface surface, + IntPtr surface, ref SDL_BlendMode blendMode ); + /* surface refers to an SDL_Surface* */ [DllImport(nativeLibName)] public static extern int SDL_GetSurfaceColorMod( - ref SDL_Surface surface, + IntPtr surface, ref byte r, ref byte g, ref byte b ); /* These are for SDL_LoadBMP, which is a macro in the SDL headers. */ - /* THIS IS AN RWops FUNCTION! - */ + /* IntPtr refers to an SDL_Surface* */ + /* THIS IS AN RWops FUNCTION! */ [DllImport(nativeLibName, EntryPoint = "SDL_LoadBMP_RW")] private static extern IntPtr INTERNAL_SDL_LoadBMP_RW( IntPtr src, int freesrc ); - public static SDL_Surface SDL_LoadBMP(string file) + public static IntPtr SDL_LoadBMP(string file) { - SDL_Surface result; IntPtr rwops = INTERNAL_SDL_RWFromFile(file, "rb"); - IntPtr result_ptr = INTERNAL_SDL_LoadBMP_RW(rwops, 1); - result = (SDL_Surface) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; + return INTERNAL_SDL_LoadBMP_RW(rwops, 1); } + /* surface refers to an SDL_Surface* */ [DllImport(nativeLibName)] - public static extern int SDL_LockSurface(ref SDL_Surface surface); + public static extern int SDL_LockSurface(IntPtr surface); + /* src and dst refer to an SDL_Surface* */ [DllImport(nativeLibName)] public static extern int SDL_LowerBlit( - ref SDL_Surface src, + IntPtr src, ref SDL_Rect srcrect, - ref SDL_Surface dst, + IntPtr dst, ref SDL_Rect dstrect ); + /* src and dst refer to an SDL_Surface* */ [DllImport(nativeLibName)] public static extern int SDL_LowerBlitScaled( - ref SDL_Surface src, + IntPtr src, ref SDL_Rect srcrect, - ref SDL_Surface dst, + IntPtr dst, ref SDL_Rect dstrect ); + /* surface refers to an SDL_Surface* */ [DllImport(nativeLibName)] public static extern int SDL_SaveBMP( - ref SDL_Surface surface, + IntPtr surface, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string file ); + /* surface refers to an SDL_Surface* */ [DllImport(nativeLibName)] public static extern SDL_bool SDL_SetClipRect( - ref SDL_Surface surface, + IntPtr surface, ref SDL_Rect rect ); + /* surface refers to an SDL_Surface* */ [DllImport(nativeLibName)] public static extern int SDL_SetColorKey( - ref SDL_Surface surface, + IntPtr surface, int flag, uint key ); + /* surface refers to an SDL_Surface* */ [DllImport(nativeLibName)] public static extern int SDL_SetSurfaceAlphaMod( - ref SDL_Surface surface, + IntPtr surface, byte alpha ); + /* surface refers to an SDL_Surface* */ [DllImport(nativeLibName)] public static extern int SDL_SetSurfaceBlendMode( - ref SDL_Surface surface, + IntPtr surface, SDL_BlendMode blendMode ); + /* surface refers to an SDL_Surface* */ [DllImport(nativeLibName)] public static extern int SDL_SetSurfaceColorMod( - ref SDL_Surface surface, + IntPtr surface, byte r, byte g, byte b ); - /* palette refers to an SDL_Palette* */ + /* surface refers to an SDL_Surface*, palette to an SDL_Palette* */ [DllImport(nativeLibName)] public static extern int SDL_SetSurfacePalette( - ref SDL_Surface surface, + IntPtr surface, IntPtr palette ); + /* surface refers to an SDL_Surface* */ [DllImport(nativeLibName)] public static extern int SDL_SetSurfaceRLE( - ref SDL_Surface surface, + IntPtr surface, int flag ); + /* src and dst refer to an SDL_Surface* */ [DllImport(nativeLibName)] public static extern int SDL_SoftStretch( - ref SDL_Surface src, + IntPtr src, ref SDL_Rect srcrect, - ref SDL_Surface dst, + IntPtr dst, ref SDL_Rect dstrect ); + /* surface refers to an SDL_Surface* */ [DllImport(nativeLibName)] - public static extern void SDL_UnlockSurface(ref SDL_Surface surface); + public static extern void SDL_UnlockSurface(IntPtr surface); + /* src and dst refer to an SDL_Surface* */ [DllImport(nativeLibName)] public static extern int SDL_UpperBlit( - ref SDL_Surface src, + IntPtr src, ref SDL_Rect srcrect, - ref SDL_Surface dst, + IntPtr dst, ref SDL_Rect dstrect ); + /* src and dst refer to an SDL_Surface* */ [DllImport(nativeLibName)] public static extern int SDL_UpperBlitScaled( - ref SDL_Surface src, + IntPtr src, ref SDL_Rect srcrect, - ref SDL_Surface dst, + IntPtr dst, ref SDL_Rect dstrect ); @@ -3376,10 +3301,10 @@ namespace SDL2 ); /* Create a cursor from an SDL_Surface */ - /* return value is an SDL_Cursor pointer */ + /* IntPtr refers to an SDL_Cursor*, surface to an SDL_Surface* */ [DllImport(nativeLibName)] public static extern IntPtr SDL_CreateColorCursor( - ref SDL_Surface surface, + IntPtr surface, int hot_x, int hot_y ); diff --git a/src/SDL2_image.cs b/src/SDL2_image.cs index ed02c10..4855fae 100644 --- a/src/SDL2_image.cs +++ b/src/SDL2_image.cs @@ -72,21 +72,12 @@ namespace SDL2 [DllImport(nativeLibName)] public static extern void IMG_Quit(); - [DllImport(nativeLibName, EntryPoint = "IMG_Load")] - private static extern IntPtr INTERNAL_IMG_Load( + /* IntPtr refers to an SDL_Surface* */ + [DllImport(nativeLibName)] + public static extern IntPtr IMG_Load( [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string file ); - public static SDL.SDL_Surface IMG_Load(string file) - { - SDL.SDL_Surface result; - IntPtr result_ptr = INTERNAL_IMG_Load(file); - result = (SDL.SDL_Surface) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } /* IntPtr refers to an SDL_Texture*, renderer to an SDL_Renderer* */ [DllImport(nativeLibName)] @@ -99,20 +90,9 @@ namespace SDL2 [DllImport(nativeLibName)] public static extern int IMG_InvertAlpha(int on); - [DllImport(nativeLibName, EntryPoint = "IMG_ReadXPMFromArray")] - private static extern IntPtr INTERNAL_IMG_ReadXPMFromArray( - ref char[] xpm - ); - public static SDL.SDL_Surface IMG_ReadXPMFromArray(ref char[] xpm) - { - SDL.SDL_Surface result; - IntPtr result_ptr = INTERNAL_IMG_ReadXPMFromArray(ref xpm); - result = (SDL.SDL_Surface) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } + /* IntPtr refers to an SDL_Surface* */ + [DllImport(nativeLibName)] + public static extern IntPtr IMG_ReadXPMFromArray(ref char[] xpm); #endregion } diff --git a/src/SDL2_mixer.cs b/src/SDL2_mixer.cs index 4a584b4..751d77e 100644 --- a/src/SDL2_mixer.cs +++ b/src/SDL2_mixer.cs @@ -163,21 +163,16 @@ namespace SDL2 /* These are for Mix_LoadWAV, which is a macro in the C header. * THIS IS AN RWops FUNCTION! */ + /* IntPtr refers to a Mix_Chunk* */ [DllImport(nativeLibName, EntryPoint = "Mix_LoadWAV_RW")] private static extern IntPtr INTERNAL_Mix_LoadWAV_RW( IntPtr src, int freesrc ); - public static Mix_Chunk Mix_LoadWAV(string file) + public static IntPtr Mix_LoadWAV(string file) { - Mix_Chunk result; IntPtr rwops = SDL.INTERNAL_SDL_RWFromFile(file, "rb"); - IntPtr result_ptr = INTERNAL_Mix_LoadWAV_RW(rwops, 1); - result = (Mix_Chunk) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; + return INTERNAL_Mix_LoadWAV_RW(rwops, 1); } /* IntPtr refers to a Mix_Music* */ @@ -187,37 +182,17 @@ namespace SDL2 string file ); - [DllImport(nativeLibName, EntryPoint = "Mix_QuickLoad_WAV")] - private static extern IntPtr INTERNAL_Mix_QuickLoad_WAV(byte[] mem); - public static Mix_Chunk Mix_QuickLoad_WAV(byte[] mem) - { - Mix_Chunk result; - IntPtr result_ptr = INTERNAL_Mix_QuickLoad_WAV(mem); - result = (Mix_Chunk) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } - - [DllImport(nativeLibName, EntryPoint = "Mix_QuickLoad_RAW")] - private static extern IntPtr INTERNAL_Mix_QuickLoad_RAW( - byte[] mem, - uint len - ); - public static Mix_Chunk Mix_QuickLoad_RAW(byte[] mem, uint len) - { - Mix_Chunk result; - IntPtr result_ptr = INTERNAL_Mix_QuickLoad_RAW(mem, len); - result = (Mix_Chunk) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } - + /* IntPtr refers to a Mix_Chunk* */ [DllImport(nativeLibName)] - public static extern void Mix_FreeChunk(ref Mix_Chunk chunk); + public static extern IntPtr Mix_QuickLoad_WAV(byte[] mem); + + /* IntPtr refers to a Mix_Chunk* */ + [DllImport(nativeLibName)] + public static extern Mix_Chunk Mix_QuickLoad_RAW(byte[] mem, uint len); + + /* chunk refers to a Mix_Chunk* */ + [DllImport(nativeLibName)] + public static extern void Mix_FreeChunk(IntPtr chunk); /* music refers to a Mix_Music* */ [DllImport(nativeLibName)] @@ -335,18 +310,20 @@ namespace SDL2 [DllImport(nativeLibName)] public static extern int Mix_GroupNewer(int tag); + /* chunk refers to a Mix_Chunk* */ public static int Mix_PlayChannel( int channel, - ref Mix_Chunk chunk, + IntPtr chunk, int loops ) { - return Mix_PlayChannelTimed(channel, ref chunk, loops, -1); + return Mix_PlayChannelTimed(channel, chunk, loops, -1); } + /* chunk refers to a Mix_Chunk* */ [DllImport(nativeLibName)] public static extern int Mix_PlayChannelTimed( int channel, - ref Mix_Chunk chunk, + IntPtr chunk, int loops, int ticks ); @@ -355,6 +332,7 @@ namespace SDL2 [DllImport(nativeLibName)] public static extern int Mix_PlayMusic(IntPtr music, int loops); + /* music refers to a Mix_Music* */ [DllImport(nativeLibName)] public static extern int Mix_FadeInMusic( IntPtr music, @@ -371,19 +349,21 @@ namespace SDL2 double position ); + /* chunk refers to a Mix_Chunk* */ public static int Mix_FadeInChannel( int channel, - ref Mix_Chunk chunk, + IntPtr chunk, int loops, int ms ) { - return Mix_FadeInChannelTimed(channel, ref chunk, loops, ms, -1); + return Mix_FadeInChannelTimed(channel, chunk, loops, ms, -1); } + /* chunk refers to a Mix_Chunk* */ [DllImport(nativeLibName)] public static extern int Mix_FadeInChannelTimed( int channel, - ref Mix_Chunk chunk, + IntPtr chunk, int loops, int ms, int ticks @@ -392,9 +372,10 @@ namespace SDL2 [DllImport(nativeLibName)] public static extern int Mix_Volume(int channel, int volume); + /* chunk refers to a Mix_Chunk* */ [DllImport(nativeLibName)] public static extern int Mix_VolumeChunk( - ref Mix_Chunk chunk, + IntPtr chunk, int volume ); @@ -489,18 +470,9 @@ namespace SDL2 IntPtr data // void* ); - [DllImport(nativeLibName, EntryPoint = "Mix_GetChunk")] - private static extern IntPtr INTERNAL_Mix_GetChunk(int channel); - public static Mix_Chunk Mix_GetChunk(int channel) - { - Mix_Chunk result; - IntPtr result_ptr = INTERNAL_Mix_GetChunk(channel); - result = (Mix_Chunk) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } + /* IntPtr refers to a Mix_Chunk* */ + [DllImport(nativeLibName)] + public static extern IntPtr Mix_GetChunk(int channel); [DllImport(nativeLibName)] public static extern void Mix_CloseAudio(); diff --git a/src/SDL2_ttf.cs b/src/SDL2_ttf.cs index 8dac26c..319499a 100644 --- a/src/SDL2_ttf.cs +++ b/src/SDL2_ttf.cs @@ -219,409 +219,140 @@ namespace SDL2 ref int h ); - /* font refers to a TTF_Font* */ - [DllImport(nativeLibName, EntryPoint = "TTF_RenderText_Solid")] - private static extern IntPtr INTERNAL_TTF_RenderText_Solid( + /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ + [DllImport(nativeLibName)] + public static extern IntPtr TTF_RenderText_Solid( IntPtr font, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string text, SDL.SDL_Color fg ); - public static SDL.SDL_Surface TTF_RenderText_Solid( - IntPtr font, - string text, - SDL.SDL_Color fg - ) { - SDL.SDL_Surface result; - IntPtr result_ptr = INTERNAL_TTF_RenderText_Solid( - font, - text, - fg - ); - result = (SDL.SDL_Surface) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } - /* font refers to a TTF_Font* */ - [DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Solid")] - private static extern IntPtr INTERNAL_TTF_RenderUTF8_Solid( + /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ + [DllImport(nativeLibName)] + public static extern IntPtr TTF_RenderUTF8_Solid( IntPtr font, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string text, SDL.SDL_Color fg ); - public static SDL.SDL_Surface TTF_RenderUTF8_Solid( - IntPtr font, - string text, - SDL.SDL_Color fg - ) { - SDL.SDL_Surface result; - IntPtr result_ptr = INTERNAL_TTF_RenderUTF8_Solid( - font, - text, - fg - ); - result = (SDL.SDL_Surface) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } - /* font refers to a TTF_Font* */ - [DllImport(nativeLibName, EntryPoint = "TTF_RenderUNICODE_Solid")] - private static extern IntPtr INTERNAL_TTF_RenderUNICODE_Solid( + /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ + [DllImport(nativeLibName)] + public static extern IntPtr TTF_RenderUNICODE_Solid( IntPtr font, ushort[] text, SDL.SDL_Color fg ); - public static SDL.SDL_Surface TTF_RenderUNICODE_Solid( - IntPtr font, - ushort[] text, - SDL.SDL_Color fg - ) { - SDL.SDL_Surface result; - IntPtr result_ptr = INTERNAL_TTF_RenderUNICODE_Solid( - font, - text, - fg - ); - result = (SDL.SDL_Surface) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } - /* font refers to a TTF_Font* */ - [DllImport(nativeLibName, EntryPoint = "TTF_RenderGlyph_Solid")] - private static extern IntPtr INTERNAL_TTF_RenderGlyph_Solid( + /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ + [DllImport(nativeLibName)] + public static extern IntPtr TTF_RenderGlyph_Solid( IntPtr font, ushort ch, SDL.SDL_Color fg ); - public static SDL.SDL_Surface TTF_RenderGlyph_Solid( - IntPtr font, - ushort ch, - SDL.SDL_Color fg - ) { - SDL.SDL_Surface result; - IntPtr result_ptr = INTERNAL_TTF_RenderGlyph_Solid( - font, - ch, - fg - ); - result = (SDL.SDL_Surface) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } - /* font refers to a TTF_Font* */ - [DllImport(nativeLibName, EntryPoint = "TTF_RenderText_Shaded")] - private static extern IntPtr INTERNAL_TTF_RenderText_Shaded( + /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ + [DllImport(nativeLibName)] + public static extern IntPtr TTF_RenderText_Shaded( IntPtr font, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string text, SDL.SDL_Color fg, SDL.SDL_Color bg ); - public static SDL.SDL_Surface TTF_RenderText_Shaded( - IntPtr font, - string text, - SDL.SDL_Color fg, - SDL.SDL_Color bg - ) { - SDL.SDL_Surface result; - IntPtr result_ptr = INTERNAL_TTF_RenderText_Shaded( - font, - text, - fg, - bg - ); - result = (SDL.SDL_Surface) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } - /* font refers to a TTF_Font* */ - [DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Shaded")] - private static extern IntPtr INTERNAL_TTF_RenderUTF8_Shaded( + /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ + [DllImport(nativeLibName)] + public static extern IntPtr TTF_RenderUTF8_Shaded( IntPtr font, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string text, SDL.SDL_Color fg, SDL.SDL_Color bg ); - public static SDL.SDL_Surface TTF_RenderUTF8_Shaded( - IntPtr font, - string text, - SDL.SDL_Color fg, - SDL.SDL_Color bg - ) { - SDL.SDL_Surface result; - IntPtr result_ptr = INTERNAL_TTF_RenderUTF8_Shaded( - font, - text, - fg, - bg - ); - result = (SDL.SDL_Surface) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } - /* font refers to a TTF_Font* */ - [DllImport(nativeLibName, EntryPoint = "TTF_RenderUNICODE_Shaded")] - private static extern IntPtr INTERNAL_TTF_RenderUNICODE_Shaded( + /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ + [DllImport(nativeLibName)] + public static extern IntPtr TTF_RenderUNICODE_Shaded( IntPtr font, ushort[] text, SDL.SDL_Color fg, SDL.SDL_Color bg ); - public static SDL.SDL_Surface TTF_RenderUNICODE_Shaded( - IntPtr font, - ushort[] text, - SDL.SDL_Color fg, - SDL.SDL_Color bg - ) { - SDL.SDL_Surface result; - IntPtr result_ptr = INTERNAL_TTF_RenderUNICODE_Shaded( - font, - text, - fg, - bg - ); - result = (SDL.SDL_Surface) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } - /* font refers to a TTF_Font* */ - [DllImport(nativeLibName, EntryPoint = "TTF_RenderGlyph_Shaded")] - private static extern IntPtr INTERNAL_TTF_RenderGlyph_Shaded( + /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ + [DllImport(nativeLibName)] + public static extern IntPtr TTF_RenderGlyph_Shaded( IntPtr font, ushort ch, SDL.SDL_Color fg, SDL.SDL_Color bg ); - public static SDL.SDL_Surface TTF_RenderGlyph_Shaded( - IntPtr font, - ushort ch, - SDL.SDL_Color fg, - SDL.SDL_Color bg - ) { - SDL.SDL_Surface result; - IntPtr result_ptr = INTERNAL_TTF_RenderGlyph_Shaded( - font, - ch, - fg, - bg - ); - result = (SDL.SDL_Surface) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } - /* font refers to a TTF_Font* */ - [DllImport(nativeLibName, EntryPoint = "TTF_RenderText_Blended")] - private static extern IntPtr INTERNAL_TTF_RenderText_Blended( + /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ + [DllImport(nativeLibName)] + public static extern IntPtr TTF_RenderText_Blended( IntPtr font, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string text, SDL.SDL_Color fg ); - public static SDL.SDL_Surface TTF_RenderText_Blended( - IntPtr font, - string text, - SDL.SDL_Color fg - ) { - SDL.SDL_Surface result; - IntPtr result_ptr = INTERNAL_TTF_RenderText_Blended( - font, - text, - fg - ); - result = (SDL.SDL_Surface) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } - /* font refers to a TTF_Font* */ - [DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Blended")] - private static extern IntPtr INTERNAL_TTF_RenderUTF8_Blended( + /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ + [DllImport(nativeLibName)] + public static extern IntPtr TTF_RenderUTF8_Blended( IntPtr font, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string text, SDL.SDL_Color fg ); - public static SDL.SDL_Surface TTF_RenderUTF8_Blended( - IntPtr font, - string text, - SDL.SDL_Color fg - ) { - SDL.SDL_Surface result; - IntPtr result_ptr = INTERNAL_TTF_RenderUTF8_Blended( - font, - text, - fg - ); - result = (SDL.SDL_Surface) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } - /* font refers to a TTF_Font* */ - [DllImport(nativeLibName, EntryPoint = "TTF_RenderUNICODE_Blended")] - private static extern IntPtr INTERNAL_TTF_RenderUNICODE_Blended( + /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ + [DllImport(nativeLibName)] + public static extern IntPtr TTF_RenderUNICODE_Blended( IntPtr font, ushort[] text, SDL.SDL_Color fg ); - public static SDL.SDL_Surface TTF_RenderUNICODE_Blended( - IntPtr font, - ushort[] text, - SDL.SDL_Color fg - ) { - SDL.SDL_Surface result; - IntPtr result_ptr = INTERNAL_TTF_RenderUNICODE_Blended( - font, - text, - fg - ); - result = (SDL.SDL_Surface) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } - /* font refers to a TTF_Font* */ - [DllImport(nativeLibName, EntryPoint = "TTF_RenderText_Blended_Wrapped")] - private static extern IntPtr INTERNAL_TTF_RenderText_Blended_Wrapped( + /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ + [DllImport(nativeLibName)] + public static extern IntPtr TTF_RenderText_Blended_Wrapped( IntPtr font, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string text, SDL.SDL_Color fg, uint wrapped ); - public static SDL.SDL_Surface TTF_RenderText_Blended_Wrapped( - IntPtr font, - string text, - SDL.SDL_Color fg, - uint wrapped - ) { - SDL.SDL_Surface result; - IntPtr result_ptr = INTERNAL_TTF_RenderText_Blended_Wrapped( - font, - text, - fg, - wrapped - ); - result = (SDL.SDL_Surface) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } - /* font refers to a TTF_Font* */ - [DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Blended_Wrapped")] - private static extern IntPtr INTERNAL_TTF_RenderUTF8_Blended_Wrapped( + /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ + [DllImport(nativeLibName)] + public static extern IntPtr TTF_RenderUTF8_Blended_Wrapped( IntPtr font, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string text, SDL.SDL_Color fg, uint wrapped ); - public static SDL.SDL_Surface TTF_RenderUTF8_Blended_Wrapped( - IntPtr font, - string text, - SDL.SDL_Color fg, - uint wrapped - ) { - SDL.SDL_Surface result; - IntPtr result_ptr = INTERNAL_TTF_RenderUTF8_Blended_Wrapped( - font, - text, - fg, - wrapped - ); - result = (SDL.SDL_Surface) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } - /* font refers to a TTF_Font* */ - [DllImport(nativeLibName, EntryPoint = "TTF_RenderUNICODE_Blended_Wrapped")] - private static extern IntPtr INTERNAL_TTF_RenderUNICODE_Blended_Wrapped( + /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ + [DllImport(nativeLibName)] + public static extern IntPtr TTF_RenderUNICODE_Blended_Wrapped( IntPtr font, ushort[] text, SDL.SDL_Color fg, uint wrapped ); - public static SDL.SDL_Surface TTF_RenderUNICODE_Blended_Wrapped( - IntPtr font, - ushort[] text, - SDL.SDL_Color fg, - uint wrapped - ) { - SDL.SDL_Surface result; - IntPtr result_ptr = INTERNAL_TTF_RenderUNICODE_Blended_Wrapped( - font, - text, - fg, - wrapped - ); - result = (SDL.SDL_Surface) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } - /* font refers to a TTF_Font* */ - [DllImport(nativeLibName, EntryPoint = "TTF_RenderGlyph_Blended")] - private static extern IntPtr INTERNAL_TTF_RenderGlyph_Blended( + /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ + [DllImport(nativeLibName)] + public static extern IntPtr TTF_RenderGlyph_Blended( IntPtr font, ushort ch, SDL.SDL_Color fg ); - public static SDL.SDL_Surface TTF_RenderGlyph_Blended( - IntPtr font, - ushort ch, - SDL.SDL_Color fg - ) { - SDL.SDL_Surface result; - IntPtr result_ptr = INTERNAL_TTF_RenderGlyph_Blended( - font, - ch, - fg - ); - result = (SDL.SDL_Surface) Marshal.PtrToStructure( - result_ptr, - result.GetType() - ); - return result; - } /* font refers to a TTF_Font* */ [DllImport(nativeLibName)]