Skip to content

Commit

Permalink
Reenable BufferedContainers etc. and fix some project issues
Browse files Browse the repository at this point in the history
  • Loading branch information
swoolcock committed Jun 9, 2018
1 parent 30fbc97 commit e5a1602
Show file tree
Hide file tree
Showing 22 changed files with 18 additions and 121 deletions.
2 changes: 0 additions & 2 deletions osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,13 @@ private void load()
createPulp(HitObject.VisualRepresentation),
border = new Circle
{
#if !__IOS__
EdgeEffect = new EdgeEffectParameters
{
Hollow = !HitObject.HyperDash,
Type = EdgeEffectType.Glow,
Radius = 4,
Colour = HitObject.HyperDash ? Color4.Red : AccentColour.Darken(1).Opacity(0.6f)
},
#endif
Size = new Vector2(Height * 1.5f),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Expand Down
1 change: 1 addition & 0 deletions osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Description>catch the fruit. to the beat.</Description>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>

<ItemGroup Label="Project References">
Expand Down
21 changes: 2 additions & 19 deletions osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,8 @@ internal class BodyPiece : Container, IHasAccentColour
private readonly Container subtractionLayer;

private readonly Drawable background;
#if __IOS__
private readonly Container foreground;
private readonly Container subtractionContainer;
#else
private readonly BufferedContainer foreground;
private readonly BufferedContainer subtractionContainer;
#endif

public BodyPiece()
{
Expand All @@ -35,31 +30,21 @@ public BodyPiece()
Children = new[]
{
background = new Box { RelativeSizeAxes = Axes.Both },
#if __IOS__
foreground = new Container
#else
foreground = new BufferedContainer
#endif
{
RelativeSizeAxes = Axes.Both,
#if !__IOS__
CacheDrawnFrameBuffer = true,
#endif
Children = new Drawable[]
{
new Box { RelativeSizeAxes = Axes.Both },
#if __IOS__
subtractionContainer = new Container
#else
subtractionContainer = new BufferedContainer
#endif
{
RelativeSizeAxes = Axes.Both,
#if !__IOS__

// This is needed because we're blending with another object
BackgroundColour = Color4.White.Opacity(0),
CacheDrawnFrameBuffer = true,
#endif

// The 'hole' is achieved by subtracting the result of this container with the parent
Blending = new BlendingParameters { AlphaEquation = BlendingEquation.ReverseSubtract },
Child = subtractionLayer = new CircularContainer
Expand Down Expand Up @@ -128,10 +113,8 @@ protected override void Update()
Radius = DrawWidth
};

#if !__IOS__
foreground.ForceRedraw();
subtractionContainer.ForceRedraw();
#endif
subtractionCache.Validate();
}
}
Expand Down
1 change: 1 addition & 0 deletions osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Description>smash the keys. to the beat.</Description>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>

<ItemGroup Label="Project References">
Expand Down
15 changes: 0 additions & 15 deletions osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ public class SliderBody : Container, ISliderProgress
{
private readonly Path path;

#if __IOS__
private readonly Container container;
#else
private readonly BufferedContainer container;
#endif

public float PathWidth
{
Expand Down Expand Up @@ -96,14 +92,9 @@ public SliderBody(Slider s)

Children = new Drawable[]
{
#if __IOS__
container = new Container
{
#else
container = new BufferedContainer
{
CacheDrawnFrameBuffer = true,
#endif
RelativeSizeAxes = Axes.Both,

Children = new Drawable[]
Expand All @@ -116,9 +107,7 @@ public SliderBody(Slider s)
},
};

#if !__IOS__
container.Attach(RenderbufferInternalFormat.DepthComponent16);
#endif
}

public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => path.ReceiveMouseInputAt(screenSpacePos);
Expand All @@ -136,9 +125,7 @@ public void SetRange(double p0, double p1)
var newTopLeftOffset = path.PositionInBoundingBox(Vector2.Zero);
path.Position = topLeftOffset - newTopLeftOffset;

#if !__IOS__
container.ForceRedraw();
#endif
}
}

Expand Down Expand Up @@ -189,9 +176,7 @@ private void reloadTexture()
texture.SetData(upload);
path.Texture = texture;

#if !__IOS__
container.ForceRedraw();
#endif
}

private void computeSize()
Expand Down
1 change: 1 addition & 0 deletions osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<OutputType>Library</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Description>click the circles. to the beat.</Description>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>

<ItemGroup Label="Project References">
Expand Down
1 change: 1 addition & 0 deletions osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Description>bash the drum. to the beat.</Description>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>

<ItemGroup Label="Project References">
Expand Down
6 changes: 0 additions & 6 deletions osu.Game/Graphics/Backgrounds/Background.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,15 @@

namespace osu.Game.Graphics.Backgrounds
{
#if __IOS__
public class Background : Container
#else
public class Background : BufferedContainer
#endif
{
public Sprite Sprite;

private readonly string textureName;

public Background(string textureName = @"")
{
#if !__IOS__
CacheDrawnFrameBuffer = true;
#endif

this.textureName = textureName;
RelativeSizeAxes = Axes.Both;
Expand Down
6 changes: 0 additions & 6 deletions osu.Game/Overlays/MusicController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -406,21 +406,15 @@ private enum TransformDirection
Prev
}

#if __IOS__
private class Background : Container
#else
private class Background : BufferedContainer
#endif
{
private readonly Sprite sprite;
private readonly WorkingBeatmap beatmap;

public Background(WorkingBeatmap beatmap = null)
{
this.beatmap = beatmap;
#if !__IOS__
CacheDrawnFrameBuffer = true;
#endif
Depth = float.MaxValue;
RelativeSizeAxes = Axes.Both;

Expand Down
2 changes: 0 additions & 2 deletions osu.Game/Overlays/Volume/VolumeMeter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ private void load(OsuColour colours)
PadExtent = true
}),
},
#if !__IOS__
maxGlow = (text = new OsuSpriteText
{
Anchor = Anchor.Centre,
Expand All @@ -125,7 +124,6 @@ private void load(OsuColour colours)
Colour = Color4.Transparent,
PadExtent = true,
})
#endif
}
});

