Debugging: output numbers on the screen

Good old libnds wisdom. I looked up an old project and saw, that you can very easy use libnds for having a simple “console” in the upper screen. Simply use code like this:
consoleDemoInit();
printf("i: %i \n", i );

The other way around is something like that. It also works at 8- and 16bit drawing modes and are somehow highly customizable. Basically it converts a number into a string.


// first of all you must include the standart io from the c-lib
#include <stdio.h>
// init an char-array
char string[32];
// convert variable into string (the char array) using sprintf
sprintf(string, “%i”, i);
// finally draw text (8- and 16-bit mode)
PA_CenterSmartText (0, 200, 8, 256, 32, string, 2, 3, 1);
// (or other modes using i.e.)
PA_InitText (0, 1);
PA_OutputSimpleText (0, 1, 1, string);

One Response to “Debugging: output numbers on the screen”

  1. Wahoo Says:

    Thank you for sharing!

Leave a Reply