#108006 - djmcbell - Sat Nov 04, 2006 12:46 am
Yep, I'm willing to bet you've had absolutely *LOADS* of these, but here we are again. I've been using the Patatersoft tutorial, which assures me I should have a sprite up and going on the bottom screen. Which would be nice and dandy, except there isn't. It displays on the top (and my modified version below displays nothing on top, as expected, but nothing on bottom), but how do I display it on the bottom instead?
I'm just using a ball sprite (I'm trying to get up and running by creating my own little vertical Pong demo, but that's by the by) so here's the important code -
updateOAM - I know I should be writing to OAM_SUB, but I don't know the settings
InitVideo - I've changed a few things on the subscreen, I don't think it should make a different here
And our initSprites itself - again, changed the sprite so that it *should* go into the submemory
I've been doing some GBA coding (quite enjoying that) but really want to get into DS coding, so any quick help here would be appreciated.[/code]
I'm just using a ball sprite (I'm trying to get up and running by creating my own little vertical Pong demo, but that's by the by) so here's the important code -
updateOAM - I know I should be writing to OAM_SUB, but I don't know the settings
Code: |
//Update the OAM - OAM_SUB
void updateOAM(SpriteEntry * spriteEntry) { DC_FlushAll(); dmaCopy(spriteEntry, OAM, 128 * sizeof(SpriteEntry)); } |
InitVideo - I've changed a few things on the subscreen, I don't think it should make a different here
Code: |
void initVideo()
{ /*map vram to display a bg on the main and sub screen and give us lots of sprites*/ vramSetMainBanks( //map A and B to main background memory //this gives us 256KB which is a healthy amount for // 16-bit gfx VRAM_A_MAIN_BG_0x6000000, VRAM_B_MAIN_BG_0x6020000, //map C to sub background memory VRAM_C_SUB_BG_0x6200000, //map D to LCD free space VRAM_D_LCD); //map a bank for use with sprites vramSetBankE(VRAM_E_MAIN_SPRITE); //mapping E to main sprites gives us 64k for sprites //(64k is the max space that 1024 tiles take up in 256 color mode) //set the video mode on the main screen videoSetMode( MODE_5_2D | //set the graphics mode to Mode 5 DISPLAY_SPR_ACTIVE | //turn on sprites DISPLAY_BG3_ACTIVE | //turn on background 3 DISPLAY_SPR_1D); //this is used when in tile mode //set the video mode on the sub screen videoSetModeSub(MODE_5_2D | DISPLAY_SPR_ACTIVE | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_1D); } |
And our initSprites itself - again, changed the sprite so that it *should* go into the submemory
Code: |
void initSprites(SpriteEntry * spriteEntry, SpriteRotation * spriteRotation)
{ //init OAM initOAM(spriteEntry, spriteRotation); ballx = SCREEN_WIDTH/2 - 64; bally = SCREEN_HEIGHT/2 - 64; //create the ball sprite int ballGfxID = 64; spriteEntry[0].attribute[0] = ATTR0_COLOR_256 | ATTR0_ROTSCALE_DOUBLE | //able to rotscale bally; spriteEntry[0].attribute[1] = ATTR1_ROTDATA(0) | ATTR1_SIZE_64 | //size 64x64 ballx; spriteEntry[0].attribute[2] = ballGfxID; //set initial rotation attributes rotateSprite(&spriteRotation[0], 0); //copy in the sprite palettes dmaCopy(ballpalette_bin, //from address (uint16 *)SPRITE_PALETTE_SUB, //to address ballpalette_bin_size); //size of data to copy //copy the sprite graphics in obj graphics mem dmaCopy(balldata_bin, //from address &SPRITE_GFX_SUB[ballGfxID * 16], //to address balldata_bin_size); //size of data to copy //update the OAM updateOAM(spriteEntry); } |
I've been doing some GBA coding (quite enjoying that) but really want to get into DS coding, so any quick help here would be appreciated.[/code]