public static bool BuildRadioButton(this ImGui gui, string option, bool selected, SchemeColor color = SchemeColor.None) { using (gui.EnterRow()) { gui.BuildIcon(selected ? Icon.RadioCheck : Icon.RadioEmpty, 1.5f, color); gui.BuildText(option, Font.text, color: color, wrap: true); } return(!selected && gui.OnClick(gui.lastRect)); }
public void Next() { if (currentRowIndex == elementsPerRow - 1) { savedContext.Dispose(); savedContext = default; currentRowIndex = -1; } currentRowIndex++; if (currentRowIndex == 0) { savedContext = gui.EnterRow(0f); gui.spacing = 0f; } savedContext.SetManualRect(new Rect((elementWidth + spacing) * currentRowIndex, 0f, elementWidth, 0f), RectAllocator.Stretch); }
public static bool BuildCheckBox(this ImGui gui, string text, bool value, out bool newValue, SchemeColor color = SchemeColor.None) { using (gui.EnterRow()) { 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); }
public static bool BuildErrorRow(this ImGui gui, string text) { var closed = false; using (gui.EnterRow(allocator: RectAllocator.RightRow, textColor: SchemeColor.ErrorText)) { if (gui.BuildButton(Icon.Close, size: 1f, over: SchemeColor.ErrorAlt)) { closed = true; } gui.RemainingRow().BuildText(text, align: RectAlignment.Middle); } if (gui.isBuilding) { gui.DrawRectangle(gui.lastRect, SchemeColor.Error); } return(closed); }
protected override void BuildContents(ImGui gui) { gui.BuildText(ex.GetType().Name, Font.header); gui.BuildText(ex.Message, Font.subheader, true); gui.BuildText(ex.StackTrace, Font.text, true); using (gui.EnterRow(0.5f, RectAllocator.RightRow)) { if (gui.BuildButton("Close")) { Close(); } if (gui.BuildButton("Ignore future errors", SchemeColor.Grey)) { ignoreAll = true; Close(); } if (gui.BuildButton("Copy to clipboard", SchemeColor.Grey)) { SDL.SDL_SetClipboardText(ex.Message + "\n\n" + ex.StackTrace); } } }