Correction màj icône musique
This commit is contained in:
parent
0f5cbc6d9e
commit
853976f56d
|
@ -38,6 +38,7 @@ private:
|
|||
std::vector<sf::Vector2f> zone;
|
||||
|
||||
sfg::Button::Ptr mute_button;
|
||||
bool previously_muted_state;
|
||||
|
||||
protected:
|
||||
ActionToolbar action_toolbar;
|
||||
|
|
|
@ -49,7 +49,8 @@ namespace {
|
|||
}
|
||||
|
||||
Level::Level(Manager& manager) : State(manager),
|
||||
gravity_direction(Utility::Direction::SOUTH) {
|
||||
gravity_direction(Utility::Direction::SOUTH),
|
||||
previously_muted_state(!ResourceManager::get().isMuted()) {
|
||||
|
||||
// métadonnées par défaut
|
||||
setName(sf::String("Nouveau niveau"));
|
||||
|
@ -282,12 +283,18 @@ void Level::frame() {
|
|||
sf::Vector2i window_size = (sf::Vector2i) window.getSize();
|
||||
|
||||
// mise à jour de l'icône du mute en fonction de l'état
|
||||
if (previously_muted_state != ResourceManager::get().isMuted()) {
|
||||
if (ResourceManager::get().isMuted()) {
|
||||
std::static_pointer_cast<sfg::Image>(mute_button->GetChild())
|
||||
->SetImage(*ResourceManager::get().getImage("no_music.tga"));
|
||||
previously_muted_state = true;
|
||||
mute_button->SetImage(sfg::Image::Create(
|
||||
*ResourceManager::get().getImage("no_music.tga")
|
||||
));
|
||||
} else {
|
||||
std::static_pointer_cast<sfg::Image>(mute_button->GetChild())
|
||||
->SetImage(*ResourceManager::get().getImage("music.tga"));
|
||||
previously_muted_state = false;
|
||||
mute_button->SetImage(sfg::Image::Create(
|
||||
*ResourceManager::get().getImage("music.tga")
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// positionnement de la barre d'actions
|
||||
|
|
Loading…
Reference in New Issue