diff --git a/OpenRA.Game/Widgets/HotkeyEntryWidget.cs b/OpenRA.Game/Widgets/HotkeyEntryWidget.cs index 714b3b1da1..daa83ff1d8 100644 --- a/OpenRA.Game/Widgets/HotkeyEntryWidget.cs +++ b/OpenRA.Game/Widgets/HotkeyEntryWidget.cs @@ -59,6 +59,8 @@ namespace OpenRA.Widgets if (!RenderBounds.Contains(mi.Location) || !TakeKeyboardFocus()) return false; + blinkCycle = 15; + return true; } @@ -83,6 +85,18 @@ namespace OpenRA.Widgets return true; } + protected int blinkCycle = 15; + protected bool showEntry = true; + + public override void Tick() + { + if (HasKeyboardFocus && --blinkCycle <= 0) + { + blinkCycle = 15; + showEntry ^= true; + } + } + public override void Draw() { var apparentText = Key.DisplayString(); @@ -100,6 +114,10 @@ namespace OpenRA.Widgets WidgetUtils.DrawPanel(state, RenderBounds); + // Blink the current entry to indicate focus + if (HasKeyboardFocus && !showEntry) + return; + // Inset text by the margin and center vertically var textPos = pos + new int2(LeftMargin, (Bounds.Height - textSize.Y) / 2 - VisualHeight);