public TerminalButton()
        {
            button = new BorderedButton();
            SetElement(button);

            MouseInput.LeftClicked += (sender, args) => ControlChanged?.Invoke(sender, args);
        }
Exemplo n.º 2
0
                public BindBox(HudParentBase parent = null) : base(parent)
                {
                    bindName = new Label(this)
                    {
                        Text            = "NewBindBox",
                        Format          = GlyphFormat.Blueish,
                        AutoResize      = false,
                        Size            = new Vector2(150f, 44f),
                        ParentAlignment = ParentAlignments.Left | ParentAlignments.InnerH,
                        DimAlignment    = DimAlignments.Height | DimAlignments.IgnorePadding,
                    };

                    con1 = new BorderedButton()
                    {
                        Text            = "none",
                        Padding         = new Vector2(),
                        Size            = new Vector2(126f, 44f),
                        BorderThickness = 1f,
                    };

                    con1.MouseInput.LeftClicked  += (sender, args) => GetNewControl(0);
                    con1.MouseInput.RightClicked += (sender, args) => RemoveControl(0);

                    con2 = new BorderedButton()
                    {
                        Text            = "none",
                        Padding         = new Vector2(),
                        Size            = new Vector2(126f, 44f),
                        BorderThickness = 1f,
                    };

                    con2.MouseInput.LeftClicked  += (sender, args) => GetNewControl(1);
                    con2.MouseInput.RightClicked += (sender, args) => RemoveControl(1);

                    con3 = new BorderedButton()
                    {
                        Text            = "none",
                        Padding         = new Vector2(),
                        Size            = new Vector2(126f, 44f),
                        BorderThickness = 1f,
                    };

                    con3.MouseInput.LeftClicked  += (sender, args) => GetNewControl(2);
                    con3.MouseInput.RightClicked += (sender, args) => RemoveControl(2);

                    layout = new HudChain(false, this)
                    {
                        SizingMode          = HudChainSizingModes.FitMembersOffAxis | HudChainSizingModes.FitChainBoth,
                        Spacing             = 13f,
                        Padding             = new Vector2(32f, 0f),
                        ParentAlignment     = ParentAlignments.Right | ParentAlignments.InnerH,
                        DimAlignment        = DimAlignments.Height | DimAlignments.IgnorePadding,
                        CollectionContainer = { con1, con2, con3 }
                    };

                    Size = new Vector2(400f, 44f);
                }
Exemplo n.º 3
0
                public BindGroupBox(HudParentBase parent = null) : base(parent)
                {
                    name = new Label()
                    {
                        Format     = GlyphFormat.White,
                        AutoResize = false,
                        Height     = 24f,
                        Padding    = new Vector2(0f, 24f),
                    };

                    resetButton = new BorderedButton(this)
                    {
                        Text            = "Defaults",
                        Size            = new Vector2(234f, 44f),
                        ParentAlignment = ParentAlignments.Top | ParentAlignments.Right | ParentAlignments.Inner,
                        Visible         = false,
                        BorderThickness = 1f,
                    };

                    resetButton.MouseInput.LeftClicked += ResetBinds;

                    scrollBox = new ScrollBox <ScrollBoxEntry <BindBox>, BindBox>(true)
                    {
                        SizingMode = HudChainSizingModes.FitMembersOffAxis | HudChainSizingModes.FitChainOffAxis | HudChainSizingModes.ClampChainAlignAxis,
                        Spacing    = 8f,
                    };

                    scrollBox.Background.Visible = false;

                    var divider1 = new TexturedBox()
                    {
                        Color   = new Color(53, 66, 75),
                        Padding = new Vector2(0f, 16f),
                        Height  = 2f,
                    };

                    var divider2 = new TexturedBox()
                    {
                        Color   = new Color(53, 66, 75),
                        Padding = new Vector2(0f, 16f),
                        Height  = 2f,
                    };

                    layout = new HudChain(true, this)
                    {
                        SizingMode          = HudChainSizingModes.FitMembersOffAxis | HudChainSizingModes.FitChainBoth,
                        DimAlignment        = DimAlignments.Width | DimAlignments.IgnorePadding,
                        Padding             = new Vector2(20f, 0f),
                        Offset              = new Vector2(-10f, 0f),
                        CollectionContainer = { name, divider1, scrollBox, divider2 },
                    };

                    Height = 338f;
                }
        public TerminalDragBox()
        {
            openButton = new BorderedButton()
            {
                Text         = "NewDragBox",
                DimAlignment = DimAlignments.Width | DimAlignments.IgnorePadding,
                Size         = new Vector2(253f, 50f)
            };
            SetElement(openButton);

            window = new DragWindow(Update)
            {
                Size    = new Vector2(300f, 250f),
                Visible = false
            };

            openButton.MouseInput.LeftClicked += Open;
            window.Confirmed += ConfirmPosition;
        }
            public DragWindow(Action UpdateAction) : base(HudMain.HighDpiRoot)
            {
                DragUpdateAction = UpdateAction;
                MinimumSize      = new Vector2(100f);
                AllowResizing    = false;

                BodyColor   = new Color(41, 54, 62, 150);
                BorderColor = new Color(58, 68, 77);

                HeaderBuilder.Format = TerminalFormatting.ControlFormat.WithAlignment(TextAlignment.Center);
                header.Height        = 40f;

                confirmButton = new BorderedButton(this)
                {
                    Text         = "Confirm",
                    DimAlignment = DimAlignments.Width | DimAlignments.IgnorePadding,
                };

                confirmButton.MouseInput.LeftClicked += (sender, args) => Confirmed?.Invoke();
            }
