Console problem (bug or feature?)
Posted: Sat Dec 18, 2010 12:12 pm
The following code produces (for me) unexpected results:
I would expect that the order in which you consoleSelect , consoleSetFont and consoleSetWindow shouldn't matter since you always pass around a reference to the console you are dealing with. Apparently you have to first consoleSelect and then you can alter some properties.
/fcg
Code: Select all
#include <nds.h>
#include <stdio.h>
#include "intro.h"
int main() {
powerOn(POWER_ALL_2D);
vramSetMainBanks( VRAM_A_MAIN_BG,
VRAM_B_LCD,
VRAM_C_SUB_BG,
VRAM_D_LCD
);
videoSetMode(MODE_5_2D);
videoSetModeSub(MODE_5_2D);
// Init print consoles
PrintConsole pcTop = *consoleInit( 0, 1, BgType_Text4bpp, BgSize_T_256x256, 0, 1, true, false);
PrintConsole pcBtm = *consoleInit( 0, 1, BgType_Text4bpp, BgSize_T_256x256, 0, 1, false, false);
// Load the font
ConsoleFont font;
font.gfx = (u16*)font8x8thinTiles;
font.pal = (u16*)font8x8thinPal;
font.numChars = 96;
font.numColors = font8x8thinPalLen / 2;
font.bpp = 4;
font.asciiOffset = 32;
font.convertSingleColor = false;
// Top screen typing
font.pal[1] = RGB15(0,31,0);
consoleSetFont(&pcTop, &font);
consoleSetWindow(&pcTop, 2, 12, 28, 20);
consoleSelect(&pcTop);
iprintf("PONG - a masterpiece by FCG\n\nThanks for all the help overat #dsdev and devkitpro.org/");
// Btm screen typing
consoleSelect(&pcBtm);
font.pal[1] = RGB15(31,31,31);
ConsoleSetFont(&pcBtm, &font);
consoleSetWindow(&pcBtm, 2, 12, 28, 20);
iprintf("This game was built with thedevkitARM toolchain providedby devkitPro - devkitpro.org");
iprintf("\ndevkitPro is not responsiblefor the game in any way.");
while(1) {
swiWaitForVBlank();
}
return 0;
}
/fcg