1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 06:07:28 +08:00
osu-lazer/osu.Game/Graphics/Backgrounds/Background.cs

44 lines
1.2 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 17:45:55 +08:00
2016-11-23 10:59:50 +08:00
using osu.Framework.Allocation;
2016-09-30 17:45:55 +08:00
using osu.Framework.Graphics;
2016-11-23 10:59:50 +08:00
using osu.Framework.Graphics.Containers;
2016-09-30 17:45:55 +08:00
using osu.Framework.Graphics.Sprites;
2016-11-23 10:59:50 +08:00
using osu.Framework.Graphics.Textures;
2016-09-30 17:45:55 +08:00
using OpenTK.Graphics;
2016-11-23 10:59:50 +08:00
namespace osu.Game.Graphics.Backgrounds
2016-09-30 17:45:55 +08:00
{
public class Background : BufferedContainer
2016-09-30 17:45:55 +08:00
{
public Sprite Sprite;
2016-09-30 17:45:55 +08:00
2016-10-05 15:35:10 +08:00
string textureName;
public Background(string textureName = @"")
{
2017-02-14 15:13:25 +08:00
CacheDrawnFrameBuffer = true;
2016-10-05 15:35:10 +08:00
this.textureName = textureName;
RelativeSizeAxes = Axes.Both;
2016-11-30 03:50:12 +08:00
Depth = float.MaxValue;
Add(Sprite = new Sprite
2016-09-30 17:45:55 +08:00
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
2016-11-23 12:18:22 +08:00
Colour = Color4.DarkGray,
FillMode = FillMode.Fill,
2016-09-30 17:45:55 +08:00
});
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
if (!string.IsNullOrEmpty(textureName))
Sprite.Texture = textures.Get(textureName);
}
2016-09-30 17:45:55 +08:00
}
}