A game framework written with osu! in mind.
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
7{
8 /// <summary>
9 /// Holds extension methods for <see cref="Drawable"/>.
10 /// </summary>
11 public static class DrawableExtensions
12 {
13 /// <summary>
14 /// Adjusts specified properties of a <see cref="Drawable"/>.
15 /// </summary>
16 /// <param name="drawable">The <see cref="Drawable"/> whose properties should be adjusted.</param>
17 /// <param name="adjustment">The adjustment function.</param>
18 /// <returns>The given <see cref="Drawable"/>.</returns>
19 public static T With<T>(this T drawable, Action<T> adjustment)
20 where T : Drawable
21 {
22 adjustment?.Invoke(drawable);
23 return drawable;
24 }
25 }
26}