SaturnRingLibrary 0.7
SGL wrapper
 
Loading...
Searching...
No Matches
SRL::ASCII Class Reference

Detailed Description

Interface for displaying ASCII text. Currently a direct replacement for slPrint. It removes any possible dependency on NBG0 system variables and displays 4bpp fonts to reduce required memory. Allows Storing and displaying up to 6 fonts and 8 color pallets.

#include <srl_ascii.hpp>

Static Public Member Functions

static void LoadFont (SRL::Bitmap::IBitmap *bmp, uint8_t fontId=0)
 Copies 4bpp Bitmap ASCII table to VRAM as 4bpp tileset.
 
static void LoadFontSG (uint8_t *source, uint8_t fontId=0)
 Use to load a 4bpp version of SGLs internal font.
 
static bool Print (char *myString, uint8_t x, uint8_t y)
 Display ASCII string on single line. Does not clamp to screen bounds or handle overflow.
 
static bool Print (const char *myString, uint8_t x, uint8_t y)
 Display ASCII string on single line. Does not clamp to screen bounds or handle overflow.
 
static bool SetColor (uint16_t color, uint8_t colorIndex)
 Set color in the specified palette index of the current font pallet.
 
static bool SetFont (uint8_t fontId)
 Set current font to print with (range 0-5)
 
static bool SetPalette (uint8_t paletteId)
 Set current color pallet to print with (range 0-7)
 

Member Function Documentation

◆ LoadFont()

static void SRL::ASCII::LoadFont ( SRL::Bitmap::IBitmap * bmp,
uint8_t fontId = 0 )
inlinestatic

Copies 4bpp Bitmap ASCII table to VRAM as 4bpp tileset.

Parameters
bmppointer to an IBitmap interface to load
Note
image layout must be grid of 8x8 pixel characters arranged in ASCII order from left to right, top to bottom, with 1 empty 8x8 tile preceding the characters (see example in VDP2 Samples)
Parameters
fontIdIndex in the font table to load this font to (range 0-5)

◆ LoadFontSG()

static void SRL::ASCII::LoadFontSG ( uint8_t * source,
uint8_t fontId = 0 )
inlinestatic

Use to load a 4bpp version of SGLs internal font.

Parameters
sourceAddress storing SGLs 8bpp font
fontIdFont index to load to (range 0-5)

◆ Print() [1/2]

static bool SRL::ASCII::Print ( char * myString,
uint8_t x,
uint8_t y )
inlinestatic

Display ASCII string on single line. Does not clamp to screen bounds or handle overflow.

Parameters
myStringThe string to print
xStarting tile X coordinate on screen (0-63)
yStarting tile Y coordinate on screen (0-63)
Returns
false if positions are out-of-range, true otherwise
Note
Tile (0,0) is aligned to the top left corner of the screen

◆ Print() [2/2]

static bool SRL::ASCII::Print ( const char * myString,
uint8_t x,
uint8_t y )
inlinestatic

Display ASCII string on single line. Does not clamp to screen bounds or handle overflow.

Parameters
myStringThe string to print
xStarting tile X coordinate on screen (0-63)
yStarting tile Y coordinate on screen (0-63)
Returns
false if positions are out-of-range, true otherwise
Note
Tile (0,0) is aligned to the top left corner of the screen

◆ SetColor()

static bool SRL::ASCII::SetColor ( uint16_t color,
uint8_t colorIndex )
inlinestatic

Set color in the specified palette index of the current font pallet.

Parameters
colorRGB555 color to set in current pallet
colorIndexindex to write the color to in the currently active font pallet (Clamped to 16 color palette)
Returns
false if colorIndex are out-of-range, true otherwise

◆ SetFont()

static bool SRL::ASCII::SetFont ( uint8_t fontId)
inlinestatic

Set current font to print with (range 0-5)

Parameters
fontIdIndex of the desired font in font table
Returns
false if fontId are out-of-range, true otherwise

◆ SetPalette()

static bool SRL::ASCII::SetPalette ( uint8_t paletteId)
inlinestatic

Set current color pallet to print with (range 0-7)

Parameters
paletteIdindex of the 16 color pallet in CRAM (limited to the first 8 pallets)
Returns
false if paletteId are out-of-range, true otherwise