Multiple Backgrounds Help
Posted: Sat Nov 14, 2009 2:07 am
Hi, I'm new to homebrew, I sought the answer in many places - including this forum -, but could not find it .
Each time I start to think that I understood how to use the backgrounds, I realize I don't, he.
I'm trying to place two backgrounds in my application, code is like this:
If I comment this line dmaCopy(drackoBitmap, bgGetGfxPtr(bgDracko), drackoBitmapLen); I realize that bgMainSplash and bgDracko have the same data, I really don't know why, because when I use the bgInit for the first I'm using layer 3 and for the second I use layer 2, I think it's the same than doing this:
and:
But it does not work as I want .
a screenshot:
Each time I start to think that I understood how to use the backgrounds, I realize I don't, he.
I'm trying to place two backgrounds in my application, code is like this:
Code: Select all
#include <nds.h>
#include <stdio.h>
#include "nanniWare.h" //256*192px
#include "mumei.h" //256*192px
#include "dracko.h" //64*64px
int main(void){
videoSetMode(MODE_5_2D);
videoSetModeSub(MODE_5_2D);
PrintConsole pcTop = *consoleInit(0, 1, BgType_Text4bpp, BgSize_T_256x256, 0, 1, true, true);
PrintConsole pcBtm = *consoleInit(0, 1, BgType_Text4bpp, BgSize_T_256x256, 0, 1, false, true);
vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
vramSetBankB(VRAM_B_MAIN_BG_0x06000000);
vramSetBankC(VRAM_C_SUB_BG_0x06200000);
int bgMainSplash = bgInit(3, BgType_Bmp16, BgSize_B16_256x256, 2, 0);
bgSetCenter(bgMainSplash, 128, 128);
bgSetRotateScale(bgMainSplash, 0, 1 << 8, 1 << 8);
bgSetScroll(bgMainSplash, 128, 128);
bgSetPriority(bgMainSplash, 3);
bgUpdate();
dmaCopy(nanniWareBitmap, bgGetGfxPtr(bgMainSplash), nanniWareBitmapLen);
int bgDracko = bgInit(2, BgType_Bmp16, BgSize_B16_256x256, 2, 0);
bgSetCenter(bgDracko, 0, 10);
bgSetRotateScale(bgDracko, 0, 1 << 8, 1 << 8);
bgSetScroll(bgDracko, 0, 0);
bgSetPriority(bgDracko, 2);
bgUpdate();
dmaCopy(drackoBitmap, bgGetGfxPtr(bgDracko), drackoBitmapLen);
int bgSubSplash = bgInitSub(2, BgType_Bmp16, BgSize_B16_256x256, 2, 0);
bgSetCenter(bgSubSplash, 0, 10);
bgSetRotateScale(bgSubSplash, 0, 1 << 8, 1 << 8);
bgSetScroll(bgSubSplash, 0, 0);
bgSetPriority(bgSubSplash, 2);
bgUpdate();
dmaCopy(mumeiBitmap, bgGetGfxPtr(bgSubSplash), mumeiBitmapLen);
iprintf("\x1b[%i;%iH%s", 0, 0, "Text");
return 0;
}
Code: Select all
REG_BG3CNT = BG_BMP16_256x256;
REG_BG3PA = 1 << 8;
REG_BG3PB = 0;
REG_BG3PC = 0;
REG_BG3PD = 1 << 8;
REG_BG3X = 0;
REG_BG3Y = 0;
Code: Select all
REG_BG2CNT = BG_BMP16_256x256;
REG_BG2PA = 1 << 8;
REG_BG2PB = 0;
REG_BG2PC = 0;
REG_BG2PD = 1 << 8;
REG_BG2X = 0;
REG_BG2Y = 0;
a screenshot: