Camera is now using Animate2 and it's mostly working, but there's a few more refactors needed.

This commit is contained in:
Zed A. Shaw 2026-02-20 00:15:19 -05:00
parent 46cc21ec7b
commit 364f66bffb
14 changed files with 106 additions and 62 deletions

View file

@ -57,6 +57,7 @@ namespace animate2 {
bool flipped{false};
float ease_rate{0.5f};
bool scaled{false};
bool relative{false};
// handled by onLoop
bool toggled{false};
@ -70,7 +71,7 @@ namespace animate2 {
std::shared_ptr<sf::Shader> shader{nullptr};
void lerp(Sequence& seq, sf::Vector2f& pos_out, sf::Vector2f& scale_out);
void apply(Sequence& seq, sf::Vector2f& pos_out, sf::Vector2f& scale_out);
};
/* Gets the number of times it looped, and returns if it should stop. */
@ -118,10 +119,10 @@ namespace animate2 {
bool has_form(const std::string& as_form);
void set_form(const std::string& form);
void apply(sf::Sprite& sprite);
void apply(sf::View& view_out, sf::Vector2f pos, sf::Vector2f size);
void apply_effect(std::shared_ptr<sf::Shader> effect);
void update();
void motion(sf::Sprite& sprite, sf::Vector2f pos, sf::Vector2f scale);
void motion(sf::Transformable& sprite, sf::Vector2f pos, sf::Vector2f scale);
void motion(sf::View& view_out, sf::Vector2f pos, sf::Vector2f scale);
std::pair<int, double> commit();
};
@ -130,6 +131,6 @@ namespace animate2 {
ENROLL_COMPONENT(Sheet, frames, frame_width, frame_height);
ENROLL_COMPONENT(Sequence, frames, durations);
ENROLL_COMPONENT(Transform, min_x, min_y, max_x, max_y,
flipped, ease_rate, scaled, toggled, looped, easing, motion);
flipped, ease_rate, scaled, relative, toggled, looped, easing, motion);
ENROLL_COMPONENT(Animate2, sheet, sequences, transforms, forms, sounds);
}