1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-06 22:47:20 +08:00

45 lines
1.3 KiB
C#
Raw Normal View History

// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
2016-09-30 18:45:55 +09:00
2016-11-23 11:59:50 +09:00
using osu.Framework.Allocation;
2016-09-30 18:45:55 +09:00
using osu.Framework.Graphics;
2016-11-23 11:59:50 +09:00
using osu.Framework.Graphics.Containers;
2016-09-30 18:45:55 +09:00
using osu.Framework.Graphics.Sprites;
2016-11-23 11:59:50 +09:00
using osu.Framework.Graphics.Textures;
2016-09-30 18:45:55 +09:00
using OpenTK.Graphics;
2016-11-23 11:59:50 +09:00
namespace osu.Game.Graphics.Backgrounds
2016-09-30 18:45:55 +09:00
{
public class Background : BufferedContainer
2016-09-30 18:45:55 +09:00
{
public Sprite Sprite;
2016-09-30 18:45:55 +09:00
private readonly string textureName;
2016-10-05 16:35:10 +09:00
public Background(string textureName = @"")
{
2017-02-14 16:13:25 +09:00
CacheDrawnFrameBuffer = true;
2016-10-05 16:35:10 +09:00
this.textureName = textureName;
RelativeSizeAxes = Axes.Both;
2016-11-29 20:50:12 +01:00
Depth = float.MaxValue;
Add(Sprite = new Sprite
2016-09-30 18:45:55 +09:00
{
RelativeSizeAxes = Axes.Both,
2016-09-30 18:45:55 +09:00
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
2016-11-23 13:18:22 +09:00
Colour = Color4.DarkGray,
FillMode = FillMode.Fill,
2016-09-30 18:45:55 +09:00
});
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
if (!string.IsNullOrEmpty(textureName))
Sprite.Texture = textures.Get(textureName);
}
2016-09-30 18:45:55 +09:00
}
}