Sprite animation editor based on the Thor library extension to SFML.
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:
- Sprite sheet selection
- Grid generation for sprite sheets based on tile size
- Export animation data directly to animation files
Setting up:
- Build the provided Visual Studio 2017 solution (
sln
) as x86 (Debug) - Copy the contents of the
dll
folder to yourDebug
folder - Run the program
- Add json to your project include settings
- Add
SpriteAnimator.hpp
andSpriteAnimator.cpp
to your project
#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;
}
- The Thor animation module have been slightly modified as crucical functionality was missing for the editor
- These changes can be found in
AnimationMap.hpp
andAnimationMap.inl
- If you want to use these files you can also uncomment
removeAnimation(...)
inSpriteAnimator.hpp
- Support is limited to one spritesheet
This library is licensed under the MIT License, see LICENSE for more information.