libnds
Loading...
Searching...
No Matches
Data Fields
PrintConsole Struct Reference

Console structure used to store the state of a console render context. More...

#include <console.h>

Data Fields

s8 bgId
 Background ID. Initialized by consoleInit().
 
u16 consoleHeight
 Height of the console hardware layer in tiles.
 
u16 consoleWidth
 Width of the console hardware layer in tiles.
 
s16 cursorX
 Current X location of the cursor. Initialized by consoleInit().
 
s16 cursorY
 Current Y location of the cursor. Initialized by consoleInit().
 
ConsoleFont font
 Font of the console.
 
u16fontBgGfx
 Pointer to the bg layer graphics if used. Initialized by consoleInit().
 
u16fontBgMap
 Pointer to the bg layer map if used. Initialized by consoleInit().
 
u16 fontCharOffset
 Offset to the first graphics tile in background memory (in case your font is not loaded at a graphics base boundary). Initialized by consoleInit().
 
u8 fontPalIndex
 Palette index where a custom palette is loaded. Initialized by consoleInit().
 
ConsoleHandleEscape HandleEscapeSequence
 This is an optional hook that is called whenever an unknown escape sequence is detected. Note that the initial ESC character isn't passed to the hook.
 
ConsoleHandleSgr HandleSgrCodes
 Handler of SGR commands that change text attributes like color. If it's NULL, it will use the legacy handler of libnds.
 
s16 prevCursorX
 Internal. Used by "\x1b[s" and "\x1b[u". Initialized by consoleInit().
 
s16 prevCursorY
 Internal. Used by "\x1b[s" and "\x1b[u". Initialized by consoleInit().
 
ConsolePrint PrintChar
 Callback for printing a character.
 
u8 tabSize
 Size of a TAB character.
 
void * userData
 Pointer available for custom user data related to this console.
 
u16 windowHeight
 Window height in tiles.
 
u16 windowWidth
 Window width in tiles.
 
u16 windowX
 Window X location in tiles.
 
u16 windowY
 Window Y location in tiles.
 

Detailed Description

Console structure used to store the state of a console render context.

Many of the values in this struct are actually initialized by libnds, and the user should leave them as 0 when consoleInit() is called.

Default values from consoleGetDefault():

PrintConsole defaultConsole =
{
.font =
{
.gfx = default_fontTiles, // Font tiles
.pal = NULL, // No font palette (use the default palettes)
.numColors = 0,
.bpp = 1,
.asciiOffset = 32, // First ASCII character in the set
.numChars = 96 // Number of characters in the font set
},
.consoleWidth = 32,
.consoleHeight = 24,
.windowX = 0,
.windowY = 0,
.windowWidth = 32,
.windowHeight = 24,
.tabSize = 3,
.PrintChar = NULL,
};
const void * gfx
Pointer to the font graphics.
Definition arm9/console.h:180
Console structure used to store the state of a console render context.
Definition arm9/console.h:239
ConsoleFont font
Font of the console.
Definition arm9/console.h:240

Field Documentation

◆ PrintChar

ConsolePrint PrintConsole::PrintChar

Callback for printing a character.

It should return true if it has handled rendering the graphics. If not, the print engine will attempt to render via tiles).

◆ userData

void* PrintConsole::userData

Pointer available for custom user data related to this console.

This is useful if the PrintChar hook requires more information than the available in this struct. libnds ignores this field, it doesn't use it or tries to free it.


The documentation for this struct was generated from the following file: