mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Add basic background display system.
This commit is contained in:
36
osu.Game/Graphics/Background/Background.cs
Normal file
36
osu.Game/Graphics/Background/Background.cs
Normal file
@ -0,0 +1,36 @@
|
||||
//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;
|
||||
|
||||
namespace osu.Game.Graphics.Background
|
||||
{
|
||||
class Background : OsuLargeContainer
|
||||
{
|
||||
protected Sprite BackgroundSprite;
|
||||
|
||||
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(ActualSize.X / BackgroundSprite.Size.X, ActualSize.Y / BackgroundSprite.Size.Y));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user