Expand Down
10 changes: 1 addition & 9 deletions osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ public WorkingBeatmap Beatmap

b.Depth = newDepth;
Add(background = b);
#if !__IOS__
background.BlurSigma = blurTarget;
#endif
});
});
}
Expand All @@ -57,13 +55,7 @@ public BackgroundScreenBeatmap(WorkingBeatmap beatmap = null)
}

public TransformSequence<Background> BlurTo(Vector2 sigma, double duration, Easing easing = Easing.None)
{
#if !__IOS__
background?.BlurTo(sigma, duration, easing);
#endif
blurTarget = sigma;
return null;
}
=> background?.BlurTo(blurTarget = sigma, duration, easing);

public override bool Equals(BackgroundScreen other)
{
Expand Down
4 changes: 0 additions & 4 deletions osu.Game/Screens/Menu/OsuLogo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,7 @@ public OsuLogo()
Alpha = 0.5f,
Size = new Vector2(0.96f)
},
#if __IOS__
new Container
#else
new BufferedContainer
#endif
{
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
Expand Down
8 changes: 0 additions & 8 deletions osu.Game/Screens/Play/Break/BlurredIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@

namespace osu.Game.Screens.Play.Break
{
#if __IOS__
public class BlurredIcon : Container
#else
public class BlurredIcon : BufferedContainer
#endif
{
private readonly SpriteIcon icon;

Expand All @@ -23,7 +19,6 @@ public FontAwesome Icon
get { return icon.Icon; }
}

#if !__IOS__
public override Vector2 Size
{
set
Expand All @@ -34,14 +29,11 @@ public override Vector2 Size
}
get { return base.Size; }
}
#endif

public BlurredIcon()
{
RelativePositionAxes = Axes.X;
#if !__IOS__
CacheDrawnFrameBuffer = true;
#endif
Child = icon = new SpriteIcon
{
Origin = Anchor.Centre,
Expand Down
4 changes: 0 additions & 4 deletions osu.Game/Screens/Play/Break/BreakArrows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ public BreakArrows()
Alpha = 0.7f,
X = -blurred_icon_offscreen_offset,
Icon = Graphics.FontAwesome.fa_chevron_right,
#if !__IOS__
BlurSigma = new Vector2(blurred_icon_blur_sigma),
#endif
Size = new Vector2(blurred_icon_size),
},
rightBlurredIcon = new BlurredIcon
Expand All @@ -73,9 +71,7 @@ public BreakArrows()
Alpha = 0.7f,
X = blurred_icon_offscreen_offset,
Icon = Graphics.FontAwesome.fa_chevron_left,
#if !__IOS__
BlurSigma = new Vector2(blurred_icon_blur_sigma),
#endif
Size = new Vector2(blurred_icon_size),
},
}
Expand Down
6 changes: 0 additions & 6 deletions osu.Game/Screens/Play/Break/GlowIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,15 @@ public override Vector2 Size
set
{
blurredIcon.Size = spriteIcon.Size = value;
#if !__IOS__
blurredIcon.ForceRedraw();
#endif
}
}

#if __IOS__
public Vector2 BlurSigma;
#else
public Vector2 BlurSigma
{
set { blurredIcon.BlurSigma = value; }
get { return blurredIcon.BlurSigma; }
}
#endif

public FontAwesome Icon
{
Expand Down
10 changes: 0 additions & 10 deletions osu.Game/Screens/Play/SquareGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@

namespace osu.Game.Screens.Play
{
#if __IOS__
public class SquareGraph : Container
#else
public class SquareGraph : BufferedContainer
#endif
{
private Column[] columns = { };

Expand Down Expand Up @@ -68,9 +64,7 @@ public Color4 FillColour

public SquareGraph()
{
#if !__IOS__
CacheDrawnFrameBuffer = true;
#endif
}

private Cached layout = new Cached();
Expand Down Expand Up @@ -100,9 +94,7 @@ private void redrawProgress()
{
for (int i = 0; i < columns.Length; i++)
columns[i].State = i <= progress ? ColumnState.Lit : ColumnState.Dimmed;
#if !__IOS__
ForceRedraw();
#endif
}

/// <summary>
Expand All @@ -112,9 +104,7 @@ private void redrawFilled()
{
for (int i = 0; i < ColumnCount; i++)
columns[i].Filled = calculatedValues.ElementAtOrDefault(i);
#if !__IOS__
ForceRedraw();
#endif
}

/// <summary>
Expand Down
Loading

0 comments on commit e5a1602

Please sign in to comment.