A game framework written with osu! in mind.
at master 41 lines 1.5 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 osu.Framework.Graphics.Containers; 5using osu.Framework.Graphics.Shapes; 6using osu.Framework.Graphics.Sprites; 7using osu.Framework.Graphics.Transforms; 8using osuTK; 9using osuTK.Graphics; 10 11namespace osu.Framework.Graphics.Visualisation 12{ 13 internal class DrawableTransform : CompositeDrawable 14 { 15 private readonly Transform transform; 16 private readonly Box applied; 17 private readonly Box appliedToEnd; 18 private readonly SpriteText text; 19 20 public DrawableTransform(Transform transform, float height = 20) 21 { 22 this.transform = transform; 23 RelativeSizeAxes = Axes.X; 24 Height = height; 25 InternalChildren = new Drawable[] 26 { 27 applied = new Box { Size = new Vector2(height) }, 28 appliedToEnd = new Box { X = height + 2, Size = new Vector2(height) }, 29 text = new SpriteText { X = (height + 2) * 2, Font = FrameworkFont.Regular.With(size: height) }, 30 }; 31 } 32 33 protected override void Update() 34 { 35 base.Update(); 36 applied.Colour = transform.Applied ? Color4.Green : Color4.Red; 37 appliedToEnd.Colour = transform.AppliedToEnd ? Color4.Green : Color4.Red; 38 text.Text = transform.ToString(); 39 } 40 } 41}