Marshaling refinements to supplementary libraries

This commit is contained in:
Jameson Ernst 2013-07-14 21:24:26 -07:00
parent 423ace8dd8
commit 51e907c959
3 changed files with 41 additions and 26 deletions

View File

@ -61,7 +61,7 @@ namespace SDL2
IMG_INIT_WEBP = 0x00000008 IMG_INIT_WEBP = 0x00000008
} }
public static void SDL_IMAGE_VERSION(ref SDL.SDL_version X) public static void SDL_IMAGE_VERSION(out SDL.SDL_version X)
{ {
X.major = SDL_IMAGE_MAJOR_VERSION; X.major = SDL_IMAGE_MAJOR_VERSION;
X.minor = SDL_IMAGE_MINOR_VERSION; X.minor = SDL_IMAGE_MINOR_VERSION;
@ -107,7 +107,10 @@ namespace SDL2
/* IntPtr refers to an SDL_Surface* */ /* IntPtr refers to an SDL_Surface* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr IMG_ReadXPMFromArray(ref char[] xpm); public static extern IntPtr IMG_ReadXPMFromArray(
[In()] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)]
string[] xpm
);
#endregion #endregion
} }

View File

@ -137,7 +137,7 @@ namespace SDL2
IntPtr b // void* IntPtr b // void*
); );
public static void SDL_MIXER_VERSION(ref SDL.SDL_version X) public static void SDL_MIXER_VERSION(out SDL.SDL_version X)
{ {
X.major = SDL_MIXER_MAJOR_VERSION; X.major = SDL_MIXER_MAJOR_VERSION;
X.minor = SDL_MIXER_MINOR_VERSION; X.minor = SDL_MIXER_MINOR_VERSION;
@ -205,11 +205,18 @@ namespace SDL2
/* IntPtr refers to a Mix_Chunk* */ /* IntPtr refers to a Mix_Chunk* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr Mix_QuickLoad_WAV(byte[] mem); public static extern IntPtr Mix_QuickLoad_WAV(
[In()] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1)]
byte[] mem
);
/* IntPtr refers to a Mix_Chunk* */ /* IntPtr refers to a Mix_Chunk* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Mix_Chunk Mix_QuickLoad_RAW(byte[] mem, uint len); public static extern Mix_Chunk Mix_QuickLoad_RAW(
[In()] [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 1)]
byte[] mem,
uint len
);
/* chunk refers to a Mix_Chunk* */ /* chunk refers to a Mix_Chunk* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]

View File

@ -66,7 +66,7 @@ namespace SDL2
public const int TTF_HINTING_MONO = 2; public const int TTF_HINTING_MONO = 2;
public const int TTF_HINTING_NONE = 3; public const int TTF_HINTING_NONE = 3;
public static void SDL_TTF_VERSION(ref SDL.SDL_version X) public static void SDL_TTF_VERSION(out SDL.SDL_version X)
{ {
X.major = SDL_TTF_MAJOR_VERSION; X.major = SDL_TTF_MAJOR_VERSION;
X.minor = SDL_TTF_MINOR_VERSION; X.minor = SDL_TTF_MINOR_VERSION;
@ -188,11 +188,11 @@ namespace SDL2
public static extern int TTF_GlyphMetrics( public static extern int TTF_GlyphMetrics(
IntPtr font, IntPtr font,
ushort ch, ushort ch,
ref int minx, out int minx,
ref int maxx, out int maxx,
ref int miny, out int miny,
ref int maxy, out int maxy,
ref int advance out int advance
); );
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
@ -201,8 +201,8 @@ namespace SDL2
IntPtr font, IntPtr font,
[In()] [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(LPUtf8StrMarshaler))] [In()] [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(LPUtf8StrMarshaler))]
string text, string text,
ref int w, out int w,
ref int h out int h
); );
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
@ -211,24 +211,25 @@ namespace SDL2
IntPtr font, IntPtr font,
[In()] [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(LPUtf8StrMarshaler))] [In()] [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(LPUtf8StrMarshaler))]
string text, string text,
ref int w, out int w,
ref int h out int h
); );
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_SizeUNICODE( public static extern int TTF_SizeUNICODE(
IntPtr font, IntPtr font,
ushort[] text, [In()] [MarshalAs(UnmanagedType.LPWStr)]
ref int w, string text,
ref int h out int w,
out int h
); );
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderText_Solid( public static extern IntPtr TTF_RenderText_Solid(
IntPtr font, IntPtr font,
[In()] [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(LPUtf8StrMarshaler))] [In()] [MarshalAs(UnmanagedType.LPStr)]
string text, string text,
SDL.SDL_Color fg SDL.SDL_Color fg
); );
@ -246,7 +247,8 @@ namespace SDL2
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderUNICODE_Solid( public static extern IntPtr TTF_RenderUNICODE_Solid(
IntPtr font, IntPtr font,
ushort[] text, [In()] [MarshalAs(UnmanagedType.LPWStr)]
string text,
SDL.SDL_Color fg SDL.SDL_Color fg
); );
@ -262,7 +264,7 @@ namespace SDL2
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderText_Shaded( public static extern IntPtr TTF_RenderText_Shaded(
IntPtr font, IntPtr font,
[In()] [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(LPUtf8StrMarshaler))] [In()] [MarshalAs(UnmanagedType.LPStr)]
string text, string text,
SDL.SDL_Color fg, SDL.SDL_Color fg,
SDL.SDL_Color bg SDL.SDL_Color bg
@ -282,7 +284,8 @@ namespace SDL2
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderUNICODE_Shaded( public static extern IntPtr TTF_RenderUNICODE_Shaded(
IntPtr font, IntPtr font,
ushort[] text, [In()] [MarshalAs(UnmanagedType.LPWStr)]
string text,
SDL.SDL_Color fg, SDL.SDL_Color fg,
SDL.SDL_Color bg SDL.SDL_Color bg
); );
@ -300,7 +303,7 @@ namespace SDL2
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderText_Blended( public static extern IntPtr TTF_RenderText_Blended(
IntPtr font, IntPtr font,
[In()] [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(LPUtf8StrMarshaler))] [In()] [MarshalAs(UnmanagedType.LPStr)]
string text, string text,
SDL.SDL_Color fg SDL.SDL_Color fg
); );
@ -318,7 +321,8 @@ namespace SDL2
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderUNICODE_Blended( public static extern IntPtr TTF_RenderUNICODE_Blended(
IntPtr font, IntPtr font,
ushort[] text, [In()] [MarshalAs(UnmanagedType.LPWStr)]
string text,
SDL.SDL_Color fg SDL.SDL_Color fg
); );
@ -326,7 +330,7 @@ namespace SDL2
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderText_Blended_Wrapped( public static extern IntPtr TTF_RenderText_Blended_Wrapped(
IntPtr font, IntPtr font,
[In()] [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(LPUtf8StrMarshaler))] [In()] [MarshalAs(UnmanagedType.LPStr)]
string text, string text,
SDL.SDL_Color fg, SDL.SDL_Color fg,
uint wrapped uint wrapped
@ -346,7 +350,8 @@ namespace SDL2
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderUNICODE_Blended_Wrapped( public static extern IntPtr TTF_RenderUNICODE_Blended_Wrapped(
IntPtr font, IntPtr font,
ushort[] text, [In()] [MarshalAs(UnmanagedType.LPWStr)]
string text,
SDL.SDL_Color fg, SDL.SDL_Color fg,
uint wrapped uint wrapped
); );