console.h File Reference

nds stdio support. More...

#include <nds/ndstypes.h>
#include <nds/arm9/background.h>

Data Structures

struct  ConsoleFont
 a font struct for the console. More...
struct  PrintConsole
 console structure used to store the state of a console render context. More...

Typedefs

typedef struct ConsoleFont ConsoleFont
 a font struct for the console.
typedef struct PrintConsole PrintConsole
 console structure used to store the state of a console render context.

Enumerations

enum  DebugDevice {
  DebugDevice_NULL = 0x0,
  DebugDevice_NOCASH = 0x1,
  DebugDevice_CONSOLE = 0x02
}
 

Console debug devices supported by libnds.

More...

Functions

void consoleClear (void)
 Clears the screan by iprintf("\x1b[2J");.
void consoleDebugInit (DebugDevice device)
 Initializes debug console output on stderr to the specified device.
PrintConsoleconsoleDemoInit (void)
 Initialize the console to a default state for prototyping. This function sets the console to use sub display, VRAM_C, and BG0 and enables MODE_0_2D on the sub display. It is intended for use in prototyping applications which need print ability and not actual game use. Print functionality can be utilized with just this call.
PrintConsoleconsoleGetDefault (void)
 Gets a pointer to the default console (this should only be used when using a single console, other wise use consoleNew(PrintsConsole* console).
PrintConsoleconsoleInit (PrintConsole *console, int layer, BgType type, BgSize size, int mapBase, int tileBase, bool mainDisplay, bool loadGraphics)
 Initialise the console.
void consoleSelect (PrintConsole *console)
 Make the specified console the render target.
void consoleSetFont (PrintConsole *console, ConsoleFont *font)
 Loads the font into the current console.
void consoleSetWindow (PrintConsole *console, int x, int y, int width, int height)
 Sets the print window.

Detailed Description

nds stdio support.

Provides studio integration for printing to the DS screen as well as debug print functionality provided by stderr.
General usage is to initialize the console by: consoleDemoInit() or to customize the console usage by: consoleInit()
The default instance utilizes the sub display, approximatly 15KiB of vram C starting at tile base 0 and 2KiB of map at map base 30.
Debug printing is performed by initializing the debug console via consoleDebugInit() as follows:
consoleDebugInit(DebugDevice_NOCASH);
fprintf(stderr, "debug message in no$gba window %i", stuff);
OR
consoleDebugInit(DebugDevice_CONSOLE);
fprintf(stderr, "debug message on DS console screen");
The print console must be initialized to use DB_CONSOLE

Typedef Documentation

typedef struct PrintConsole PrintConsole

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

Default values from consolNew():

PrintConsole defaultConsole =
{
Font:
	{
		(u16*)default_font_bin, //font gfx
		0, //font palette
		0, //font color count
		4, //bpp
		0, //first ascii character in the set
		128, //number of characters in the font set
		true, //convert to single color
	},
	0, //font background map
	0, //font background gfx
	31, //map base
	0, //char base
	0, //bg layer in use
	-1, //bg id
	0,0, //cursorX cursorY
	0,0, //prevcursorX prevcursorY
	32, //console width
	24, //console height
	0,  //window x
	0,  //window y
	32, //window width
	24, //window height
	3, //tab size
	0, //font character offset
	0, //selected palette
	0,  //print callback
	false, //console initialized
	true, //load graphics
};

Enumeration Type Documentation

Console debug devices supported by libnds.

Enumerator:
DebugDevice_NULL 

swallows prints to stderr

DebugDevice_NOCASH 

Directs stderr debug statements to no$gba debug window.

DebugDevice_CONSOLE 

Directs stderr debug statements to DS console window.


Function Documentation

void consoleDebugInit ( DebugDevice  device  ) 

Initializes debug console output on stderr to the specified device.

Parameters:
device The debug device (or devices) to output debug print statements to
PrintConsole* consoleDemoInit ( void   ) 

Initialize the console to a default state for prototyping. This function sets the console to use sub display, VRAM_C, and BG0 and enables MODE_0_2D on the sub display. It is intended for use in prototyping applications which need print ability and not actual game use. Print functionality can be utilized with just this call.

Returns:
A pointer to the current PrintConsole.
Examples:
audio/maxmod/audio_modes/source/main.c, audio/maxmod/basic_sound/source/MaxModExample.c, audio/maxmod/reverb/source/main.c, audio/maxmod/streaming/source/main.c, audio/micrecord/source/micrecord.c, card/eeprom/source/main.cpp, ds_motion/source/main.c, dswifi/ap_search/source/template.c, dswifi/autoconnect/source/autoconnect.c, dswifi/httpget/source/httpget.c, filesystem/libfat/libfatdir/source/directory.c, filesystem/nitrofs/nitrodir/source/directory.c, Graphics/3D/BoxTest/source/main.cpp, Graphics/3D/nehe/lesson10/source/nehe10.cpp, Graphics/3D/Paletted_Cube/source/main.cpp, Graphics/Backgrounds/16bit_color_bmp/source/template.cpp, Graphics/Backgrounds/256_color_bmp/source/main.cpp, Graphics/Backgrounds/all_in_one/source/main.cpp, Graphics/Backgrounds/Double_Buffer/source/main.cpp, Graphics/Backgrounds/rotation/source/main.cpp, Graphics/Printing/ansi_console/source/main.c, Graphics/Printing/console_windows/source/main.c, Graphics/Sprites/allocation_test/source/main.c, Graphics/Sprites/bitmap_sprites/source/main.cpp, hello_world/source/main.cpp, input/keyboard/keyboard_async/source/template.c, input/keyboard/keyboard_stdin/source/keymain.c, input/Touch_Pad/touch_area/source/template.c, time/RealTimeClock/source/main.c, and time/stopwatch/source/main.c.
PrintConsole* consoleGetDefault ( void   ) 

Gets a pointer to the default console (this should only be used when using a single console, other wise use consoleNew(PrintsConsole* console).

Returns:
A pointer to the default console
PrintConsole* consoleInit ( PrintConsole console,
int  layer,
BgType  type,
BgSize  size,
int  mapBase,
int  tileBase,
bool  mainDisplay,
bool  loadGraphics 
)

Initialise the console.

Parameters:
console A pointer to the console initialze data (if null default console will be used)
layer background layer to use
type the type of the background
size the size of the background
mapBase the map base
tileBase the tile graphics base
mainDisplay if true main engine is used, otherwise false
loadGraphics if true the default font graphics will be loaded into the layer
Returns:
A pointer to the current console.
Examples:
capture/ScreenShot/source/main.cpp, Graphics/Printing/custom_font/source/main.c, Graphics/Printing/print_both_screens/source/template.c, Graphics/Printing/rotscale_text/source/main.c, and input/Touch_Pad/touch_test/source/main.c.
void consoleSelect ( PrintConsole console  ) 

Make the specified console the render target.

Parameters:
console A pointer to the console struct (must have been initialized with consoleInit(PrintConsole* console)
Examples:
Graphics/Printing/console_windows/source/main.c, and Graphics/Printing/print_both_screens/source/template.c.
void consoleSetFont ( PrintConsole console,
ConsoleFont font 
)

Loads the font into the current console.

Parameters:
console pointer to the print console to update
font the font to load
Examples:
Graphics/Printing/custom_font/source/main.c, and Graphics/Printing/rotscale_text/source/main.c.
void consoleSetWindow ( PrintConsole console,
int  x,
int  y,
int  width,
int  height 
)

Sets the print window.

Parameters:
console console to set, if NULL will set current console window
x x location of the window
y y location of the window
width width of the window
height height of the window
Examples:
dswifi/ap_search/source/template.c, and Graphics/Printing/console_windows/source/main.c.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Generated on Sat Oct 2 12:55:12 2010 for libnds by  doxygen 1.6.3