Skip to content

Commit

Permalink
Fix blank space under tournament screen test scenes on very wide screens
Browse files Browse the repository at this point in the history
  • Loading branch information
bdach committed Jul 24, 2023
1 parent 09ee500 commit e7c1664
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions osu.Game.Tournament.Tests/TournamentScreenTestScene.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
Expand All @@ -10,17 +11,28 @@ namespace osu.Game.Tournament.Tests
{
public abstract partial class TournamentScreenTestScene : TournamentTestScene
{
protected override Container<Drawable> Content { get; } = new DrawSizePreservingFillContainer
{
TargetDrawSize = new Vector2(1920, 1080),
Scale = new Vector2(1920 / (float)(1920 + TournamentSceneManager.CONTROL_AREA_WIDTH)),
RelativeSizeAxes = Axes.Both
};
protected override Container<Drawable> Content { get; } = new TournamentScalingContainer();

[BackgroundDependencyLoader]
private void load()
{
base.Content.Add(Content);
}

private partial class TournamentScalingContainer : DrawSizePreservingFillContainer
{
public TournamentScalingContainer()
{
TargetDrawSize = new Vector2(1920, 1080);
RelativeSizeAxes = Axes.Both;
}

protected override void Update()
{
base.Update();

Scale = new Vector2(Math.Min(1, Content.DrawWidth / (1920 + TournamentSceneManager.CONTROL_AREA_WIDTH)));
}
}
}
}

0 comments on commit e7c1664

Please sign in to comment.