SSBMTonberry/tileson

Make a tson::Animation class to handle tile animations

SSBMTonberry opened this issue · 1 comments

Right now getAnimation only gives frames, which is correct if blindly following the Tiled spec, but I'd rather give a pointer to a animation class instead, which can do simple animation handling as well. To save potential space and overhead, it should be a unique_ptr.

This i much related to #32 and the suggestion of a demo of animated tiles

The tson::Animation object ended up being a regular object to keep the copy-constructor. This should not be a big problem anyways, as the animation class only holds a small state with a uint32_t and a float.

Since getAnimation() of tson::Tile now uses a tson::Animation instead of std::vector<tson::Frame> this is a breaking change, but the same data can be retrieved by just calling getAnimation().getFrames().