SFML community forums

General => Feature requests => Topic started by: N1ghtly on May 12, 2012, 08:21:32 pm

Title: Animation
Post by: N1ghtly on May 12, 2012, 08:21:32 pm
I'm sure this has been asked before, but I couldn't find a thread with the search function.
For what reason is there no support for animation in SFML?
Title: Re: Animation
Post by: Perde on May 12, 2012, 08:32:22 pm
I suppose because everyone has different needs and SFML is there to provide the basic tools?
All you need for a simple animation is sf::Sprite::setTextureRect() and sf::Clock anyway.
Title: Re: Animation
Post by: Lo-X on May 12, 2012, 09:29:12 pm
SFML isn't a framework.
SFML isn't only for video games.

That's why you have to implement animation by yourself. Thor library has a good animation module if you want to see how it works.
Title: Re: Animation
Post by: N1ghtly on May 13, 2012, 01:00:37 pm
That's why you have to implement animation by yourself. Thor library has a good animation module if you want to see how it works.

It's not that I don't know how it would work, I have an AnimatedSprite class in my engine :)
But yes, I guess you're right :)
Title: Re: Animation
Post by: L01man on May 16, 2012, 08:16:09 pm
GUI programs as well as video games as well as slideshows as well as ... may use animations. You say you have an AnimatedSprite class, but why not create an AnimatedDrawable class?
Title: Re: Animation
Post by: Nexus on May 16, 2012, 08:35:12 pm
You say you have an AnimatedSprite class, but why not create an AnimatedDrawable class?
What features should it provide and how does its API look like?

In fact, I'm also reflecting on this topic, to allow animations on other objects than sf::Sprite, so don't hesitate to post ideas. The most flexible approach that I've already come up with and that doesn't duplicate code would result in templates. But they tend to quickly make things quite complicated ;)

By the way, deriving AnimatedSprite from sf::Sprite is a bad idea, since some operations cannot be meaningfully inherited (mainly setTexture() and setTextureRect()).
Title: Re: Animation
Post by: Jove on May 16, 2012, 11:53:22 pm
It's not really difficult to implement your own animation class using the tools SFML provides, that and you can tailor it more specifically to your own needs.

It's important to remember that libraries like SFML insulate you from the task of learning lower level stuff like OpenGL, in detail, which in itself is a lot of research.

By comparison, an animation class created using SFML is pretty easy because, well, you don't have to think about so much stuff. Just use the library as a go-between, which is what it is.

Title: Re: Animation
Post by: Nexus on May 17, 2012, 10:43:22 am
It's not really difficult to implement your own animation class using the tools SFML provides, that and you can tailor it more specifically to your own needs.
That may be true for end users, but not for extension library developers who aim to write reusable and generic code ;)