2017-10-03 18:21:08 +08:00
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
using OpenTK;
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Configuration;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
using osu.Game.Overlays;
|
2017-10-10 14:22:32 +08:00
|
|
|
using osu.Game.Screens.Edit.Screens.Compose.Timeline;
|
2017-10-03 18:21:08 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual
|
|
|
|
{
|
2017-12-20 20:47:45 +08:00
|
|
|
public class TestCaseWaveform : OsuTestCase
|
2017-10-03 18:21:08 +08:00
|
|
|
{
|
|
|
|
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
|
|
|
|
|
|
|
|
public TestCaseWaveform()
|
|
|
|
{
|
|
|
|
FillFlowContainer flow;
|
|
|
|
Child = flow = new FillFlowContainer
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
Spacing = new Vector2(0, 10),
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
2017-10-04 17:55:45 +08:00
|
|
|
new MusicController
|
2017-10-03 18:21:08 +08:00
|
|
|
{
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
Y = 100,
|
|
|
|
State = Visibility.Visible
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
for (int i = 1; i <= 16; i *= 2)
|
|
|
|
{
|
2017-10-05 13:33:39 +08:00
|
|
|
var newDisplay = new BeatmapWaveformGraph
|
2017-10-04 13:42:22 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Resolution = 1f / i
|
|
|
|
};
|
2017-10-03 18:21:08 +08:00
|
|
|
|
2017-10-04 13:42:22 +08:00
|
|
|
newDisplay.Beatmap.BindTo(beatmapBacking);
|
2017-10-03 18:21:08 +08:00
|
|
|
|
|
|
|
flow.Add(new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
Height = 100,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
newDisplay,
|
|
|
|
new Container
|
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Colour = Color4.Black,
|
|
|
|
Alpha = 0.75f
|
|
|
|
},
|
|
|
|
new OsuSpriteText
|
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
2017-10-05 13:33:49 +08:00
|
|
|
Text = $"Resolution: {1f / i:0.00}"
|
2017-10-03 18:21:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2017-10-04 13:42:22 +08:00
|
|
|
private void load(OsuGameBase osuGame) => beatmapBacking.BindTo(osuGame.Beatmap);
|
2017-10-03 18:21:08 +08:00
|
|
|
}
|
|
|
|
}
|