1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 16:27:43 +08:00
osu-lazer/osu.Game/Graphics/Background/Background.cs

43 lines
1.1 KiB
C#
Raw Normal View History

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;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.Containers;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics.Containers;
2016-09-30 17:45:55 +08:00
namespace osu.Game.Graphics.Background
{
class Background : Container
2016-09-30 17:45:55 +08:00
{
protected Sprite BackgroundSprite;
public Background()
{
RelativeSizeAxes = Axes.Both;
}
2016-09-30 17:45:55 +08:00
public override void Load()
{
base.Load();
Add(BackgroundSprite = new Sprite
{
Texture = Game.Textures.Get(@"Menu/background"),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Colour = Color4.DarkGray
});
}
protected override void Update()
{
base.Update();
BackgroundSprite.Scale = new Vector2(Math.Max(Size.X / BackgroundSprite.Size.X, Size.Y / BackgroundSprite.Size.Y));
2016-09-30 17:45:55 +08:00
}
}
}