1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-20 16:12:54 +08:00

Fix scale ratio of gamefield.

This commit is contained in:
Dean Herbert 2016-11-02 15:37:45 +09:00
parent 788cba6f4d
commit e939746159
3 changed files with 25 additions and 10 deletions

View File

@ -34,19 +34,20 @@ namespace osu.Desktop.VisualTests.Tests
ourClock.ProcessFrame();
for (int i = 0; i < 20; i++)
const int count = 10;
for (int i = 0; i < count; i++)
{
var h = new Circle
{
StartTime = ourClock.CurrentTime + 1000 + i * 80,
Position = new Vector2(i * 14),
Position = new Vector2((i - count / 2) * 14),
};
Add(new DrawableCircle(h)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(1.2f),
Depth = -i,
State = ArmedState.Armed,
});

View File

@ -30,7 +30,8 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
this.h = h;
Origin = Anchor.Centre;
Position = h.Position;
RelativePositionAxes = Axes.Both;
Position = new Vector2(h.Position.X / 512, h.Position.Y / 384);
Children = new Framework.Graphics.Drawable[]
{
@ -57,8 +58,6 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
Colour = h.Colour
}
};
Size = new Vector2(100);
}
protected override void Load(BaseGame game)

View File

@ -16,24 +16,39 @@ namespace osu.Game.GameModes.Play.Osu
private Container hitObjectContainer;
public override Vector2 Size
{
get
{
var parentSize = Parent.DrawSize;
var aspectSize = parentSize.X * 0.75f < parentSize.Y ? new Vector2(parentSize.X, parentSize.X * 0.75f) : new Vector2(parentSize.Y * 4f / 3f, parentSize.Y);
return new Vector2(aspectSize.X / parentSize.X, aspectSize.Y / parentSize.Y) * base.Size;
}
}
public OsuPlayfield()
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
Size = new Vector2(512, 384);
RelativeSizeAxes = Axes.Both;
Size = new Vector2(0.86f);
AddInternal(new Box
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
Alpha = 0.5f
Alpha = 0.5f,
});
AddInternal(hitObjectContainer = new Container
{
RelativeSizeAxes = Axes.Both
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(0.4f),
});
}
}