Code Monkey home page Code Monkey logo

spriteanimator's Introduction

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:

  • Sprite sheet selection
  • Grid generation for sprite sheets based on tile size
  • Export animation data directly to animation files

Screenshot

screenshot

screenshot

How-to

Setting up:

  • Build the provided Visual Studio 2017 solution (sln) as x86 (Debug)
  • Copy the contents of the dll folder to your Debug folder
  • Run the program

How-to integrate

  • Add json to your project include settings
  • Add SpriteAnimator.hpp and SpriteAnimator.cpp to your project

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

  • The Thor animation module have been slightly modified as crucical functionality was missing for the editor
  • These changes can be found in AnimationMap.hpp and AnimationMap.inl
  • If you want to use these files you can also uncomment removeAnimation(...) in SpriteAnimator.hpp

Limitations

  • Support is limited to one spritesheet

Dependencies

License

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

spriteanimator's People

Contributors

rikora avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.