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

Merge remote-tracking branch 'ChrisDill/master'

This commit is contained in:
Mikael Rasmussen
2018-10-25 19:08:56 +02:00
22 changed files with 81 additions and 69 deletions

View File

@ -643,14 +643,20 @@ namespace Raylib
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct RayHitInfo
{
public bool hit;
public bool hit
{
get { return Convert.ToBoolean(isHit); }
set { isHit = Convert.ToByte(hit); }
}
public byte isHit;
public float distance;
public Vector3 position;
public Vector3 normal;
public RayHitInfo(bool hit, float distance, Vector3 position, Vector3 normal)
{
this.hit = hit;
this.isHit = Convert.ToByte(hit);
this.distance = distance;
this.position = position;
this.normal = normal;
@ -1866,18 +1872,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);

View File

@ -8,6 +8,7 @@ namespace Raylib
#region Raylib-cs Types
// Vector2 type
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct Vector2
{
public float x;
@ -161,6 +162,7 @@ namespace Raylib
}
// Vector3 type
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct Vector3
{
public float x;
@ -283,6 +285,7 @@ namespace Raylib
}
// Vector4 type
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct Vector4
{
public float x;