Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Rendering images using SDL_Rect and 2D sprite sheets


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 too_many_stars   Members   -  Reputation: 212

Like
0Likes
Like

Posted 17 July 2013 - 10:57 AM

Hi guys,

 

Just a general question. When cutting images using the SDL API we do something like this:

 

 

SDL_Rect move_right[x];

 

move_right[0].x=0;

move_right[0].y=0;

move_right[0].w=10;

move_right[0].h=10;

 

move_right[1].x=10;

move_right[1].y=0;

move_right[1].w=10;

move_right[1].h=10;

 

and so on...

 

However, not all images on a sprite sheet line up correctly, and the rendered sequence oftentimes has a "jerking" motion. I would simply solve this with trail and error, which is time consuming and frustrating.

 

My question is: Does anyone know of a good rough guide on how to line up the sprites without having to manipulate the variables (through SDL_Rect) by (sometimes) a pixel(s) at a time?

 

Thanks,

 

Mike



Sponsor:

#2 Ludus   Members   -  Reputation: 970

Like
0Likes
Like

Posted 17 July 2013 - 11:23 PM

Use an image editor (or perhaps an animation program) that allows you to setup animation frames. This will allow you to flip between adjacent frames so you can see what corrections are needed for a smoother motion. Once that is done, simply export all the frames individually and put them together to create the sprite sheet.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS