#70476 - Payk - Mon Feb 06, 2006 8:12 pm
ok i tried to have 16bit sprites and bg. it should map randompixels to bg and have some sprites (12 if it matter later more but not much more then 20 at size of 64_64)
untill here is no use of sprites but will be used later and they run perfect.
but all i get on bg is black. ok i didnt forget the alphabit and all code is mixed up from to examples (Double_buffer and Sprite_bitmap i think)
what did i wrong? thanx
Code: |
//turn everything on
powerON(POWER_ALL_2D); //irqs are nice irqInit(); irqSet(IRQ_VBLANK, 0); irqEnable(IRQ_VBLANK); //enable vram and map it to the right places vramSetMainBanks( VRAM_A_MAIN_SPRITE, //A and B maped consecutivly as sprite memory VRAM_B_MAIN_SPRITE, //this gives us 256KB which is the max VRAM_C_MAIN_BG_0x6000000, //map C to background memory VRAM_D_LCD //not using D ); //set the video mode videoSetMode( MODE_0_2D | DISPLAY_SPR_ACTIVE | //turn on sprites DISPLAY_SPR_2D | //this is used when in tile mode DISPLAY_SPR_1D_BMP | //and this in bitmap mode DISPLAY_BG3_ACTIVE); //turn down all sprites (0-127) for(int i = 0; i < 128; i++) { sprites[i].attribute[0] = 0; sprites[i].attribute[1] = 0; sprites[i].attribute[2] = 0; } BG3_CR = BG_BMP16_256x256; //these are rotation backgrounds so you must set the rotation attributes: //these are fixed point numbers with the low 8 bits the fractional part //this basicaly gives it a 1:1 translation in x and y so you get a nice flat bitmap BG3_XDX = 1 << 8; BG3_XDY = 0; BG3_YDX = 0; BG3_YDY = 1 << 8; //our bitmap looks a bit better if we center it so scroll down (256 - 192) / 2 BG3_CX = 0; BG3_CY = 0; u16* frontBuffer = (u16*)(0x06000000); for(int iy = 0; iy < 196 ; iy++) for(int ix = 0; ix < 256 ; ix++) frontBuffer[iy * 256 + ix] = rand() | BIT(15); //WaitForVblank while(DISP_Y!=192); while(DISP_Y==192); |
untill here is no use of sprites but will be used later and they run perfect.
but all i get on bg is black. ok i didnt forget the alphabit and all code is mixed up from to examples (Double_buffer and Sprite_bitmap i think)
what did i wrong? thanx