osu/osu.Game/OsuGame.cs
Dean Herbert 7bdb2fcfc7 Add basic implementation of VisualTest framework for osu! project.
Comes with one complimentary test.
2016-09-24 15:47:17 +09:00

49 lines
1.4 KiB
C#

//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Configuration;
using osu.Game.GameModes.Menu;
using OpenTK;
using osu.Framework.Graphics;
using osu.Framework.OS;
namespace osu.Game
{
public class OsuGame : OsuGameBase
{
public override void SetHost(BasicGameHost host)
{
base.SetHost(host);
host.Size = new Vector2(Config.Get<int>(OsuConfig.Width), Config.Get<int>(OsuConfig.Height));
}
public override void Load()
{
base.Load();
Add(new MainMenu());
}
protected override void Dispose(bool isDisposing)
{
//refresh token may have changed.
Config.Set(OsuConfig.Token, API.Token);
base.Dispose(isDisposing);
}
public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true)
{
if (!base.Invalidate(invalidation, source, shallPropagate)) return false;
if (Parent != null)
{
Config.Set(OsuConfig.Width, ActualSize.X);
Config.Set(OsuConfig.Height, ActualSize.Y);
}
return true;
}
}
}