Original Post
EDIT: My last post has more up to date information on the problem at hand, if you wouldn't mind scrolling down. Thank you.
I'm working on getting sprites to work in my gba application. It compiles but the sprites just don't appear. Quite odd.
Relavent (but not exhaustive) code snippet:
u16* videoBuffeer = ((u16*)0x6000000);
u16* paletteMem = ((u16*)0x5000000);
u16* OAM = ((u16*)0x7000000);
OAMEntry sprites[128];
pRotData rotData = (pRotData)sprites;
void copyOAM()
{
u16* temp;
temp = (u16*)sprites;
for(u16 i = 0; i < 128*4; i++)
OAM[i] = temp[i];
}
void initializeSprites()
{
for(u16 i = 0; i < 128; i++)
{
sprites[i].attribute0 = 160;
sprites[i].attribute1 = 240;
}
}
void VSync()
{
while((volatile u16)REG_VCOUNT != 160)
{
}
}
int main()
{
s16 x = 100, y = 60;
setMode(MODE_1 | OBJ_ENABLE | OBJ_MAP_1D);
for(int i = 0; i < 256; i++)
OBJPaletteMem[i] = mySpritePalette[i];
initializeSprites();
sprites[0].attribute0 = COLOR_256 | SQUARE | x;
sprites[0].attribute1 = SIZE_64 | y;
sprites[0].attribute2 = 0;
for(int i = 0; i < 128; i++)
OAMdata[i] = mySpriteData[i];
setMode(MODE_4 | BG2_ENABLE);
for(int i = 0; i < 256; i++)
paletteMem[i] = FFPalette[i];
for(int i = 0; i < 120; i++)
for(int j = 0; j < 160; j++)
plotPixel(i, j, FFData[j * 120 + i]);
while(1)
{
VSync();
copyOAM();
}
return 0;
}
The background scene (FF) draws but the sprites don't. I don't think they're being overlapped because I only added the background image later to make sure that the sprite wasn't just blending in with the black background (it's in black and white).
Any thoughts? I'm fresh out.
EDIT: Provided additional info
When you find yourself in the company of a halfling and an ill-tempered Dragon, remember, you do not have to outrun the Dragon...
[edited by - CyberSlag5k on April 16, 2004 5:51:25 PM]
[edited by - CyberSlag5k on April 17, 2004 1:46:07 AM]