Use new framework-level triangles.

This commit is contained in:
Thomas Müller
2016-12-01 19:12:35 +01:00
parent 20947623d5
commit 1e8dc780ab
5 changed files with 16 additions and 27 deletions

View File

@ -13,10 +13,8 @@ using OpenTK;
namespace osu.Game.Graphics.Backgrounds
{
public class Triangles : Container
public class Triangles : Container<Triangle>
{
private Texture triangle;
public Triangles()
{
Alpha = 0.3f;
@ -35,12 +33,6 @@ namespace osu.Game.Graphics.Backgrounds
}
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
triangle = textures.Get(@"Play/osu/triangle@2x");
}
private int aimTriangleCount => (int)((DrawWidth * DrawHeight) / 800 / triangleScale);
protected override void Update()
@ -60,16 +52,18 @@ namespace osu.Game.Graphics.Backgrounds
}
protected virtual Sprite CreateTriangle()
protected virtual Triangle CreateTriangle()
{
var scale = triangleScale * RNG.NextSingle() * 0.4f + 0.2f;
const float size = 100;
return new Sprite
return new Triangle
{
Texture = triangle,
Origin = Anchor.TopCentre,
RelativePositionAxes = Axes.Both,
Scale = new Vector2(scale),
// Scaling height by 0.866 results in equiangular triangles (== 60° and equal side length)
Size = new Vector2(size, 0.866f * size),
Alpha = RNG.NextSingle(),
Depth = scale,
};