#172972 - Stephanie - Sat Mar 13, 2010 4:32 pm
So far I've just been using the console modes to output text, as well as playing with some sprites. I'd like to incorporate a graphical background now, but still be able to output text overtop of it.
I'm looking at one of the libnds examples, Graphics/Backgrounds/16bit_color_bmp and trying to modify that to get what I want.
I've changed it so it displays the background image on both screens, but now I'm trying to print text over the lower screen, and it keeps giving me garbled output.
I'm sure it's a problem with either the vram banks, or the layers... but I think I understand how the layers should work? I have mode 5, for two text bg layers and two extended layers. The bgInit / bgInitSub functions work and as I said, I get the graphic on both screens. But when I use consoleInit to set up a text console, the lower screen gets garbled up.
If anyone could point me in the right direction as to where I'm going wrong with this, I'd really appreciate it!
Thank you!
-Stephanie
I'm looking at one of the libnds examples, Graphics/Backgrounds/16bit_color_bmp and trying to modify that to get what I want.
I've changed it so it displays the background image on both screens, but now I'm trying to print text over the lower screen, and it keeps giving me garbled output.
I'm sure it's a problem with either the vram banks, or the layers... but I think I understand how the layers should work? I have mode 5, for two text bg layers and two extended layers. The bgInit / bgInitSub functions work and as I said, I get the graphic on both screens. But when I use consoleInit to set up a text console, the lower screen gets garbled up.
Code: |
#include <nds.h>
#include <stdio.h> // git outputs a nice header to reference data #include "drunkenlogo.h" int main(void) { videoSetMode(MODE_5_2D); videoSetModeSub(MODE_5_2D); vramSetMainBanks(VRAM_A_MAIN_BG, VRAM_B_LCD, VRAM_C_SUB_BG, VRAM_D_LCD); // consoleDemoInit(); bgInit(3, BgType_Bmp16, BgSize_B16_256x256, 0,0); bgInitSub(3, BgType_Bmp16, BgSize_B16_256x256, 0,0); // graphics on layer 3 decompress(drunkenlogoBitmap, BG_GFX, LZ77Vram); decompress(drunkenlogoBitmap, BG_GFX_SUB, LZ77Vram); PrintConsole bottomScreen; consoleInit(&bottomScreen, 0, BgType_Text4bpp, BgSize_T_256x256, 31, 0, false, true); // text on layer 0 consoleSelect(&bottomScreen); BG_PALETTE_SUB[255] = RGB15(0, 0, 0); // set text to be black iprintf("Hello DS devers\n"); iprintf("www.drunkencoders.com\n"); iprintf("16 bit bitmap demo"); while(1) { swiWaitForVBlank(); } return 0; } |
If anyone could point me in the right direction as to where I'm going wrong with this, I'd really appreciate it!
Thank you!
-Stephanie