From 1b3422db2d752f41f5af3a42cf86dacb2679f9b5 Mon Sep 17 00:00:00 2001 From: rob-v Date: Sat, 27 May 2017 09:21:10 +0200 Subject: [PATCH] Fix flickering tooltip --- OpenRA.Game/Game.cs | 2 -- OpenRA.Game/Graphics/Viewport.cs | 2 +- OpenRA.Game/Widgets/Widget.cs | 2 +- OpenRA.Mods.Common/Widgets/TooltipContainerWidget.cs | 4 ++-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 9846496c0a..7b21435bc1 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -539,8 +539,6 @@ namespace OpenRA var integralTickTimestep = (uiTickDelta / Timestep) * Timestep; Ui.LastTickTime += integralTickTimestep >= TimestepJankThreshold ? integralTickTimestep : Timestep; - Viewport.TicksSinceLastMove += uiTickDelta / Timestep; - Sync.CheckSyncUnchanged(world, Ui.Tick); Cursor.Tick(); } diff --git a/OpenRA.Game/Graphics/Viewport.cs b/OpenRA.Game/Graphics/Viewport.cs index 41f347f99b..7a6aad3ade 100644 --- a/OpenRA.Game/Graphics/Viewport.cs +++ b/OpenRA.Game/Graphics/Viewport.cs @@ -80,7 +80,7 @@ namespace OpenRA.Graphics } } - public static long TicksSinceLastMove = 0; + public static long LastMoveRunTime = 0; public static int2 LastMousePos; float ClosestTo(float[] collection, float target) diff --git a/OpenRA.Game/Widgets/Widget.cs b/OpenRA.Game/Widgets/Widget.cs index 34911a4e4a..1a20c6fe06 100644 --- a/OpenRA.Game/Widgets/Widget.cs +++ b/OpenRA.Game/Widgets/Widget.cs @@ -108,7 +108,7 @@ namespace OpenRA.Widgets if (mi.Event == MouseInputEvent.Move) { Viewport.LastMousePos = mi.Location; - Viewport.TicksSinceLastMove = 0; + Viewport.LastMoveRunTime = Game.RunTime; } if (wasMouseOver != MouseOverWidget) diff --git a/OpenRA.Mods.Common/Widgets/TooltipContainerWidget.cs b/OpenRA.Mods.Common/Widgets/TooltipContainerWidget.cs index c76ac2772d..160ff3b2f4 100644 --- a/OpenRA.Mods.Common/Widgets/TooltipContainerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/TooltipContainerWidget.cs @@ -24,12 +24,12 @@ namespace OpenRA.Mods.Common.Widgets public int BottomEdgeYOffset = -5; public Action BeforeRender = Nothing; - public int TooltipDelay = 5; + public int TooltipDelayMilliseconds = 200; Widget tooltip; public TooltipContainerWidget() { - IsVisible = () => Viewport.TicksSinceLastMove >= TooltipDelay; + IsVisible = () => Game.RunTime > Viewport.LastMoveRunTime + TooltipDelayMilliseconds; } public void SetTooltip(string id, WidgetArgs args)