mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +08:00
Bypass 640x480 coordinate space for video storyboard elements
This allows the `FillMode.Fill` to take up the full space of the storyboard container.
This commit is contained in:
parent
0c55bba220
commit
5ea948aabe
@ -5,6 +5,7 @@ using System.Threading;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Storyboards.Drawables
|
||||
{
|
||||
@ -15,6 +16,8 @@ namespace osu.Game.Storyboards.Drawables
|
||||
|
||||
public override bool IsPresent => Enabled && base.IsPresent;
|
||||
|
||||
protected LayerElementContainer ElementContainer { get; }
|
||||
|
||||
public DrawableStoryboardLayer(StoryboardLayer layer)
|
||||
{
|
||||
Layer = layer;
|
||||
@ -24,10 +27,10 @@ namespace osu.Game.Storyboards.Drawables
|
||||
Enabled = layer.VisibleWhenPassing;
|
||||
Masking = layer.Masking;
|
||||
|
||||
InternalChild = new LayerElementContainer(layer);
|
||||
InternalChild = ElementContainer = new LayerElementContainer(layer);
|
||||
}
|
||||
|
||||
private class LayerElementContainer : LifetimeManagementContainer
|
||||
protected class LayerElementContainer : LifetimeManagementContainer
|
||||
{
|
||||
private readonly StoryboardLayer storyboardLayer;
|
||||
|
||||
@ -35,8 +38,8 @@ namespace osu.Game.Storyboards.Drawables
|
||||
{
|
||||
storyboardLayer = layer;
|
||||
|
||||
Width = 640;
|
||||
Height = 480;
|
||||
Size = new Vector2(640, 480);
|
||||
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ namespace osu.Game.Storyboards
|
||||
|
||||
public Storyboard()
|
||||
{
|
||||
layers.Add("Video", new StoryboardLayer("Video", 4, false));
|
||||
layers.Add("Video", new StoryboardLayerVideo("Video", 4, false));
|
||||
layers.Add("Background", new StoryboardLayer("Background", 3));
|
||||
layers.Add("Fail", new StoryboardLayer("Fail", 2) { VisibleWhenPassing = false, });
|
||||
layers.Add("Pass", new StoryboardLayer("Pass", 1) { VisibleWhenFailing = false, });
|
||||
|
@ -32,7 +32,7 @@ namespace osu.Game.Storyboards
|
||||
Elements.Add(element);
|
||||
}
|
||||
|
||||
public DrawableStoryboardLayer CreateDrawable()
|
||||
public virtual DrawableStoryboardLayer CreateDrawable()
|
||||
=> new DrawableStoryboardLayer(this) { Depth = Depth, Name = Name };
|
||||
}
|
||||
}
|
||||
|
32
osu.Game/Storyboards/StoryboardLayerVideo.cs
Normal file
32
osu.Game/Storyboards/StoryboardLayerVideo.cs
Normal file
@ -0,0 +1,32 @@
|
||||
// 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 osu.Framework.Graphics;
|
||||
using osu.Game.Storyboards.Drawables;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Storyboards
|
||||
{
|
||||
public class StoryboardLayerVideo : StoryboardLayer
|
||||
{
|
||||
public StoryboardLayerVideo(string name, int depth, bool masking)
|
||||
: base(name, depth, masking)
|
||||
{
|
||||
}
|
||||
|
||||
public override DrawableStoryboardLayer CreateDrawable()
|
||||
=> new DrawableStoryboardLayerVideo(this) { Depth = Depth, Name = Name };
|
||||
|
||||
public class DrawableStoryboardLayerVideo : DrawableStoryboardLayer
|
||||
{
|
||||
public DrawableStoryboardLayerVideo(StoryboardLayerVideo layer)
|
||||
: base(layer)
|
||||
{
|
||||
// for videos we want to take on the full size of the storyboard container hierarchy
|
||||
// to allow the video to fill the full available region.
|
||||
ElementContainer.RelativeSizeAxes = Axes.Both;
|
||||
ElementContainer.Size = Vector2.One;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user