Sound is now working, and the animator tools will play them and also has mute.
This commit is contained in:
parent
a4ffacdb18
commit
46f34828e4
5 changed files with 38 additions and 19 deletions
|
|
@ -126,7 +126,7 @@ namespace animator {
|
|||
void FSM::run_animation() {
|
||||
if($anim.playing) {
|
||||
$anim.update();
|
||||
if(!$anim.transform.simple) $anim.apply(*$sprite);
|
||||
$anim.apply(*$sprite);
|
||||
$anim.motion(*$sprite, $pos, $scale);
|
||||
}
|
||||
}
|
||||
|
|
@ -181,6 +181,9 @@ namespace animator {
|
|||
event(Event::PREV_FORM);
|
||||
} else if($router.scancode == KEY::Down) {
|
||||
event(Event::NEXT_FORM);
|
||||
} else if($router.scancode == KEY::M) {
|
||||
$mute = !$mute;
|
||||
sound::mute($mute);
|
||||
}
|
||||
break;
|
||||
case MOUSE_CLICK:
|
||||
|
|
@ -302,8 +305,7 @@ int main(int argc, char* argv[]) {
|
|||
anim_name = sprite_name; // default to the same
|
||||
}
|
||||
|
||||
sound::mute(true);
|
||||
sound::play("ambient_1", true);
|
||||
sound::mute(false);
|
||||
|
||||
animator::FSM main;
|
||||
main.init(sprite_name, anim_name, background);
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ namespace animator {
|
|||
sf::Clock $timer;
|
||||
std::string $cur_form = "idle";
|
||||
int $cur_form_i = 0;
|
||||
bool $mute = false;
|
||||
|
||||
void init(const std::string &sprite_name, const std::string& background, const std::string &anim_name);
|
||||
void event(Event ev, std::any data={});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue