SDL 2.0.12 Update (#167)

* Add SDL_Metal APIs
* Added LockTextureToSurface functions
* Add SDL_HasARMSIMD and SDL_GameControllerType enum/functions
* Updated enum names, added missing macros, added new hints
* Added Get/SetPlayerIndex functions
* Standardize comment format
* Added SDL_Get/SetTextureScaleMode
* TTF updates
* Added IMG_Animation API to SDL_image
* SDL_mixer updates
* Add SDL_BLENDMODE_MUL
* Added hints and SDL_GetAndroidSDKVersion
This commit is contained in:
Caleb Cornett 2020-03-10 16:41:58 -04:00 committed by GitHub
parent 11064cc128
commit 8d0760016b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 964 additions and 314 deletions

File diff suppressed because it is too large Load diff

View file

@ -50,7 +50,7 @@ namespace SDL2
*/
public const int SDL_IMAGE_MAJOR_VERSION = 2;
public const int SDL_IMAGE_MINOR_VERSION = 0;
public const int SDL_IMAGE_PATCHLEVEL = 2;
public const int SDL_IMAGE_PATCHLEVEL = 6;
[Flags]
public enum IMG_InitFlags
@ -235,6 +235,54 @@ namespace SDL2
int quality
);
#region Animated Image Support
/* This region is only available in 2.0.6 or higher. */
public struct IMG_Animation
{
public int w;
public int h;
public IntPtr frames; /* SDL_Surface** */
public IntPtr delays; /* int* */
}
/* IntPtr refers to an IMG_Animation* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr IMG_LoadAnimation(
[In()] [MarshalAs(UnmanagedType.LPStr)]
string file
);
/* IntPtr refers to an IMG_Animation*, src to an SDL_RWops* */
/* THIS IS A PUBLIC RWops FUNCTION! */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr IMG_LoadAnimation_RW(
IntPtr src,
int freesrc
);
/* IntPtr refers to an IMG_Animation*, src to an SDL_RWops* */
/* THIS IS A PUBLIC RWops FUNCTION! */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr IMG_LoadAnimationTyped_RW(
IntPtr src,
int freesrc,
[In()] [MarshalAs(UnmanagedType.LPStr)]
string type
);
/* anim refers to an IMG_Animation* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void IMG_FreeAnimation(IntPtr anim);
/* IntPtr refers to an IMG_Animation*, src to an SDL_RWops* */
/* THIS IS A PUBLIC RWops FUNCTION! */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr IMG_LoadGIFAnimation_RW(IntPtr src);
#endregion
#endregion
}
}

View file

