PVSnesLib  4.6.0
Documentation to code in C or ASM for the Nintendo SNES
Loading...
Searching...
No Matches
textfont.h File Reference

contains the basic definitions for controlling the variable width font display. More...

#include <snes/snestypes.h>

Go to the source code of this file.

Functions

void consoleDrawText (u16 x, u16 y, char *fmt,...)
 Output formatted string on a screen (tiles mode)
 
void consoleDrawTextMap (u16 x, u16 y, u8 *map, u8 attributes, char *fmt,...)
 Output formatted string on a screen (2 colors tiles mode)
 
void consoleDrawTextMapCenter (u16 y, u16 *map, u8 attributes, char *fmt,...)
 Output formatted string on a screen, centered it (2 colors tiles mode)
 
void consoleInitDefaultText (u8 palnum)
 Initialize the Text System with the font shipped in PVSNesLib.
 
void consoleInitText (u8 palnum, u8 palsize, u8 *tilfont, u8 *palfont)
 Initialize the Text System.
 
void consoleSetTextGfxPtr (u16 vramfont)
 Change text graphics address (4K aligned)
 
void consoleSetTextMapPtr (u16 offsetfont)
 Change text Background map address for display (must be BG address)
 
void consoleSetTextOffset (u16 offsetfont)
 Change text Background map address for display (must be BG address)
 
void consoleSetTextPal (u8 palnum, u8 *palfont, u8 palsize)
 Change text font palette.
 
void consoleSetvwTextBlkTile (u16 tileEntry)
 Sets the blank tile entry to reset a line.
 
void consoleSetvwTextMapAttr (u8 mapAttr)
 Sets the high byte attr into tilemap entry.
 
void consoleUpdate (void)
 Update current text buffer on screen.
 
void consolevwTextUpdate (void)
 DMA all dirty line buffers to VRAM.
 

Variables

u8 scr_txt_dirty
 flag to redraw text during vblank
 
u8 scr_txt_font_map [0x800]
 tilemap used for text display
 

Detailed Description

contains the basic definitions for controlling the variable width font display.

Function Documentation

◆ consoleDrawText()

◆ consoleDrawTextMap()

void consoleDrawTextMap ( u16  x,
u16  y,
u8 *  map,
u8  attributes,
char *  fmt,
  ... 
)

Output formatted string on a screen (2 colors tiles mode)

Parameters
xThe X character number the string should start on
yThe Y character number the string should start on
mapThe 0x800 char map entry to put string
attributesattributes for tiles
fmtThe Format string (see printf() documentation in your local C tutorial)

Output a text string to the screen. Before using this, you need to call consoleInitText(). You can also print the value of variables this way, by putting a format string and additional parameters.

◆ consoleDrawTextMapCenter()

void consoleDrawTextMapCenter ( u16  y,
u16 *  map,
u8  attributes,
char *  fmt,
  ... 
)

Output formatted string on a screen, centered it (2 colors tiles mode)

Parameters
yThe Y character number the string should start on
mapThe 0x800 char map entry to put string
attributesattributes for tiles
fmtThe Format string (see printf() documentation in your local C tutorial)

Output a text string to the screen. Before using this, you need to call consoleInitText(). You can also print the value of variables this way, by putting a format string and additional parameters. The text will be centered on x axis.

◆ consoleInitDefaultText()

void consoleInitDefaultText ( u8  palnum)

Initialize the Text System with the font shipped in PVSNesLib.

Parameters
palnumpalette entry (0..7)

Reserve a BG and load the font characters into VRAM. It will only work in tiled display modes. You can change address of graphics and map with consoleSetTextVramAdr() and consoleSetTextVramBGAdr(). Also, consoleSetTextPal can change the text palette.

Examples
hello_world/src/hello_world.c, systems/breakpoints/src/breakpoints.c, systems/memory_mapping/src/memory_mapping.c, systems/random/src/random.c, systems/scoring/src/scoring.c, systems/sram/sramoffset/src/sramoffset.c, systems/sram/sramsimple/src/sram.c, systems/testregion/src/testregion.c, systems/timer/src/timer.c, and systems/typeconsole/src/pal_ntsc.c.

◆ consoleInitText()

void consoleInitText ( u8  palnum,
u8  palsize,
u8 *  tilfont,
u8 *  palfont 
)

Initialize the Text System.

Parameters
palnumpalette entry (0..7)
palsizesize of palette of text (4,16,etc ...)
tilfontPointer to tiles gfx for printing
palfontPointer to palette of text

Reserve a BG and load the font characters into VRAM. It will only work in tiled display modes. You can change address of graphics and map with consoleSetTextVramAdr() and consoleSetTextVramBGAdr(). Also, consoleSetTextPal can change the text palette.

Examples
audio/effects/effects.c, audio/effectsandmusic/effectsandmusic.c, audio/music/Music.c, audio/musicGreaterThan32k/musicGreaterThan32k.c, audio/tada/Tada.c, graphics/Backgrounds/Mode1Scroll/Mode1Scroll.c, graphics/Palette/GetColors/GetColors.c, graphics/Sprites/DynamicEngineMetaSprite/DynamicEngineMetaSprite.c, graphics/Sprites/ObjectSize/ObjectSize.c, graphics/maps/slopemario/slopemario.c, input/controller/controller.c, input/mouse/mouse.c, input/multiplay5/multiplay5.c, input/superscope/superscope.c, and systems/games/likemario/src/LikeMario.c.

◆ consoleSetTextGfxPtr()

◆ consoleSetTextMapPtr()

◆ consoleSetTextOffset()

◆ consoleSetTextPal()

consoleSetTextPal ( u8  palnum,
u8 *  palfont,
u8  palsize 
)

Change text font palette.

Parameters
palnumpalette entry (0..7)
palfontpointer to the new palette
palsizesize of palette of text (4,16,etc ...)

◆ consoleSetvwTextBlkTile()

void consoleSetvwTextBlkTile ( u16  tileEntry)

Sets the blank tile entry to reset a line.

Parameters
tileEntryID of the tile

Sets the full 16-bit tilemap word used to blank a line's unused columns when consoleSetvwTextClearLine() is called. Default is 0.

◆ consoleSetvwTextMapAttr()

void consoleSetvwTextMapAttr ( u8  mapAttr)

Sets the high byte attr into tilemap entry.

Parameters
mapAttrAttribute (VHPC CC00)

Sets the high byte (palette/priority/flip bits) into every tilemap entry written by consoleDrawvwText(). Default is 0. VHPC CC00 is V Vectiale / H horizontal Flip P Priority bit of background C Palette selection (0-7)

◆ consolevwTextUpdate()

consolevwTextUpdate ( void  )

DMA all dirty line buffers to VRAM.

Call during / just before or after VBlank. Call dmaCopyVram().

Examples
systems/textvwfont/src/textvwfont.c.