Exemplo n.º 1
0
 public ImGui(GuiBuilder gui, Padding padding, RectAllocator defaultAllocator = RectAllocator.Stretch, bool clip = false)
 {
     this.gui = gui;
     if (gui == null)
     {
         action = ImGuiAction.Build;
     }
     this.defaultAllocator = defaultAllocator;
     this.clip             = clip;
     initialPadding        = padding;
 }
Exemplo n.º 2
0
        public Context EnterGroup(Padding padding, RectAllocator allocator, SchemeColor textColor = SchemeColor.None, float spacing = float.NegativeInfinity)
        {
            state.AllocateSpacing();
            var ctx = new Context(this, padding);

            state.allocator = allocator;
            if (!float.IsNegativeInfinity(spacing))
            {
                state.spacing = spacing;
            }
            if (textColor != SchemeColor.None)
            {
                state.textColor = textColor;
            }
            return(ctx);
        }
Exemplo n.º 3
0
 public ImGui RemainingRow(float spacing = float.NegativeInfinity)
 {
     state.AllocateSpacing(spacing);
     allocator = RectAllocator.RemainigRow;
     return(this);
 }
Exemplo n.º 4
0
 public Context EnterRow(float spacing = 0.5f, RectAllocator allocator = RectAllocator.LeftRow, SchemeColor textColor = SchemeColor.None) => EnterGroup(default, allocator, textColor, spacing);
Exemplo n.º 5
0
        public static bool BuildCheckBox(this ImGui gui, string text, bool value, out bool newValue, SchemeColor color = SchemeColor.None, RectAllocator allocator = RectAllocator.LeftRow)
        {
            using (gui.EnterRow(allocator: allocator))
            {
                gui.BuildIcon(value ? Icon.CheckBoxCheck : Icon.CheckBoxEmpty, 1.5f, color);
                gui.BuildText(text, Font.text, color: color);
            }

            if (gui.OnClick(gui.lastRect))
            {
                newValue = !value;
                return(true);
            }

            newValue = value;
            return(false);
        }