Problem with images
Posted: Thu Oct 29, 2009 1:22 pm
Hello,
I have a problem with 16x16 images.
I am doing the following:
The 16x16 picture i am loding is a part of a much bigger picture. But when i run this, i get a 16x16 picture of half the picture i wanted and half the next picture :S
What am i doing wrong? I think it is something with the dmaCopy, but i don't know what. I tried to use dmaCopy, dmaCopyWord and dmaCopyHalfWord but they all gave me the same strange output :S.
This picture shows the problem.
I used grit to convert the image tweedee.png.
I have a problem with 16x16 images.
I am doing the following:
Code: Select all
videoSetModeSub(MODE_0_2D);
vramSetBankD(VRAM_D_SUB_SPRITE);
oamInit(&oamSub, SpriteMapping_1D_32, false);
u16* gfx = oamAllocateGfx(&oamSub, SpriteSize_16x16, SpriteColorFormat_256Color);
dmaCopy(tweedeePal, SPRITE_PALETTE_SUB, 512);
dmaCopyHalfWords(2,tweedeeTiles+(32*(8*0)), gfx, 16*16);
while(true)
{
oamSet(&oamSub, //main graphics engine context
0, //oam index (0 to 127)
5, 5, //x and y pixle location of the sprite
0, //priority, lower renders last (on top)
0, //this is the palette index if multiple palettes or the alpha value if bmp sprite
SpriteSize_16x16,
SpriteColorFormat_256Color,
gfx, //pointer to the loaded graphics
-1, //sprite rotation data
false, //double the size when rotating?
false, //hide the sprite?
false, false, //vflip, hflip
false //apply mosaic
);
swiWaitForVBlank();
oamUpdate(&oamSub);
}
What am i doing wrong? I think it is something with the dmaCopy, but i don't know what. I tried to use dmaCopy, dmaCopyWord and dmaCopyHalfWord but they all gave me the same strange output :S.
This picture shows the problem.
I used grit to convert the image tweedee.png.
Code: Select all
-m!
-gB8
#metatile
-Mh4
-Mw4