#139839 - ghuldan - Mon Sep 10, 2007 6:17 pm
Hi everyone,
I tried to display 35 bmp_sprites (32x32) with this code.
Sprites are filled correctly into VRAM :
- from tilenum 0 to 15 for sprite1
- from tilenum 16 to 31 for sprite2 etc etc ...
But i need to put (firstTilenum * 4) on oam attribute2 to make its displayed correctly.
And sprite index Attribute2 can only go from 0 to 1024 : so my 17th sprite overlap on first instead of the 65th
I tried to change that thing "DISPLAY_SPR_1D_SIZE_64" to anything i could find but it doesnt do anything different.
I tried to display 35 bmp_sprites (32x32) with this code.
Sprites are filled correctly into VRAM :
- from tilenum 0 to 15 for sprite1
- from tilenum 16 to 31 for sprite2 etc etc ...
But i need to put (firstTilenum * 4) on oam attribute2 to make its displayed correctly.
And sprite index Attribute2 can only go from 0 to 1024 : so my 17th sprite overlap on first instead of the 65th
Code: |
#include <PA9.h>
#include "gfx/all_gfx.h" #include "gfx/all_gfx.c" //Main... int main(void){ PA_Init(); //PAlib Init... PA_InitVBL(); //VBL Init... videoSetMode( MODE_0_2D | DISPLAY_BG0_ACTIVE | DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D | DISPLAY_SPR_1D_BMP | DISPLAY_SPR_1D_SIZE_64 ); unsigned short * gfx = (unsigned short*)malloc(sizeof(unsigned short) * 32 * 32); int i, k, l, w = 7, h = 5; for(l = 0; l < h; l ++) for(k = 0; k < w; k ++) { PA_obj[0][k + w * l].atr0 = ATTR0_BMP | ATTR0_ROTSCALE | (l * 35 + 5); PA_obj[0][k + w * l].atr1 = ATTR1_SIZE_32 | (k * 35 + 5); PA_obj[0][k + w * l].atr2 = ATTR2_ALPHA(1) | PA_CreateGfx(0, gfx, OBJ_SIZE_32X32, 2) * 1; // red 32*32 square for 1d bitmap mode for(i = 0; i < 32 * 32; i++) gfx[i] = ship_Sprite[i];//RGB15(31 - 3*(k + w * l)/4, 3*(k + w * l)/4, 3*(k + w * l)/4) | (1 << 15); PA_UpdateGfx(0, PA_GetSpriteGfx(0, k + w * l), (void*)gfx); } while(1){ // Infinite loop PA_WaitForVBL(); } return 0; } |
I tried to change that thing "DISPLAY_SPR_1D_SIZE_64" to anything i could find but it doesnt do anything different.