Class Text
- Namespace
- MohawkGame2D
- Assembly
- GAME 10003 Game Development Foundations - 2D Game Template.dll
Access text drawing functions.
public static class Text
- Inheritance
-
Text
- Inherited Members
Remarks
A static wrapper to standardize raylib's text API.
Properties
Color
Text color.
public static Color Color { get; set; }
Property Value
Font
Text font.
public static Font Font { get; set; }
Property Value
FontName
Name of Font.
public static string FontName { get; }
Property Value
Kerning
Text kerning (space between letters) in pixels.
public static int Kerning { get; set; }
Property Value
Remarks
Default is 0px.
LoadedFonts
Get an array of all loaded fonts.
public static Font[] LoadedFonts { get; }
Property Value
- Font[]
MonospaceFont
Default monospace font.
public static Font MonospaceFont { get; }
Property Value
MonospaceFontName
Name of MonospaceFont.
public static string MonospaceFontName { get; }
Property Value
Rotation
Text rotation in degrees (0-360), clockwise.
public static float Rotation { get; set; }
Property Value
Size
Text size in pixels.
public static int Size { get; set; }
Property Value
Methods
Draw(string, Vector2)
Draws text at position on screen.
public static void Draw(string text, Vector2 position)
Parameters
Draw(string, Vector2, Font)
Draws text at position on screen
using font.
public static void Draw(string text, Vector2 position, Font font)
Parameters
textstringThe text to draw.
positionVector2The position to draw text at.
fontFontThe font to draw with.
Draw(string, float, float)
Draws text at position (x,
y) on screen.
public static void Draw(string text, float x, float y)
Parameters
textstringThe text to draw.
xfloatThe X position to draw text at.
yfloatThe Y position to draw text at.
Draw(string, float, float, Font)
Draws text at position (x,
y) on screen using font.
public static void Draw(string text, float x, float y, Font font)
Parameters
textstringThe text to draw.
xfloatThe X position to draw text at.
yfloatThe Y position to draw text at.
fontFontThe font to draw with.
Initialize()
Loads the inital fonts.
public static void Initialize()
LoadFont(string)
Loads the typeface specified at filePath
with a raasterized pixel sive of Size.
public static Font LoadFont(string filePath)
Parameters
filePathstringThe path to the font file.
Returns
LoadFont(string, int)
Loads the typeface specified at filePath
with a raasterized pixel sive of fontSize.
public static Font LoadFont(string filePath, int fontSize)
Parameters
filePathstringThe path to the font file.
fontSizeintThe font's pixel size. If drawn at a different scale, it may look blurry.
Returns
LoadFont(string, string)
Loads the typeface with filename and
extension in the user's system font directory (folder)
with a raasterized pixel sive of Size.
public static Font LoadFont(string filename, string extension)
Parameters
Returns
LoadFont(string, string, int)
Loads the typeface with filename and
extension in the user's system font directory (folder)
with a raasterized pixel sive of fontSize.
public static Font LoadFont(string filename, string extension, int fontSize)
Parameters
filenamestringThe font's file name.
extensionstringThe font's extension.
fontSizeintThe font's pixel size. If drawn at a different scale, it may look blurry.
Returns
ResetFont()
Resets Font to the default font.
public static void ResetFont()
UnloadFont(Font)
Unloads a font from memory.
public static void UnloadFont(Font font)
Parameters
fontFontThe font to unload.