sprite sheet help

Hi guys,

Started working with SDL, and right now I am going through a few tutorials. However, they supply the sprite sheets, and the dimensions they are extracting from them.

If I download a random sprite sheet, how do I know without trail and error where to cut the image width, and image height in pixels to load into my array?

Thanks,

Mike
Assuming all images will have same dimensions, you can think of the sprite sheet as a multidimensional array of images. Then you can get the part of the image by multiplying each array index by the corresponding sprite dimension.

Edit: I think I misunderstood. Some sheets I have found have noted the dimensions, others I've calculated based on the sheet dimensions and number of images or open in an image editor that gives cursor position coords.
Last edited on
Thanks naraku,

I like both ideas; simply take the dimensions and do a little division based on the amount of images.

The second method sounds like a good idea too, and I will implement one or the other as the circumstances necessitate.

I thought maybe there would be some algorithm or a more sophisticated method.

Thanks,

Mike
Topic archived. No new replies allowed.