Animator won't crash anymore when there's an error, and instead displays an error message.

This commit is contained in:
Zed A. Shaw 2026-02-07 13:05:24 -05:00
parent 46f34828e4
commit 0d481a5ab7
6 changed files with 76 additions and 18 deletions

View file

@ -9,6 +9,8 @@
#include <thread>
#include "rand.hpp"
#include "animate2.hpp"
#include "sound.hpp"
using namespace components;
using namespace textures;
@ -53,6 +55,8 @@ void PLAY_TEST(Animate2 &anim) {
*/
TEST_CASE("new animation system", "[animation-new]") {
textures::init();
sound::init();
sound::mute(true);
auto anim = load_animation("rat_king_boss");
PLAY_TEST(anim);
@ -96,6 +100,8 @@ TEST_CASE("new animation system", "[animation-new]") {
TEST_CASE("confirm frame sequencing works", "[animation-new]") {
textures::init();
animation::init();
sound::init();
sound::mute(true);
auto anim = load_animation("rat_king_boss");
@ -109,8 +115,6 @@ TEST_CASE("confirm frame sequencing works", "[animation-new]") {
anim.onLoop = [&](auto& seq, auto& tr) -> bool {
seq.current = 0;
loop_ran = true;
REQUIRE(boss.sprite->getTextureRect() != init_rect);
return false;
};
@ -125,14 +129,13 @@ TEST_CASE("confirm frame sequencing works", "[animation-new]") {
REQUIRE(loop_ran == true);
REQUIRE(anim.playing == false);
// this confirms it went back to the first frame
REQUIRE(boss.sprite->getTextureRect() == init_rect);
}
TEST_CASE("confirm transition changes work", "[animation-new]") {
textures::init();
animation::init();
sound::init();
sound::mute(true);
auto sprite = *textures::get_sprite("rat_king_boss").sprite;
sf::Vector2f pos{100,100};