Skip to content

LameText

Text-drawing functionality for LameStation games.

txt : "LameText"

About

LameGFX must be started before LameText can be used.

Begin by loading a font into LameText with txt.Load, passing the font address, first character, and character width and height. Only one font can be loaded at a time, but fonts can be switched at any time. Changing the width and height of the font changes the spacing of letters.

Now you can use any of the text-drawing commands, keeping in mind that they won't be visible until lcd.Draw is called.

Font Format

LameStation fonts are regular LameGFX sprites, but organized according to the ASCII table.

You can find a collection of ready-to-use fonts in /media/fonts/.

Functions

txt.Load

Load a font into LameText.

txt.Load(source, start, w, h)
  • source - The address of the font sprite.

  • start - The first character in the sprite (usually " ").

  • w, h - Desired letter spacing.

This function loads a font into LameText. Only one font can be loaded at a time, but fonts can be switched at any time.

Changing the width and height of the font changes the spacing of letters. Setting to (0,0) will use the sprite frame size for spacing.

txt.Bin

Draw a binary value at position (x,y).

txt.Bin(value, digits, x, y)
  • value - The binary value to draw.

  • digits - The number of digits to print.

  • x, y - The target position.

txt.Char

Draw a character at position (x,y).

txt.Char(char_byte, x, y)
  • char_byte - The character to draw.

  • x, y - The position to draw the character.

txt.Dec

Draw a decimal value at position (x,y).

txt.Dec(value, x, y)
  • value - The decimal value to draw.

  • x, y - The target position.

txt.Hex

Draw a hexadecimal value at position (x,y).

txt.Hex(value, digits, x, y)
  • value - The hexadecimal value to draw.

  • digits - The number of digits to print.

  • x, y - The target position.

txt.Str

Draw a string at position (x,y).

txt.Str(stringvar, x, y)
  • stringvar - The address of the string to draw.

  • x, y - The position to draw the character.