Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C/C++: 2D animation library

Tags:

c++

c

animation

I need to write an application that (among the other things) renders 2D animated images, let's suppose it's a videogame.

Figured out that videogame-like images can have a quite complex structure that depends very little on the program logic, mostly on the image itself:

  • It can have several animations (one for each state the object to draw can be on)

  • To pass from a state to another there could be an acyclic animation too.

  • Each animation can be made of several frames, each of which has got a duration.

And also the way to store images on the disk can be complex:

  • The above properties of the image, of its states and of its frames should be stored on a data file bound to the image, not hardcoded in the program source.

  • The different frames could be put all together in the same image file, or on different layers of an image file, or on different image files.

  • Background pixels could be indicated via a separated bitmask or using a specific color.

And I guess actual videogames will need a lot more parameters which I don't (don't know, another bitmask to identify pixels to be replaced with team color or whatever).


This makes me think there must be already a library that does all of this. But half an hour on google didn't help me.

Is there any opensource 2D animation library for C++ or C?

Otherwise, if I need to write one, can you link any 2D animation library for other languages (or also closed source ones)? I'll be happy to give a loop to their API and to the way they work.

like image 943
peoro Avatar asked May 03 '26 05:05

peoro


1 Answers

SDL is excellent for games. Check out http://www.sdltutorials.com/sdl-animation/

like image 138
horsh Avatar answered May 05 '26 20:05

horsh