1 using Microsoft.Xna.Framework;
2 using Microsoft.Xna.Framework.Graphics;
10 internal static class GuiUtils
12 internal const int SPACING = 25;
13 internal const int PADDING = 5;
15 public static Rectangle BoundsFromParent(
this Texture2D texture, Rectangle parentBounds)
17 var texBounds = texture.Bounds;
18 return new Rectangle(parentBounds.X, parentBounds.Y, texBounds.Width, texBounds.Height);
21 public static T RightOf<T>(
this T @
this, UIElement @that) where T : UIElement
23 @this.Left.Set(@that.Left.Pixels + @that.Width.Pixels + PADDING, 0f);
27 public static T LeftOf<T>(
this T @
this, UIElement @that) where T : UIElement
29 @this.Left.Set(@that.Left.Pixels - @that.Width.Pixels - PADDING, 0f);
33 public static T Below<T>(
this T @
this, UIElement @that) where T : UIElement
35 @this.Top.Set(@that.Top.Pixels + @that.Height.Pixels + PADDING, 0f);
39 public static T Above<T>(
this T @
this, UIElement @that) where T : UIElement
41 @this.Top.Set(@that.Top.Pixels - @that.Height.Pixels - PADDING, 0f);