From a765003579b5c0f7e41e39a8572277701de493ef Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 6 Apr 2026 14:07:52 -0700
Subject: [PATCH] Wait for the game-over sound to complete before showing IME
Bringing up the IME can be expensive and interrupt sound on some platforms like iOS.
---
game/gameover.cpp | 13 ++++++++++++-
game/gameover.h | 1 +
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/game/gameover.cpp b/game/gameover.cpp
index cf042e5b..778abd3f 100644
--- a/game/gameover.cpp
+++ b/game/gameover.cpp
@@ -119,6 +119,7 @@ void GameOverPanelDelegate::OnShow()
delete[] final;
/* -- See if they got a high score */
+ m_showIME = false;
m_handleLabel = NULL;
if (gReplay.IsRecording() && !gReplay.HasContinues() &&
!gGameInfo.IsMultiplayer() && !gGameInfo.IsKidMode() &&
@@ -154,6 +155,16 @@ void GameOverPanelDelegate::OnHide()
void GameOverPanelDelegate::OnTick()
{
+ if (m_showIME) {
+ // Wait for the sound to complete before bringing up text entry
+ if (sound->Playing()) {
+ return;
+ }
+
+ screen->EnableTextInput(m_handleLabel->X(), m_handleLabel->Y(), m_handleLabel->Width(), m_handleLabel->Height());
+ m_showIME = false;
+ }
+
if (m_handleLabel) {
return;
}
@@ -260,7 +271,7 @@ void GameOverPanelDelegate::BeginEnterName()
}
m_handleSize = (int)SDL_strlen(m_handle);
- screen->EnableTextInput(m_handleLabel->X(), m_handleLabel->Y(), m_handleLabel->Width(), m_handleLabel->Height());
+ m_showIME = true;
}
void GameOverPanelDelegate::FinishEnterName()
diff --git a/game/gameover.h b/game/gameover.h
index 4070d324..08d74581 100644
--- a/game/gameover.h
+++ b/game/gameover.h
@@ -42,6 +42,7 @@ class GameOverPanelDelegate : public UIPanelDelegate
UIElement *m_handleLabel;
int m_handleSize;
char m_handle[MAX_NAMELEN+1];
+ bool m_showIME;
Uint64 m_showTime;
};