1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-23 16:07:24 +08:00
osu-lazer/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs

96 lines
2.9 KiB
C#
Raw Normal View History

2016-09-02 17:06:36 +08:00
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using osu.Framework.GameModes.Testing;
using osu.Framework.Graphics;
using osu.Framework.MathUtils;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Objects;
2016-09-02 18:25:13 +08:00
using osu.Game.Beatmaps.Objects.Osu;
using osu.Game.GameModes.Play.Catch;
using osu.Game.GameModes.Play.Mania;
2016-09-02 18:25:13 +08:00
using osu.Game.GameModes.Play.Osu;
2016-09-02 18:50:22 +08:00
using osu.Game.GameModes.Play.Taiko;
using System.Collections.Generic;
using osu.Framework.Timing;
2016-09-02 17:06:36 +08:00
namespace osu.Desktop.Tests
2016-09-02 17:06:36 +08:00
{
class TestCaseGamefield : TestCase
2016-09-02 17:06:36 +08:00
{
public override string Name => @"Gamefield";
public override string Description => @"Showing hitobjects and what not.";
FramedOffsetClock localClock;
protected override IFrameBasedClock Clock => localClock;
public override void Reset()
2016-09-02 17:06:36 +08:00
{
base.Reset();
///create a new clock offset to 0.
localClock = new FramedOffsetClock(base.Clock) { Offset = -base.Clock.CurrentTime };
2016-09-26 14:07:29 +08:00
List<HitObject> objects = new List<HitObject>();
int time = 500;
for (int i = 0; i < 100; i++)
{
objects.Add(new Circle()
2016-09-02 18:25:13 +08:00
{
StartTime = time,
Position = new Vector2(RNG.Next(0, 512), RNG.Next(0, 384))
});
time += RNG.Next(50, 500);
}
Beatmap beatmap = new Beatmap
{
HitObjects = objects
};
Add(new Drawable[]
{
2016-09-21 12:25:23 +08:00
new OsuHitRenderer
{
Objects = beatmap.HitObjects,
Scale = new Vector2(0.5f),
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft
},
new TaikoHitRenderer
{
Objects = beatmap.HitObjects,
Scale = new Vector2(0.5f),
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight
},
new CatchHitRenderer
{
Objects = beatmap.HitObjects,
Scale = new Vector2(0.5f),
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft
},
new ManiaHitRenderer
{
Objects = beatmap.HitObjects,
Scale = new Vector2(0.5f),
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight
}
});
}
protected override void Update()
{
base.Update();
localClock.ProcessFrame();
2016-09-02 17:06:36 +08:00
}
}
}