2
0
mirror of https://github.com/raylib-cs/raylib-cs synced 2025-06-30 19:03:42 -04:00

Removed FormatText + SubText change

- Using built in string.Format instead of FormatText.
- SubText changed to extension method for a string that uses Substring and a bound limit.
This commit is contained in:
2018-10-25 17:21:47 +01:00
parent 696a9cf14a
commit 67d5628fe3
18 changed files with 52 additions and 65 deletions

View File

@ -1835,18 +1835,12 @@ namespace Raylib
[DllImport(nativeLibName,CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 MeasureTextEx(Font font, string text, float fontSize, float spacing);
// Formatting of text with variables to 'embed'
[DllImport(nativeLibName, EntryPoint = "FormatText", CallingConvention = CallingConvention.Cdecl)]
private static extern string FormatTextInternal(string text, __arglist);
public static string FormatText(string text, params object[] args)
// extension providing SubText
public static string SubText(this string input, int position, int length)
{
return FormatTextInternal(text, __arglist(args));
return input.Substring(position, Math.Min(length, input.Length));
}
// Get a piece of a text string
[DllImport(nativeLibName,CallingConvention = CallingConvention.Cdecl)]
public static extern string SubText(string text, int position, int length);
// Get index position for a unicode character on font
[DllImport(nativeLibName,CallingConvention = CallingConvention.Cdecl)]
public static extern int GetGlyphIndex(Font font, int character);