Table of Contents

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

Color

Font

Text font.

public static Font Font { get; set; }

Property Value

Font

FontName

Name of Font.

public static string FontName { get; }

Property Value

string

Kerning

Text kerning (space between letters) in pixels.

public static int Kerning { get; set; }

Property Value

int

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

Font

MonospaceFontName

Name of MonospaceFont.

public static string MonospaceFontName { get; }

Property Value

string

Rotation

Text rotation in degrees (0-360), clockwise.

public static float Rotation { get; set; }

Property Value

float

Size

Text size in pixels.

public static int Size { get; set; }

Property Value

int

Methods

Draw(string, Vector2)

Draws text at position on screen.

public static void Draw(string text, Vector2 position)

Parameters

text string

The text to draw.

position Vector2

The position to draw text at.

Draw(string, Vector2, Font)

Draws text at position on screen using font.

public static void Draw(string text, Vector2 position, Font font)

Parameters

text string

The text to draw.

position Vector2

The position to draw text at.

font Font

The 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

text string

The text to draw.

x float

The X position to draw text at.

y float

The 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

text string

The text to draw.

x float

The X position to draw text at.

y float

The Y position to draw text at.

font Font

The 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

filePath string

The path to the font file.

Returns

Font

Returns the loaded Font.

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

filePath string

The path to the font file.

fontSize int

The font's pixel size. If drawn at a different scale, it may look blurry.

Returns

Font

Returns the loaded Font.

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

filename string

The font's file name.

extension string

The font's extension.

Returns

Font

Returns the loaded Font.

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

filename string

The font's file name.

extension string

The font's extension.

fontSize int

The font's pixel size. If drawn at a different scale, it may look blurry.

Returns

Font

Returns the loaded Font.

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

font Font

The font to unload.