#5684 - Link - Mon May 05, 2003 11:15 pm
i'm not success to see the sprite, this is the code:
here some declaration in gba.h:
....................
u16* OAMData =(u16*)0x6010000;
#define CharMem ((u16*)0x6010000)
#define OBJPaletteMem ((u16*)0x5000200)
#define REG_INTERUPT (*(volatile u32*)0x3007FFC)
#define REG_DISPCNT (*(volatile u32*)0x4000000)
..........................
[/code]
Code: |
#include "gba.h"
#include "screenmode.h" #include "sprite.h" #include "sprite1.h" //header file ottenuto da pcx2gfx int main(void) { SetMode(OBJ_MAP_2D | MODE_3 | OBJ_ENABLE); u8 sprite1Atributes = 0; s16 x = 10; s16 y = 10; u16 char_number = 0; //for(s16 loop = 0; loop < 256; loop++) //OBJPaletteMem[loop] = sprite1Palette[loop]; sprites[sprite1Atributes].attribute0 = COLOR_256 | SQUARE | y; sprites[sprite1Atributes].attribute1 = SIZE_64 | x; sprites[sprite1Atributes].attribute2 = char_number; int x_loop = 0, y_loop = 0, index = 0; for(y_loop = 0; y_loop < 8; y_loop++) { for(x_loop = 0; x_loop < 256; x_loop++) { CharMem[x_loop + y_loop * 512] = sprite1Data[index]; index++; } //end for x_loop } //end for y_loop void MoveSprite( OAMEntry* sp, int x, int y) { sprites->attribute1 = sprites->attribute1 & 0xFE00; //azzera il vecchio valore di x sprites->attribute1 = sprites->attribute1 | x; sprites->attribute0 = sprites->attribute0 & 0xFF00; //azzera la vecchia y sprites->attribute0 = sprites->attribute0 | y; } int loop; for(loop = 0; loop < 256; loop++) OBJPaletteMem[loop] = sprite1Palette[loop]; void InitializeSprites(void) { int loop; for(loop = 0; loop < 128; loop++) { sprites[loop].attribute0 = 160; //y to > 159 sprites[loop].attribute1 = 240; //x to > 239 } } } |
here some declaration in gba.h:
....................
u16* OAMData =(u16*)0x6010000;
#define CharMem ((u16*)0x6010000)
#define OBJPaletteMem ((u16*)0x5000200)
#define REG_INTERUPT (*(volatile u32*)0x3007FFC)
#define REG_DISPCNT (*(volatile u32*)0x4000000)
..........................
[/code]