A game framework written with osu! in mind.
at master 24 lines 1.3 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; 5 6namespace osu.Framework.Graphics.Effects 7{ 8 /// <summary> 9 /// This class holds extension methods for effects. 10 /// </summary> 11 public static class EffectExtensions 12 { 13 /// <summary> 14 /// Applies the given effect to the given drawable and optionally initializes the created drawable with the given initializationAction. 15 /// </summary> 16 /// <typeparam name="T">The type of the drawable that results from applying the given effect.</typeparam> 17 /// <param name="effect">The effect to apply to the drawable.</param> 18 /// <param name="drawable">The drawable to apply the effect to.</param> 19 /// <param name="initializationAction">The action that should get called to initialize the created drawable before it is returned.</param> 20 /// <returns>The drawable created by applying the given effect to this drawable.</returns> 21 public static T ApplyTo<T>(this IEffect<T> effect, Drawable drawable, Action<T> initializationAction = null) where T : Drawable 22 => drawable.WithEffect(effect, initializationAction); 23 } 24}