Page 1 of 1

SDL sprite sheet clipping

Posted: Mon Oct 18, 2010 2:33 am
by Kyosaur
I decided to take up SDL and started reading tutorials from lazyfoo.net. Its going quite well so far, i just ran into a question after finishing up lesson 6 (Clip Blitting and Sprite Sheets). The tutorial did a good job of explaining how to "clip" and blit a simple sprite sheet, but what do you do when you have a BIG sheet filled with different sized images?

I wanted to try clipping a mario sprite sheet and sort of got lost. I knew none of the dimensions at all, and even if i figured it out, there are different sized images inside the sprite as well. Am i just suppose to figure them all out (x,y,w, and h) and then assign the attributes to my SDL_Rect array?

I planned to write a nice clipping function with a few parameters to do all the dirty work for me, but this kind of threw a wrench into my plans.



EDIT:

This is sort of offtopic, but the next topic in this section will make the topic count "1337" :D!

Re: SDL sprite sheet clipping

Posted: Mon Oct 18, 2010 5:38 am
by ismetteren
I would create a XML file to go along with the image, that would contain information about where the different sprites are placed on the image.