2016-09-30 17:45:55 +08:00
|
|
|
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using System;
|
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;
|
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
|
|
2016-11-23 10:59:50 +08:00
|
|
|
|
namespace osu.Game.Graphics.Backgrounds
|
2016-09-30 17:45:55 +08:00
|
|
|
|
{
|
2016-11-20 00:39:43 +08:00
|
|
|
|
public class Background : BufferedContainer
|
2016-09-30 17:45:55 +08:00
|
|
|
|
{
|
2016-11-20 00:39:43 +08:00
|
|
|
|
public Sprite Sprite;
|
2016-09-30 17:45:55 +08:00
|
|
|
|
|
2016-10-05 15:35:10 +08:00
|
|
|
|
string textureName;
|
|
|
|
|
|
2016-11-20 00:39:43 +08:00
|
|
|
|
public Background(string textureName = @"")
|
2016-10-01 17:40:14 +08:00
|
|
|
|
{
|
2016-10-05 15:35:10 +08:00
|
|
|
|
this.textureName = textureName;
|
2016-10-01 17:40:14 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
2016-10-05 15:35:10 +08:00
|
|
|
|
Depth = float.MinValue;
|
2016-10-01 17:40:14 +08:00
|
|
|
|
|
2016-11-20 00:39:43 +08:00
|
|
|
|
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
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-13 01:34:36 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(TextureStore textures)
|
|
|
|
|
{
|
2016-11-20 00:39:43 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(textureName))
|
|
|
|
|
Sprite.Texture = textures.Get(textureName);
|
2016-11-13 01:34:36 +08:00
|
|
|
|
}
|
2016-09-30 17:45:55 +08:00
|
|
|
|
}
|
|
|
|
|
}
|