Exemplo n.º 6
0
                public DemoBox(HudParentBase parent = null) : base(parent)
                {
                    // Spawn controls
                    //
                    // List of available control types
                    typeList     = new ListBox <DemoElements>();
                    createButton = new BorderedButton()
                    {
                        Text = "Create", Padding = Vector2.Zero
                    };

                    typeColumn = new HudChain(true)
                    {
                        SizingMode          = HudChainSizingModes.FitMembersOffAxis | HudChainSizingModes.FitChainBoth,
                        CollectionContainer = { typeList, createButton },
                        Spacing             = 8f
                    };

                    // Add list of supported test elements to the type list
                    var supportedTypes = Enum.GetValues(typeof(DemoElements)) as DemoElements[];

                    for (int n = 0; n < supportedTypes.Length; n++)
                    {
                        typeList.Add(supportedTypes[n].ToString(), supportedTypes[n]);
                    }

                    createButton.MouseInput.LeftClicked += InstantiateSelectedType;

                    // Instance list
                    instanceList = new ListBox <TestWindowNode>();
                    removeButton = new BorderedButton()
                    {
                        Text = "Remove", Padding = Vector2.Zero
                    };
                    clearAllButton = new BorderedButton()
                    {
                        Text = "Clear All", Padding = Vector2.Zero
                    };

                    instanceButtonRow = new HudChain(false)
                    {
                        SizingMode          = HudChainSizingModes.FitMembersBoth | HudChainSizingModes.FitChainBoth,
                        CollectionContainer = { removeButton, clearAllButton },
                        Spacing             = 8f,
                    };

                    instanceColumn = new HudChain(true)
                    {
                        SizingMode          = HudChainSizingModes.FitMembersOffAxis | HudChainSizingModes.FitChainBoth,
                        CollectionContainer = { instanceList, instanceButtonRow },
                        Spacing             = 8f
                    };

                    removeButton.MouseInput.LeftClicked   += RemoveSelectedInstance;
                    clearAllButton.MouseInput.LeftClicked += ClearInstances;
                    instanceList.SelectionChanged         += UpdateSelection;

                    // Transform controls
                    //
                    // Column 1
                    screenSpaceToggle = new NamedCheckBox()
                    {
                        Name = "Screen Space"
                    };
                    xAxisBar = new NamedSliderBox()
                    {
                        Name = "AxisX", Padding = new Vector2(40f, 0f), Min = -1f, Max = 1f
                    };
                    yAxisBar = new NamedSliderBox()
                    {
                        Name = "AxisY", Padding = new Vector2(40f, 0f), Min = -1f, Max = 1f
                    };
                    zAxisBar = new NamedSliderBox()
                    {
                        Name = "AxisZ", Padding = new Vector2(40f, 0f), Min = -1f, Max = 1f
                    };
                    angleBar = new NamedSliderBox()
                    {
                        Name = "Angle", Padding = new Vector2(40f, 0f), Min = -(float)(Math.PI), Max = (float)(Math.PI)
                    };

                    transformCol1 = new HudChain(true)
                    {
                        Spacing             = 10f,
                        CollectionContainer = { screenSpaceToggle, xAxisBar, yAxisBar, zAxisBar, angleBar }
                    };

                    // Column 2
                    resScaleToggle = new NamedCheckBox()
                    {
                        Name = "Res Scaling"
                    };
                    scaleBar = new NamedSliderBox()
                    {
                        Name = "Scale", Padding = new Vector2(40f, 0f), Min = 0.001f, Max = 1f
                    };
                    xPosBar = new NamedSliderBox()
                    {
                        Name = "PosX", Padding = new Vector2(40f, 0f), Min = -.5f, Max = .5f
                    };
                    yPosBar = new NamedSliderBox()
                    {
                        Name = "PosY", Padding = new Vector2(40f, 0f), Min = -.5f, Max = .5f
                    };
                    zPosBar = new NamedSliderBox()
                    {
                        Name = "PosZ", Padding = new Vector2(40f, 0f), Min = -2f, Max = 0f
                    };

                    transformCol2 = new HudChain(true)
                    {
                        Spacing             = 10f,
                        CollectionContainer = { resScaleToggle, scaleBar, xPosBar, yPosBar, zPosBar }
                    };

                    spawnControls = new HudChain(false)
                    {
                        CollectionContainer = { typeColumn, instanceColumn },
                        Spacing             = 16f,
                    };

                    transformControls = new HudChain(false)
                    {
                        CollectionContainer = { transformCol1, transformCol2 }
                    };

                    var layout = new HudChain(true, this)
                    {
                        ParentAlignment     = ParentAlignments.Left | ParentAlignments.Inner,
                        Spacing             = 10f,
                        CollectionContainer = { spawnControls, transformControls }
                    };

                    Padding  = new Vector2(40f, 8f);
                    demoRoot = new HudCollection(HudMain.HighDpiRoot);
                }