From ce689032c7a095fa07251fcf42c62abc19fcf14a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 4 Feb 2017 20:55:03 +0900 Subject: [PATCH 1/7] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 99955eecba..3c795346a7 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 99955eecba415328c3e2b4055afb10aeb8a4ceb9 +Subproject commit 3c795346a777a9446d849cfe55ffeea744defe0f From 1e3266a9d2b9284a4c233c8710df562a7a8126a0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 4 Feb 2017 20:55:26 +0900 Subject: [PATCH 2/7] Fix sliderbar lines lagging behind nub. --- osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 968f70364c..5c4eebc9a2 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -114,9 +114,9 @@ namespace osu.Game.Graphics.UserInterface return base.OnDrag(state); } - protected override void Update() + protected override void UpdateAfterChildren() { - base.Update(); + base.UpdateAfterChildren(); leftBox.Scale = new Vector2(MathHelper.Clamp( nub.DrawPosition.X - nub.DrawWidth / 2, 0, DrawWidth), 1); rightBox.Scale = new Vector2(MathHelper.Clamp( From 97d52188b2f46173c0c49cb734cb2714ccf7ef33 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 4 Feb 2017 20:56:14 +0900 Subject: [PATCH 3/7] Make sliderbar lines smoother when scrolling. --- osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 5c4eebc9a2..d8b1438dc8 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -31,6 +31,7 @@ namespace osu.Game.Graphics.UserInterface leftBox = new Box { Height = 2, + EdgeSmoothness = new Vector2(0, 0.5f), Position = new Vector2(2, 0), RelativeSizeAxes = Axes.None, Anchor = Anchor.CentreLeft, @@ -39,6 +40,7 @@ namespace osu.Game.Graphics.UserInterface rightBox = new Box { Height = 2, + EdgeSmoothness = new Vector2(0, 0.5f), Position = new Vector2(-2, 0), RelativeSizeAxes = Axes.None, Anchor = Anchor.CentreRight, From 0fefa50b54e0e3b5e0463e1f21fa5b21d449a401 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 4 Feb 2017 20:57:08 +0900 Subject: [PATCH 4/7] Add padding beneath sliders in options. --- osu.Game/Overlays/Options/OptionSlider.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Options/OptionSlider.cs b/osu.Game/Overlays/Options/OptionSlider.cs index 5ca5695ecc..484b050b7e 100644 --- a/osu.Game/Overlays/Options/OptionSlider.cs +++ b/osu.Game/Overlays/Options/OptionSlider.cs @@ -48,8 +48,8 @@ namespace osu.Game.Overlays.Options }, slider = new OsuSliderBar { - Margin = new MarginPadding { Top = 5 }, - RelativeSizeAxes = Axes.X, + Margin = new MarginPadding { Top = 5, Bottom = 5 }, + RelativeSizeAxes = Axes.X } }; } From 57d97ba2e9e76eb02921fd71c45b62d391e7d940 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 4 Feb 2017 22:09:44 +0900 Subject: [PATCH 5/7] Make triangles look better in many cases. --- osu-framework | 2 +- osu.Game/Beatmaps/Drawables/BeatmapPanel.cs | 1 + osu.Game/Graphics/Backgrounds/Triangles.cs | 30 +++++++++++++++------ osu.Game/Overlays/Toolbar/ToolbarButton.cs | 4 ++- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/osu-framework b/osu-framework index 3c795346a7..f9627494e4 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 3c795346a777a9446d849cfe55ffeea744defe0f +Subproject commit f9627494e444d8b35eb20d418539ada15f258c4d diff --git a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs index af1f458462..c21a90a294 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs @@ -69,6 +69,7 @@ namespace osu.Game.Beatmaps.Drawables }, triangles = new Triangles { + TriangleScale = 2, RelativeSizeAxes = Axes.Both, ColourLight = OsuColour.FromHex(@"3a7285"), ColourDark = OsuColour.FromHex(@"123744") diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index f9bcf56d12..80b5a7a16e 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Textures; using osu.Framework.MathUtils; using OpenTK; using OpenTK.Graphics; +using System; namespace osu.Game.Graphics.Backgrounds { @@ -34,7 +35,14 @@ namespace osu.Game.Graphics.Backgrounds } } - private int aimTriangleCount => (int)((DrawWidth * DrawHeight) / 800 / triangleScale); + protected override void LoadComplete() + { + base.LoadComplete(); + for (int i = 0; i < aimTriangleCount; i++) + addTriangle(true); + } + + private int aimTriangleCount => (int)(DrawWidth * DrawHeight * 0.002f / (triangleScale * triangleScale)); protected override void Update() { @@ -42,20 +50,25 @@ namespace osu.Game.Graphics.Backgrounds foreach (Drawable d in Children) { - d.Position -= new Vector2(0, (float)(d.Scale.X * (50 / DrawHeight) * (Time.Elapsed / 880)) / triangleScale); + d.Position -= new Vector2(0, (float)(d.Scale.X * (50 / DrawHeight) * (Time.Elapsed / 950)) / triangleScale); if (d.DrawPosition.Y + d.DrawSize.Y * d.Scale.Y < 0) d.Expire(); } - bool useRandomX = Children.Count() < aimTriangleCount / 2; while (Children.Count() < aimTriangleCount) - addTriangle(useRandomX); - + addTriangle(false); } protected virtual Triangle CreateTriangle() { - var scale = triangleScale * RNG.NextSingle() * 0.4f + 0.2f; + float stdDev = 0.16f; + float mean = 0.5f; + + float u1 = 1 - RNG.NextSingle(); //uniform(0,1] random floats + float u2 = 1 - RNG.NextSingle(); + float randStdNormal = (float)(Math.Sqrt(-2.0 * Math.Log(u1)) * Math.Sin(2.0 * Math.PI * u2)); //random normal(0,1) + var scale = Math.Max(triangleScale * (mean + stdDev * randStdNormal), 0.1f); //random normal(mean,stdDev^2) + const float size = 100; return new Triangle @@ -72,10 +85,11 @@ namespace osu.Game.Graphics.Backgrounds protected virtual Color4 GetTriangleShade() => Interpolation.ValueAt(RNG.NextSingle(), ColourDark, ColourLight, 0, 1); - private void addTriangle(bool randomX) + private void addTriangle(bool randomY) { var sprite = CreateTriangle(); - sprite.Position = new Vector2(RNG.NextSingle(), randomX ? RNG.NextSingle() : 1); + var triangleHeight = sprite.DrawHeight / DrawHeight; + sprite.Position = new Vector2(RNG.NextSingle(), randomY ? (RNG.NextSingle() * (1 + triangleHeight) - triangleHeight) : 1); Add(sprite); } } diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index 78235bc99c..13b8ba0108 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -169,6 +169,7 @@ namespace osu.Game.Overlays.Toolbar { RelativeSizeAxes = Axes.Both; Masking = true; + MaskingSmoothness = 0; EdgeEffect = new EdgeEffect { Type = EdgeEffectType.Shadow, @@ -186,7 +187,8 @@ namespace osu.Game.Overlays.Toolbar new Triangles { RelativeSizeAxes = Axes.Both, - Alpha = 0.05f, + ColourLight = OsuColour.Gray(40), + ColourDark = OsuColour.Gray(20), }, }; } From 714c94b7a8b0640f8bdac9ea88b7871d11f93c72 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 4 Feb 2017 22:27:05 +0900 Subject: [PATCH 6/7] Fix toolbar sizing hackiness. --- osu.Game/Overlays/Toolbar/ToolbarButton.cs | 11 ++--------- osu.Game/Overlays/Toolbar/ToolbarUserArea.cs | 1 + 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index 13b8ba0108..a890e6dac0 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -101,7 +101,7 @@ namespace osu.Game.Overlays.Toolbar tooltipContainer = new FlowContainer { Direction = FlowDirection.VerticalOnly, - AutoSizeAxes = Axes.Both, + RelativeSizeAxes = Axes.Both, //stops us being considered in parent's autosize Anchor = Anchor.BottomLeft, Position = new Vector2(5, 5), Alpha = 0, @@ -123,6 +123,7 @@ namespace osu.Game.Overlays.Toolbar }; RelativeSizeAxes = Axes.Y; + AutoSizeAxes = Axes.X; } [BackgroundDependencyLoader] @@ -131,14 +132,6 @@ namespace osu.Game.Overlays.Toolbar sampleClick = audio.Sample.Get(@"Menu/menuclick"); } - protected override void Update() - { - base.Update(); - - //todo: find a way to avoid using this (autosize needs to be able to ignore certain drawables.. in this case the tooltip) - Size = new Vector2(Flow.DrawSize.X, 1); - } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; protected override bool OnClick(InputState state) diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs b/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs index a6feffab65..61a1af9537 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs @@ -22,6 +22,7 @@ namespace osu.Game.Overlays.Toolbar public ToolbarUserArea() { RelativeSizeAxes = Axes.Y; + AutoSizeAxes = Axes.X; Children = new Drawable[] { button = new ToolbarUserButton From d97f02a219b549f9feb9fa9ac18880ebb546a480 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 4 Feb 2017 22:56:56 +0900 Subject: [PATCH 7/7] Cursor becomes vector. --- .../Graphics/Cursor/OsuCursorContainer.cs | 60 +++++++++++++++++-- osu.Game/Graphics/UserInterface/Nub.cs | 2 +- 2 files changed, 55 insertions(+), 7 deletions(-) diff --git a/osu.Game/Graphics/Cursor/OsuCursorContainer.cs b/osu.Game/Graphics/Cursor/OsuCursorContainer.cs index 3074be9df0..5409ed2f9f 100644 --- a/osu.Game/Graphics/Cursor/OsuCursorContainer.cs +++ b/osu.Game/Graphics/Cursor/OsuCursorContainer.cs @@ -2,6 +2,7 @@ //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; +using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; @@ -41,12 +42,13 @@ namespace osu.Game.Graphics.Cursor class OsuCursor : Container { + private Container cursorContainer; private BindableDouble cursorScale; - private Sprite sprite; + public OsuCursor() { Origin = Anchor.Centre; - AutoSizeAxes = Axes.Both; + Size = new Vector2(42); } [BackgroundDependencyLoader] @@ -56,18 +58,64 @@ namespace osu.Game.Graphics.Cursor Children = new Drawable[] { - sprite = new Sprite + cursorContainer = new CircularContainer { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + RelativeSizeAxes = Axes.Both, Scale = new Vector2((float)cursorScale), - Texture = textures.Get(@"Cursor/cursor") - } + Masking = true, + BorderThickness = Size.X / 6, + BorderColour = Color4.White, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0.01f, + }, + new CircularContainer + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Masking = true, + BorderThickness = Size.X / 3, + BorderColour = Color4.White.Opacity(0.5f), + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0.01f, + }, + }, + }, + new CircularContainer + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Scale = new Vector2(0.1f), + Masking = true, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.White, + }, + }, + }, + } + }, }; cursorScale.ValueChanged += scaleChanged; } private void scaleChanged(object sender, EventArgs e) { - sprite.Scale = new Vector2((float)cursorScale); + cursorContainer.Scale = new Vector2((float)cursorScale); } } } diff --git a/osu.Game/Graphics/UserInterface/Nub.cs b/osu.Game/Graphics/UserInterface/Nub.cs index cd59c13d12..9eca8582cb 100644 --- a/osu.Game/Graphics/UserInterface/Nub.cs +++ b/osu.Game/Graphics/UserInterface/Nub.cs @@ -39,7 +39,7 @@ namespace osu.Game.Graphics.UserInterface fill = new Box { RelativeSizeAxes = Axes.Both, - Alpha = 0.01f, //todo: remove once we figure why containers aren't drawing at all times + Alpha = 0.01f, }, }; }