gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Display sprite on two screen

#167192 - intel3 - Thu Mar 05, 2009 2:09 am

Hi,

I am pretty new to DS programming. There are some concept I would like to clarify.

First I allocate memory for sprite on both engine, example

VRAM_E_MAIN_SPRITE and VRAM_D_SUB_SPRITE

Then I create two SpriteEntry, one for each screen
Then I put it into two OAMTable, one for each screen

Using the following code

DC_FlushAll();
dmaCopyHalfWords(SPRITE_DMA_CHANNEL,
oam->oamBuffer,
OAM,
SPRITE_COUNT * sizeof(SpriteEntry));

I use it twice replacing OAM with OAM_Sub for sub video engin.
Is there a sub SPRITE_DMA_CHANNEL that I am not aware of?

dmaCopyHalfWords(SPRITE_DMA_CHANNEL,
orangeShuttlePal,
&SPRITE_PALETTE[shuttleInfo->oamId *
COLORS_PER_PALETTE],
orangeShuttlePalLen);
dmaCopyHalfWords(SPRITE_DMA_CHANNEL,
orangeShuttle2Tiles,
&SPRITE_GFX[shuttle2->gfxIndex * OFFSET_MULTIPLIER],
orangeShuttle2TilesLen);

changing &SPRITE_GFX_SUB and &SPRITE_PALETTE_SUB and maybe change the SPRITE_DMA_CHANNEL to the subscreen?

Now if i want to move sprite from one screen to another, i just verify the coordinate and make it appear and disappear off the screen accordingly.

Am I correct? Is there anything i am missing?

Thanks for the replay