mirror of https://github.com/ppy/osu
Comment in some clarification
This commit is contained in:
parent
0170c04baf
commit
fb1d20bd39
|
@ -49,7 +49,7 @@ public void TestLegacySmoothCursorTrail()
|
||||||
{
|
{
|
||||||
createTest(() =>
|
createTest(() =>
|
||||||
{
|
{
|
||||||
var skinContainer = new LegacySkinContainer(renderer, false);
|
var skinContainer = new LegacySkinContainer(renderer, provideMiddle: false);
|
||||||
var legacyCursorTrail = new LegacyCursorTrail(skinContainer);
|
var legacyCursorTrail = new LegacyCursorTrail(skinContainer);
|
||||||
|
|
||||||
skinContainer.Child = legacyCursorTrail;
|
skinContainer.Child = legacyCursorTrail;
|
||||||
|
@ -63,7 +63,7 @@ public void TestLegacyDisjointCursorTrail()
|
||||||
{
|
{
|
||||||
createTest(() =>
|
createTest(() =>
|
||||||
{
|
{
|
||||||
var skinContainer = new LegacySkinContainer(renderer, true);
|
var skinContainer = new LegacySkinContainer(renderer, provideMiddle: true);
|
||||||
var legacyCursorTrail = new LegacyCursorTrail(skinContainer);
|
var legacyCursorTrail = new LegacyCursorTrail(skinContainer);
|
||||||
|
|
||||||
skinContainer.Child = legacyCursorTrail;
|
skinContainer.Child = legacyCursorTrail;
|
||||||
|
@ -77,7 +77,7 @@ public void TestLegacyDisjointCursorTrailViaNoCursor()
|
||||||
{
|
{
|
||||||
createTest(() =>
|
createTest(() =>
|
||||||
{
|
{
|
||||||
var skinContainer = new LegacySkinContainer(renderer, false, false);
|
var skinContainer = new LegacySkinContainer(renderer, provideMiddle: false, provideCursor: false);
|
||||||
var legacyCursorTrail = new LegacyCursorTrail(skinContainer);
|
var legacyCursorTrail = new LegacyCursorTrail(skinContainer);
|
||||||
|
|
||||||
skinContainer.Child = legacyCursorTrail;
|
skinContainer.Child = legacyCursorTrail;
|
||||||
|
@ -104,13 +104,13 @@ private void createTest(Func<Drawable> createContent) => AddStep("create trail",
|
||||||
private partial class LegacySkinContainer : Container, ISkinSource
|
private partial class LegacySkinContainer : Container, ISkinSource
|
||||||
{
|
{
|
||||||
private readonly IRenderer renderer;
|
private readonly IRenderer renderer;
|
||||||
private readonly bool disjoint;
|
private readonly bool provideMiddle;
|
||||||
private readonly bool provideCursor;
|
private readonly bool provideCursor;
|
||||||
|
|
||||||
public LegacySkinContainer(IRenderer renderer, bool disjoint, bool provideCursor = true)
|
public LegacySkinContainer(IRenderer renderer, bool provideMiddle, bool provideCursor = true)
|
||||||
{
|
{
|
||||||
this.renderer = renderer;
|
this.renderer = renderer;
|
||||||
this.disjoint = disjoint;
|
this.provideMiddle = provideMiddle;
|
||||||
this.provideCursor = provideCursor;
|
this.provideCursor = provideCursor;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
@ -129,7 +129,7 @@ public Texture GetTexture(string componentName, WrapMode wrapModeS, WrapMode wra
|
||||||
return new Texture(renderer.WhitePixel);
|
return new Texture(renderer.WhitePixel);
|
||||||
|
|
||||||
case "cursormiddle":
|
case "cursormiddle":
|
||||||
return disjoint ? null : renderer.WhitePixel;
|
return provideMiddle ? null : renderer.WhitePixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -37,6 +37,9 @@ private void load(OsuConfigManager config, ISkinSource skinSource)
|
||||||
|
|
||||||
Texture = skin.GetTexture("cursortrail");
|
Texture = skin.GetTexture("cursortrail");
|
||||||
|
|
||||||
|
// Cursor and cursor trail components are sourced from potentially different skin sources.
|
||||||
|
// Stable always chooses cursor trail disjoint behaviour based on the cursor texture lookup source, so we need to fetch where that occurred.
|
||||||
|
// See https://github.com/peppy/osu-stable-reference/blob/3ea48705eb67172c430371dcfc8a16a002ed0d3d/osu!/Graphics/Skinning/SkinManager.cs#L269
|
||||||
var cursorProvider = skinSource.FindProvider(s => s.GetTexture("cursor") != null);
|
var cursorProvider = skinSource.FindProvider(s => s.GetTexture("cursor") != null);
|
||||||
DisjointTrail = cursorProvider?.GetTexture("cursormiddle") == null;
|
DisjointTrail = cursorProvider?.GetTexture("cursormiddle") == null;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue