Home

Awesome

Sprite Animator

Sprite animation editor based on the Thor library extension to SFML.

Features

Sprite Animator is an easy and flexible editor which allows you to create animations in a matter of seconds. The editor is built upon the animation module from Thor and has support for:

Screenshot

screenshot

screenshot

How-to

Setting up:

How-to integrate

Example code

#include <SFML/Graphics.hpp>
#include <SFML/Window/Event.hpp>
#include <SFML/System/Clock.hpp>
#include <loader/SpriteAnimator.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "Animation");
    sf::Clock clock;
    sf::Sprite sprite;
    sf::Texture spriteSheet;
    px::SpriteAnimator animator;

    // Prepare sprite
    spriteSheet.loadFromFile("src/res/sprites/orc.png");
    sprite.setTexture(spriteSheet);
    sprite.setPosition(sf::Vector2f(400.f, 300.f));

    // Load animations
    animator.loadAnimation("src/res/data/up_orc.anim");
    animator.loadAnimation("src/res/data/left_orc.anim");
    animator.playAnimation("left_orc", true);

    while (window.isOpen())
    {
        sf::Event event;

        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }
		
        // Update animation system
        animator.update(sprite, clock.restart());

        window.clear();
        window.draw(sprite);
        window.display();
    }

    return 0;
}

Remarks

Limitations

Dependencies

License

This library is licensed under the MIT License, see LICENSE for more information.