Fix namespace definition and docs
This commit is contained in:
parent
cca48d095d
commit
55a10addbd
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Cyber.Util;
|
||||
|
||||
namespace Cyber.Console {
|
||||
|
||||
|
@ -2,11 +2,25 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class FontUtil : MonoBehaviour {
|
||||
public static float GetCharacterWidth(Font font, int fontSize, FontStyle fontStyle) {
|
||||
CharacterInfo CharInfo;
|
||||
font.RequestCharactersInTexture("W", fontSize, fontStyle);
|
||||
font.GetCharacterInfo('W', out CharInfo, fontSize, fontStyle);
|
||||
return CharInfo.glyphWidth - 1;
|
||||
namespace Cyber.Util {
|
||||
|
||||
/// <summary>
|
||||
/// Conjures useful information about fonts.
|
||||
/// </summary>
|
||||
public class FontUtil : MonoBehaviour {
|
||||
|
||||
/// <summary>
|
||||
/// Gets the width of the character.
|
||||
/// </summary>
|
||||
/// <returns>The character width.</returns>
|
||||
/// <param name="font">Font.</param>
|
||||
/// <param name="fontSize">Font size.</param>
|
||||
/// <param name="fontStyle">Font style.</param>
|
||||
public static float GetCharacterWidth(Font font, int fontSize, FontStyle fontStyle) {
|
||||
CharacterInfo CharInfo;
|
||||
font.RequestCharactersInTexture("W", fontSize, fontStyle);
|
||||
font.GetCharacterInfo('W', out CharInfo, fontSize, fontStyle);
|
||||
return CharInfo.glyphWidth - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -23,6 +23,11 @@ namespace Cyber.Util {
|
||||
Singleton = this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the mesh at the defined index.
|
||||
/// </summary>
|
||||
/// <returns>The mesh.</returns>
|
||||
/// <param name="index">Index.</param>
|
||||
public static Mesh GetMesh(int index) {
|
||||
return Singleton.Meshes[index];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user