Animator won't crash anymore when there's an error, and instead displays an error message.
This commit is contained in:
parent
46f34828e4
commit
0d481a5ab7
6 changed files with 76 additions and 18 deletions
|
|
@ -51,6 +51,7 @@ namespace animate2 {
|
|||
}
|
||||
|
||||
void Animate2::play_sound() {
|
||||
// BUG: this can be optimized way better
|
||||
if(sounds.contains(form_name)) {
|
||||
fmt::println("Playing sound for {}", form_name);
|
||||
for(auto& [at_frame, sound_name] : sounds.at(form_name)) {
|
||||
|
|
@ -58,6 +59,8 @@ namespace animate2 {
|
|||
sound::play(sound_name);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fmt::println("Animation has not sound {}", form_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -169,6 +172,10 @@ namespace animate2 {
|
|||
// scale_out.x, scale_out.y);
|
||||
}
|
||||
|
||||
bool Animate2::has_form(const std::string& as_form) {
|
||||
return forms.contains(as_form);
|
||||
}
|
||||
|
||||
void Animate2::set_form(const std::string& as_form) {
|
||||
dbc::check(forms.contains(as_form),
|
||||
fmt::format("form {} does not exist in animation", as_form));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue