#176361 - singu-clarity - Wed Jul 06, 2011 9:30 am
Hi dev scene,
I just got started homebrew programming, and i'm stuck on the problem of loading multiple backgrounds with separate palettes. Here's the relevant code:
It seems that both backgrounds refer to the palette starting from BG_PALETTE, since my second bg displays fine, but my first bg is really trippy and messed up looking (second bg has transparency).
I'm assuming that sprites have the same problem. Do most developers just use a single shared palette?
I just got started homebrew programming, and i'm stuck on the problem of loading multiple backgrounds with separate palettes. Here's the relevant code:
Code: |
void initBG() { //bg uses akiraBitmap and akiraPal //bg2 uses testMapSharedTiles, testMapSharedPal, and Layer_1Map //bg 2 and bg 3 are both ex rot. bg 0 and 1 are text layers int bg = bgInit(2, BgType_Bmp8, BgSize_B8_256x256, 0,0); int bg2 = bgInit(1, BgType_Text8bpp, BgSize_ER_256x256, 1,1); bgSetPriority(bg2, 1); bgSetPriority(bg, 2); dmaCopy(akiraBitmap, bgGetGfxPtr(bg), sizeof(akiraBitmap)); dmaCopy(akiraPal, BG_PALETTE, sizeof(akiraPal)); dmaCopy(testMapSharedTiles, bgGetGfxPtr(bg2), sizeof(testMapSharedTiles)); dmaCopy(Layer_1Map, bgGetMapPtr(bg2), Layer_1MapLen); //WHERE TO PUT SECOND PALETTE??? dmaCopy(testMapSharedPal, BG_PALETTE, sizeof(testMapSharedPal)); } |
It seems that both backgrounds refer to the palette starting from BG_PALETTE, since my second bg displays fine, but my first bg is really trippy and messed up looking (second bg has transparency).
I'm assuming that sprites have the same problem. Do most developers just use a single shared palette?