@ -50,7 +50,7 @@ namespace SDL2
*/
public const int SDL_MIXER_MAJOR_VERSION = 2;
public const int SDL_MIXER_MINOR_VERSION = 0;
public const int SDL_MIXER_PATCHLEVEL = 2;
public const int SDL_MIXER_PATCHLEVEL = 5;
/* In C, you can redefine this value before including SDL_mixer.h.
* We're not going to allow this in SDL2#, since the value of this
@ -58,7 +58,7 @@ namespace SDL2
*/
public const int MIX_CHANNELS = 8;
public static readonly int MIX_DEFAULT_FREQUENCY = 22050;
public static readonly int MIX_DEFAULT_FREQUENCY = 44100;
public static readonly ushort MIX_DEFAULT_FORMAT =
BitConverter.IsLittleEndian ? SDL.AUDIO_S16LSB : SDL.AUDIO_S16MSB;
public static readonly int MIX_DEFAULT_CHANNELS = 2;
@ -72,6 +72,15 @@ namespace SDL2
MIX_INIT_MP3 = 0x00000008,
MIX_INIT_OGG = 0x00000010,
MIX_INIT_MID = 0x00000020,
MIX_INIT_OPUS = 0x00000040
}
public struct MIX_Chunk
{
public int allocated;
public IntPtr abuf; /* Uint8* */
public uint alen;
public byte volume;
}
public enum Mix_Fading
@ -90,9 +99,10 @@ namespace SDL2
MUS_MID,
MUS_OGG,
MUS_MP3,
MUS_MP3_MAD,
MUS_MP3_MAD_UNUSED,
MUS_FLAC,
MUS_MODPLUG
MUS_MODPLUG_UNUSED,
MUS_OPUS
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
@ -249,6 +259,66 @@ namespace SDL2
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Mix_MusicType Mix_GetMusicType(IntPtr music);
/* music refers to a Mix_Music*
* Only available in 2.0.5 or higher.
*/
[DllImport(nativeLibName, EntryPoint = "Mix_GetMusicTitle", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr INTERNAL_Mix_GetMusicTitle(IntPtr music);
public static string Mix_GetMusicTitle(IntPtr music)
{
return SDL.UTF8_ToManaged(
INTERNAL_Mix_GetMusicTitle(music)
);
}
/* music refers to a Mix_Music*
* Only available in 2.0.5 or higher.
*/
[DllImport(nativeLibName, EntryPoint = "Mix_GetMusicTitleTag", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr INTERNAL_Mix_GetMusicTitleTag(IntPtr music);
public static string Mix_GetMusicTitleTag(IntPtr music)
{
return SDL.UTF8_ToManaged(
INTERNAL_Mix_GetMusicTitleTag(music)
);
}
/* music refers to a Mix_Music*
* Only available in 2.0.5 or higher.
*/
[DllImport(nativeLibName, EntryPoint = "Mix_GetMusicArtistTag", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr INTERNAL_Mix_GetMusicArtistTag(IntPtr music);
public static string Mix_GetMusicArtistTag(IntPtr music)
{
return SDL.UTF8_ToManaged(
INTERNAL_Mix_GetMusicArtistTag(music)
);
}
/* music refers to a Mix_Music*
* Only available in 2.0.5 or higher.
*/
[DllImport(nativeLibName, EntryPoint = "Mix_GetMusicAlbumTag", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr INTERNAL_Mix_GetMusicAlbumTag(IntPtr music);
public static string Mix_GetMusicAlbumTag(IntPtr music)
{
return SDL.UTF8_ToManaged(
INTERNAL_Mix_GetMusicAlbumTag(music)
);
}
/* music refers to a Mix_Music*
* Only available in 2.0.5 or higher.
*/
[DllImport(nativeLibName, EntryPoint = "Mix_GetMusicCopyrightTag", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr INTERNAL_Mix_GetMusicCopyrightTag(IntPtr music);
public static string Mix_GetMusicCopyrightTag(IntPtr music)
{
return SDL.UTF8_ToManaged(
INTERNAL_Mix_GetMusicCopyrightTag(music)
);
}
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Mix_SetPostMix(
MixFuncDelegate mix_func,
@ -405,6 +475,12 @@ namespace SDL2
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_VolumeMusic(int volume);
/* music refers to a Mix_Music*
* Only available in 2.0.5 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_GetVolumeMusicStream(IntPtr music);
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_HaltChannel(int channel);
@ -456,6 +532,36 @@ namespace SDL2
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_SetMusicPosition(double position);
/* music refers to a Mix_Music*
* Only available in 2.0.5 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern double Mix_GetMusicPosition(IntPtr music);
/* music refers to a Mix_Music*
* Only available in 2.0.5 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern double Mix_MusicDuration(IntPtr music);
/* music refers to a Mix_Music*
* Only available in 2.0.5 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern double Mix_GetMusicLoopStartTime(IntPtr music);
/* music refers to a Mix_Music*
* Only available in 2.0.5 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern double Mix_GetMusicLoopEndTime(IntPtr music);
/* music refers to a Mix_Music*
* Only available in 2.0.5 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern double Mix_GetMusicLoopLengthTime(IntPtr music);
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_Playing(int channel);
@ -494,7 +600,9 @@ namespace SDL2
private static extern IntPtr INTERNAL_Mix_GetSoundFonts();
public static string Mix_GetSoundFonts()
{
return SDL.UTF8_ToManaged(INTERNAL_Mix_GetSoundFonts());
return SDL.UTF8_ToManaged(
INTERNAL_Mix_GetSoundFonts()
);
}
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@ -503,6 +611,23 @@ namespace SDL2
IntPtr data // void*
);
/* Only available in 2.0.5 or later. */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Mix_SetTimidityCfg(
[In()] [MarshalAs(UnmanagedType.LPStr)]
string path
);
/* Only available in 2.0.5 or later. */
[DllImport(nativeLibName, EntryPoint = "Mix_GetTimidityCfg", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr INTERNAL_Mix_GetTimidityCfg();
public static string Mix_GetTimidityCfg()
{
return SDL.UTF8_ToManaged(
INTERNAL_Mix_GetTimidityCfg()
);
}
/* IntPtr refers to a Mix_Chunk* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr Mix_GetChunk(int channel);

View file

@ -50,7 +50,7 @@ namespace SDL2
*/
public const int SDL_TTF_MAJOR_VERSION = 2;
public const int SDL_TTF_MINOR_VERSION = 0;
public const int SDL_TTF_PATCHLEVEL = 12;
public const int SDL_TTF_PATCHLEVEL = 16;
public const int UNICODE_BOM_NATIVE = 0xFEFF;
public const int UNICODE_BOM_SWAPPED = 0xFFFE;
@ -61,10 +61,11 @@ namespace SDL2
public const int TTF_STYLE_UNDERLINE = 0x04;
public const int TTF_STYLE_STRIKETHROUGH = 0x08;
public const int TTF_HINTING_NORMAL = 0;
public const int TTF_HINTING_LIGHT = 1;
public const int TTF_HINTING_MONO = 2;
public const int TTF_HINTING_NONE = 3;
public const int TTF_HINTING_NORMAL = 0;
public const int TTF_HINTING_LIGHT = 1;
public const int TTF_HINTING_MONO = 2;
public const int TTF_HINTING_NONE = 3;
public const int TTF_HINTING_LIGHT_SUBPIXEL = 4; /* >= 2.0.16 */
public static void SDL_TTF_VERSION(out SDL.SDL_version X)
{
@ -144,6 +145,15 @@ namespace SDL2
long index
);
/* font refers to a TTF_Font*
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_SetFontSize(
IntPtr font,
int ptsize
);
/* font refers to a TTF_Font* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_GetFontStyle(IntPtr font);
@ -228,6 +238,12 @@ namespace SDL2
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_GlyphIsProvided(IntPtr font, ushort ch);
/* font refers to a TTF_Font*
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_GlyphIsProvided32(IntPtr font, uint ch);
/* font refers to a TTF_Font* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_GlyphMetrics(
@ -240,6 +256,20 @@ namespace SDL2
out int advance
);
/* font refers to a TTF_Font*
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_GlyphMetrics32(
IntPtr font,
uint ch,
out int minx,
out int maxx,
out int miny,
out int maxy,
out int advance
);
/* font refers to a TTF_Font* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_SizeText(
@ -282,6 +312,59 @@ namespace SDL2
out int h
);
/* font refers to a TTF_Font*
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_MeasureText(
IntPtr font,
[In()] [MarshalAs(UnmanagedType.LPStr)]
string text,
int measure_width,
out int extent,
out int count
);
/* font refers to a TTF_Font*
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, EntryPoint = "TTF_MeasureUTF8", CallingConvention = CallingConvention.Cdecl)]
public static extern int INTERNAL_TTF_MeasureUTF8(
IntPtr font,
byte[] text,
int measure_width,
out int extent,
out int count
);
public static int TTF_MeasureUTF8(
IntPtr font,
string text,
int measure_width,
out int extent,
out int count
) {
return INTERNAL_TTF_MeasureUTF8(
font,
SDL.UTF8_ToNative(text),
measure_width,
out extent,
out count
);
}
/* font refers to a TTF_Font*
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_MeasureUNICODE(
IntPtr font,
[In()] [MarshalAs(UnmanagedType.LPWStr)]
string text,
int measure_width,
out int extent,
out int count
);
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderText_Solid(
@ -319,6 +402,54 @@ namespace SDL2
SDL.SDL_Color fg
);
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font*
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderText_Solid_Wrapped(
IntPtr font,
[In()] [MarshalAs(UnmanagedType.LPStr)]
string text,
SDL.SDL_Color fg,
uint wrapLength
);
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font*
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Solid_Wrapped", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr INTERNAL_TTF_RenderUTF8_Solid_Wrapped(
IntPtr font,
byte[] text,
SDL.SDL_Color fg,
uint wrapLength
);
public static IntPtr TTF_RenderUTF8_Solid_Wrapped(
IntPtr font,
string text,
SDL.SDL_Color fg,
uint wrapLength
) {
return INTERNAL_TTF_RenderUTF8_Solid_Wrapped(
font,
SDL.UTF8_ToNative(text),
fg,
wrapLength
);
}
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font*
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderUNICODE_Solid_Wrapped(
IntPtr font,
[In()] [MarshalAs(UnmanagedType.LPWStr)]
string text,
SDL.SDL_Color fg,
uint wrapLength
);
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderGlyph_Solid(
@ -327,6 +458,16 @@ namespace SDL2
SDL.SDL_Color fg
);
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font*
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderGlyph32_Solid(
IntPtr font,
uint ch,
SDL.SDL_Color fg
);
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderText_Shaded(
@ -369,6 +510,55 @@ namespace SDL2
SDL.SDL_Color bg
);
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderText_Shaded_Wrapped(
IntPtr font,
[In()] [MarshalAs(UnmanagedType.LPStr)]
string text,
SDL.SDL_Color fg,
SDL.SDL_Color bg,
uint wrapLength
);
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font*
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Shaded_Wrapped", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr INTERNAL_TTF_RenderUTF8_Shaded_Wrapped(
IntPtr font,
byte[] text,
SDL.SDL_Color fg,
SDL.SDL_Color bg,
uint wrapLength
);
public static IntPtr TTF_RenderUTF8_Shaded_Wrapped(
IntPtr font,
string text,
SDL.SDL_Color fg,
SDL.SDL_Color bg,
uint wrapLength
) {
return INTERNAL_TTF_RenderUTF8_Shaded_Wrapped(
font,
SDL.UTF8_ToNative(text),
fg,
bg,
wrapLength
);
}
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderUNICODE_Shaded_Wrapped(
IntPtr font,
[In()] [MarshalAs(UnmanagedType.LPWStr)]
string text,
SDL.SDL_Color fg,
SDL.SDL_Color bg,
uint wrapLength
);
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderGlyph_Shaded(
@ -378,6 +568,17 @@ namespace SDL2
SDL.SDL_Color bg
);
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font*
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderGlyph32_Shaded(
IntPtr font,
uint ch,
SDL.SDL_Color fg,
SDL.SDL_Color bg
);
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderText_Blended(
@ -465,6 +666,24 @@ namespace SDL2
SDL.SDL_Color fg
);
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font*
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr TTF_RenderGlyph32_Blended(
IntPtr font,
uint ch,
SDL.SDL_Color fg
);
/* Only available in 2.0.16 or higher. */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_SetDirection(int direction);
/* Only available in 2.0.16 or higher. */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_SetScript(int script);
/* font refers to a TTF_Font* */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void TTF_CloseFont(IntPtr font);
@ -483,6 +702,26 @@ namespace SDL2
int index
);
/* font refers to a TTF_Font*
* Only available in 2.0.15 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_GetFontKerningSizeGlyphs(
IntPtr font,
ushort previous_ch,
ushort ch
);
/* font refers to a TTF_Font*
* Only available in 2.0.16 or higher.
*/
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TTF_GetFontKerningSizeGlyphs32(
IntPtr font,
ushort previous_ch,
ushort ch
);
#endregion
}
}