diff --git a/osu.Desktop.VisualTests/Program.cs b/osu.Desktop.VisualTests/Program.cs new file mode 100644 index 0000000000..b8583229b8 --- /dev/null +++ b/osu.Desktop.VisualTests/Program.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2007-2016 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE + +using System; +using osu.Framework.Desktop; +using osu.Framework.OS; + +namespace osu.Framework.VisualTests +{ + public static class Program + { + [STAThread] + public static void Main(string[] args) + { + BasicGameHost host = Host.GetSuitableHost(); + host.Load(new VisualTestGame()); + host.Run(); + } + } +} diff --git a/osu.Desktop.VisualTests/Tests/TestCaseAutosize.cs b/osu.Desktop.VisualTests/Tests/TestCaseAutosize.cs new file mode 100644 index 0000000000..6675af8612 --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseAutosize.cs @@ -0,0 +1,430 @@ +// Copyright (c) 2007-2016 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Drawables; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Transformations; +using osu.Framework.Input; +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.GameModes.Testing; + +namespace osu.Framework.VisualTests.Tests +{ + class TestCaseAutosize : TestCase + { + public override string Name => @"Autosize"; + public override string Description => @"Various scenarios which potentially challenge autosize calculations."; + + private ToggleButton toggleDebugAutosize; + + private Container testContainer; + + public override void Reset() + { + base.Reset(); + + toggleDebugAutosize = AddToggle(@"debug autosize", reloadCallback); + + Add(testContainer = new LargeContainer()); + + for (int i = 1; i <= 6; i++) + { + int test = i; + AddButton($@"Test {i}", delegate { loadTest(test); }); + } + + loadTest(1); + + Add(new Box + { + Colour = Color4.Black, + Size = new Vector2(22, 4), + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }); + + Add(new Box + { + Colour = Color4.Black, + Size = new Vector2(4, 22), + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }); + + Add(new Box + { + Colour = Color4.WhiteSmoke, + Size = new Vector2(20, 2), + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }); + + Add(new Box + { + Colour = Color4.WhiteSmoke, + Size = new Vector2(2, 20), + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }); + } + + private void reloadCallback() + { + loadTest(currentTest); + } + + private int currentTest; + + private void loadTest(int testType) + { + currentTest = testType; + + testContainer.Clear(); + + Container box; + + switch (currentTest) + { + case 1: + testContainer.Add(box = new InfofulBoxAutoSize + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }); + + addCornerMarkers(box); + + box.Add(new InfofulBox(RectangleF.Empty, 0, Color4.Blue) + { + //chameleon = true, + Position = new Vector2(0, 0), + Size = new Vector2(25, 25), + Origin = Anchor.Centre, + Anchor = Anchor.Centre + }); + + box.Add(box = new InfofulBox(RectangleF.Empty, 0, Color4.DarkSeaGreen) + { + Size = new Vector2(250, 250), + Alpha = 0.5f, + Origin = Anchor.Centre, + Anchor = Anchor.Centre + }); + + box.OnUpdate += delegate { box.Rotation += 0.05f; }; + break; + case 2: + testContainer.Add(box = new InfofulBoxAutoSize + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }); + + addCornerMarkers(box, 5); + + + box.Add(box = new InfofulBoxAutoSize + { + Colour = Color4.DarkSeaGreen, + Alpha = 0.5f, + Origin = Anchor.Centre, + Anchor = Anchor.Centre + }); + + Drawable localBox = box; + box.OnUpdate += delegate { localBox.Rotation += 0.05f; }; + + box.Add(new InfofulBox(RectangleF.Empty, 0, Color4.Blue) + { + //chameleon = true, + Size = new Vector2(100, 100), + Position = new Vector2(50, 50), + Alpha = 0.5f, + Origin = Anchor.Centre, + Anchor = Anchor.Centre + }); + break; + case 3: + testContainer.Add(box = new InfofulBoxAutoSize + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }); + + addCornerMarkers(box, 10, Color4.YellowGreen); + + for (int i = 0; i < 100; i++) + { + box.Add(box = new InfofulBoxAutoSize + { + Colour = new Color4(253, 253, 253, 255), + Position = new Vector2(3, 3), + Origin = Anchor.BottomRight, + Anchor = Anchor.BottomRight + }); + } + + addCornerMarkers(box, 2); + + box.Add(new InfofulBox(RectangleF.Empty, 1, Color4.SeaGreen) + { + //chameleon = true, + Size = new Vector2(50, 50), + Origin = Anchor.TopLeft, + Anchor = Anchor.TopLeft + }); + break; + case 4: + testContainer.Add(box = new InfofulBoxAutoSize + { + Anchor = Anchor.Centre, + Origin = Anchor.CentreLeft + }); + + box.Add(new InfofulBox(RectangleF.Empty, 0, Color4.OrangeRed) + { + Position = new Vector2(5, 0), + Size = new Vector2(300, 80), + Origin = Anchor.TopLeft, + Anchor = Anchor.TopLeft + }); + + box.Add(new SpriteText + { + Position = new Vector2(5, -20), + Text = "Test CentreLeft line 1", + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft + }); + + box.Add(new SpriteText + { + Position = new Vector2(5, 20), + Text = "Test CentreLeft line 2", + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft + }); + break; + case 5: + testContainer.Add(box = new InfofulBoxAutoSize + { + Anchor = Anchor.Centre, + Origin = Anchor.CentreLeft + }); + + box.Add(new InfofulBox(RectangleF.Empty, 0, Color4.OrangeRed) + { + Position = new Vector2(5, 0), + Size = new Vector2(300, 80), + Origin = Anchor.TopLeft, + Anchor = Anchor.TopLeft + }); + + box.Add(new SpriteText + { + Position = new Vector2(5, -20), + Text = "123,456,789=", + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft, + Scale = new Vector2(2f) + }); + + box.Add(new SpriteText + { + Position = new Vector2(5, 20), + Text = "123,456,789ms", + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft + }); + break; + case 6: + testContainer.Add(box = new InfofulBoxAutoSize + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }); + + box.Add(box = new InfofulBoxAutoSize + { + Colour = Color4.OrangeRed, + Position = new Vector2(100, 100), + Origin = Anchor.Centre, + Anchor = Anchor.TopLeft + }); + + box.Add(new InfofulBox(RectangleF.Empty, 0, Color4.OrangeRed) + { + Position = new Vector2(100, 100), + Size = new Vector2(100, 100), + Origin = Anchor.Centre, + Anchor = Anchor.TopLeft + }); + break; + } + +#if DEBUG + //if (toggleDebugAutosize.State) + // testContainer.Children.FindAll(c => c.HasAutosizeChildren).ForEach(c => c.AutoSizeDebug = true); +#endif + } + + private void addCornerMarkers(Container box, int size = 50, Color4? colour = null) + { + box.Add(new InfofulBox(RectangleF.Empty, 2, colour ?? Color4.Red) + { + //chameleon = true, + Size = new Vector2(size, size), + Origin = Anchor.TopLeft, + Anchor = Anchor.TopLeft, + AllowDrag = false + }); + + box.Add(new InfofulBox(RectangleF.Empty, 2, colour ?? Color4.Red) + { + //chameleon = true, + Size = new Vector2(size, size), + Origin = Anchor.TopRight, + Anchor = Anchor.TopRight, + AllowDrag = false + }); + + box.Add(new InfofulBox(RectangleF.Empty, 2, colour ?? Color4.Red) + { + //chameleon = true, + Size = new Vector2(size, size), + Origin = Anchor.BottomLeft, + Anchor = Anchor.BottomLeft, + AllowDrag = false + }); + + box.Add(new InfofulBox(RectangleF.Empty, 2, colour ?? Color4.Red) + { + //chameleon = true, + Size = new Vector2(size, size), + Origin = Anchor.BottomRight, + Anchor = Anchor.BottomRight, + AllowDrag = false + }); + } + } + + class InfofulBoxAutoSize : AutoSizeContainer + { + public override void Load() + { + base.Load(); + + Masking = true; + + Add(new Box + { + SizeMode = InheritMode.XY + }); + } + + public bool AllowDrag = true; + + protected override bool OnDrag(InputState state) + { + if (!AllowDrag) return false; + + Position += state.Mouse.Delta; + return true; + } + + protected override bool OnDragEnd(InputState state) + { + return true; + } + + protected override bool OnDragStart(InputState state) => AllowDrag; + } + + class InfofulBox : Container + { + private SpriteText debugInfo; + + public bool chameleon = false; + + public InfofulBox(RectangleF rectangle, float depth, Color4 color) + { + Position = new Vector2(rectangle.X, rectangle.Y); + Size = new Vector2(rectangle.Width, rectangle.Height); + Depth = depth; + Colour = color; + } + + public bool AllowDrag = true; + + protected override bool OnDrag(InputState state) + { + if (!AllowDrag) return false; + + Position += state.Mouse.Delta; + return true; + } + + protected override bool OnDragEnd(InputState state) + { + return true; + } + + protected override bool OnDragStart(InputState state) => AllowDrag; + + public override void Load() + { + base.Load(); + + Add(new Box + { + SizeMode = InheritMode.XY + }); + + debugInfo = new SpriteText + { + Colour = Color4.Black + }; + Add(debugInfo); + } + + int lastSwitch; + + protected override void Update() + { + if (chameleon && (int)Time / 1000 != lastSwitch) + { + lastSwitch = (int)Time / 1000; + switch (lastSwitch % 6) + { + case 0: + Anchor = (Anchor)((int)Anchor + 1); + Origin = (Anchor)((int)Origin + 1); + break; + case 1: + MoveTo(new Vector2(0, 0), 800, EasingTypes.Out); + break; + case 2: + MoveTo(new Vector2(200, 0), 800, EasingTypes.Out); + break; + case 3: + MoveTo(new Vector2(200, 200), 800, EasingTypes.Out); + break; + case 4: + MoveTo(new Vector2(0, 200), 800, EasingTypes.Out); + break; + case 5: + MoveTo(new Vector2(0, 0), 800, EasingTypes.Out); + break; + } + } + + base.Update(); + + //debugInfo.Text = ToString(); + } + } +} diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScrollableFlow.cs b/osu.Desktop.VisualTests/Tests/TestCaseScrollableFlow.cs new file mode 100644 index 0000000000..75024e2e5a --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseScrollableFlow.cs @@ -0,0 +1,70 @@ +// Copyright (c) 2007-2016 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Drawables; +using osu.Framework.Graphics.Transformations; +using osu.Framework.MathUtils; +using osu.Framework.Threading; +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.GameModes.Testing; + +namespace osu.Framework.VisualTests.Tests +{ + class TestCaseScrollableFlow : TestCase + { + private ScheduledDelegate boxCreator; + + public override string Name => @"Scrollable Flow"; + public override string Description => @"A flow container in a scroll container"; + + Scheduler scheduler = new Scheduler(); + + public override void Reset() + { + base.Reset(); + + FlowContainer flow = new FlowContainer + { + LayoutDuration = 100, + LayoutEasing = EasingTypes.Out, + Padding = new Vector2(1, 1), + SizeMode = InheritMode.X + }; + + boxCreator?.Cancel(); + + boxCreator = scheduler.AddDelayed(delegate + { + if (Parent == null) return; + + Box box = new Box + { + Size = new Vector2(80, 80), + Colour = new Color4(RNG.NextSingle(), RNG.NextSingle(), RNG.NextSingle(), 1) + }; + + flow.Add(box); + + box.FadeInFromZero(1000); + box.Delay(RNG.Next(0, 20000)); + box.FadeOutFromOne(4000); + box.Expire(); + }, 100, true); + + scheduler.Add(boxCreator); + + ScrollContainer scrolling = new ScrollContainer(); + scrolling.Add(flow); + Add(scrolling); + } + + protected override void Update() + { + scheduler.Update(); + base.Update(); + } + } +} diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSpriteText.cs b/osu.Desktop.VisualTests/Tests/TestCaseSpriteText.cs new file mode 100644 index 0000000000..f4a0a0f8a6 --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseSpriteText.cs @@ -0,0 +1,50 @@ +// Copyright (c) 2007-2016 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE + +using osu.Framework.GameModes.Testing; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; + +namespace osu.Framework.VisualTests.Tests +{ + class TestCaseSpriteText : TestCase + { + public override string Name => @"SpriteText"; + + public override string Description => @"Test all sizes of text rendering"; + + public override void Reset() + { + base.Reset(); + + FlowContainer flow; + + Children = new Drawable[] + { + new ScrollContainer + { + Children = new[] + { + flow = new FlowContainer + { + Anchor = Anchor.TopLeft, + Direction = FlowDirection.VerticalOnly, + } + } + } + }; + + for (int i = 1; i <= 200; i++) + { + SpriteText text = new SpriteText + { + Text = $@"Font testy at size {i}", + TextSize = i + }; + + flow.Add(text); + } + } + } +} diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs b/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs new file mode 100644 index 0000000000..3e2c1f095d --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs @@ -0,0 +1,54 @@ +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.GameModes.Testing; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.MathUtils; +using osu.Game.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace osu.Desktop.Tests +{ + class TestCaseTextAwesome : TestCase + { + public override string Name => @"TextAwesome"; + + public override string Description => @"Tests display of icons"; + + public override void Reset() + { + base.Reset(); + + FlowContainer flow; + + Add(flow = new FlowContainer() + { + SizeMode = InheritMode.XY, + Size = new Vector2(0.5f), + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }); + + int i = 50; + foreach (FontAwesome fa in Enum.GetValues(typeof(FontAwesome))) + { + flow.Add(new TextAwesome + { + Icon = fa, + TextSize = 60, + Colour = new Color4( + Math.Max(0.5f, RNG.NextSingle()), + Math.Max(0.5f, RNG.NextSingle()), + Math.Max(0.5f, RNG.NextSingle()), + 1) + }); + + if (i-- == 0) break; + } + } + } +} diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTextBox.cs b/osu.Desktop.VisualTests/Tests/TestCaseTextBox.cs new file mode 100644 index 0000000000..9efcf7eb8d --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseTextBox.cs @@ -0,0 +1,59 @@ +// Copyright (c) 2007-2016 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.UserInterface; +using OpenTK; +using osu.Framework.GameModes.Testing; + +namespace osu.Framework.VisualTests.Tests +{ + class TestCaseTextBox : TestCase + { + private TextBox tb; + + public override string Name => @"TextBox"; + + public override string Description => @"Text entry evolved"; + + public override int DisplayOrder => -1; + + public override void Reset() + { + base.Reset(); + + FlowContainer textBoxes = new FlowContainer + { + Direction = FlowDirection.VerticalOnly, + Padding = new Vector2(0, 50), + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + SizeMode = InheritMode.XY, + Size = new Vector2(0.8f, 1) + }; + + Add(textBoxes); + + textBoxes.Add(tb = new TextBox + { + Size = new Vector2(100, 16), + }); + + textBoxes.Add(tb = new TextBox + { + Text = @"Limited length", + Size = new Vector2(200, 20), + LengthLimit = 20 + }); + + textBoxes.Add(tb = new TextBox + { + Text = @"Box with some more text", + Size = new Vector2(500, 30), + }); + + //textBoxes.Add(tb = new PasswordTextBox(@"", 14, Vector2.Zero, 300)); + } + } +} diff --git a/osu.Desktop.VisualTests/VisualTestGame.cs b/osu.Desktop.VisualTests/VisualTestGame.cs new file mode 100644 index 0000000000..ecbaf7ac8f --- /dev/null +++ b/osu.Desktop.VisualTests/VisualTestGame.cs @@ -0,0 +1,21 @@ +// Copyright (c) 2007-2016 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE + +using osu.Framework.GameModes.Testing; +using osu.Framework.Graphics.Cursor; +using osu.Game; + +namespace osu.Framework.VisualTests +{ + class VisualTestGame : OsuGameBase + { + public override void Load() + { + base.Load(); + + Add(new TestBrowser()); + + ShowPerformanceOverlay = true; + } + } +} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj new file mode 100644 index 0000000000..71e1500a05 --- /dev/null +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -0,0 +1,175 @@ + + + + {69051C69-12AE-4E7D-A3E6-460D2E282312} + Debug + AnyCPU + WinExe + Properties + osu.Desktop + osu! + 3CF060CD28877D0E3112948951A64B2A7CEEC909 + codesigning.pfx + false + false + false + + + 3.5 + + + osu.Framework.VisualTests.Program + OnOutputUpdated + false + LocalIntranet + v4.5 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 2 + 1.0.0.%2a + false + true + 12.0.0 + 2.0 + + + + + + + true + full + false + bin\Debug\ + DEBUG + prompt + 0 + true + false + AnyCPU + true + AllRules.ruleset + false + true + + + none + true + bin\Release\ + CuttingEdge NoUpdate + prompt + 4 + true + false + AnyCPU + true + AllRules.ruleset + false + + + + + + + bin\Deploy\ + CuttingEdge + true + true + true + AnyCPU + false + prompt + AllRules.ruleset + false + + + + + + + + + osu.licenseheader + + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 2.0 %28x86%29 + true + + + False + .NET Framework 3.0 %28x86%29 + false + + + False + .NET Framework 3.5 + false + + + False + .NET Framework 3.5 SP1 + false + + + + + {65dc628f-a640-4111-ab35-3a5652bc1e17} + osu.Framework.Desktop + + + {c76bf5b3-985e-4d39-95fe-97c9c879b83a} + osu.Framework + + + {d9a367c9-4c1a-489f-9b05-a0cea2b53b58} + osu.Game.Resources + + + {0d3fbf8a-7464-4cf7-8c90-3e7886df2d4d} + osu.Game + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/osu.Game/GameModes/Menu/MainMenu.cs b/osu.Game/GameModes/Menu/MainMenu.cs index fbd7af5e15..d06e1ac1fb 100644 --- a/osu.Game/GameModes/Menu/MainMenu.cs +++ b/osu.Game/GameModes/Menu/MainMenu.cs @@ -1,13 +1,10 @@ //Copyright (c) 2007-2016 ppy Pty Ltd . //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; using osu.Framework.Audio.Sample; using osu.Framework.Audio.Track; using osu.Framework.GameModes; using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.UserInterface; namespace osu.Game.GameModes.Menu { diff --git a/osu.Game/Graphics/TextAwesome.cs b/osu.Game/Graphics/TextAwesome.cs index bfb49ee03f..4d434b701d 100644 --- a/osu.Game/Graphics/TextAwesome.cs +++ b/osu.Game/Graphics/TextAwesome.cs @@ -6,9 +6,9 @@ using OpenTK; namespace osu.Game.Graphics { - internal class TextAwesome : SpriteText + public class TextAwesome : SpriteText { - //internal override FontFace FontFace => (int)Icon < 0xf000 ? FontFace.OsuFont : FontFace.FontAwesome; + //public override FontFace FontFace => (int)Icon < 0xf000 ? FontFace.OsuFont : FontFace.FontAwesome; private FontAwesome icon; @@ -34,7 +34,7 @@ namespace osu.Game.Graphics } } - internal enum FontAwesome + public enum FontAwesome { glass = 0xf000, music = 0xf001, diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 2803f6ddb9..22c8e079a4 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -1,30 +1,16 @@ //Copyright (c) 2007-2016 ppy Pty Ltd . //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; -using System.Collections.Generic; using osu.Game.Configuration; using osu.Game.GameModes.Menu; -using osu.Game.Graphics.Processing; -using osu.Game.Online.API; -using osu.Game.Online.API.Requests; using OpenTK; using osu.Framework.Graphics; -using osu.Framework.Graphics.Cursor; -using osu.Framework.Graphics.Textures; -using osu.Framework.IO.Stores; using osu.Framework.OS; namespace osu.Game { - public class OsuGame : Framework.Game + public class OsuGame : OsuGameBase { - internal OsuConfigManager Config = new OsuConfigManager(); - - protected override string MainResourceFile => @"osu.Game.Resources.dll"; - - internal APIAccess API; - public override void SetHost(BasicGameHost host) { base.SetHost(host); @@ -36,37 +22,7 @@ namespace osu.Game { base.Load(); - //this completely overrides the framework default. will need to change once we make a proper FontStore. - Fonts = new TextureStore() { ScaleAdjust = 0.01f }; - Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Regular")); - Fonts.AddStore(new GlyphStore(Resources, @"Fonts/FontAwesome")); - Fonts.AddStore(new GlyphStore(Resources, @"Fonts/osuFont")); - - - API = new APIAccess() - { - Username = Config.Get(OsuConfig.Username), - Password = Config.Get(OsuConfig.Password), - Token = Config.Get(OsuConfig.Token) - }; - - //var req = new ListChannelsRequest(); - //req.Success += content => - //{ - //}; - //API.Queue(req); - - Children = new Drawable[] - { - new RatioAdjust - { - Children = new Drawable[] - { - new MainMenu(), - new CursorContainer() - } - } - }; + Add(new MainMenu()); } protected override void Dispose(bool isDisposing) @@ -80,7 +36,7 @@ namespace osu.Game 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); diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs new file mode 100644 index 0000000000..c9398b15b7 --- /dev/null +++ b/osu.Game/OsuGameBase.cs @@ -0,0 +1,53 @@ +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; +using osu.Framework.Graphics.Textures; +using osu.Framework.IO.Stores; +using osu.Game.Configuration; +using osu.Game.Graphics.Processing; +using osu.Game.Online.API; + +namespace osu.Game +{ + public class OsuGameBase : Framework.Game + { + internal OsuConfigManager Config = new OsuConfigManager(); + + protected override string MainResourceFile => @"osu.Game.Resources.dll"; + + internal APIAccess API; + + protected override Container AddTarget => ratioContainer?.IsLoaded == true ? ratioContainer : base.AddTarget; + + private RatioAdjust ratioContainer; + + public override void Load() + { + base.Load(); + + //this completely overrides the framework default. will need to change once we make a proper FontStore. + Fonts = new TextureStore() { ScaleAdjust = 0.01f }; + Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Regular")); + Fonts.AddStore(new GlyphStore(Resources, @"Fonts/FontAwesome")); + Fonts.AddStore(new GlyphStore(Resources, @"Fonts/osuFont")); + + API = new APIAccess() + { + Username = Config.Get(OsuConfig.Username), + Password = Config.Get(OsuConfig.Password), + Token = Config.Get(OsuConfig.Token) + }; + + Add(new Drawable[] + { + ratioContainer = new RatioAdjust + { + Children = new Drawable[] + { + new CursorContainer() + } + } + }); + } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index c5d2810f00..34f7b3801b 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -63,6 +63,7 @@ + diff --git a/osu.sln b/osu.sln index 2ead7c05df..891d22b6d3 100644 --- a/osu.sln +++ b/osu.sln @@ -17,6 +17,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Framework", "Framework", "{ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Framework.Desktop", "osu-framework\osu.Framework.Desktop\osu.Framework.Desktop.csproj", "{65DC628F-A640-4111-AB35-3A5652BC1E17}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Desktop.VisualTests", "osu.Desktop.VisualTests\osu.Desktop.VisualTests.csproj", "{69051C69-12AE-4E7D-A3E6-460D2E282312}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -54,6 +56,12 @@ Global {65DC628F-A640-4111-AB35-3A5652BC1E17}.Deploy|Any CPU.Build.0 = Debug|Any CPU {65DC628F-A640-4111-AB35-3A5652BC1E17}.Release|Any CPU.ActiveCfg = Release|Any CPU {65DC628F-A640-4111-AB35-3A5652BC1E17}.Release|Any CPU.Build.0 = Release|Any CPU + {69051C69-12AE-4E7D-A3E6-460D2E282312}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {69051C69-12AE-4E7D-A3E6-460D2E282312}.Debug|Any CPU.Build.0 = Debug|Any CPU + {69051C69-12AE-4E7D-A3E6-460D2E282312}.Deploy|Any CPU.ActiveCfg = Deploy|Any CPU + {69051C69-12AE-4E7D-A3E6-460D2E282312}.Deploy|Any CPU.Build.0 = Deploy|Any CPU + {69051C69-12AE-4E7D-A3E6-460D2E282312}.Release|Any CPU.ActiveCfg = Release|Any CPU + {69051C69-12AE-4E7D-A3E6-460D2E282312}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -64,5 +72,6 @@ Global {0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D} = {0D37A2AD-80A4-464F-A1DE-1560B70F1CE3} {D9A367C9-4C1A-489F-9B05-A0CEA2B53B58} = {0D37A2AD-80A4-464F-A1DE-1560B70F1CE3} {65DC628F-A640-4111-AB35-3A5652BC1E17} = {7A75DFA2-DE65-4458-98AF-26AF96FFD6DC} + {69051C69-12AE-4E7D-A3E6-460D2E282312} = {0D37A2AD-80A4-464F-A1DE-1560B70F1CE3} EndGlobalSection EndGlobal