#168658 - renatobs - Wed May 13, 2009 5:23 pm
Hi! I?m having problems to create aprites on sub-screen. I don?t know what is happen, but i?m doing some thing like it:
videoSetMode ( MODE_0_2D | DISPLAY_BG3_ACTIVE | DISPLAY_BG2_ACTIVE | DISPLAY_BG1_ACTIVE | DISPLAY_BG0_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D );
videoSetModeSub ( MODE_0_2D | DISPLAY_BG3_ACTIVE | DISPLAY_BG2_ACTIVE | DISPLAY_BG1_ACTIVE | DISPLAY_BG0_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D );
vramSetBankA( VRAM_A_MAIN_BG_0x06000000 );
vramSetBankB( VRAM_B_MAIN_SPRITE_0x06400000 );
vramSetBankC( VRAM_C_SUB_BG_0x06200000);
vramSetBankD( VRAM_D_SUB_SPRITE );
SpriteEntry sprites[128];
SpriteEntry sub_sprites[128];
...
void InitSprites(void)
{
int i;
for(i = 0; i < 128; i++)
{
sprites[i].attribute[0] = ATTR0_DISABLED;
sub_sprites[i].attribute[0] = ATTR0_DISABLED;
}
swiCopy( sprites, OAM , 128 * sizeof(SpriteEntry));
swiCopy( sub_sprites, OAM_SUB , 128 * sizeof(SpriteEntry));
}
...
for(a = 0; a < 32 ;a++)
{
sprites[a].attribute[0] = ATTR0_COLOR_256 | ATTR0_SQUARE | OBJ_Y(y-8);
sprites[a].attribute[1] = ATTR1_SIZE_32 | OBJ_X(x);
sprites[a].attribute[2] = prioridade[a] * 32 | ATTR2_PRIORITY(OBJPRIORITY_1);
sub_sprites[a].attribute[0] = ATTR0_COLOR_256 | ATTR0_SQUARE | OBJ_Y(y-8);
sub_sprites[a].attribute[1] = ATTR1_SIZE_32 | OBJ_X(x);
sub_sprites[a].attribute[2] = prioridade[a] * 32 | ATTR2_PRIORITY(OBJPRIORITY_1);
}
swiCopy( sprites , OAM , 128 * sizeof(SpriteEntry));
swiCopy( sub_sprites , OAM_SUB , 128* sizeof(SpriteEntry));
I already have the sprites datas and pal in VRAM and more needing things. The problem is when I put all sprites, the sub_sprites appear correct in sub_screen but i have a big problem with main_screen, that lost your pal colors and sprites became a garbage... Need I do some special thing to put sub_sprites on sub_screen ? If I don?t put them, the main screen and sprites seems correct !!!
Could someone here give a example of sprites on 2 screen same time ?
Thanks.
videoSetMode ( MODE_0_2D | DISPLAY_BG3_ACTIVE | DISPLAY_BG2_ACTIVE | DISPLAY_BG1_ACTIVE | DISPLAY_BG0_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D );
videoSetModeSub ( MODE_0_2D | DISPLAY_BG3_ACTIVE | DISPLAY_BG2_ACTIVE | DISPLAY_BG1_ACTIVE | DISPLAY_BG0_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D );
vramSetBankA( VRAM_A_MAIN_BG_0x06000000 );
vramSetBankB( VRAM_B_MAIN_SPRITE_0x06400000 );
vramSetBankC( VRAM_C_SUB_BG_0x06200000);
vramSetBankD( VRAM_D_SUB_SPRITE );
SpriteEntry sprites[128];
SpriteEntry sub_sprites[128];
...
void InitSprites(void)
{
int i;
for(i = 0; i < 128; i++)
{
sprites[i].attribute[0] = ATTR0_DISABLED;
sub_sprites[i].attribute[0] = ATTR0_DISABLED;
}
swiCopy( sprites, OAM , 128 * sizeof(SpriteEntry));
swiCopy( sub_sprites, OAM_SUB , 128 * sizeof(SpriteEntry));
}
...
for(a = 0; a < 32 ;a++)
{
sprites[a].attribute[0] = ATTR0_COLOR_256 | ATTR0_SQUARE | OBJ_Y(y-8);
sprites[a].attribute[1] = ATTR1_SIZE_32 | OBJ_X(x);
sprites[a].attribute[2] = prioridade[a] * 32 | ATTR2_PRIORITY(OBJPRIORITY_1);
sub_sprites[a].attribute[0] = ATTR0_COLOR_256 | ATTR0_SQUARE | OBJ_Y(y-8);
sub_sprites[a].attribute[1] = ATTR1_SIZE_32 | OBJ_X(x);
sub_sprites[a].attribute[2] = prioridade[a] * 32 | ATTR2_PRIORITY(OBJPRIORITY_1);
}
swiCopy( sprites , OAM , 128 * sizeof(SpriteEntry));
swiCopy( sub_sprites , OAM_SUB , 128* sizeof(SpriteEntry));
I already have the sprites datas and pal in VRAM and more needing things. The problem is when I put all sprites, the sub_sprites appear correct in sub_screen but i have a big problem with main_screen, that lost your pal colors and sprites became a garbage... Need I do some special thing to put sub_sprites on sub_screen ? If I don?t put them, the main screen and sprites seems correct !!!
Could someone here give a example of sprites on 2 screen same time ?
Thanks.