Skip to content

Commit

Permalink
Merge pull request #579 from LumpBloom7/fan-slide-shadow
Browse files Browse the repository at this point in the history
Add shadow to fan slides
  • Loading branch information
LumpBloom7 committed Apr 30, 2024
2 parents d0df8ae + 3d268d2 commit 6f185cd
Showing 1 changed file with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
using System;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Layout;
using osu.Framework.Utils;
using osuTK;
using osuTK.Graphics;

Expand Down Expand Up @@ -63,17 +66,20 @@ protected override bool OnInvalidate(Invalidation invalidation, InvalidationSour
return base.OnInvalidate(invalidation, source);
}

private float chevHeight, chevWidth;

public ChevronBackingTexture(float lengthScale, float heightScale)
: base(cachedFrameBuffer: true)
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
chevHeight = 16 + (10 * heightScale);
chevWidth = 6 + (210 * lengthScale);
AutoSizeAxes = Axes.Both;

float chevHeight = 16 + (10 * heightScale);
float chevWidth = 6 + (210 * lengthScale);
BufferedContainer content;

AddInternal(new Container
// Effect container
// We are doing this ourelves to increase the padding'
AddInternal(content = new Container
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Expand Down Expand Up @@ -161,7 +167,15 @@ public ChevronBackingTexture(float lengthScale, float heightScale)
},
},
}
});
}.WithEffect(new GlowEffect
{
BlurSigma = new Vector2(20),
Placement = EffectPlacement.Behind,
Colour = Color4.Black
}));

// PadExtent doesn't fully avoid the clipped shadows, we pad with a more conservative estimate
content.Padding = new MarginPadding(Blur.KernelSize(25));
}
}
}
Expand Down

0 comments on commit 6f185cd

Please sign in to comment.