Fix namespace definition and docs

This commit is contained in:
excitedneon 2017-05-14 21:51:50 +03:00
parent cca48d095d
commit 55a10addbd
3 changed files with 27 additions and 7 deletions

View File

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Text.RegularExpressions;
using UnityEngine;
using UnityEngine.UI;
using Cyber.Util;
namespace Cyber.Console {

View File

@ -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;
}
}
}
}

View File

@ -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];
}