SDL2 compatibility fixes.

This commit is contained in:
Ethan Lee 2013-04-17 18:08:38 -04:00
parent 2a2bdc2884
commit 5440f8ad22
4 changed files with 469 additions and 460 deletions

File diff suppressed because it is too large Load Diff

View File

@ -53,7 +53,7 @@ namespace SDL2
IMG_INIT_WEBP = 0x00000008 IMG_INIT_WEBP = 0x00000008
} }
[DllImport(nativeLibName, EntryPoint = "IMG_LinkedVersion")] [DllImport(nativeLibName, EntryPoint = "IMG_LinkedVersion", CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr INTERNAL_IMG_LinkedVersion(); private static extern IntPtr INTERNAL_IMG_LinkedVersion();
public static SDL.SDL_version IMG_LinkedVersion() public static SDL.SDL_version IMG_LinkedVersion()
{ {
@ -61,37 +61,37 @@ namespace SDL2
IntPtr result_ptr = INTERNAL_IMG_LinkedVersion(); IntPtr result_ptr = INTERNAL_IMG_LinkedVersion();
result = (SDL.SDL_version) Marshal.PtrToStructure( result = (SDL.SDL_version) Marshal.PtrToStructure(
result_ptr, result_ptr,
result.GetType() typeof(SDL.SDL_version)
); );
return result; return result;
} }
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int IMG_Init(IMG_InitFlags flags); public static extern int IMG_Init(IMG_InitFlags flags);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void IMG_Quit(); public static extern void IMG_Quit();
/* IntPtr refers to an SDL_Surface* */ /* IntPtr refers to an SDL_Surface* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr IMG_Load( public static extern IntPtr IMG_Load(
[In()] [MarshalAs(UnmanagedType.LPStr)] [In()] [MarshalAs(UnmanagedType.LPStr)]
string file string file
); );
/* IntPtr refers to an SDL_Texture*, renderer to an SDL_Renderer* */ /* IntPtr refers to an SDL_Texture*, renderer to an SDL_Renderer* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr IMG_LoadTexture( public static extern IntPtr IMG_LoadTexture(
IntPtr renderer, IntPtr renderer,
[In()] [MarshalAs(UnmanagedType.LPStr)] [In()] [MarshalAs(UnmanagedType.LPStr)]
string file string file
); );
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int IMG_InvertAlpha(int on); public static extern int IMG_InvertAlpha(int on);
/* IntPtr refers to an SDL_Surface* */ /* IntPtr refers to an SDL_Surface* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr IMG_ReadXPMFromArray(ref char[] xpm); public static extern IntPtr IMG_ReadXPMFromArray(ref char[] xpm);
#endregion #endregion

View File

@ -96,12 +96,14 @@ namespace SDL2
public byte volume; public byte volume;
} }
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void MixFuncDelegate( public delegate void MixFuncDelegate(
IntPtr udata, // void* IntPtr udata, // void*
IntPtr stream, // Uint8* IntPtr stream, // Uint8*
int len int len
); );
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void Mix_EffectFunc_t( public delegate void Mix_EffectFunc_t(
int chan, int chan,
IntPtr stream, // void* IntPtr stream, // void*
@ -109,21 +111,25 @@ namespace SDL2
IntPtr udata // void* IntPtr udata // void*
); );
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void Mix_EffectDone_t( public delegate void Mix_EffectDone_t(
int chan, int chan,
IntPtr udata // void* IntPtr udata // void*
); );
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void MusicFinishedDelegate(); public delegate void MusicFinishedDelegate();
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void ChannelFinishedDelegate(int channel); public delegate void ChannelFinishedDelegate(int channel);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int SoundFontDelegate( public delegate int SoundFontDelegate(
IntPtr a, // const char* IntPtr a, // const char*
IntPtr b // void* IntPtr b // void*
); );
[DllImport(nativeLibName, EntryPoint = "MIX_Linked_Version")] [DllImport(nativeLibName, EntryPoint = "MIX_Linked_Version", CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr INTERNAL_MIX_Linked_Version(); private static extern IntPtr INTERNAL_MIX_Linked_Version();
public static SDL.SDL_version MIX_Linked_Version() public static SDL.SDL_version MIX_Linked_Version()
{ {
@ -131,18 +137,18 @@ namespace SDL2
IntPtr result_ptr = INTERNAL_MIX_Linked_Version(); IntPtr result_ptr = INTERNAL_MIX_Linked_Version();
result = (SDL.SDL_version) Marshal.PtrToStructure( result = (SDL.SDL_version) Marshal.PtrToStructure(
result_ptr, result_ptr,
result.GetType() typeof(SDL.SDL_version)
); );
return result; return result;
} }
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_Init(MIX_InitFlags flags); public static extern int Mix_Init(MIX_InitFlags flags);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Mix_Quit(); public static extern void Mix_Quit();
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_OpenAudio( public static extern int Mix_OpenAudio(
int frequency, int frequency,
ushort format, ushort format,
@ -150,10 +156,10 @@ namespace SDL2
int chunksize int chunksize
); );
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_AllocateChannels(int numchans); public static extern int Mix_AllocateChannels(int numchans);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_QuerySpec( public static extern int Mix_QuerySpec(
ref int frequency, ref int frequency,
ref ushort format, ref ushort format,
@ -164,7 +170,7 @@ namespace SDL2
* THIS IS AN RWops FUNCTION! * THIS IS AN RWops FUNCTION!
*/ */
/* IntPtr refers to a Mix_Chunk* */ /* IntPtr refers to a Mix_Chunk* */
[DllImport(nativeLibName, EntryPoint = "Mix_LoadWAV_RW")] [DllImport(nativeLibName, EntryPoint = "Mix_LoadWAV_RW", CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr INTERNAL_Mix_LoadWAV_RW( private static extern IntPtr INTERNAL_Mix_LoadWAV_RW(
IntPtr src, IntPtr src,
int freesrc int freesrc
@ -176,32 +182,32 @@ namespace SDL2
} }
/* IntPtr refers to a Mix_Music* */ /* IntPtr refers to a Mix_Music* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr Mix_LoadMUS( public static extern IntPtr Mix_LoadMUS(
[In()] [MarshalAs(UnmanagedType.LPStr)] [In()] [MarshalAs(UnmanagedType.LPStr)]
string file string file
); );
/* IntPtr refers to a Mix_Chunk* */ /* IntPtr refers to a Mix_Chunk* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr Mix_QuickLoad_WAV(byte[] mem); public static extern IntPtr Mix_QuickLoad_WAV(byte[] mem);
/* IntPtr refers to a Mix_Chunk* */ /* IntPtr refers to a Mix_Chunk* */
[DllImport(nativeLibName)] [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(byte[] mem, uint len);
/* chunk refers to a Mix_Chunk* */ /* chunk refers to a Mix_Chunk* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Mix_FreeChunk(IntPtr chunk); public static extern void Mix_FreeChunk(IntPtr chunk);
/* music refers to a Mix_Music* */ /* music refers to a Mix_Music* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Mix_FreeMusic(IntPtr music); public static extern void Mix_FreeMusic(IntPtr music);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_GetNumChunkDecoders(); public static extern int Mix_GetNumChunkDecoders();
[DllImport(nativeLibName, EntryPoint = "Mix_GetChunkDecoder")] [DllImport(nativeLibName, EntryPoint = "Mix_GetChunkDecoder", CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr INTERNAL_Mix_GetChunkDecoder(int index); private static extern IntPtr INTERNAL_Mix_GetChunkDecoder(int index);
public static string Mix_GetChunkDecoder(int index) public static string Mix_GetChunkDecoder(int index)
{ {
@ -210,10 +216,10 @@ namespace SDL2
); );
} }
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_GetNumMusicDecoders(); public static extern int Mix_GetNumMusicDecoders();
[DllImport(nativeLibName, EntryPoint = "Mix_GetMusicDecoder")] [DllImport(nativeLibName, EntryPoint = "Mix_GetMusicDecoder", CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr INTERNAL_Mix_GetMusicDecoder(int index); private static extern IntPtr INTERNAL_Mix_GetMusicDecoder(int index);
public static string Mix_GetMusicDecoder(int index) public static string Mix_GetMusicDecoder(int index)
{ {
@ -223,36 +229,36 @@ namespace SDL2
} }
/* music refers to a Mix_Music* */ /* music refers to a Mix_Music* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Mix_MusicType Mix_GetMusicType(IntPtr music); public static extern Mix_MusicType Mix_GetMusicType(IntPtr music);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Mix_SetPostMix( public static extern void Mix_SetPostMix(
MixFuncDelegate mix_func, MixFuncDelegate mix_func,
IntPtr arg // void* IntPtr arg // void*
); );
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Mix_HookMusic( public static extern void Mix_HookMusic(
MixFuncDelegate mix_func, MixFuncDelegate mix_func,
IntPtr arg // void* IntPtr arg // void*
); );
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Mix_HookMusicFinished( public static extern void Mix_HookMusicFinished(
MusicFinishedDelegate music_finished MusicFinishedDelegate music_finished
); );
/* IntPtr refers to a void* */ /* IntPtr refers to a void* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr Mix_GetMusicHookData(); public static extern IntPtr Mix_GetMusicHookData();
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Mix_ChannelFinished( public static extern void Mix_ChannelFinished(
ChannelFinishedDelegate channel_finished ChannelFinishedDelegate channel_finished
); );
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_RegisterEffect( public static extern int Mix_RegisterEffect(
int chan, int chan,
Mix_EffectFunc_t f, Mix_EffectFunc_t f,
@ -260,54 +266,54 @@ namespace SDL2
IntPtr arg // void* IntPtr arg // void*
); );
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_UnregisterEffect( public static extern int Mix_UnregisterEffect(
int channel, int channel,
Mix_EffectFunc_t f Mix_EffectFunc_t f
); );
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_UnregisterAllEffects(int channel); public static extern int Mix_UnregisterAllEffects(int channel);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_SetPanning( public static extern int Mix_SetPanning(
int channel, int channel,
byte left, byte left,
byte right byte right
); );
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_SetPosition( public static extern int Mix_SetPosition(
int channel, int channel,
short angle, short angle,
byte distance byte distance
); );
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_SetDistance(int channel, byte distance); public static extern int Mix_SetDistance(int channel, byte distance);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_SetReverseStereo(int channel, int flip); public static extern int Mix_SetReverseStereo(int channel, int flip);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_ReserveChannels(int num); public static extern int Mix_ReserveChannels(int num);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_GroupChannel(int which, int tag); public static extern int Mix_GroupChannel(int which, int tag);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_GroupChannels(int from, int to, int tag); public static extern int Mix_GroupChannels(int from, int to, int tag);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_GroupAvailable(int tag); public static extern int Mix_GroupAvailable(int tag);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_GroupCount(int tag); public static extern int Mix_GroupCount(int tag);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_GroupOldest(int tag); public static extern int Mix_GroupOldest(int tag);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_GroupNewer(int tag); public static extern int Mix_GroupNewer(int tag);
/* chunk refers to a Mix_Chunk* */ /* chunk refers to a Mix_Chunk* */
@ -320,7 +326,7 @@ namespace SDL2
} }
/* chunk refers to a Mix_Chunk* */ /* chunk refers to a Mix_Chunk* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_PlayChannelTimed( public static extern int Mix_PlayChannelTimed(
int channel, int channel,
IntPtr chunk, IntPtr chunk,
@ -329,11 +335,11 @@ namespace SDL2
); );
/* music refers to a Mix_Music* */ /* music refers to a Mix_Music* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_PlayMusic(IntPtr music, int loops); public static extern int Mix_PlayMusic(IntPtr music, int loops);
/* music refers to a Mix_Music* */ /* music refers to a Mix_Music* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_FadeInMusic( public static extern int Mix_FadeInMusic(
IntPtr music, IntPtr music,
int loops, int loops,
@ -341,7 +347,7 @@ namespace SDL2
); );
/* music refers to a Mix_Music* */ /* music refers to a Mix_Music* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_FadeInMusicPos( public static extern int Mix_FadeInMusicPos(
IntPtr music, IntPtr music,
int loops, int loops,
@ -360,7 +366,7 @@ namespace SDL2
} }
/* chunk refers to a Mix_Chunk* */ /* chunk refers to a Mix_Chunk* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_FadeInChannelTimed( public static extern int Mix_FadeInChannelTimed(
int channel, int channel,
IntPtr chunk, IntPtr chunk,
@ -369,112 +375,112 @@ namespace SDL2
int ticks int ticks
); );
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_Volume(int channel, int volume); public static extern int Mix_Volume(int channel, int volume);
/* chunk refers to a Mix_Chunk* */ /* chunk refers to a Mix_Chunk* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_VolumeChunk( public static extern int Mix_VolumeChunk(
IntPtr chunk, IntPtr chunk,
int volume int volume
); );
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_VolumeMusic(int volume); public static extern int Mix_VolumeMusic(int volume);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_HaltChannel(int channel); public static extern int Mix_HaltChannel(int channel);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_HaltGroup(int tag); public static extern int Mix_HaltGroup(int tag);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_HaltMusic(); public static extern int Mix_HaltMusic();
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_ExpireChannel(int channel, int ticks); public static extern int Mix_ExpireChannel(int channel, int ticks);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_FadeOutChannel(int which, int ms); public static extern int Mix_FadeOutChannel(int which, int ms);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_FadeOutGroup(int tag, int ms); public static extern int Mix_FadeOutGroup(int tag, int ms);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_FadeOutMusic(int ms); public static extern int Mix_FadeOutMusic(int ms);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Mix_Fading Mix_FadingMusic(); public static extern Mix_Fading Mix_FadingMusic();
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Mix_Fading Mix_FadingChannel(int which); public static extern Mix_Fading Mix_FadingChannel(int which);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Mix_Pause(int channel); public static extern void Mix_Pause(int channel);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Mix_Resume(int channel); public static extern void Mix_Resume(int channel);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_Paused(int channel); public static extern int Mix_Paused(int channel);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Mix_PauseMusic(); public static extern void Mix_PauseMusic();
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Mix_ResumeMusic(); public static extern void Mix_ResumeMusic();
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Mix_RewindMusic(); public static extern void Mix_RewindMusic();
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_PausedMusic(); public static extern int Mix_PausedMusic();
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_SetMusicPosition(double position); public static extern int Mix_SetMusicPosition(double position);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_Playing(int channel); public static extern int Mix_Playing(int channel);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_PlayingMusic(); public static extern int Mix_PlayingMusic();
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_SetMusicCMD( public static extern int Mix_SetMusicCMD(
[In()] [MarshalAs(UnmanagedType.LPStr)] [In()] [MarshalAs(UnmanagedType.LPStr)]
string command string command
); );
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_SetSynchroValue(int value); public static extern int Mix_SetSynchroValue(int value);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_GetSynchroValue(); public static extern int Mix_GetSynchroValue();
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_SetSoundFonts( public static extern int Mix_SetSoundFonts(
[In()] [MarshalAs(UnmanagedType.LPStr)] [In()] [MarshalAs(UnmanagedType.LPStr)]
string paths string paths
); );
[DllImport(nativeLibName, EntryPoint = "Mix_GetSoundFonts")] [DllImport(nativeLibName, EntryPoint = "Mix_GetSoundFonts", CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr INTERNAL_Mix_GetSoundFonts(); private static extern IntPtr INTERNAL_Mix_GetSoundFonts();
public static string Mix_GetSoundFonts() public static string Mix_GetSoundFonts()
{ {
return Marshal.PtrToStringAnsi(INTERNAL_Mix_GetSoundFonts()); return Marshal.PtrToStringAnsi(INTERNAL_Mix_GetSoundFonts());
} }
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_EachSoundFont( public static extern int Mix_EachSoundFont(
SoundFontDelegate function, SoundFontDelegate function,
IntPtr data // void* IntPtr data // void*
); );
/* IntPtr refers to a Mix_Chunk* */ /* IntPtr refers to a Mix_Chunk* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr Mix_GetChunk(int channel); public static extern IntPtr Mix_GetChunk(int channel);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Mix_CloseAudio(); public static extern void Mix_CloseAudio();
#endregion #endregion

View File

@ -58,7 +58,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;
[DllImport(nativeLibName, EntryPoint = "TTF_LinkedVersion")] [DllImport(nativeLibName, EntryPoint = "TTF_LinkedVersion", CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr INTERNAL_TTF_LinkedVersion(); private static extern IntPtr INTERNAL_TTF_LinkedVersion();
public static SDL.SDL_version TTF_LinkedVersion() public static SDL.SDL_version TTF_LinkedVersion()
{ {
@ -66,19 +66,19 @@ namespace SDL2
IntPtr result_ptr = INTERNAL_TTF_LinkedVersion(); IntPtr result_ptr = INTERNAL_TTF_LinkedVersion();
result = (SDL.SDL_version) Marshal.PtrToStructure( result = (SDL.SDL_version) Marshal.PtrToStructure(
result_ptr, result_ptr,
result.GetType() typeof(SDL.SDL_version)
); );
return result; return result;
} }
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void TTF_ByteSwappedUNICODE(int swapped); public static extern void TTF_ByteSwappedUNICODE(int swapped);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_Init(); public static extern int TTF_Init();
/* IntPtr refers to a TTF_Font* */ /* IntPtr refers to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_OpenFont( public static extern IntPtr TTF_OpenFont(
[In()] [MarshalAs(UnmanagedType.LPStr)] [In()] [MarshalAs(UnmanagedType.LPStr)]
string file, string file,
@ -86,7 +86,7 @@ namespace SDL2
); );
/* IntPtr refers to a TTF_Font* */ /* IntPtr refers to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_OpenFontIndex( public static extern IntPtr TTF_OpenFontIndex(
[In()] [MarshalAs(UnmanagedType.LPStr)] [In()] [MarshalAs(UnmanagedType.LPStr)]
string file, string file,
@ -95,63 +95,63 @@ namespace SDL2
); );
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_GetFontStyle(IntPtr font); public static extern int TTF_GetFontStyle(IntPtr font);
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void TTF_SetFontStyle(IntPtr font, int style); public static extern void TTF_SetFontStyle(IntPtr font, int style);
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_GetFontOutline(IntPtr font); public static extern int TTF_GetFontOutline(IntPtr font);
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void TTF_SetFontOutline(IntPtr font, int outline); public static extern void TTF_SetFontOutline(IntPtr font, int outline);
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_GetFontHinting(IntPtr font); public static extern int TTF_GetFontHinting(IntPtr font);
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void TTF_SetFontHinting(IntPtr font, int hinting); public static extern void TTF_SetFontHinting(IntPtr font, int hinting);
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_FontHeight(IntPtr font); public static extern int TTF_FontHeight(IntPtr font);
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_FontAscent(IntPtr font); public static extern int TTF_FontAscent(IntPtr font);
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_FontDescent(IntPtr font); public static extern int TTF_FontDescent(IntPtr font);
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_FontLineSkip(IntPtr font); public static extern int TTF_FontLineSkip(IntPtr font);
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_GetFontKerning(IntPtr font); public static extern int TTF_GetFontKerning(IntPtr font);
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void TTF_SetFontKerning(IntPtr font, int allowed); public static extern void TTF_SetFontKerning(IntPtr font, int allowed);
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern long TTF_FontFaces(IntPtr font); public static extern long TTF_FontFaces(IntPtr font);
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_FontFaceIsFixedWidth(IntPtr font); public static extern int TTF_FontFaceIsFixedWidth(IntPtr font);
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName, EntryPoint = "TTF_FontFaceFamilyName")] [DllImport(nativeLibName, EntryPoint = "TTF_FontFaceFamilyName", CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr INTERNAL_TTF_FontFaceFamilyName( private static extern IntPtr INTERNAL_TTF_FontFaceFamilyName(
IntPtr font IntPtr font
); );
@ -163,7 +163,7 @@ namespace SDL2
} }
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName, EntryPoint = "TTF_FontFaceStyleName")] [DllImport(nativeLibName, EntryPoint = "TTF_FontFaceStyleName", CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr INTERNAL_TTF_FontFaceStyleName( private static extern IntPtr INTERNAL_TTF_FontFaceStyleName(
IntPtr font IntPtr font
); );
@ -175,11 +175,11 @@ namespace SDL2
} }
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_GlyphIsProvided(IntPtr font, ushort ch); public static extern int TTF_GlyphIsProvided(IntPtr font, ushort ch);
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_GlyphMetrics( public static extern int TTF_GlyphMetrics(
IntPtr font, IntPtr font,
ushort ch, ushort ch,
@ -191,7 +191,7 @@ namespace SDL2
); );
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_SizeText( public static extern int TTF_SizeText(
IntPtr font, IntPtr font,
[In()] [MarshalAs(UnmanagedType.LPStr)] [In()] [MarshalAs(UnmanagedType.LPStr)]
@ -201,7 +201,7 @@ namespace SDL2
); );
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_SizeUTF8( public static extern int TTF_SizeUTF8(
IntPtr font, IntPtr font,
[In()] [MarshalAs(UnmanagedType.LPStr)] [In()] [MarshalAs(UnmanagedType.LPStr)]
@ -211,7 +211,7 @@ namespace SDL2
); );
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_SizeUNICODE( public static extern int TTF_SizeUNICODE(
IntPtr font, IntPtr font,
ushort[] text, ushort[] text,
@ -220,7 +220,7 @@ namespace SDL2
); );
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
[DllImport(nativeLibName)] [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.LPStr)] [In()] [MarshalAs(UnmanagedType.LPStr)]
@ -229,7 +229,7 @@ namespace SDL2
); );
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderUTF8_Solid( public static extern IntPtr TTF_RenderUTF8_Solid(
IntPtr font, IntPtr font,
[In()] [MarshalAs(UnmanagedType.LPStr)] [In()] [MarshalAs(UnmanagedType.LPStr)]
@ -238,7 +238,7 @@ namespace SDL2
); );
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
[DllImport(nativeLibName)] [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, ushort[] text,
@ -246,7 +246,7 @@ namespace SDL2
); );
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderGlyph_Solid( public static extern IntPtr TTF_RenderGlyph_Solid(
IntPtr font, IntPtr font,
ushort ch, ushort ch,
@ -254,7 +254,7 @@ namespace SDL2
); );
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
[DllImport(nativeLibName)] [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.LPStr)] [In()] [MarshalAs(UnmanagedType.LPStr)]
@ -264,7 +264,7 @@ namespace SDL2
); );
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderUTF8_Shaded( public static extern IntPtr TTF_RenderUTF8_Shaded(
IntPtr font, IntPtr font,
[In()] [MarshalAs(UnmanagedType.LPStr)] [In()] [MarshalAs(UnmanagedType.LPStr)]
@ -274,7 +274,7 @@ namespace SDL2
); );
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
[DllImport(nativeLibName)] [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, ushort[] text,
@ -283,7 +283,7 @@ namespace SDL2
); );
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderGlyph_Shaded( public static extern IntPtr TTF_RenderGlyph_Shaded(
IntPtr font, IntPtr font,
ushort ch, ushort ch,
@ -292,7 +292,7 @@ namespace SDL2
); );
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
[DllImport(nativeLibName)] [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.LPStr)] [In()] [MarshalAs(UnmanagedType.LPStr)]
@ -301,7 +301,7 @@ namespace SDL2
); );
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderUTF8_Blended( public static extern IntPtr TTF_RenderUTF8_Blended(
IntPtr font, IntPtr font,
[In()] [MarshalAs(UnmanagedType.LPStr)] [In()] [MarshalAs(UnmanagedType.LPStr)]
@ -310,7 +310,7 @@ namespace SDL2
); );
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
[DllImport(nativeLibName)] [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, ushort[] text,
@ -318,7 +318,7 @@ namespace SDL2
); );
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
[DllImport(nativeLibName)] [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.LPStr)] [In()] [MarshalAs(UnmanagedType.LPStr)]
@ -328,7 +328,7 @@ namespace SDL2
); );
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderUTF8_Blended_Wrapped( public static extern IntPtr TTF_RenderUTF8_Blended_Wrapped(
IntPtr font, IntPtr font,
[In()] [MarshalAs(UnmanagedType.LPStr)] [In()] [MarshalAs(UnmanagedType.LPStr)]
@ -338,7 +338,7 @@ namespace SDL2
); );
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
[DllImport(nativeLibName)] [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, ushort[] text,
@ -347,7 +347,7 @@ namespace SDL2
); );
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ /* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderGlyph_Blended( public static extern IntPtr TTF_RenderGlyph_Blended(
IntPtr font, IntPtr font,
ushort ch, ushort ch,
@ -355,17 +355,17 @@ namespace SDL2
); );
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void TTF_CloseFont(IntPtr font); public static extern void TTF_CloseFont(IntPtr font);
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void TTF_Quit(); public static extern void TTF_Quit();
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_WasInit(); public static extern int TTF_WasInit();
/* font refers to a TTF_Font* */ /* font refers to a TTF_Font* */
[DllImport(nativeLibName)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int SDL_GetFontKerningSize( public static extern int SDL_GetFontKerningSize(
IntPtr font, IntPtr font,
int prev_index, int prev_index,