SDL sprite sheet clipping

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
Kyosaur
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 78
Joined: Tue Jul 13, 2010 2:00 am
Favorite Gaming Platforms: PS2,PS3,NDS
Programming Language of Choice: C++

SDL sprite sheet clipping

Post 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!
Image
User avatar
ismetteren
Chaos Rift Junior
Chaos Rift Junior
Posts: 276
Joined: Mon Jul 21, 2008 4:13 pm

Re: SDL sprite sheet clipping

Post 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.
Image ImageImage Image
Post Reply