void Setting::menuSoundToggleCallback(Ref* pSender)
{
auto soundToggleMenuItem = (MenuItemToggle*)pSender;
log("soundToggleMenuItem %d", soundToggleMenuItem->getSelectedIndex());
UserDefault *defaults = UserDefault::getInstance();
if (defaults->getBoolForKey(SOUND_KEY)) {
defaults->setBoolForKey(SOUND_KEY, false);
} else {
defaults->setBoolForKey(SOUND_KEY, true);
SimpleAudioEngine::getInstance()->playEffect("sound/Blip.wav");
}
}
void Setting::menuMusicToggleCallback(Ref* pSender)
{
auto musicToggleMenuItem = (MenuItemToggle*)pSender;
log("musicToggleMenuItem %d", musicToggleMenuItem->getSelectedIndex());
UserDefault *defaults = UserDefault::getInstance();
if (defaults->getBoolForKey(MUSIC_KEY)) {
defaults->setBoolForKey(MUSIC_KEY, false);
SimpleAudioEngine::getInstance()->stopBackgroundMusic();
} else {
defaults->setBoolForKey(MUSIC_KEY, true);
SimpleAudioEngine::getInstance()->playBackgroundMusic("sound/Synth.mp3");
}
}