From 882f11bf79d0ce405fb865cd0a7a1d552f540513 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 18 Feb 2024 23:19:57 +0800 Subject: [PATCH 1/2] Fix logo tracking container being off by one frame This was especially visible at the main menu when running in single thread mode. --- osu.Game/Graphics/Containers/LogoTrackingContainer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/Containers/LogoTrackingContainer.cs b/osu.Game/Graphics/Containers/LogoTrackingContainer.cs index 08eae25951..57f87b588a 100644 --- a/osu.Game/Graphics/Containers/LogoTrackingContainer.cs +++ b/osu.Game/Graphics/Containers/LogoTrackingContainer.cs @@ -82,9 +82,9 @@ namespace osu.Game.Graphics.Containers absolutePos.Y / Logo.Parent!.RelativeToAbsoluteFactor.Y); } - protected override void Update() + protected override void UpdateAfterChildren() { - base.Update(); + base.UpdateAfterChildren(); if (Logo == null) return; From 6b6a6aea54fadf4dd5b811629fd075fe1b7f5c34 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 18 Feb 2024 23:35:26 +0800 Subject: [PATCH 2/2] Apply NRT to `LogoTrackingContainer` --- .../Visual/UserInterface/TestSceneLogoTrackingContainer.cs | 2 +- osu.Game/Graphics/Containers/LogoTrackingContainer.cs | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneLogoTrackingContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneLogoTrackingContainer.cs index 57ea4ee58e..8d5c961265 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneLogoTrackingContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneLogoTrackingContainer.cs @@ -282,7 +282,7 @@ namespace osu.Game.Tests.Visual.UserInterface /// /// Check that the logo is tracking the position of the facade, with an acceptable precision lenience. /// - public bool IsLogoTracking => Precision.AlmostEquals(Logo.Position, ComputeLogoTrackingPosition()); + public bool IsLogoTracking => Precision.AlmostEquals(Logo!.Position, ComputeLogoTrackingPosition()); } } } diff --git a/osu.Game/Graphics/Containers/LogoTrackingContainer.cs b/osu.Game/Graphics/Containers/LogoTrackingContainer.cs index 57f87b588a..13c672cbd6 100644 --- a/osu.Game/Graphics/Containers/LogoTrackingContainer.cs +++ b/osu.Game/Graphics/Containers/LogoTrackingContainer.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -19,7 +17,7 @@ namespace osu.Game.Graphics.Containers { public Facade LogoFacade => facade; - protected OsuLogo Logo { get; private set; } + protected OsuLogo? Logo { get; private set; } private readonly InternalFacade facade = new InternalFacade(); @@ -76,7 +74,7 @@ namespace osu.Game.Graphics.Containers /// Will only be correct if the logo's are set to Axes.Both protected Vector2 ComputeLogoTrackingPosition() { - var absolutePos = Logo.Parent!.ToLocalSpace(LogoFacade.ScreenSpaceDrawQuad.Centre); + var absolutePos = Logo!.Parent!.ToLocalSpace(LogoFacade.ScreenSpaceDrawQuad.Centre); return new Vector2(absolutePos.X / Logo.Parent!.RelativeToAbsoluteFactor.X, absolutePos.Y / Logo.Parent!.RelativeToAbsoluteFactor.Y);