Hook up the first UI sound, make it play.

This commit is contained in:
Henrik Rydgård committed 2020-08-03 12:08:11 +02:00
1 parent b30be913c0
commit 5423f76e25
5 files changed
+89 -20

No files matched your search

+15
View File
@@ -17,6 +17,9 @@ static bool focusMovementEnabled;
bool focusForced;
static std::mutex eventMutex_;
static std::function<void(UISound)> soundCallback;
struct DispatchQueueItem {
Event *e;
EventParams params;
@@ -133,6 +136,18 @@ void MoveFocus(ViewGroup *root, FocusDirection direction) {
if (neigh.view) {
neigh.view->SetFocus();
root->SubviewFocused(neigh.view);
PlayUISound(UISound::SELECT);
}
}
void SetSoundCallback(std::function<void(UISound)> func) {
soundCallback = func;
}
void PlayUISound(UISound sound) {
if (soundCallback) {
soundCallback(UISound::SELECT);
}
}