#104850 - jandujar - Tue Oct 03, 2006 8:09 am
I want to make a program that uses sprites, but I want that this sprites must be loaded from a SD with old chrism FAT library.
I thing I must use 16bit sprites (because I don't know the palette of the SD sprites)
But I don't know how to load/show 16bit sprites in mode 5.
Could somebody help me?
I make this and the sprite is show:
Is this correct? If I put for(int i=0;i<64*64;i++) instead of for(int i=0;i<64*64*2;i++) I only see the half of the cube.
-How can I load a jpeg to this gfx? using libjpeg from libnds.
*What is the sprite limit using 64x64 16bit sprites?
I think sprite space is 256KB = 256 * 1024 bytes = 262144 bytes
And I 64x64 16bit sprite uses 64*64*2 = 8192 bytes
Could I use up to 262144/8192 = 32 64x64 sprites ?
_________________
http://jandujar.homelinux.com
http://www.dsrobot.com
I thing I must use 16bit sprites (because I don't know the palette of the SD sprites)
But I don't know how to load/show 16bit sprites in mode 5.
Could somebody help me?
I make this and the sprite is show:
Code: |
//Preparo el espacio en memoria de los sprites. //sprite attribute memory SpriteEntry * spritesMain = new SpriteEntry[128]; //rotation attributes overlap so assign then to the same location SpriteRotation * spriteRotationsMain = (SpriteRotation *)spritesMain; initOAM(spritesMain, spriteRotationsMain); updateOAM(spritesMain); spritesMain[0].attribute[0] = ATTR0_BMP | ATTR0_ROTSCALE_DOUBLE | 0; spritesMain[0].attribute[1] = ATTR1_SIZE_64 | 0; spritesMain[0].attribute[2] = ATTR2_ALPHA(1)| 0; // red 64*64 square for 1d bitmap mode for(int i=0;i<64*64*2;i++) SPRITE_GFX[i]=RGB15(31,0,0)|(1<<15); //dont forget alpha bit updateOAM(spritesMain); while(1){ swiWaitForVBlank(); } |
Is this correct? If I put for(int i=0;i<64*64;i++) instead of for(int i=0;i<64*64*2;i++) I only see the half of the cube.
-How can I load a jpeg to this gfx? using libjpeg from libnds.
*What is the sprite limit using 64x64 16bit sprites?
I think sprite space is 256KB = 256 * 1024 bytes = 262144 bytes
And I 64x64 16bit sprite uses 64*64*2 = 8192 bytes
Could I use up to 262144/8192 = 32 64x64 sprites ?
_________________
http://jandujar.homelinux.com
http://www.dsrobot.com