mirror of
https://github.com/Ryujinx/SDL2-CS.git
synced 2025-03-04 18:59:45 +00:00
Minor style fixes, UTF8 update for mixer/ttf
This commit is contained in:
parent
040d39b4a5
commit
c782115e7f
49
src/SDL2.cs
49
src/SDL2.cs
|
@ -85,7 +85,7 @@ namespace SDL2
|
||||||
{
|
{
|
||||||
Debug.Assert(str != null);
|
Debug.Assert(str != null);
|
||||||
int bufferSize = Utf8Size(str);
|
int bufferSize = Utf8Size(str);
|
||||||
byte* buffer = (byte*)Marshal.AllocHGlobal(bufferSize);
|
byte* buffer = (byte*) Marshal.AllocHGlobal(bufferSize);
|
||||||
fixed (char* strPtr = str)
|
fixed (char* strPtr = str)
|
||||||
{
|
{
|
||||||
Encoding.UTF8.GetBytes(strPtr, str.Length + 1, buffer, bufferSize);
|
Encoding.UTF8.GetBytes(strPtr, str.Length + 1, buffer, bufferSize);
|
||||||
|
@ -95,16 +95,21 @@ namespace SDL2
|
||||||
internal static unsafe byte* Utf8EncodeNullable(string str)
|
internal static unsafe byte* Utf8EncodeNullable(string str)
|
||||||
{
|
{
|
||||||
int bufferSize = Utf8SizeNullable(str);
|
int bufferSize = Utf8SizeNullable(str);
|
||||||
byte* buffer = (byte*)Marshal.AllocHGlobal(bufferSize);
|
byte* buffer = (byte*) Marshal.AllocHGlobal(bufferSize);
|
||||||
fixed (char* strPtr = str)
|
fixed (char* strPtr = str)
|
||||||
{
|
{
|
||||||
Encoding.UTF8.GetBytes(strPtr, str != null ? str.Length + 1 : 0, buffer, bufferSize);
|
Encoding.UTF8.GetBytes(
|
||||||
|
strPtr,
|
||||||
|
(str != null) ? (str.Length + 1) : 0,
|
||||||
|
buffer,
|
||||||
|
bufferSize
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is public because SDL_DropEvent needs it! */
|
/* This is public because SDL_DropEvent needs it! */
|
||||||
internal static unsafe string UTF8_ToManaged(IntPtr s, bool freePtr = false)
|
public static unsafe string UTF8_ToManaged(IntPtr s, bool freePtr = false)
|
||||||
{
|
{
|
||||||
if (s == IntPtr.Zero)
|
if (s == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
|
@ -268,8 +273,8 @@ namespace SDL2
|
||||||
utf8File,
|
utf8File,
|
||||||
utf8Mode
|
utf8Mode
|
||||||
);
|
);
|
||||||
Marshal.FreeHGlobal((IntPtr)utf8Mode);
|
Marshal.FreeHGlobal((IntPtr) utf8Mode);
|
||||||
Marshal.FreeHGlobal((IntPtr)utf8File);
|
Marshal.FreeHGlobal((IntPtr) utf8File);
|
||||||
return rwOps;
|
return rwOps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1746,20 +1751,6 @@ namespace SDL2
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void SDL_GL_DeleteContext(IntPtr context);
|
public static extern void SDL_GL_DeleteContext(IntPtr context);
|
||||||
|
|
||||||
/* IntPtr refers to a function pointer */
|
|
||||||
[DllImport(nativeLibName, EntryPoint = "SDL_GL_GetProcAddress", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
private static extern unsafe IntPtr INTERNAL_SDL_GL_GetProcAddress(
|
|
||||||
byte* proc
|
|
||||||
);
|
|
||||||
public static unsafe IntPtr SDL_GL_GetProcAddress(string proc)
|
|
||||||
{
|
|
||||||
int utf8ProcBufSize = Utf8Size(proc);
|
|
||||||
byte* utf8Proc = stackalloc byte[utf8ProcBufSize];
|
|
||||||
return INTERNAL_SDL_GL_GetProcAddress(
|
|
||||||
Utf8Encode(proc, utf8Proc, utf8ProcBufSize)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
[DllImport(nativeLibName, EntryPoint = "SDL_GL_LoadLibrary", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, EntryPoint = "SDL_GL_LoadLibrary", CallingConvention = CallingConvention.Cdecl)]
|
||||||
private static extern unsafe int INTERNAL_SDL_GL_LoadLibrary(byte* path);
|
private static extern unsafe int INTERNAL_SDL_GL_LoadLibrary(byte* path);
|
||||||
public static unsafe int SDL_GL_LoadLibrary(string path)
|
public static unsafe int SDL_GL_LoadLibrary(string path)
|
||||||
|
@ -1768,7 +1759,7 @@ namespace SDL2
|
||||||
int result = INTERNAL_SDL_GL_LoadLibrary(
|
int result = INTERNAL_SDL_GL_LoadLibrary(
|
||||||
utf8Path
|
utf8Path
|
||||||
);
|
);
|
||||||
Marshal.FreeHGlobal((IntPtr)utf8Path);
|
Marshal.FreeHGlobal((IntPtr) utf8Path);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1776,6 +1767,16 @@ namespace SDL2
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr SDL_GL_GetProcAddress(IntPtr proc);
|
public static extern IntPtr SDL_GL_GetProcAddress(IntPtr proc);
|
||||||
|
|
||||||
|
/* IntPtr refers to a function pointer */
|
||||||
|
public static unsafe IntPtr SDL_GL_GetProcAddress(string proc)
|
||||||
|
{
|
||||||
|
int utf8ProcBufSize = Utf8Size(proc);
|
||||||
|
byte* utf8Proc = stackalloc byte[utf8ProcBufSize];
|
||||||
|
return SDL_GL_GetProcAddress(
|
||||||
|
(IntPtr) Utf8Encode(proc, utf8Proc, utf8ProcBufSize)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void SDL_GL_UnloadLibrary();
|
public static extern void SDL_GL_UnloadLibrary();
|
||||||
|
|
||||||
|
@ -2133,7 +2134,7 @@ namespace SDL2
|
||||||
int result = INTERNAL_SDL_Vulkan_LoadLibrary(
|
int result = INTERNAL_SDL_Vulkan_LoadLibrary(
|
||||||
utf8Path
|
utf8Path
|
||||||
);
|
);
|
||||||
Marshal.FreeHGlobal((IntPtr)utf8Path);
|
Marshal.FreeHGlobal((IntPtr) utf8Path);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4322,7 +4323,7 @@ namespace SDL2
|
||||||
int result = INTERNAL_SDL_SetClipboardText(
|
int result = INTERNAL_SDL_SetClipboardText(
|
||||||
utf8Text
|
utf8Text
|
||||||
);
|
);
|
||||||
Marshal.FreeHGlobal((IntPtr)utf8Text);
|
Marshal.FreeHGlobal((IntPtr) utf8Text);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6306,7 +6307,7 @@ namespace SDL2
|
||||||
int result = INTERNAL_SDL_GameControllerAddMapping(
|
int result = INTERNAL_SDL_GameControllerAddMapping(
|
||||||
utf8MappingString
|
utf8MappingString
|
||||||
);
|
);
|
||||||
Marshal.FreeHGlobal((IntPtr)utf8MappingString);
|
Marshal.FreeHGlobal((IntPtr) utf8MappingString);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ namespace SDL2
|
||||||
IntPtr handle = INTERNAL_IMG_Load(
|
IntPtr handle = INTERNAL_IMG_Load(
|
||||||
utf8File
|
utf8File
|
||||||
);
|
);
|
||||||
Marshal.FreeHGlobal((IntPtr)utf8File);
|
Marshal.FreeHGlobal((IntPtr) utf8File);
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ namespace SDL2
|
||||||
renderer,
|
renderer,
|
||||||
utf8File
|
utf8File
|
||||||
);
|
);
|
||||||
Marshal.FreeHGlobal((IntPtr)utf8File);
|
Marshal.FreeHGlobal((IntPtr) utf8File);
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ namespace SDL2
|
||||||
freesrc,
|
freesrc,
|
||||||
utf8Type
|
utf8Type
|
||||||
);
|
);
|
||||||
Marshal.FreeHGlobal((IntPtr)utf8Type);
|
Marshal.FreeHGlobal((IntPtr) utf8Type);
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ namespace SDL2
|
||||||
surface,
|
surface,
|
||||||
utf8File
|
utf8File
|
||||||
);
|
);
|
||||||
Marshal.FreeHGlobal((IntPtr)utf8File);
|
Marshal.FreeHGlobal((IntPtr) utf8File);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ namespace SDL2
|
||||||
utf8File,
|
utf8File,
|
||||||
quality
|
quality
|
||||||
);
|
);
|
||||||
Marshal.FreeHGlobal((IntPtr)utf8File);
|
Marshal.FreeHGlobal((IntPtr) utf8File);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -200,12 +200,17 @@ namespace SDL2
|
||||||
|
|
||||||
/* IntPtr refers to a Mix_Music* */
|
/* IntPtr refers to a Mix_Music* */
|
||||||
[DllImport(nativeLibName, EntryPoint = "Mix_LoadMUS", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, EntryPoint = "Mix_LoadMUS", CallingConvention = CallingConvention.Cdecl)]
|
||||||
private static extern IntPtr INTERNAL_Mix_LoadMUS(
|
private static extern unsafe IntPtr INTERNAL_Mix_LoadMUS(
|
||||||
byte[] file
|
byte* file
|
||||||
);
|
);
|
||||||
public static IntPtr Mix_LoadMUS(string file)
|
public static unsafe IntPtr Mix_LoadMUS(string file)
|
||||||
{
|
{
|
||||||
return INTERNAL_Mix_LoadMUS(SDL.UTF8_ToNative(file));
|
byte* utf8File = SDL.Utf8Encode(file);
|
||||||
|
IntPtr handle = INTERNAL_Mix_LoadMUS(
|
||||||
|
utf8File
|
||||||
|
);
|
||||||
|
Marshal.FreeHGlobal((IntPtr) utf8File);
|
||||||
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IntPtr refers to a Mix_Chunk* */
|
/* IntPtr refers to a Mix_Chunk* */
|
||||||
|
@ -569,14 +574,17 @@ namespace SDL2
|
||||||
public static extern int Mix_PlayingMusic();
|
public static extern int Mix_PlayingMusic();
|
||||||
|
|
||||||
[DllImport(nativeLibName, EntryPoint = "Mix_SetMusicCMD", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, EntryPoint = "Mix_SetMusicCMD", CallingConvention = CallingConvention.Cdecl)]
|
||||||
private static extern int INTERNAL_Mix_SetMusicCMD(
|
private static extern unsafe int INTERNAL_Mix_SetMusicCMD(
|
||||||
byte[] command
|
byte* command
|
||||||
);
|
);
|
||||||
public static int Mix_SetMusicCMD(string command)
|
public static unsafe int Mix_SetMusicCMD(string command)
|
||||||
{
|
{
|
||||||
return INTERNAL_Mix_SetMusicCMD(
|
byte* utf8Cmd = SDL.Utf8Encode(command);
|
||||||
SDL.UTF8_ToNative(command)
|
int result = INTERNAL_Mix_SetMusicCMD(
|
||||||
|
utf8Cmd
|
||||||
);
|
);
|
||||||
|
Marshal.FreeHGlobal((IntPtr) utf8Cmd);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
@ -586,14 +594,17 @@ namespace SDL2
|
||||||
public static extern int Mix_GetSynchroValue();
|
public static extern int Mix_GetSynchroValue();
|
||||||
|
|
||||||
[DllImport(nativeLibName, EntryPoint = "Mix_SetSoundFonts", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, EntryPoint = "Mix_SetSoundFonts", CallingConvention = CallingConvention.Cdecl)]
|
||||||
private static extern int INTERNAL_Mix_SetSoundFonts(
|
private static extern unsafe int INTERNAL_Mix_SetSoundFonts(
|
||||||
byte[] paths
|
byte* paths
|
||||||
);
|
);
|
||||||
public static int Mix_SetSoundFonts(string paths)
|
public static unsafe int Mix_SetSoundFonts(string paths)
|
||||||
{
|
{
|
||||||
return INTERNAL_Mix_SetSoundFonts(
|
byte* utf8Paths = SDL.Utf8Encode(paths);
|
||||||
SDL.UTF8_ToNative(paths)
|
int result = INTERNAL_Mix_SetSoundFonts(
|
||||||
|
utf8Paths
|
||||||
);
|
);
|
||||||
|
Marshal.FreeHGlobal((IntPtr) utf8Paths);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport(nativeLibName, EntryPoint = "Mix_GetSoundFonts", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, EntryPoint = "Mix_GetSoundFonts", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
|
130
src/SDL2_ttf.cs
130
src/SDL2_ttf.cs
|
@ -95,16 +95,19 @@ namespace SDL2
|
||||||
|
|
||||||
/* IntPtr refers to a TTF_Font* */
|
/* IntPtr refers to a TTF_Font* */
|
||||||
[DllImport(nativeLibName, EntryPoint = "TTF_OpenFont", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, EntryPoint = "TTF_OpenFont", CallingConvention = CallingConvention.Cdecl)]
|
||||||
private static extern IntPtr INTERNAL_TTF_OpenFont(
|
private static extern unsafe IntPtr INTERNAL_TTF_OpenFont(
|
||||||
byte[] file,
|
byte* file,
|
||||||
int ptsize
|
int ptsize
|
||||||
);
|
);
|
||||||
public static IntPtr TTF_OpenFont(string file, int ptsize)
|
public static unsafe IntPtr TTF_OpenFont(string file, int ptsize)
|
||||||
{
|
{
|
||||||
return INTERNAL_TTF_OpenFont(
|
byte* utf8File = SDL.Utf8Encode(file);
|
||||||
SDL.UTF8_ToNative(file),
|
IntPtr handle = INTERNAL_TTF_OpenFont(
|
||||||
|
utf8File,
|
||||||
ptsize
|
ptsize
|
||||||
);
|
);
|
||||||
|
Marshal.FreeHGlobal((IntPtr) utf8File);
|
||||||
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* src refers to an SDL_RWops*, IntPtr to a TTF_Font* */
|
/* src refers to an SDL_RWops*, IntPtr to a TTF_Font* */
|
||||||
|
@ -118,21 +121,24 @@ namespace SDL2
|
||||||
|
|
||||||
/* IntPtr refers to a TTF_Font* */
|
/* IntPtr refers to a TTF_Font* */
|
||||||
[DllImport(nativeLibName, EntryPoint = "TTF_OpenFontIndex", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, EntryPoint = "TTF_OpenFontIndex", CallingConvention = CallingConvention.Cdecl)]
|
||||||
private static extern IntPtr INTERNAL_TTF_OpenFontIndex(
|
private static extern unsafe IntPtr INTERNAL_TTF_OpenFontIndex(
|
||||||
byte[] file,
|
byte* file,
|
||||||
int ptsize,
|
int ptsize,
|
||||||
long index
|
long index
|
||||||
);
|
);
|
||||||
public static IntPtr TTF_OpenFontIndex(
|
public static unsafe IntPtr TTF_OpenFontIndex(
|
||||||
string file,
|
string file,
|
||||||
int ptsize,
|
int ptsize,
|
||||||
long index
|
long index
|
||||||
) {
|
) {
|
||||||
return INTERNAL_TTF_OpenFontIndex(
|
byte* utf8File = SDL.Utf8Encode(file);
|
||||||
SDL.UTF8_ToNative(file),
|
IntPtr handle = INTERNAL_TTF_OpenFontIndex(
|
||||||
|
utf8File,
|
||||||
ptsize,
|
ptsize,
|
||||||
index
|
index
|
||||||
);
|
);
|
||||||
|
Marshal.FreeHGlobal((IntPtr) utf8File);
|
||||||
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* src refers to an SDL_RWops*, IntPtr to a TTF_Font* */
|
/* src refers to an SDL_RWops*, IntPtr to a TTF_Font* */
|
||||||
|
@ -282,24 +288,27 @@ namespace SDL2
|
||||||
|
|
||||||
/* font refers to a TTF_Font* */
|
/* font refers to a TTF_Font* */
|
||||||
[DllImport(nativeLibName, EntryPoint = "TTF_SizeUTF8", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, EntryPoint = "TTF_SizeUTF8", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern int INTERNAL_TTF_SizeUTF8(
|
public static extern unsafe int INTERNAL_TTF_SizeUTF8(
|
||||||
IntPtr font,
|
IntPtr font,
|
||||||
byte[] text,
|
byte* text,
|
||||||
out int w,
|
out int w,
|
||||||
out int h
|
out int h
|
||||||
);
|
);
|
||||||
public static int TTF_SizeUTF8(
|
public static unsafe int TTF_SizeUTF8(
|
||||||
IntPtr font,
|
IntPtr font,
|
||||||
string text,
|
string text,
|
||||||
out int w,
|
out int w,
|
||||||
out int h
|
out int h
|
||||||
) {
|
) {
|
||||||
return INTERNAL_TTF_SizeUTF8(
|
byte* utf8Text = SDL.Utf8Encode(text);
|
||||||
|
int result = INTERNAL_TTF_SizeUTF8(
|
||||||
font,
|
font,
|
||||||
SDL.UTF8_ToNative(text),
|
utf8Text,
|
||||||
out w,
|
out w,
|
||||||
out h
|
out h
|
||||||
);
|
);
|
||||||
|
Marshal.FreeHGlobal((IntPtr) utf8Text);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* font refers to a TTF_Font* */
|
/* font refers to a TTF_Font* */
|
||||||
|
@ -329,27 +338,30 @@ namespace SDL2
|
||||||
* Only available in 2.0.16 or higher.
|
* Only available in 2.0.16 or higher.
|
||||||
*/
|
*/
|
||||||
[DllImport(nativeLibName, EntryPoint = "TTF_MeasureUTF8", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, EntryPoint = "TTF_MeasureUTF8", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern int INTERNAL_TTF_MeasureUTF8(
|
public static extern unsafe int INTERNAL_TTF_MeasureUTF8(
|
||||||
IntPtr font,
|
IntPtr font,
|
||||||
byte[] text,
|
byte* text,
|
||||||
int measure_width,
|
int measure_width,
|
||||||
out int extent,
|
out int extent,
|
||||||
out int count
|
out int count
|
||||||
);
|
);
|
||||||
public static int TTF_MeasureUTF8(
|
public static unsafe int TTF_MeasureUTF8(
|
||||||
IntPtr font,
|
IntPtr font,
|
||||||
string text,
|
string text,
|
||||||
int measure_width,
|
int measure_width,
|
||||||
out int extent,
|
out int extent,
|
||||||
out int count
|
out int count
|
||||||
) {
|
) {
|
||||||
return INTERNAL_TTF_MeasureUTF8(
|
byte* utf8Text = SDL.Utf8Encode(text);
|
||||||
|
int result = INTERNAL_TTF_MeasureUTF8(
|
||||||
font,
|
font,
|
||||||
SDL.UTF8_ToNative(text),
|
utf8Text,
|
||||||
measure_width,
|
measure_width,
|
||||||
out extent,
|
out extent,
|
||||||
out count
|
out count
|
||||||
);
|
);
|
||||||
|
Marshal.FreeHGlobal((IntPtr) utf8Text);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* font refers to a TTF_Font*
|
/* font refers to a TTF_Font*
|
||||||
|
@ -376,21 +388,24 @@ 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, EntryPoint = "TTF_RenderUTF8_Solid", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Solid", CallingConvention = CallingConvention.Cdecl)]
|
||||||
private static extern IntPtr INTERNAL_TTF_RenderUTF8_Solid(
|
private static extern unsafe IntPtr INTERNAL_TTF_RenderUTF8_Solid(
|
||||||
IntPtr font,
|
IntPtr font,
|
||||||
byte[] text,
|
byte* text,
|
||||||
SDL.SDL_Color fg
|
SDL.SDL_Color fg
|
||||||
);
|
);
|
||||||
public static IntPtr TTF_RenderUTF8_Solid(
|
public static unsafe IntPtr TTF_RenderUTF8_Solid(
|
||||||
IntPtr font,
|
IntPtr font,
|
||||||
string text,
|
string text,
|
||||||
SDL.SDL_Color fg
|
SDL.SDL_Color fg
|
||||||
) {
|
) {
|
||||||
return INTERNAL_TTF_RenderUTF8_Solid(
|
byte* utf8Text = SDL.Utf8Encode(text);
|
||||||
|
IntPtr result = INTERNAL_TTF_RenderUTF8_Solid(
|
||||||
font,
|
font,
|
||||||
SDL.UTF8_ToNative(text),
|
utf8Text,
|
||||||
fg
|
fg
|
||||||
);
|
);
|
||||||
|
Marshal.FreeHGlobal((IntPtr) utf8Text);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
||||||
|
@ -418,24 +433,27 @@ namespace SDL2
|
||||||
* Only available in 2.0.16 or higher.
|
* Only available in 2.0.16 or higher.
|
||||||
*/
|
*/
|
||||||
[DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Solid_Wrapped", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Solid_Wrapped", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr INTERNAL_TTF_RenderUTF8_Solid_Wrapped(
|
public static extern unsafe IntPtr INTERNAL_TTF_RenderUTF8_Solid_Wrapped(
|
||||||
IntPtr font,
|
IntPtr font,
|
||||||
byte[] text,
|
byte* text,
|
||||||
SDL.SDL_Color fg,
|
SDL.SDL_Color fg,
|
||||||
uint wrapLength
|
uint wrapLength
|
||||||
);
|
);
|
||||||
public static IntPtr TTF_RenderUTF8_Solid_Wrapped(
|
public static unsafe IntPtr TTF_RenderUTF8_Solid_Wrapped(
|
||||||
IntPtr font,
|
IntPtr font,
|
||||||
string text,
|
string text,
|
||||||
SDL.SDL_Color fg,
|
SDL.SDL_Color fg,
|
||||||
uint wrapLength
|
uint wrapLength
|
||||||
) {
|
) {
|
||||||
return INTERNAL_TTF_RenderUTF8_Solid_Wrapped(
|
byte* utf8Text = SDL.Utf8Encode(text);
|
||||||
|
IntPtr result = INTERNAL_TTF_RenderUTF8_Solid_Wrapped(
|
||||||
font,
|
font,
|
||||||
SDL.UTF8_ToNative(text),
|
utf8Text,
|
||||||
fg,
|
fg,
|
||||||
wrapLength
|
wrapLength
|
||||||
);
|
);
|
||||||
|
Marshal.FreeHGlobal((IntPtr) utf8Text);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font*
|
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font*
|
||||||
|
@ -480,24 +498,27 @@ 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, EntryPoint = "TTF_RenderUTF8_Shaded", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Shaded", CallingConvention = CallingConvention.Cdecl)]
|
||||||
private static extern IntPtr INTERNAL_TTF_RenderUTF8_Shaded(
|
private static extern unsafe IntPtr INTERNAL_TTF_RenderUTF8_Shaded(
|
||||||
IntPtr font,
|
IntPtr font,
|
||||||
byte[] text,
|
byte* text,
|
||||||
SDL.SDL_Color fg,
|
SDL.SDL_Color fg,
|
||||||
SDL.SDL_Color bg
|
SDL.SDL_Color bg
|
||||||
);
|
);
|
||||||
public static IntPtr TTF_RenderUTF8_Shaded(
|
public static unsafe IntPtr TTF_RenderUTF8_Shaded(
|
||||||
IntPtr font,
|
IntPtr font,
|
||||||
string text,
|
string text,
|
||||||
SDL.SDL_Color fg,
|
SDL.SDL_Color fg,
|
||||||
SDL.SDL_Color bg
|
SDL.SDL_Color bg
|
||||||
) {
|
) {
|
||||||
return INTERNAL_TTF_RenderUTF8_Shaded(
|
byte* utf8Text = SDL.Utf8Encode(text);
|
||||||
|
IntPtr result = INTERNAL_TTF_RenderUTF8_Shaded(
|
||||||
font,
|
font,
|
||||||
SDL.UTF8_ToNative(text),
|
utf8Text,
|
||||||
fg,
|
fg,
|
||||||
bg
|
bg
|
||||||
);
|
);
|
||||||
|
Marshal.FreeHGlobal((IntPtr) utf8Text);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
||||||
|
@ -525,27 +546,30 @@ namespace SDL2
|
||||||
* Only available in 2.0.16 or higher.
|
* Only available in 2.0.16 or higher.
|
||||||
*/
|
*/
|
||||||
[DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Shaded_Wrapped", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Shaded_Wrapped", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr INTERNAL_TTF_RenderUTF8_Shaded_Wrapped(
|
public static extern unsafe IntPtr INTERNAL_TTF_RenderUTF8_Shaded_Wrapped(
|
||||||
IntPtr font,
|
IntPtr font,
|
||||||
byte[] text,
|
byte* text,
|
||||||
SDL.SDL_Color fg,
|
SDL.SDL_Color fg,
|
||||||
SDL.SDL_Color bg,
|
SDL.SDL_Color bg,
|
||||||
uint wrapLength
|
uint wrapLength
|
||||||
);
|
);
|
||||||
public static IntPtr TTF_RenderUTF8_Shaded_Wrapped(
|
public static unsafe IntPtr TTF_RenderUTF8_Shaded_Wrapped(
|
||||||
IntPtr font,
|
IntPtr font,
|
||||||
string text,
|
string text,
|
||||||
SDL.SDL_Color fg,
|
SDL.SDL_Color fg,
|
||||||
SDL.SDL_Color bg,
|
SDL.SDL_Color bg,
|
||||||
uint wrapLength
|
uint wrapLength
|
||||||
) {
|
) {
|
||||||
return INTERNAL_TTF_RenderUTF8_Shaded_Wrapped(
|
byte* utf8Text = SDL.Utf8Encode(text);
|
||||||
|
IntPtr result = INTERNAL_TTF_RenderUTF8_Shaded_Wrapped(
|
||||||
font,
|
font,
|
||||||
SDL.UTF8_ToNative(text),
|
utf8Text,
|
||||||
fg,
|
fg,
|
||||||
bg,
|
bg,
|
||||||
wrapLength
|
wrapLength
|
||||||
);
|
);
|
||||||
|
Marshal.FreeHGlobal((IntPtr) utf8Text);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
||||||
|
@ -590,21 +614,24 @@ 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, EntryPoint = "TTF_RenderUTF8_Blended", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Blended", CallingConvention = CallingConvention.Cdecl)]
|
||||||
private static extern IntPtr INTERNAL_TTF_RenderUTF8_Blended(
|
private static extern unsafe IntPtr INTERNAL_TTF_RenderUTF8_Blended(
|
||||||
IntPtr font,
|
IntPtr font,
|
||||||
byte[] text,
|
byte* text,
|
||||||
SDL.SDL_Color fg
|
SDL.SDL_Color fg
|
||||||
);
|
);
|
||||||
public static IntPtr TTF_RenderUTF8_Blended(
|
public static unsafe IntPtr TTF_RenderUTF8_Blended(
|
||||||
IntPtr font,
|
IntPtr font,
|
||||||
string text,
|
string text,
|
||||||
SDL.SDL_Color fg
|
SDL.SDL_Color fg
|
||||||
) {
|
) {
|
||||||
return INTERNAL_TTF_RenderUTF8_Blended(
|
byte* utf8Text = SDL.Utf8Encode(text);
|
||||||
|
IntPtr result = INTERNAL_TTF_RenderUTF8_Blended(
|
||||||
font,
|
font,
|
||||||
SDL.UTF8_ToNative(text),
|
utf8Text,
|
||||||
fg
|
fg
|
||||||
);
|
);
|
||||||
|
Marshal.FreeHGlobal((IntPtr) utf8Text);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
||||||
|
@ -628,24 +655,27 @@ 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, EntryPoint = "TTF_RenderUTF8_Blended_Wrapped", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Blended_Wrapped", CallingConvention = CallingConvention.Cdecl)]
|
||||||
private static extern IntPtr INTERNAL_TTF_RenderUTF8_Blended_Wrapped(
|
private static extern unsafe IntPtr INTERNAL_TTF_RenderUTF8_Blended_Wrapped(
|
||||||
IntPtr font,
|
IntPtr font,
|
||||||
byte[] text,
|
byte* text,
|
||||||
SDL.SDL_Color fg,
|
SDL.SDL_Color fg,
|
||||||
uint wrapped
|
uint wrapped
|
||||||
);
|
);
|
||||||
public static IntPtr TTF_RenderUTF8_Blended_Wrapped(
|
public static unsafe IntPtr TTF_RenderUTF8_Blended_Wrapped(
|
||||||
IntPtr font,
|
IntPtr font,
|
||||||
string text,
|
string text,
|
||||||
SDL.SDL_Color fg,
|
SDL.SDL_Color fg,
|
||||||
uint wrapped
|
uint wrapped
|
||||||
) {
|
) {
|
||||||
return INTERNAL_TTF_RenderUTF8_Blended_Wrapped(
|
byte* utf8Text = SDL.Utf8Encode(text);
|
||||||
|
IntPtr result = INTERNAL_TTF_RenderUTF8_Blended_Wrapped(
|
||||||
font,
|
font,
|
||||||
SDL.UTF8_ToNative(text),
|
utf8Text,
|
||||||
fg,
|
fg,
|
||||||
wrapped
|
wrapped
|
||||||
);
|
);
|
||||||
|
Marshal.FreeHGlobal((IntPtr) utf8Text);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
||||||
|
|
Loading…
Reference in a new issue