BG0_CR was not declared in this scope
Posted: Fri Sep 11, 2009 5:36 pm
Hi!
I'm following a tutorial for learning some DS programming, but I've got a problem. I was able to solve all my previous problems using Google, but this time my Google skills have proven to be lacking. =(
Here's the code:
And the error is in the title. Anyone got an idea about what I did wrong?
I'm following a tutorial for learning some DS programming, but I've got a problem. I was able to solve all my previous problems using Google, but this time my Google skills have proven to be lacking. =(
Here's the code:
Code: Select all
#include <nds.h>
//create a tile called redTile
u8 redTile[64] =
{
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1
};
//create a tile called greenTile
u8 greenTile[64] =
{
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2
};
//---------------------------------------------------------------------------------
int main(void) {
//---------------------------------------------------------------------------------
int i;
//set video mode and map vram to the background
videoSetMode(MODE_0_2D | DISPLAY_BG0_ACTIVE);
vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
//get the address of the tile and map blocks
u8* tileMemory = (u8*)BG_TILE_RAM(1);
u16* mapMemory = (u16*)BG_MAP_RAM(0);
//tell the DS where we are putting everything and set 256 color mode and that we are using a 32 by 32 tile map.
BG0_CR = BG_32x32 | BG_COLOR_256 | BG_MAP_BASE(0) | BG_TILE_BASE(1);
//load our palette
BG_PALETTE[1] = RGB15(31,0,0);
BG_PALETTE[2] = RGB15(0,31,0);
//copy the tiles into tile memory one after the other
swiCopy(redTile, tileMemory, 32);
swiCopy(greenTile, tileMemory + 64, 32);
//create a map in map memory
for(i = 0; i < 32 * 32; i++)
mapMemory[i] = i & 1;
return 0;
}