sprite from image not showing
Posted: Tue May 05, 2009 12:41 am
hello everybody
I'm trying to put a sprite on the screen from an image thats processed by grit. I modify'd the simple sprite example, but the image is somehow not showing.
here is my code:
if I use the commented out for loop instead of the dmacopy's, it does show the red box, so there has to be something wrong with the dmacopy's (or the generated data), but I cant figure out what.
the image is a 64*64 png image with the following grit rule file:
is there anything wrong with it, or are there any options which I could add to process the image better, because it gives me a: "WARNING: No explicit symbol name. In overwrite mode, so using dst title."
does anybody know what I am doing wrong?
I'm trying to put a sprite on the screen from an image thats processed by grit. I modify'd the simple sprite example, but the image is somehow not showing.
here is my code:
Code: Select all
#include <nds.h>
#include "vuurrobin.h"//generated by grit
int main()
{
powerOn(POWER_ALL_2D);
videoSetMode(MODE_0_2D);
vramSetBankA(VRAM_A_MAIN_SPRITE);
oamInit(&oamMain, SpriteMapping_1D_32, false);
u16* gfx = oamAllocateGfx(&oamMain, SpriteSize_64x64, SpriteColorFormat_256Color);
dmaCopyHalfWords(3, vuurrobinTiles, gfx, vuurrobinTilesLen);
dmaCopyHalfWords(3, vuurrobinPal, SPRITE_PALETTE, vuurrobinPalLen);
/*
for(int i = 0; i < 32 * 32 / 2; i++)
{
gfx[i] = BIT(0) | BIT(8);
}
SPRITE_PALETTE[1] = RGB15(31,0,0);
//*/
oamSet(&oamMain, //main graphics engine context
0, //oam index (0 to 127)
10, 10, //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_64x64,
SpriteColorFormat_256Color,
gfx, //pointer to the loaded graphics
-1, //sprite rotation data
false, //double the size when rotating?
false, //hide the sprite?
false, //vflip
false, //hflip
false //apply mosaic
);
swiWaitForVBlank();
oamUpdate(&oamMain);
return 0;
}
the image is a 64*64 png image with the following grit rule file:
Code: Select all
# Set the warning/log level to 3
-W3
# Tell grit to include a palette (the first index in it will be transparent)
-p
# Tile the image
-gt
# Set the bit depth to 4 (16 colors)
-gB4
does anybody know what I am doing wrong?