Class Text
- Namespace
- GB
- Assembly
- GBSharp.Framework.dll
Drawing text from a FontAsset, tile by tile.
public static class Text
- Inheritance
-
Text
- Inherited Members
Remarks
There is no cursor, no scrolling, and no printf. A string is a row of
tiles like any other background artwork: one call uploads the glyphs once,
and another writes them into the map wherever the game wants them. GBDK's
own gbdk/font.h and console.h exist for the opposite choice - a
cursor and scrolling state the game does not control - which is exactly the
kind of hardware-hiding layer GB# does not add. GB# abstracts boilerplate,
not hardware.
GB#'s subset has no string (GBS0043), so there is no
string literal to pass here yet. Write the bytes directly:
static readonly byte[] Label = { 72, 69, 76, 76, 79 };. Sugar that
turns a string literal into that array at compile time is real, separate
work - a language-subset change with its own review - and is deliberately
not part of this.
Methods
Draw(FontAsset, byte, byte, byte, byte, byte[])
Draws length bytes of text as
tiles, left to right starting at x, y.
[Native("gbs_font_draw")]
public static void Draw(FontAsset font, byte firstTile, byte x, byte y, byte length, byte[] text)
Parameters
Remarks
Each byte is a character code, looked up in the font's glyph table and
written as a background tile - the same map write SetTile(byte, byte, byte)
makes, just several in a row. A code the font's Characters did not
declare draws whichever glyph is tile 0, rather than being checked here:
see FontAttribute.
DrawWindow(FontAsset, byte, byte, byte, byte, byte[])
Same as Draw(FontAsset, byte, byte, byte, byte, byte[]), onto the window layer instead of the background.
[Native("gbs_win_font_draw")]
public static void DrawWindow(FontAsset font, byte firstTile, byte x, byte y, byte length, byte[] text)
Parameters
Load(FontAsset, byte)
Uploads a font's glyph tiles into the background/window tile region.
[Native("gbs_font_load")]
public static void Load(FontAsset font, byte firstTile)