How to Render Bitmaps
Posted: Tue Dec 15, 2009 2:30 pm
Hi,
i'm trying to render bitmaps in my NDS-Homebrew app. The problem, the don't look like they should.
I'm using grit with the following options:
My init function looks like this:
My initSpriteFunction looks like this:
my copy over funtion:
and finaly my update function
so what am i doing wrong?
i'm trying to render bitmaps in my NDS-Homebrew app. The problem, the don't look like they should.
I'm using grit with the following options:
Code: Select all
-W3
-p
-gb
-gB8
Code: Select all
vramSetMainBanks(VRAM_A_MAIN_BG_0x06000000,
VRAM_B_MAIN_BG_0x06020000,
VRAM_C_SUB_BG_0x06200000,
VRAM_D_LCD);
vramSetBankE(VRAM_E_MAIN_SPRITE);
vramSetBankD(VRAM_D_SUB_SPRITE);
//MAINSCREEN
videoSetMode ( MODE_5_2D | DISPLAY_BG2_ACTIVE | DISPLAY_BG3_ACTIVE
| DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D
);
//SUBSCREEN
videoSetModeSub( MODE_5_2D | DISPLAY_BG3_ACTIVE
| DISPLAY_SPR_ACTIVE | DISPLAY_SPR_1D
);
Code: Select all
SpriteInfo *coverInfo = &this->spriteInfo[i];
SpriteEntry *coverEntry = &this->oam->oamBuffer[i];
coverInfo->oamId = i;
coverInfo->width = 32;
coverInfo->height = 32;
coverInfo->angle = 0;
coverInfo->entry = coverEntry;
coverEntry->y = 10+(i-OAMID_THUMB0)*33;
coverEntry->x = 10;
coverEntry->isRotateScale = false;
coverEntry->isSizeDouble = false;
coverEntry->blendMode = OBJMODE_NORMAL; //on OBJMODE_BITMAP, the sprite disapears
coverEntry->isMosaic = false;
coverEntry->colorMode = OBJCOLOR_256;
coverEntry->shape = OBJSHAPE_SQUARE;
coverEntry->rotationIndex = coverInfo->oamId;
coverEntry->size = OBJSIZE_32;
coverEntry->priority = OBJPRIORITY_0;
coverEntry->palette = coverInfo->oamId;
coverEntry->gfxIndex = nextAvailableTileIdx;
nextAvailableTileIdx += thumb0000BitmapLen / BYTES_PER_16_COLOR_TILE;
Code: Select all
//Copy over the sprites palettes
dmaCopyHalfWords(SPRITE_DMA_CHANNEL,
data->Pal,
&SPRITE_PALETTE[info->oamId * COLORS_PER_PALETTE],
data->PalLen);
//Copy the sprite graphics to sprite graphics memory
dmaCopyHalfWords(SPRITE_DMA_CHANNEL,
data->Tiles,
&SPRITE_GFX[entry->gfxIndex * OFFSET_MULTIPIER],
data->TilesLen);
}
Code: Select all
DC_FlushAll();
dmaCopyHalfWords(SPRITE_DMA_CHANNEL, this->oam_sub->oamBuffer, OAM_SUB, SPRITE_COUNT * sizeof(SpriteEntry));