Figured out the crash, but want to see what valgrind would say.

This commit is contained in:
Zed A. Shaw 2026-02-12 12:59:35 -05:00
parent aaf5aa4165
commit 0e8b661273
7 changed files with 30 additions and 15 deletions

View file

@ -127,7 +127,9 @@ namespace scene {
void Engine::play_animations() {
for(auto& fixture : $fixtures) {
if(fixture.anim.playing) {
fixture.anim.update();
fixture.anim.apply(*fixture.st.sprite);
// REFACTOR: fixture.anim.apply(*fixture.st.sprite);
} else {
fixture.effect = nullptr;
}
@ -135,9 +137,10 @@ namespace scene {
for(auto& actor : $actors) {
if(actor.anim.playing) {
actor.anim.update();
actor.anim.apply(*actor.st.sprite);
// REFACTOR: actor.anim.apply(actor.text, actor.pos);
if(actor.effect != nullptr) actor.anim.apply_effect(actor.effect);
// if(actor.effect != nullptr) actor.anim.apply_effect(actor.effect);
} else {
actor.effect = nullptr;
}
@ -173,13 +176,22 @@ namespace scene {
}
void Engine::set_end_cb(std::function<void()> cb) {
// REFACTOR:
// for(auto& actor : $actors) {
// actor.anim.end_cb = cb;
// }
for(auto& actor : $actors) {
actor.anim.onLoop = [&](auto& seq, auto& tr) -> bool {
seq.current = tr.toggled ? seq.frame_count - 1 : 0;
cb();
return tr.looped;
};
}
}
void Engine::reset(sf::RenderTexture& view) {
$camera.reset(view);
}
void Engine::tick() {
for(auto& actor : $actors) {
auto [ticks, alpha] = actor.anim.commit();
}
}
}