Animator tool can now play, stop, loop, and toggle an animation.
This commit is contained in:
parent
7d79e75651
commit
df730047ac
3 changed files with 200 additions and 142 deletions
|
|
@ -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});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue