#120931 - peper - Wed Mar 07, 2007 11:15 am
Hi,
I'm having a small problem with my latest code and I really lack of knowledge here. The problem is quite simple:
Load two different *.pcx images and display them. Both images have a hight and width of 32px and share the same palette.
Now
will overwrite the data of the first image but
won't work either. With the second code the emulator shows that the data from 512 until 1024 in SPRITE_GFX is the same as from 0 to 512. I do not assume that everytime I need to draw a sprite that I need to copy the image data into the SPRITE_GFX first. So I think the overall question is: How do I map the sprite data to the SpriteEntry?
I would appreciate every idea.
Regards,
I'm having a small problem with my latest code and I really lack of knowledge here. The problem is quite simple:
Load two different *.pcx images and display them. Both images have a hight and width of 32px and share the same palette.
Code: |
// load image a sImage img_a; loadPCX((u8*))a_pcx, &img_a); // tile image a imageTileData(&img_a); // initialize the palette for(int i = 0; i < 256; i++) SPRITE_PALETTE[i] = img_a.palette[i]; // load the image data for(int i = 0; i < 512; i++) SPRITE_GFX[i] = img_a.image.data16[i]; /* up until this point everything is working fine */ // load the second image sImage img_b; loadPCX((u8*))a_pcx, &img_b); imageTileData(&img_b); /* now where to store the data of the second image? */ |
Now
Code: |
for(int i = 0; i < 512; i++) SPRITE_GFX[i] = img_b.image.data16[i]; |
will overwrite the data of the first image but
Code: |
for(int i = 512; i < 1024; i++) SPRITE_GFX[i] = img_b.image.data16[i]; |
won't work either. With the second code the emulator shows that the data from 512 until 1024 in SPRITE_GFX is the same as from 0 to 512. I do not assume that everytime I need to draw a sprite that I need to copy the image data into the SPRITE_GFX first. So I think the overall question is: How do I map the sprite data to the SpriteEntry?
I would appreciate every idea.
Regards,