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 osu.Framework.Allocation;
5using osu.Framework.Bindables;
6using osu.Framework.Graphics.Containers;
7using osu.Framework.Graphics.Shapes;
8using osuTK;
9
10namespace osu.Framework.Graphics.Visualisation
11{
12 internal class TransformDisplay : Container
13 {
14 private readonly FillFlowContainer<DrawableTransform> flow;
15 private Bindable<Drawable> inspectedDrawable;
16
17 public TransformDisplay()
18 {
19 RelativeSizeAxes = Axes.Both;
20 Children = new Drawable[]
21 {
22 new Box
23 {
24 Colour = FrameworkColour.GreenDarker,
25 RelativeSizeAxes = Axes.Both
26 },
27 new BasicScrollContainer
28 {
29 Padding = new MarginPadding(10),
30 RelativeSizeAxes = Axes.Both,
31 ScrollbarOverlapsContent = false,
32 Child = flow = new FillFlowContainer<DrawableTransform>
33 {
34 RelativeSizeAxes = Axes.X,
35 AutoSizeAxes = Axes.Y,
36 Direction = FillDirection.Vertical,
37 Spacing = new Vector2(0, 2)
38 }
39 }
40 };
41 }
42
43 [BackgroundDependencyLoader]
44 private void load(Bindable<Drawable> inspected)
45 {
46 inspectedDrawable = inspected.GetBoundCopy();
47 }
48
49 protected override void Update()
50 {
51 base.Update();
52 flow.Clear();
53
54 if (inspectedDrawable.Value == null)
55 return;
56
57 foreach (var t in inspectedDrawable.Value.Transforms)
58 flow.Add(new DrawableTransform(t));
59 }
60 }
61}