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