mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 20:12:57 +08:00
Add basic implementation of VisualTest framework for osu! project.
Comes with one complimentary test.
This commit is contained in:
parent
1705914093
commit
7bdb2fcfc7
20
osu.Desktop.VisualTests/Program.cs
Normal file
20
osu.Desktop.VisualTests/Program.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
430
osu.Desktop.VisualTests/Tests/TestCaseAutosize.cs
Normal file
430
osu.Desktop.VisualTests/Tests/TestCaseAutosize.cs
Normal file
@ -0,0 +1,430 @@
|
|||||||
|
// Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
70
osu.Desktop.VisualTests/Tests/TestCaseScrollableFlow.cs
Normal file
70
osu.Desktop.VisualTests/Tests/TestCaseScrollableFlow.cs
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
// Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
50
osu.Desktop.VisualTests/Tests/TestCaseSpriteText.cs
Normal file
50
osu.Desktop.VisualTests/Tests/TestCaseSpriteText.cs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
// Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
54
osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs
Normal file
54
osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
59
osu.Desktop.VisualTests/Tests/TestCaseTextBox.cs
Normal file
59
osu.Desktop.VisualTests/Tests/TestCaseTextBox.cs
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
// Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// 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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
21
osu.Desktop.VisualTests/VisualTestGame.cs
Normal file
21
osu.Desktop.VisualTests/VisualTestGame.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
175
osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj
Normal file
175
osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ProjectGuid>{69051C69-12AE-4E7D-A3E6-460D2E282312}</ProjectGuid>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>osu.Desktop</RootNamespace>
|
||||||
|
<AssemblyName>osu!</AssemblyName>
|
||||||
|
<ManifestCertificateThumbprint>3CF060CD28877D0E3112948951A64B2A7CEEC909</ManifestCertificateThumbprint>
|
||||||
|
<ManifestKeyFile>codesigning.pfx</ManifestKeyFile>
|
||||||
|
<GenerateManifests>false</GenerateManifests>
|
||||||
|
<SignManifests>false</SignManifests>
|
||||||
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
|
<FileUpgradeFlags>
|
||||||
|
</FileUpgradeFlags>
|
||||||
|
<OldToolsVersion>3.5</OldToolsVersion>
|
||||||
|
<UpgradeBackupLocation>
|
||||||
|
</UpgradeBackupLocation>
|
||||||
|
<StartupObject>osu.Framework.VisualTests.Program</StartupObject>
|
||||||
|
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
|
||||||
|
<SignAssembly>false</SignAssembly>
|
||||||
|
<TargetZone>LocalIntranet</TargetZone>
|
||||||
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
|
<PublishUrl>publish\</PublishUrl>
|
||||||
|
<Install>true</Install>
|
||||||
|
<InstallFrom>Disk</InstallFrom>
|
||||||
|
<UpdateEnabled>false</UpdateEnabled>
|
||||||
|
<UpdateMode>Foreground</UpdateMode>
|
||||||
|
<UpdateInterval>7</UpdateInterval>
|
||||||
|
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||||
|
<UpdatePeriodically>false</UpdatePeriodically>
|
||||||
|
<UpdateRequired>false</UpdateRequired>
|
||||||
|
<MapFileExtensions>true</MapFileExtensions>
|
||||||
|
<ApplicationRevision>2</ApplicationRevision>
|
||||||
|
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||||
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
|
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||||
|
<ProductVersion>12.0.0</ProductVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<TargetFrameworkProfile>
|
||||||
|
</TargetFrameworkProfile>
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>0</WarningLevel>
|
||||||
|
<NoStdLib>true</NoStdLib>
|
||||||
|
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||||
|
<Prefer32Bit>true</Prefer32Bit>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>none</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>CuttingEdge NoUpdate</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<NoStdLib>true</NoStdLib>
|
||||||
|
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<Win32Resource>
|
||||||
|
</Win32Resource>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Deploy|AnyCPU'">
|
||||||
|
<OutputPath>bin\Deploy\</OutputPath>
|
||||||
|
<DefineConstants>CuttingEdge</DefineConstants>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<NoStdLib>true</NoStdLib>
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="mscorlib" />
|
||||||
|
<Reference Include="OpenTK, Version=1.2.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4" />
|
||||||
|
<Reference Include="System" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\osu.licenseheader">
|
||||||
|
<Link>osu.licenseheader</Link>
|
||||||
|
</None>
|
||||||
|
<None Include="Properties\app.manifest" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||||
|
<Install>false</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
|
||||||
|
<Install>true</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
|
||||||
|
<Install>false</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>.NET Framework 3.5</ProductName>
|
||||||
|
<Install>false</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||||
|
<Install>false</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\osu-framework\osu.Framework.Desktop\osu.Framework.Desktop.csproj">
|
||||||
|
<Project>{65dc628f-a640-4111-ab35-3a5652bc1e17}</Project>
|
||||||
|
<Name>osu.Framework.Desktop</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\osu-framework\osu.Framework\osu.Framework.csproj">
|
||||||
|
<Project>{c76bf5b3-985e-4d39-95fe-97c9c879b83a}</Project>
|
||||||
|
<Name>osu.Framework</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\osu-resources\osu.Game.Resources\osu.Game.Resources.csproj">
|
||||||
|
<Project>{d9a367c9-4c1a-489f-9b05-a0cea2b53b58}</Project>
|
||||||
|
<Name>osu.Game.Resources</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\osu.Game\osu.Game.csproj">
|
||||||
|
<Project>{0d3fbf8a-7464-4cf7-8c90-3e7886df2d4d}</Project>
|
||||||
|
<Name>osu.Game</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Program.cs" />
|
||||||
|
<Compile Include="Tests\TestCaseTextAwesome.cs" />
|
||||||
|
<Compile Include="VisualTestGame.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup />
|
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
<ProjectExtensions>
|
||||||
|
<VisualStudio>
|
||||||
|
</VisualStudio>
|
||||||
|
</ProjectExtensions>
|
||||||
|
<PropertyGroup>
|
||||||
|
<PreBuildEvent>
|
||||||
|
</PreBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<PostBuildEvent>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
@ -1,13 +1,10 @@
|
|||||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using OpenTK;
|
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.GameModes;
|
using osu.Framework.GameModes;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Framework.Graphics.UserInterface;
|
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Menu
|
namespace osu.Game.GameModes.Menu
|
||||||
{
|
{
|
||||||
|
@ -6,9 +6,9 @@ using OpenTK;
|
|||||||
|
|
||||||
namespace osu.Game.Graphics
|
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;
|
private FontAwesome icon;
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ namespace osu.Game.Graphics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal enum FontAwesome
|
public enum FontAwesome
|
||||||
{
|
{
|
||||||
glass = 0xf000,
|
glass = 0xf000,
|
||||||
music = 0xf001,
|
music = 0xf001,
|
||||||
|
@ -1,30 +1,16 @@
|
|||||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
//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.Configuration;
|
||||||
using osu.Game.GameModes.Menu;
|
using osu.Game.GameModes.Menu;
|
||||||
using osu.Game.Graphics.Processing;
|
|
||||||
using osu.Game.Online.API;
|
|
||||||
using osu.Game.Online.API.Requests;
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Cursor;
|
|
||||||
using osu.Framework.Graphics.Textures;
|
|
||||||
using osu.Framework.IO.Stores;
|
|
||||||
using osu.Framework.OS;
|
using osu.Framework.OS;
|
||||||
|
|
||||||
namespace osu.Game
|
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)
|
public override void SetHost(BasicGameHost host)
|
||||||
{
|
{
|
||||||
base.SetHost(host);
|
base.SetHost(host);
|
||||||
@ -36,37 +22,7 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
base.Load();
|
base.Load();
|
||||||
|
|
||||||
//this completely overrides the framework default. will need to change once we make a proper FontStore.
|
Add(new MainMenu());
|
||||||
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<string>(OsuConfig.Username),
|
|
||||||
Password = Config.Get<string>(OsuConfig.Password),
|
|
||||||
Token = Config.Get<string>(OsuConfig.Token)
|
|
||||||
};
|
|
||||||
|
|
||||||
//var req = new ListChannelsRequest();
|
|
||||||
//req.Success += content =>
|
|
||||||
//{
|
|
||||||
//};
|
|
||||||
//API.Queue(req);
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new RatioAdjust
|
|
||||||
{
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new MainMenu(),
|
|
||||||
new CursorContainer()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
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)
|
public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true)
|
||||||
{
|
{
|
||||||
if (!base.Invalidate(invalidation, source, shallPropagate)) return false;
|
if (!base.Invalidate(invalidation, source, shallPropagate)) return false;
|
||||||
|
|
||||||
if (Parent != null)
|
if (Parent != null)
|
||||||
{
|
{
|
||||||
Config.Set(OsuConfig.Width, ActualSize.X);
|
Config.Set(OsuConfig.Width, ActualSize.X);
|
||||||
|
53
osu.Game/OsuGameBase.cs
Normal file
53
osu.Game/OsuGameBase.cs
Normal file
@ -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<string>(OsuConfig.Username),
|
||||||
|
Password = Config.Get<string>(OsuConfig.Password),
|
||||||
|
Token = Config.Get<string>(OsuConfig.Token)
|
||||||
|
};
|
||||||
|
|
||||||
|
Add(new Drawable[]
|
||||||
|
{
|
||||||
|
ratioContainer = new RatioAdjust
|
||||||
|
{
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new CursorContainer()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -63,6 +63,7 @@
|
|||||||
<Compile Include="Online\Chat\Channel.cs" />
|
<Compile Include="Online\Chat\Channel.cs" />
|
||||||
<Compile Include="Online\Chat\Message.cs" />
|
<Compile Include="Online\Chat\Message.cs" />
|
||||||
<Compile Include="OsuGame.cs" />
|
<Compile Include="OsuGame.cs" />
|
||||||
|
<Compile Include="OsuGameBase.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
9
osu.sln
9
osu.sln
@ -17,6 +17,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Framework", "Framework", "{
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Framework.Desktop", "osu-framework\osu.Framework.Desktop\osu.Framework.Desktop.csproj", "{65DC628F-A640-4111-AB35-3A5652BC1E17}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Framework.Desktop", "osu-framework\osu.Framework.Desktop\osu.Framework.Desktop.csproj", "{65DC628F-A640-4111-AB35-3A5652BC1E17}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Desktop.VisualTests", "osu.Desktop.VisualTests\osu.Desktop.VisualTests.csproj", "{69051C69-12AE-4E7D-A3E6-460D2E282312}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
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}.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.ActiveCfg = Release|Any CPU
|
||||||
{65DC628F-A640-4111-AB35-3A5652BC1E17}.Release|Any CPU.Build.0 = 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
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@ -64,5 +72,6 @@ Global
|
|||||||
{0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D} = {0D37A2AD-80A4-464F-A1DE-1560B70F1CE3}
|
{0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D} = {0D37A2AD-80A4-464F-A1DE-1560B70F1CE3}
|
||||||
{D9A367C9-4C1A-489F-9B05-A0CEA2B53B58} = {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}
|
{65DC628F-A640-4111-AB35-3A5652BC1E17} = {7A75DFA2-DE65-4458-98AF-26AF96FFD6DC}
|
||||||
|
{69051C69-12AE-4E7D-A3E6-460D2E282312} = {0D37A2AD-80A4-464F-A1DE-1560B70F1CE3}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
Loading…
Reference in New Issue
Block a user