protected void Add(string text, int size, bool bold, string color, GuiRendererControl control) { RichTextFormatter textFormatter = RichTextFormatter.For(text); if (color.Length > 0) { textFormatter.SetColor(color); } if (bold) { textFormatter.SetBold(); } textFormatter.SetSize(Pixels.GetDensityIndependentPixels(size)); text = textFormatter.Format(); GuiPosition position = lastGuiElement == null ? firstPosition : defaultPosition; GuiTextRendererBuilder textRendererBuilder = new GuiTextRendererBuilder().WithRichText(text).InPosition(position, lastGuiElement); if (control != null) { textRendererBuilder.WithControl(control); } lastGuiElement = textRendererBuilder.Get(); manager.AddElement(new GuiStaticElement(lastGuiElement)); }
public GuiTextRendererBuilder InPosition(GuiPosition position, GuiContentRenderer reference = null) { renderer.SetPosition(position, reference); return this; }
public GuiStaticElement(GuiContentRenderer renderer) { guiContentRenderer = renderer; }
public void SetPosition(GuiPosition position, GuiContentRenderer positionReference) { this.position = position; this.positionReference = positionReference; }
public void Init() { manager = new GuiManager(); lastGuiElement = null; }
public GuiTextRendererBuilder InPosition(GuiPosition position, GuiContentRenderer reference = null) { renderer.SetPosition(position, reference); return(this); }