2017-02-07 04:59:30 +00:00
|
|
|
|
// 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 09:45:55 +00:00
|
|
|
|
|
|
|
|
|
using System;
|
2016-11-23 02:59:50 +00:00
|
|
|
|
using osu.Framework.Allocation;
|
2016-09-30 09:45:55 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
2016-11-23 02:59:50 +00:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2016-09-30 09:45:55 +00:00
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2016-11-23 02:59:50 +00:00
|
|
|
|
using osu.Framework.Graphics.Textures;
|
2016-09-30 09:45:55 +00:00
|
|
|
|
using OpenTK;
|
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
|
|
2016-11-23 02:59:50 +00:00
|
|
|
|
namespace osu.Game.Graphics.Backgrounds
|
2016-09-30 09:45:55 +00:00
|
|
|
|
{
|
2016-11-19 16:39:43 +00:00
|
|
|
|
public class Background : BufferedContainer
|
2016-09-30 09:45:55 +00:00
|
|
|
|
{
|
2016-11-19 16:39:43 +00:00
|
|
|
|
public Sprite Sprite;
|
2016-09-30 09:45:55 +00:00
|
|
|
|
|
2016-10-05 07:35:10 +00:00
|
|
|
|
string textureName;
|
|
|
|
|
|
2016-11-19 16:39:43 +00:00
|
|
|
|
public Background(string textureName = @"")
|
2016-10-01 09:40:14 +00:00
|
|
|
|
{
|
2016-10-05 07:35:10 +00:00
|
|
|
|
this.textureName = textureName;
|
2016-10-01 09:40:14 +00:00
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
2016-11-29 19:50:12 +00:00
|
|
|
|
Depth = float.MaxValue;
|
2016-10-01 09:40:14 +00:00
|
|
|
|
|
2016-11-19 16:39:43 +00:00
|
|
|
|
Add(Sprite = new Sprite
|
2016-09-30 09:45:55 +00:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2016-11-23 04:18:22 +00:00
|
|
|
|
Colour = Color4.DarkGray,
|
|
|
|
|
FillMode = FillMode.Fill,
|
2016-09-30 09:45:55 +00:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-12 17:34:36 +00:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(TextureStore textures)
|
|
|
|
|
{
|
2016-11-19 16:39:43 +00:00
|
|
|
|
if (!string.IsNullOrEmpty(textureName))
|
|
|
|
|
Sprite.Texture = textures.Get(textureName);
|
2016-11-12 17:34:36 +00:00
|
|
|
|
}
|
2016-09-30 09:45:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|