#166494 - Pete_Lockwood - Sun Feb 08, 2009 10:00 pm
So I've got some code working which is using tiles to put stuff to a single layer and I want to extend it to use 2 layers. The code (below) is hacked from the advMultipleLayers libNds example. It *does* work for *one* layer, i.e. poking values into map[] will get the DS to draw my tiles correctly.
When I remove the comments to attempt to use a second layer, however, I'm only able to get something to draw if I poke the exact same value into map[] and map2[] at the exact same offset. I suspect this means I'm stupid and missing the plot somewhere. Can someone point me in the right direction?
_________________
It's not an illusion, it just looks like one.
Last edited by Pete_Lockwood on Thu Feb 12, 2009 1:03 am; edited 1 time in total
When I remove the comments to attempt to use a second layer, however, I'm only able to get something to draw if I poke the exact same value into map[] and map2[] at the exact same offset. I suspect this means I'm stupid and missing the plot somewhere. Can someone point me in the right direction?
Code: |
void InitScreen(void) { videoSetMode(MODE_5_2D); vramSetBankA(VRAM_A_MAIN_BG); int bg0 = bgInit(0, BgType_Text4bpp, BgSize_ER_256x256, 0,1); // int bg1 = bgInit(1, BgType_Text4bpp, BgSize_ER_256x256, 1,1); bgSetPriority(bg0, 0); // bgSetPriority(bg1, 1); // according to the sample code they magically share tiles and a palette dmaCopy(tilesTiles, bgGetGfxPtr(bg0), sizeof(tilesTiles)); dmaCopy(tilesPal, BG_PALETTE, sizeof(tilesPal)); map = (u16*)bgGetMapPtr(bg0); // map2 = (u16*)bgGetMapPtr(bg1); } |
_________________
It's not an illusion, it just looks like one.
Last edited by Pete_Lockwood on Thu Feb 12, 2009 1:03 am; edited 1 time in total