1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-18 00:12:54 +08:00
osu-lazer/osu.Game/Graphics/Backgrounds/Background.cs
2019-01-24 17:43:03 +09:00

42 lines
1.1 KiB
C#

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
namespace osu.Game.Graphics.Backgrounds
{
public class Background : BufferedContainer
{
public Sprite Sprite;
private readonly string textureName;
public Background(string textureName = @"")
{
CacheDrawnFrameBuffer = true;
this.textureName = textureName;
RelativeSizeAxes = Axes.Both;
Add(Sprite = new Sprite
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fill,
});
}
[BackgroundDependencyLoader]
private void load(LargeTextureStore textures)
{
if (!string.IsNullOrEmpty(textureName))
Sprite.Texture = textures.Get(textureName);
}
}
}