1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Adjust layout to ballpark-match stable

I dunno what the wiki is claiming with the "24px" figure or why
but I'm not playing conversion games either. Dimensions ballparked
via screenshots captured at x768 resolution.

Also removes a weird homebrew method to keep the text upright.
There is one canonical way to do this, namely
`UprightAspectMaintainingContainer`. And the other key counters
were already using it.
This commit is contained in:
Bartłomiej Dach 2024-07-24 14:26:16 +02:00
parent ace5071d88
commit 087dd759be
No known key found for this signature in database
4 changed files with 26 additions and 43 deletions

View File

@ -37,6 +37,6 @@ namespace osu.Game.Tests.Visual.Gameplay
protected override Drawable CreateDefaultImplementation() => new ArgonKeyCounterDisplay();
protected override Drawable CreateLegacyImplementation() => new LegacyKeyCounterDisplay(); //{ Rotation = 90, };
protected override Drawable CreateLegacyImplementation() => new LegacyKeyCounterDisplay();
}
}

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Screens.Play.HUD;
@ -30,18 +31,6 @@ namespace osu.Game.Skinning
private Colour4 keyTextColour = Colour4.White;
private float keyTextRotation;
public float KeyTextRotation
{
get => keyTextRotation;
set
{
keyTextRotation = value;
overlayKeyText.Rotation = value;
}
}
private readonly Container keyContainer;
private readonly OsuSpriteText overlayKeyText;
@ -55,7 +44,7 @@ namespace osu.Game.Skinning
Anchor = Anchor.Centre;
Child = keyContainer = new Container
{
RelativeSizeAxes = Axes.Both,
AutoSizeAxes = Axes.Both,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Children = new Drawable[]
@ -64,23 +53,26 @@ namespace osu.Game.Skinning
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
BypassAutoSizeAxes = Axes.Both,
Rotation = -90,
},
overlayKeyText = new OsuSpriteText
new UprightAspectMaintainingContainer
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = trigger.Name,
Colour = keyTextColour,
Font = OsuFont.GetFont(size: 20),
Rotation = KeyTextRotation
Child = overlayKeyText = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = trigger.Name,
Colour = keyTextColour,
Font = OsuFont.GetFont(size: 20),
},
},
}
};
// Legacy key counter size
Height = Width = 48 * 0.95f;
// matches longest dimension of default skin asset
Height = Width = 46;
}
[BackgroundDependencyLoader]

View File

@ -8,6 +8,7 @@ using osu.Game.Screens.Play.HUD;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osuTK;
namespace osu.Game.Skinning
{
@ -27,18 +28,19 @@ namespace osu.Game.Skinning
{
backgroundSprite = new Sprite
{
Anchor = Anchor.TopLeft,
Anchor = Anchor.TopRight,
Origin = Anchor.TopLeft,
Scale = new Vector2(1.05f, 1),
Rotation = 90,
},
KeyFlow = new FillFlowContainer<KeyCounter>
{
// https://osu.ppy.sh/wiki/en/Skinning/Interface#input-overlay
// 24px away from the container, there're 4 counter in legacy, so divide by 4
// "inputoverlay-background.png" are 1.05x in-game. so *1.05f to the X coordinate
X = 24f / 4f,
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft,
Direction = FillDirection.Horizontal,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
X = -1.5f,
Y = 7,
Spacing = new Vector2(1.8f),
Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Both,
},
});
@ -65,18 +67,8 @@ namespace osu.Game.Skinning
{
TransitionDuration = key_transition_time,
KeyTextColour = keyTextColor,
KeyTextRotation = -Rotation,
};
protected override void Update()
{
base.Update();
// keep the text are always horizontal
foreach (var child in KeyFlow.Cast<LegacyKeyCounter>())
child.KeyTextRotation = -Rotation;
}
private Colour4 keyTextColor = Colour4.White;
public Colour4 KeyTextColor

View File

@ -396,10 +396,9 @@ namespace osu.Game.Skinning
if (keyCounter != null)
{
keyCounter.Rotation = 90f;
// set the anchor to top right so that it won't squash to the return button to the top
keyCounter.Anchor = Anchor.CentreRight;
keyCounter.Origin = Anchor.TopCentre;
keyCounter.Origin = Anchor.CentreRight;
keyCounter.X = 0;
// 340px is the default height inherit from stable
keyCounter.Y = container.ToLocalSpace(new Vector2(0, container.ScreenSpaceDrawQuad.Centre.Y - 340f)).Y;