Hook up a couple more sounds. Unfortunately clickable back buttons now play both back and confirm sounds...

This commit is contained in:
Henrik Rydgård committed 2020-08-03 12:08:11 +02:00
1 parent 5423f76e25
commit 55eb2844fd
5 files changed
+8 -2

No files matched your search

+1 -1
View File
@@ -369,7 +369,7 @@ int BackgroundAudio::Play() {
}
}
// Mix in menu sound effects
// Mix in menu sound effects. Terribly slow mixer but meh.
if (!plays_.empty()) {
for (int i = 0; i < sz * 2; i += 2) {
std::vector<PlayInstance>::iterator iter = plays_.begin();
+1 -1
View File
@@ -147,7 +147,7 @@ void SetSoundCallback(std::function<void(UISound)> func) {
void PlayUISound(UISound sound) {
if (soundCallback) {
soundCallback(UISound::SELECT);
soundCallback(sound);
}
}
+1
View File
@@ -1,6 +1,7 @@
#pragma once
#include <functional>
#include "ui/ui_context.h"
#include "input/input_state.h"
+4
View File
@@ -157,6 +157,10 @@ bool UIScreen::key(const KeyInput &key) {
}
void UIScreen::TriggerFinish(DialogResult result) {
switch (result) {
case DialogResult::DR_BACK: UI::PlayUISound(UI::UISound::BACK); break;
case DialogResult::DR_OK: UI::PlayUISound(UI::UISound::CONFIRM); break;
}
screenManager()->finishDialog(this, result);
}
+1
View File
@@ -217,6 +217,7 @@ void Clickable::Click() {
UI::EventParams e{};
e.v = this;
OnClick.Trigger(e);
UI::PlayUISound(UI::UISound::CONFIRM);
};
void Clickable::FocusChanged(int focusFlags) {