[solved] 512x512 backgrounds not displaying
Posted: Thu Mar 05, 2009 12:55 pm
Hi there, I'm working with a team trying to make an NDS game, and we're stumped trying to get 512x512 backgrounds displaying. Our code is below; we have no idea what we're doing wrong or simply not doing what we should be because the documentation we've found is sparse and tutorials covering this all seem to stop immediately before making this work. Any help is appreciated.
Code: Select all
#include <nds.h>
#include <stdio.h>
#include "rah.h" // our grit-generated graphics header
int main(void)
{
// Turn on 2d graphics core
powerOn ( POWER_ALL_2D );
// Video mode
videoSetMode ( MODE_5_2D | DISPLAY_BG3_ACTIVE );
// Tried these three as well as vramSetMainBanks, equally unsuccessful:
//
//vramSetBankA ( VRAM_A_MAIN_BG_0x06000000 );
//vramSetBankA(VRAM_A_MAIN_BG);
//vramSetBankB(VRAM_B_MAIN_BG);
vramSetMainBanks(
VRAM_A_MAIN_BG_0x06000000,
VRAM_B_MAIN_BG_0x06020000,
VRAM_C_MAIN_BG_0x06040000,
VRAM_D_MAIN_BG_0x06060000);
consoleDemoInit();
// Taken from one of the examples
iprintf("\n\n\tHello DS devers\n");
iprintf("\twww.drunkencoders.com\n");
iprintf("\t256 color bitmap demo");
// Initialize our background and place it in memory
int bg1 = bgInit( 3, BgType_Bmp8, BgSize_B8_512x512, 0, 0 );
dmaCopy( rahBitmap, bgGetGfxPtr(bg1), rahBitmapLen );
dmaCopy( rahPal, BG_PALETTE, rahPalLen );
while(1)
{
swiWaitForVBlank();
}
return 0;
}