#124648 - Stuk - Sat Apr 07, 2007 4:27 pm
I seem to be encountering a few problems learning to code for the DS :)
This time I can't get a 16x16 sprite to appear properly. The left of the image is how it appears in emulators and on the DS, and the right is how it should appear (without the magenta eventually :) ):
[Images not permitted - Click here to view it]
For this I've set the sprite attributes to be 32x32 just to show that the data is there, but not in the right place. When set to 16x16 just the top red and green parts are shown.
This is the code I'm using to display the sprite:
And this is how I've set up the memory:
initOAM() clears the attributes for all sprites. Does anybody have any ideas on what might be going wrong? I wondered if I should be using a different display mode, but on switching this to MODE_5_2D everything broke :). I could have another stab at it if that is the problem.
Any help would be appreciated,
Stuk
Last edited by Stuk on Sat Apr 07, 2007 4:57 pm; edited 1 time in total
This time I can't get a 16x16 sprite to appear properly. The left of the image is how it appears in emulators and on the DS, and the right is how it should appear (without the magenta eventually :) ):
[Images not permitted - Click here to view it]
For this I've set the sprite attributes to be 32x32 just to show that the data is there, but not in the right place. When set to 16x16 just the top red and green parts are shown.
This is the code I'm using to display the sprite:
Code: |
//sprite attribute memory SpriteEntry *spritesMain = new SpriteEntry[128]; //rotation attributes overlap so assign then to the same location SpriteRotation *spriteRotationsMain = (SpriteRotation *)spritesMain; initOAM(spritesMain, spriteRotationsMain); int x = 10, y= 110, loc = 32; spritesMain[0].attribute[0] = ATTR0_COLOR_256 | ATTR0_ROTSCALE_DOUBLE | y; spritesMain[0].attribute[1] = ATTR1_ROTDATA(0) | ATTR1_SIZE_32 | x; //Set to 32 for debugging, should be 16 spritesMain[0].attribute[2] = loc; //copy in the sprite palettes dmaCopy(ball_pal_bin, SPRITE_PALETTE, ball_pal_bin_size); //copy the sprite graphics in obj graphics mem dmaCopy(ball_img_bin, &SPRITE_GFX[loc * 16], ball_img_bin_size); updateOAM(spritesMain); |
And this is how I've set up the memory:
Code: |
videoSetMode(MODE_0_2D | DISPLAY_BG0_ACTIVE| DISPLAY_SPR_ACTIVE ); videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); vramSetMainBanks(VRAM_A_MAIN_BG, VRAM_B_MAIN_BG, VRAM_C_SUB_BG, VRAM_D_LCD); vramSetBankE(VRAM_E_MAIN_SPRITE); |
initOAM() clears the attributes for all sprites. Does anybody have any ideas on what might be going wrong? I wondered if I should be using a different display mode, but on switching this to MODE_5_2D everything broke :). I could have another stab at it if that is the problem.
Any help would be appreciated,
Stuk
Last edited by Stuk on Sat Apr 07, 2007 4:57 pm; edited 1 time in total