コード例 #1
0
            public MarginPaddingControlsContainer(SafeAreaContainer safeAreaBackground, SafeAreaContainer safeAreaGrid, BindableSafeArea bindableSafeArea)
            {
                this.bindableSafeArea = bindableSafeArea;

                safeAreaPaddingTop = new BindableFloat {
                    MinValue = 0, MaxValue = 200
                };
                safeAreaPaddingBottom = new BindableFloat {
                    MinValue = 0, MaxValue = 200
                };
                safeAreaPaddingLeft = new BindableFloat {
                    MinValue = 0, MaxValue = 200
                };
                safeAreaPaddingRight = new BindableFloat {
                    MinValue = 0, MaxValue = 200
                };

                Direction = FillDirection.Vertical;
                Spacing   = new Vector2(10);
                Children  = new Drawable[]
                {
                    new MarginPaddingControl(safeAreaBackground, safeAreaGrid, "Top", safeAreaPaddingTop, Edges.Top),
                    new MarginPaddingControl(safeAreaBackground, safeAreaGrid, "Bottom", safeAreaPaddingBottom, Edges.Bottom),
                    new MarginPaddingControl(safeAreaBackground, safeAreaGrid, "Left", safeAreaPaddingLeft, Edges.Left),
                    new MarginPaddingControl(safeAreaBackground, safeAreaGrid, "Right", safeAreaPaddingRight, Edges.Right),
                };

                safeAreaPaddingTop.ValueChanged    += updateMarginPadding;
                safeAreaPaddingBottom.ValueChanged += updateMarginPadding;
                safeAreaPaddingLeft.ValueChanged   += updateMarginPadding;
                safeAreaPaddingRight.ValueChanged  += updateMarginPadding;
            }
コード例 #2
0
 /// <summary>
 /// Initialises a <see cref="SafeAreaDefiningContainer"/> by optionally providing a custom <see cref="BindableSafeArea"/>.
 /// If no such binding is provided, the container will default to <see cref="GameWindow.SafeAreaPadding"/>.
 /// </summary>
 /// <param name="safeArea">The custom <see cref="BindableSafeArea"/> to bind to, if required.</param>
 public SafeAreaDefiningContainer(BindableSafeArea safeArea = null)
 {
     if (safeArea != null)
     {
         usesCustomBinding = true;
         this.safeArea.BindTo(safeArea);
     }
 }
コード例 #3
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            // Usually this would be placed between the host and the game, but that's a bit of a pain to do with the test scene hierarchy.

            // Add is required for the container to get a size (and give out correct metrics to the usages in SafeAreaContainer).
            Add(safeAreaContainer = new SafeAreaDefiningContainer(safeArea = new BindableSafeArea())
            {
                RelativeSizeAxes = Axes.Both
            });

            // Cache is required for the test game to see the safe area.
            Dependencies.CacheAs <ISafeArea>(safeAreaContainer);
        }