2018-11-22 00:18:42 -05:00
|
|
|
#region License
|
|
|
|
/* SDL2# - C# Wrapper for SDL2
|
|
|
|
*
|
2018-11-25 09:50:29 -05:00
|
|
|
* Copyright (c) 2013-2016 Ethan Lee.
|
2018-11-22 00:18:42 -05:00
|
|
|
*
|
|
|
|
* This software is provided 'as-is', without any express or implied warranty.
|
|
|
|
* In no event will the authors be held liable for any damages arising from
|
|
|
|
* the use of this software.
|
|
|
|
*
|
|
|
|
* Permission is granted to anyone to use this software for any purpose,
|
|
|
|
* including commercial applications, and to alter it and redistribute it
|
|
|
|
* freely, subject to the following restrictions:
|
|
|
|
*
|
|
|
|
* 1. The origin of this software must not be misrepresented; you must not
|
|
|
|
* claim that you wrote the original software. If you use this software in a
|
|
|
|
* product, an acknowledgment in the product documentation would be
|
|
|
|
* appreciated but is not required.
|
|
|
|
*
|
|
|
|
* 2. Altered source versions must be plainly marked as such, and must not be
|
|
|
|
* misrepresented as being the original software.
|
|
|
|
*
|
|
|
|
* 3. This notice may not be removed or altered from any source distribution.
|
|
|
|
*
|
|
|
|
* Ethan "flibitijibibo" Lee <flibitijibibo@flibitijibibo.com>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#endregion
|
2018-12-08 12:52:09 -05:00
|
|
|
#pragma warning disable S4200
|
|
|
|
#pragma warning disable S4214
|
|
|
|
#pragma warning disable S101
|
2018-11-22 00:18:42 -05:00
|
|
|
#region Using Statements
|
|
|
|
using System;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
namespace SDL2
|
|
|
|
{
|
|
|
|
public static class SDL_ttf
|
|
|
|
{
|
|
|
|
#region SDL2# Variables
|
|
|
|
|
|
|
|
/* Used by DllImport to load the native library. */
|
2018-11-25 09:50:29 -05:00
|
|
|
private const string nativeLibName = "SDL2_ttf";
|
2018-11-22 00:18:42 -05:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region SDL_ttf.h
|
|
|
|
|
|
|
|
/* Similar to the headers, this is the version we're expecting to be
|
|
|
|
* running with. You will likely want to check this somewhere in your
|
|
|
|
* program!
|
|
|
|
*/
|
|
|
|
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 UNICODE_BOM_NATIVE = 0xFEFF;
|
|
|
|
public const int UNICODE_BOM_SWAPPED = 0xFFFE;
|
|
|
|
|
|
|
|
public const int TTF_STYLE_NORMAL = 0x00;
|
|
|
|
public const int TTF_STYLE_BOLD = 0x01;
|
|
|
|
public const int TTF_STYLE_ITALIC = 0x02;
|
|
|
|
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 static void SDL_TTF_VERSION(out SDL.SDL_version X)
|
|
|
|
{
|
|
|
|
X.major = SDL_TTF_MAJOR_VERSION;
|
|
|
|
X.minor = SDL_TTF_MINOR_VERSION;
|
|
|
|
X.patch = SDL_TTF_PATCHLEVEL;
|
|
|
|
}
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, EntryPoint = "TTF_LinkedVersion", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
private static extern IntPtr INTERNAL_TTF_LinkedVersion();
|
|
|
|
public static SDL.SDL_version TTF_LinkedVersion()
|
|
|
|
{
|
|
|
|
SDL.SDL_version result;
|
|
|
|
IntPtr result_ptr = INTERNAL_TTF_LinkedVersion();
|
|
|
|
result = (SDL.SDL_version) Marshal.PtrToStructure(
|
|
|
|
result_ptr,
|
|
|
|
typeof(SDL.SDL_version)
|
|
|
|
);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern void TTF_ByteSwappedUNICODE(int swapped);
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern int TTF_Init();
|
|
|
|
|
|
|
|
/* IntPtr refers to a TTF_Font* */
|
2018-11-25 09:50:29 -05:00
|
|
|
[DllImport(nativeLibName, EntryPoint = "TTF_OpenFont", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
private static extern IntPtr INTERNAL_TTF_OpenFont(
|
|
|
|
byte[] file,
|
2018-11-22 00:18:42 -05:00
|
|
|
int ptsize
|
|
|
|
);
|
2018-11-25 09:50:29 -05:00
|
|
|
public static IntPtr TTF_OpenFont(string file, int ptsize)
|
|
|
|
{
|
|
|
|
return INTERNAL_TTF_OpenFont(
|
|
|
|
SDL.UTF8_ToNative(file),
|
|
|
|
ptsize
|
|
|
|
);
|
|
|
|
}
|
2018-11-22 00:18:42 -05:00
|
|
|
|
|
|
|
/* src refers to an SDL_RWops*, IntPtr to a TTF_Font* */
|
|
|
|
/* THIS IS A PUBLIC RWops FUNCTION! */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern IntPtr TTF_OpenFontRW(
|
|
|
|
IntPtr src,
|
|
|
|
int freesrc,
|
|
|
|
int ptsize
|
|
|
|
);
|
|
|
|
|
|
|
|
/* IntPtr refers to a TTF_Font* */
|
2018-11-25 09:50:29 -05:00
|
|
|
[DllImport(nativeLibName, EntryPoint = "TTF_OpenFontIndex", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
private static extern IntPtr INTERNAL_TTF_OpenFontIndex(
|
|
|
|
byte[] file,
|
2018-11-22 00:18:42 -05:00
|
|
|
int ptsize,
|
|
|
|
long index
|
|
|
|
);
|
2018-11-25 09:50:29 -05:00
|
|
|
public static IntPtr TTF_OpenFontIndex(
|
|
|
|
string file,
|
|
|
|
int ptsize,
|
|
|
|
long index
|
|
|
|
) {
|
|
|
|
return INTERNAL_TTF_OpenFontIndex(
|
|
|
|
SDL.UTF8_ToNative(file),
|
|
|
|
ptsize,
|
|
|
|
index
|
|
|
|
);
|
|
|
|
}
|
2018-11-22 00:18:42 -05:00
|
|
|
|
|
|
|
/* src refers to an SDL_RWops*, IntPtr to a TTF_Font* */
|
|
|
|
/* THIS IS A PUBLIC RWops FUNCTION! */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern IntPtr TTF_OpenFontIndexRW(
|
|
|
|
IntPtr src,
|
|
|
|
int freesrc,
|
|
|
|
int ptsize,
|
|
|
|
long index
|
|
|
|
);
|
|
|
|
|
|
|
|
/* font refers to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern int TTF_GetFontStyle(IntPtr font);
|
|
|
|
|
|
|
|
/* font refers to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern void TTF_SetFontStyle(IntPtr font, int style);
|
|
|
|
|
|
|
|
/* font refers to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern int TTF_GetFontOutline(IntPtr font);
|
|
|
|
|
|
|
|
/* font refers to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern void TTF_SetFontOutline(IntPtr font, int outline);
|
|
|
|
|
|
|
|
/* font refers to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern int TTF_GetFontHinting(IntPtr font);
|
|
|
|
|
|
|
|
/* font refers to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern void TTF_SetFontHinting(IntPtr font, int hinting);
|
|
|
|
|
|
|
|
/* font refers to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern int TTF_FontHeight(IntPtr font);
|
|
|
|
|
|
|
|
/* font refers to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern int TTF_FontAscent(IntPtr font);
|
|
|
|
|
|
|
|
/* font refers to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern int TTF_FontDescent(IntPtr font);
|
|
|
|
|
|
|
|
/* font refers to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern int TTF_FontLineSkip(IntPtr font);
|
|
|
|
|
|
|
|
/* font refers to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern int TTF_GetFontKerning(IntPtr font);
|
|
|
|
|
|
|
|
/* font refers to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern void TTF_SetFontKerning(IntPtr font, int allowed);
|
|
|
|
|
|
|
|
/* font refers to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern long TTF_FontFaces(IntPtr font);
|
|
|
|
|
|
|
|
/* font refers to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern int TTF_FontFaceIsFixedWidth(IntPtr font);
|
|
|
|
|
|
|
|
/* font refers to a TTF_Font* */
|
2018-11-25 09:50:29 -05:00
|
|
|
[DllImport(nativeLibName, EntryPoint = "TTF_FontFaceFamilyName", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
private static extern IntPtr INTERNAL_TTF_FontFaceFamilyName(
|
2018-11-22 00:18:42 -05:00
|
|
|
IntPtr font
|
|
|
|
);
|
2018-11-25 09:50:29 -05:00
|
|
|
public static string TTF_FontFaceFamilyName(IntPtr font)
|
|
|
|
{
|
|
|
|
return SDL.UTF8_ToManaged(
|
|
|
|
INTERNAL_TTF_FontFaceFamilyName(font)
|
|
|
|
);
|
|
|
|
}
|
2018-11-22 00:18:42 -05:00
|
|
|
|
|
|
|
/* font refers to a TTF_Font* */
|
2018-11-25 09:50:29 -05:00
|
|
|
[DllImport(nativeLibName, EntryPoint = "TTF_FontFaceStyleName", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
private static extern IntPtr INTERNAL_TTF_FontFaceStyleName(
|
2018-11-22 00:18:42 -05:00
|
|
|
IntPtr font
|
|
|
|
);
|
2018-11-25 09:50:29 -05:00
|
|
|
public static string TTF_FontFaceStyleName(IntPtr font)
|
|
|
|
{
|
|
|
|
return SDL.UTF8_ToManaged(
|
|
|
|
INTERNAL_TTF_FontFaceStyleName(font)
|
|
|
|
);
|
|
|
|
}
|
2018-11-22 00:18:42 -05:00
|
|
|
|
|
|
|
/* font refers to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern int TTF_GlyphIsProvided(IntPtr font, ushort ch);
|
|
|
|
|
|
|
|
/* font refers to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern int TTF_GlyphMetrics(
|
|
|
|
IntPtr font,
|
|
|
|
ushort 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(
|
|
|
|
IntPtr font,
|
2018-11-25 09:50:29 -05:00
|
|
|
[In()] [MarshalAs(UnmanagedType.LPStr)]
|
2018-11-22 00:18:42 -05:00
|
|
|
string text,
|
|
|
|
out int w,
|
|
|
|
out int h
|
|
|
|
);
|
|
|
|
|
|
|
|
/* font refers to a TTF_Font* */
|
2018-11-25 09:50:29 -05:00
|
|
|
[DllImport(nativeLibName, EntryPoint = "TTF_SizeUTF8", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern int INTERNAL_TTF_SizeUTF8(
|
2018-11-22 00:18:42 -05:00
|
|
|
IntPtr font,
|
2018-11-25 09:50:29 -05:00
|
|
|
byte[] text,
|
2018-11-22 00:18:42 -05:00
|
|
|
out int w,
|
|
|
|
out int h
|
|
|
|
);
|
2018-11-25 09:50:29 -05:00
|
|
|
public static int TTF_SizeUTF8(
|
|
|
|
IntPtr font,
|
|
|
|
string text,
|
|
|
|
out int w,
|
|
|
|
out int h
|
|
|
|
) {
|
|
|
|
return INTERNAL_TTF_SizeUTF8(
|
|
|
|
font,
|
|
|
|
SDL.UTF8_ToNative(text),
|
|
|
|
out w,
|
|
|
|
out h
|
|
|
|
);
|
|
|
|
}
|
2018-11-22 00:18:42 -05:00
|
|
|
|
|
|
|
/* font refers to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern int TTF_SizeUNICODE(
|
|
|
|
IntPtr font,
|
|
|
|
[In()] [MarshalAs(UnmanagedType.LPWStr)]
|
|
|
|
string text,
|
|
|
|
out int w,
|
|
|
|
out int h
|
|
|
|
);
|
|
|
|
|
|
|
|
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern IntPtr TTF_RenderText_Solid(
|
|
|
|
IntPtr font,
|
|
|
|
[In()] [MarshalAs(UnmanagedType.LPStr)]
|
|
|
|
string text,
|
|
|
|
SDL.SDL_Color fg
|
|
|
|
);
|
|
|
|
|
|
|
|
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
2018-11-25 09:50:29 -05:00
|
|
|
[DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Solid", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
private static extern IntPtr INTERNAL_TTF_RenderUTF8_Solid(
|
2018-11-22 00:18:42 -05:00
|
|
|
IntPtr font,
|
2018-11-25 09:50:29 -05:00
|
|
|
byte[] text,
|
2018-11-22 00:18:42 -05:00
|
|
|
SDL.SDL_Color fg
|
|
|
|
);
|
2018-11-25 09:50:29 -05:00
|
|
|
public static IntPtr TTF_RenderUTF8_Solid(
|
|
|
|
IntPtr font,
|
|
|
|
string text,
|
|
|
|
SDL.SDL_Color fg
|
|
|
|
) {
|
|
|
|
return INTERNAL_TTF_RenderUTF8_Solid(
|
|
|
|
font,
|
|
|
|
SDL.UTF8_ToNative(text),
|
|
|
|
fg
|
|
|
|
);
|
|
|
|
}
|
2018-11-22 00:18:42 -05:00
|
|
|
|
|
|
|
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern IntPtr TTF_RenderUNICODE_Solid(
|
|
|
|
IntPtr font,
|
|
|
|
[In()] [MarshalAs(UnmanagedType.LPWStr)]
|
|
|
|
string text,
|
|
|
|
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_RenderGlyph_Solid(
|
|
|
|
IntPtr font,
|
|
|
|
ushort 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(
|
|
|
|
IntPtr font,
|
|
|
|
[In()] [MarshalAs(UnmanagedType.LPStr)]
|
|
|
|
string text,
|
|
|
|
SDL.SDL_Color fg,
|
|
|
|
SDL.SDL_Color bg
|
|
|
|
);
|
|
|
|
|
|
|
|
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
2018-11-25 09:50:29 -05:00
|
|
|
[DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Shaded", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
private static extern IntPtr INTERNAL_TTF_RenderUTF8_Shaded(
|
2018-11-22 00:18:42 -05:00
|
|
|
IntPtr font,
|
2018-11-25 09:50:29 -05:00
|
|
|
byte[] text,
|
2018-11-22 00:18:42 -05:00
|
|
|
SDL.SDL_Color fg,
|
|
|
|
SDL.SDL_Color bg
|
|
|
|
);
|
2018-11-25 09:50:29 -05:00
|
|
|
public static IntPtr TTF_RenderUTF8_Shaded(
|
|
|
|
IntPtr font,
|
|
|
|
string text,
|
|
|
|
SDL.SDL_Color fg,
|
|
|
|
SDL.SDL_Color bg
|
|
|
|
) {
|
|
|
|
return INTERNAL_TTF_RenderUTF8_Shaded(
|
|
|
|
font,
|
|
|
|
SDL.UTF8_ToNative(text),
|
|
|
|
fg,
|
|
|
|
bg
|
|
|
|
);
|
|
|
|
}
|
2018-11-22 00:18:42 -05:00
|
|
|
|
|
|
|
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern IntPtr TTF_RenderUNICODE_Shaded(
|
|
|
|
IntPtr font,
|
|
|
|
[In()] [MarshalAs(UnmanagedType.LPWStr)]
|
|
|
|
string text,
|
|
|
|
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_RenderGlyph_Shaded(
|
|
|
|
IntPtr font,
|
|
|
|
ushort 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(
|
|
|
|
IntPtr font,
|
|
|
|
[In()] [MarshalAs(UnmanagedType.LPStr)]
|
|
|
|
string text,
|
|
|
|
SDL.SDL_Color fg
|
|
|
|
);
|
|
|
|
|
|
|
|
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
2018-11-25 09:50:29 -05:00
|
|
|
[DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Blended", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
private static extern IntPtr INTERNAL_TTF_RenderUTF8_Blended(
|
2018-11-22 00:18:42 -05:00
|
|
|
IntPtr font,
|
2018-11-25 09:50:29 -05:00
|
|
|
byte[] text,
|
2018-11-22 00:18:42 -05:00
|
|
|
SDL.SDL_Color fg
|
|
|
|
);
|
2018-11-25 09:50:29 -05:00
|
|
|
public static IntPtr TTF_RenderUTF8_Blended(
|
|
|
|
IntPtr font,
|
|
|
|
string text,
|
|
|
|
SDL.SDL_Color fg
|
|
|
|
) {
|
|
|
|
return INTERNAL_TTF_RenderUTF8_Blended(
|
|
|
|
font,
|
|
|
|
SDL.UTF8_ToNative(text),
|
|
|
|
fg
|
|
|
|
);
|
|
|
|
}
|
2018-11-22 00:18:42 -05:00
|
|
|
|
|
|
|
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern IntPtr TTF_RenderUNICODE_Blended(
|
|
|
|
IntPtr font,
|
|
|
|
[In()] [MarshalAs(UnmanagedType.LPWStr)]
|
|
|
|
string text,
|
|
|
|
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_Blended_Wrapped(
|
|
|
|
IntPtr font,
|
|
|
|
[In()] [MarshalAs(UnmanagedType.LPStr)]
|
|
|
|
string text,
|
|
|
|
SDL.SDL_Color fg,
|
|
|
|
uint wrapped
|
|
|
|
);
|
|
|
|
|
|
|
|
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
2018-11-25 09:50:29 -05:00
|
|
|
[DllImport(nativeLibName, EntryPoint = "TTF_RenderUTF8_Blended_Wrapped", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
private static extern IntPtr INTERNAL_TTF_RenderUTF8_Blended_Wrapped(
|
2018-11-22 00:18:42 -05:00
|
|
|
IntPtr font,
|
2018-11-25 09:50:29 -05:00
|
|
|
byte[] text,
|
2018-11-22 00:18:42 -05:00
|
|
|
SDL.SDL_Color fg,
|
|
|
|
uint wrapped
|
|
|
|
);
|
2018-11-25 09:50:29 -05:00
|
|
|
public static IntPtr TTF_RenderUTF8_Blended_Wrapped(
|
|
|
|
IntPtr font,
|
|
|
|
string text,
|
|
|
|
SDL.SDL_Color fg,
|
|
|
|
uint wrapped
|
|
|
|
) {
|
|
|
|
return INTERNAL_TTF_RenderUTF8_Blended_Wrapped(
|
|
|
|
font,
|
|
|
|
SDL.UTF8_ToNative(text),
|
|
|
|
fg,
|
|
|
|
wrapped
|
|
|
|
);
|
|
|
|
}
|
2018-11-22 00:18:42 -05:00
|
|
|
|
|
|
|
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern IntPtr TTF_RenderUNICODE_Blended_Wrapped(
|
|
|
|
IntPtr font,
|
|
|
|
[In()] [MarshalAs(UnmanagedType.LPWStr)]
|
|
|
|
string text,
|
|
|
|
SDL.SDL_Color fg,
|
|
|
|
uint wrapped
|
|
|
|
);
|
|
|
|
|
|
|
|
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern IntPtr TTF_RenderGlyph_Blended(
|
|
|
|
IntPtr font,
|
|
|
|
ushort ch,
|
|
|
|
SDL.SDL_Color fg
|
|
|
|
);
|
|
|
|
|
|
|
|
/* font refers to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern void TTF_CloseFont(IntPtr font);
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern void TTF_Quit();
|
|
|
|
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern int TTF_WasInit();
|
|
|
|
|
|
|
|
/* font refers to a TTF_Font* */
|
|
|
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
public static extern int SDL_GetFontKerningSize(
|
|
|
|
IntPtr font,
|
|
|
|
int prev_index,
|
|
|
|
int index
|
|
|
|
);
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|
2018-12-08 12:52:09 -05:00
|
|
|
#pragma warning restore S4214
|
|
|
|
#pragma warning restore S4200 // Native methods should be wrapped
|