Skip to content

Commit

Permalink
Merge pull request #6060 from EVAST9919/circular-progress-protected
Browse files Browse the repository at this point in the history
Make `CircularProgressDrawNode` and its properties protected
  • Loading branch information
bdach authored Nov 27, 2023
2 parents 7261bc7 + 272e04e commit 450ef26
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions osu.Framework/Graphics/UserInterface/CircularProgress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public bool RoundedCaps
}
}

private class CircularProgressDrawNode : SpriteDrawNode
protected class CircularProgressDrawNode : SpriteDrawNode
{
public new CircularProgress Source => (CircularProgress)base.Source;

Expand All @@ -98,28 +98,28 @@ public CircularProgressDrawNode(CircularProgress source)
{
}

private float innerRadius;
private float progress;
private float texelSize;
private bool roundedCaps;
protected float InnerRadius { get; private set; }
protected float Progress { get; private set; }
protected float TexelSize { get; private set; }
protected bool RoundedCaps { get; private set; }

public override void ApplyState()
{
base.ApplyState();

innerRadius = Source.innerRadius;
progress = Math.Abs((float)Source.current.Value);
roundedCaps = Source.roundedCaps;
InnerRadius = Source.innerRadius;
Progress = Math.Abs((float)Source.current.Value);
RoundedCaps = Source.roundedCaps;

// smoothstep looks too sharp with 1px, let's give it a bit more
texelSize = 1.5f / ScreenSpaceDrawQuad.Size.X;
TexelSize = 1.5f / ScreenSpaceDrawQuad.Size.X;
}

private IUniformBuffer<CircularProgressParameters> parametersBuffer;

protected override void Blit(IRenderer renderer)
{
if (innerRadius == 0 || (!roundedCaps && progress == 0))
if (InnerRadius == 0 || (!RoundedCaps && Progress == 0))
return;

base.Blit(renderer);
Expand All @@ -132,10 +132,10 @@ protected override void BindUniformResources(IShader shader, IRenderer renderer)
parametersBuffer ??= renderer.CreateUniformBuffer<CircularProgressParameters>();
parametersBuffer.Data = new CircularProgressParameters
{
InnerRadius = innerRadius,
Progress = progress,
TexelSize = texelSize,
RoundedCaps = roundedCaps,
InnerRadius = InnerRadius,
Progress = Progress,
TexelSize = TexelSize,
RoundedCaps = RoundedCaps,
};

shader.BindUniformBlock("m_CircularProgressParameters", parametersBuffer);
Expand Down

0 comments on commit 450ef26

Please sign in to comment.