#20346 - tethered - Sat May 08, 2004 5:29 pm
hello,
first of all, since this is my first post on this forum, i'd like to take a moment and introduce myself... my name is chuck, i'm an intermediate-level c programmer, and I have recently gotten sucked into developing for the gba console (its deceptively simple!). i've been lurking around and have collected a lot of information and advice from you guys already, but i've hit a slight road block...
i'm working on creating a multi-layered background in mode 0, text bg 0, but i'm having trouble finding any clearly written documentation on how to do so. at this point, with a single layer, my code looks like this:
clearly its not the most efficient way to go about it, but for the time being, as i'm slowly getting comfortable with the console, clarity is more important than optimization.
so, with that said, working within the constructs of my software loop, how would i go about adding multiple layers of parallax scrolling? i understand there's 2 bits for the background priority in the background control register, but i'm not sure how to use it in a practical sense.
any help would be greatly appreciated.
thanks in advance,
chuck
first of all, since this is my first post on this forum, i'd like to take a moment and introduce myself... my name is chuck, i'm an intermediate-level c programmer, and I have recently gotten sucked into developing for the gba console (its deceptively simple!). i've been lurking around and have collected a lot of information and advice from you guys already, but i've hit a slight road block...
i'm working on creating a multi-layered background in mode 0, text bg 0, but i'm having trouble finding any clearly written documentation on how to do so. at this point, with a single layer, my code looks like this:
Code: |
u16* ScreenBB = (u16*)ScreenBaseBlock(8);
u16* CharBB = (u16*) CharBaseBlock(0); // set video mode SetMode(MODE_0 | BG0_ENABLE); // set bg control register REG_BG0CNT = BG_COLOR_256 | TEXTBG_SIZE_256x256 | (8 << SCREEN_SHIFT) | (0 << CHAR_SHIFT); // load palette data for (i = 0; i < 256; i++) BG_PaletteMem[i] = stars_Palette[i]; // load map data for (i = 0; i < 1024; i++) ScreenBB[i] = stars_Map[i]; // load tile data for (i = 0; i < 128 / 2; i++) CharBB[i] = (stars_Tiles[i*2+1] << 8) + stars_Tiles[i*2]; // game loop while (1) { // 1. detect key presses and change x and y coords accordingly // 2. wait for vdraw // 3. update bg's x and y registers } |
clearly its not the most efficient way to go about it, but for the time being, as i'm slowly getting comfortable with the console, clarity is more important than optimization.
so, with that said, working within the constructs of my software loop, how would i go about adding multiple layers of parallax scrolling? i understand there's 2 bits for the background priority in the background control register, but i'm not sure how to use it in a practical sense.
any help would be greatly appreciated.
thanks in advance,
chuck