Animator tool can now play, stop, loop, and toggle an animation.

This commit is contained in:
Zed A. Shaw 2026-02-02 00:02:10 -05:00
parent 7d79e75651
commit df730047ac
3 changed files with 200 additions and 142 deletions

View file

@ -38,7 +38,7 @@ Animate2 crafter() {
.max_y{0.8f},
.simple{false},
.flipped{false},
.ease_rate{0.5f},
.ease_rate{5.0f},
.scaled{true},
.toggled{false},
.looped{false},
@ -159,7 +159,8 @@ TEST_CASE("confirm transition changes work", "[animation-new]") {
animation::init();
auto sprite = *textures::get_sprite("rat_king_boss").sprite;
auto pos = sprite.getPosition();
sf::Vector2f pos{100,100};
sprite.setPosition(pos);
auto scale = sprite.getScale();
auto anim = crafter();
@ -167,6 +168,7 @@ TEST_CASE("confirm transition changes work", "[animation-new]") {
REQUIRE(anim.onFrame == nullptr);
anim.play();
REQUIRE(anim.playing == true);
sf::Clock clock;
clock.start();
@ -188,7 +190,7 @@ TEST_CASE("confirm transition changes work", "[animation-new]") {
}
REQUIRE(anim.playing == false);
REQUIRE(pos != sf::Vector2f{0,0});
REQUIRE(pos == sf::Vector2f{100, 100});
REQUIRE(scale != sf::Vector2f{0,0});
}