Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Animation  (Read 5923 times)

0 Members and 1 Guest are viewing this topic.

N1ghtly

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
Animation
« 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?

Perde

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: Animation
« Reply #1 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.

Lo-X

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
    • My personal website, with CV, portfolio and projects
Re: Animation
« Reply #2 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.

N1ghtly

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
Re: Animation
« Reply #3 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 :)

L01man

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Re: Animation
« Reply #4 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?
http://metroidprime4.xooit.fr/

Un même visage, un même passé, deux destins différents ?
Metroid Prime : Némésis, fangame de la suite du célèbre Metroid Prime 3 : Corruption.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Animation
« Reply #5 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()).
« Last Edit: May 16, 2012, 08:38:32 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Jove

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • http://www.jestofevekites.com/
Re: Animation
« Reply #6 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.

{much better code}

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Animation
« Reply #7 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 ;)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: