#46649 - pr0vidence - Tue Jun 28, 2005 5:03 pm
Hey guys, me again.
Trying to move along in the process of learning, getting stuck again.
I have a program that SHOULD put a sprite on screen, very simple. again I am following, mostly, the code given on one of the various tutorials out there. As far as I can tell this should work. Somehow, my sprite, which is just an 8x8 pixel smiley face, gets mangled in the copying. I get an 8x8 pixel thing on screen, but it's a mess.
I am trying to get through it myself and not have you guys hold my hand every step of the way, but it doesn't appear to be going that smoothly :-/ Sorry guys.
here is what I have:
Here is a compiled binary so you can see whats happening:
www.boomspeed.com/pr0vidence/gba/sprite.gba
and the sprite header file created by pcx2gba
www.boomspeed.com/pr0vidence/gba/sprite.h
And finally my little PCX sprite smiley
www.boomspeed.com/pr0vidence/gba/sprite.pcx
thanks for helping me out.
-pr0v
Trying to move along in the process of learning, getting stuck again.
I have a program that SHOULD put a sprite on screen, very simple. again I am following, mostly, the code given on one of the various tutorials out there. As far as I can tell this should work. Somehow, my sprite, which is just an 8x8 pixel smiley face, gets mangled in the copying. I get an 8x8 pixel thing on screen, but it's a mess.
I am trying to get through it myself and not have you guys hold my hand every step of the way, but it doesn't appear to be going that smoothly :-/ Sorry guys.
here is what I have:
Code: |
#include "gba.h"
#include "sprite.h" OAMEntry sprites[128]; void InitializeSprites() { u16 loop; for(loop=0;loop<128;loop++) { sprites[loop].attribute[0]=160; sprites[loop].attribute[1]=240; } } void WaitForVsync() { while((volatile u16)REG_VCOUNT != 160){} } void CopyOAM() { u16 loop; u16* temp; temp = (u16*)sprites; for(loop = 0; loop < 128*4; loop++) { OAMMem[loop] = temp[loop]; } } int main() { u16 loop; s16 x=100; s16 y=60; SetMode(MODE_1|OBJ_ENABLE|OBJ_MAP_1D); for(loop=0;loop<256;loop++) { OBJPaletteMem[loop] = spritePalette[loop]; } InitializeSprites(); sprites[0].attribute[0]= (COLOR_16|SQUARE|y); sprites[0].attribute[1]= (SIZE_8|x); sprites[0].attribute[2]= (0); for(loop=0;loop<128;loop++) { OBJ_GFXMem[loop] = spriteData[loop]; } while(1) { WaitForVsync(); CopyOAM(); } } |
Here is a compiled binary so you can see whats happening:
www.boomspeed.com/pr0vidence/gba/sprite.gba
and the sprite header file created by pcx2gba
www.boomspeed.com/pr0vidence/gba/sprite.h
And finally my little PCX sprite smiley
www.boomspeed.com/pr0vidence/gba/sprite.pcx
thanks for helping me out.
-pr0v