//Copyright (c) 2007-2016 ppy Pty Ltd . //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; namespace osu.Game.Graphics.Background { class Background : Container { protected Sprite BackgroundSprite; string textureName; public Background(string textureName = @"Menu/background") { this.textureName = textureName; RelativeSizeAxes = Axes.Both; Depth = float.MinValue; } public override void Load() { base.Load(); Add(BackgroundSprite = new Sprite { Texture = Game.Textures.Get(textureName), 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)); } } }