Example #1
0
    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));
    }
    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;
 }
Example #4
0
 public GuiStaticElement(GuiContentRenderer renderer)
 {
     guiContentRenderer = renderer;
 }
 public void SetPosition(GuiPosition position, GuiContentRenderer positionReference)
 {
     this.position = position;
     this.positionReference = positionReference;
 }
Example #6
0
 public void Init()
 {
     manager        = new GuiManager();
     lastGuiElement = null;
 }
Example #7
0
 public void SetPosition(GuiPosition position, GuiContentRenderer positionReference)
 {
     this.position          = position;
     this.positionReference = positionReference;
 }
Example #8
0
 public GuiTextRendererBuilder InPosition(GuiPosition position, GuiContentRenderer reference = null)
 {
     renderer.SetPosition(position, reference);
     return(this);
 }
 public void Init()
 {
     manager = new GuiManager();
     lastGuiElement = null;
 }