Animation tool now lets you cycle through different sequence/transform 'forms' and shows you which one you're viewing.
This commit is contained in:
parent
07b2102f59
commit
4356b1535e
5 changed files with 170 additions and 56 deletions
18
animate2.hpp
18
animate2.hpp
|
|
@ -86,20 +86,32 @@ namespace animate2 {
|
|||
return tr.looped;
|
||||
}
|
||||
|
||||
using Form = std::pair<std::string, std::string>;
|
||||
|
||||
class Animate2 {
|
||||
public:
|
||||
Sheet sheet;
|
||||
Sequence sequence;
|
||||
Transform transform;
|
||||
std::unordered_map<std::string, Sequence> sequences;
|
||||
std::unordered_map<std::string, Transform> transforms;
|
||||
std::unordered_map<std::string, Form> forms;
|
||||
OnFrameHandler onFrame = nullptr;
|
||||
|
||||
Sequence sequence{};
|
||||
Transform transform{};
|
||||
|
||||
std::vector<sf::IntRect> $frame_rects{calc_frames()};
|
||||
OnLoopHandler onLoop = DefaultOnLoop;
|
||||
bool playing = false;
|
||||
|
||||
// mostly for debugging purposes
|
||||
std::string form_name="idle";
|
||||
std::string sequence_name="";
|
||||
std::string transform_name="";
|
||||
|
||||
std::vector<sf::IntRect> calc_frames();
|
||||
void play();
|
||||
void stop();
|
||||
void set_form(const std::string& form);
|
||||
void apply(sf::Sprite& sprite);
|
||||
void update_frame();
|
||||
void update();
|
||||
|
|
@ -113,5 +125,5 @@ namespace animate2 {
|
|||
ENROLL_COMPONENT(Sequence, frames, durations);
|
||||
ENROLL_COMPONENT(Transform, min_x, min_y, max_x, max_y, simple,
|
||||
flipped, ease_rate, scaled, toggled, looped, easing, motion);
|
||||
ENROLL_COMPONENT(Animate2, sheet, sequence, transform);
|
||||
ENROLL_COMPONENT(Animate2, sheet, sequences, transforms, forms);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue