fix button click not playing when returning from a GUI and then clicking it again

This commit is contained in:
Kae 2024-09-11 15:23:35 +10:00
parent c68ebd2e0e
commit a6b20df3f0

View File

@ -165,6 +165,12 @@ void ButtonWidget::mouseOut() {
void ButtonWidget::mouseReturnStillDown() {
Widget::mouseReturnStillDown();
if (!isPressed()) {
auto assets = Root::singleton().assets();
auto sound = Random::randValueFrom(m_clickSounds, "");
if (!sound.empty())
context()->playAudio(sound);
}
m_hovered = true;
m_pressed = true;
}