-
Notifications
You must be signed in to change notification settings - Fork 235
Open
Description
When any button is activated, a sound plays.
void Button::activate()
{
...
mSounds.play(SoundEffect::Button);
}
Currently, the button's volume differs based on x and y values.
void SoundPlayer::play(SoundEffect::ID effect)
{
play(effect, getListenerPosition());
}
If we use the code below, the sound volume for each button remains the same, which is more adequate for UI buttons.
void SoundPlayer::play(SoundEffect::ID effect)
{
mSounds.push_back(sf::Sound(mSoundBuffers.get(effect)));
sf::Sound& sound = mSounds.back();
sound.setRelativeToListener(true); // ignore world coordinates
sound.setAttenuation(0.f); // no distance fade
sound.play();
}
Metadata
Metadata
Assignees
Labels
No labels