A game framework written with osu! in mind.
at master 58 lines 2.1 kB view raw
1// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. 2// See the LICENCE file in the repository root for full licence text. 3 4using System; 5using osu.Framework.Graphics.Colour; 6using osu.Framework.Graphics.Containers; 7using osuTK; 8 9namespace osu.Framework.Graphics.Effects 10{ 11 /// <summary> 12 /// Parametrizes the appearance of an edge effect. 13 /// </summary> 14 public struct EdgeEffectParameters : IEquatable<EdgeEffectParameters> 15 { 16 /// <summary> 17 /// Colour of the edge effect. 18 /// </summary> 19 public SRGBColour Colour; 20 21 /// <summary> 22 /// Positional offset applied to the edge effect. 23 /// Useful for off-center shadows. 24 /// </summary> 25 public Vector2 Offset; 26 27 /// <summary> 28 /// The type of the edge effect. 29 /// </summary> 30 public EdgeEffectType Type; 31 32 /// <summary> 33 /// How round the edge effect should appear. Adds to the <see cref="CompositeDrawable.CornerRadius"/> 34 /// of the corresponding <see cref="CompositeDrawable"/>. Not to confuse with the <see cref="Radius"/>. 35 /// </summary> 36 public float Roundness; 37 38 /// <summary> 39 /// How "thick" the edge effect is around the <see cref="CompositeDrawable"/>. In other words: At what distance 40 /// from the <see cref="CompositeDrawable"/>'s border the edge effect becomes fully invisible. 41 /// </summary> 42 public float Radius; 43 44 /// <summary> 45 /// Whether the inside of the EdgeEffect rectangle should be empty. 46 /// </summary> 47 public bool Hollow; 48 49 public readonly bool Equals(EdgeEffectParameters other) => 50 Colour.Equals(other.Colour) && 51 Offset == other.Offset && 52 Type == other.Type && 53 Roundness == other.Roundness && 54 Radius == other.Radius; 55 56 public override readonly string ToString() => Type != EdgeEffectType.None ? $@"{Radius} {Type}EdgeEffect" : @"EdgeEffect (Disabled)"; 57 } 58}