protected override void Render() { base.Render(); if (!Box.Contains(Utils.MousePosition())) { _currentHoveredLabel = null; } if (_currentHoveredLabel != null || _currentDraggingLabel != null) { var l = _currentHoveredLabel; if (l == null) { l = _currentDraggingLabel; } var rect = new Rectangle(l.Box.x, l.Box.y + l.Box.height * 0.9f, l.Box.width, l.Box.height * 0.1f); Rendering.DrawRect(rect, CurrentStyle.FontColor()); } }
public void Draw() { if (!_isThemeApplied) { Initialize(); } if (CurrentStyle.Get <bool>(Styles.Hidden)) { return; } RecalculateBox(); // update all events UpdateEvents(); var marginOffset = new Vec2(Position.x + _margin.Left, Position.y + _margin.Top); // Raw background var contentBox = ContentBox; contentBox.height += _padding.Top + _padding.Bottom; contentBox.width += _padding.Left + _padding.Right; contentBox.x -= _padding.Left; contentBox.y -= _padding.Top; var bg = CurrentStyle.Get <Col>(Styles.BackgroundColor); if (bg.a > 0.001f) { Rendering.DrawRect(contentBox, bg); } // Draw border var borderColor = CurrentStyle.Get <Col>(Styles.BorderColor); float widthWithBorder = _border.Left + InnerWidth + _padding.Left + _border.Right + _padding.Right; float heightWithBorder = _border.Top + InnerHeight + _padding.Top + _border.Bottom + _padding.Bottom; if (_border.Top > float.Epsilon) { Rendering.DrawRect(new Rectangle(marginOffset.x + _border.Left, marginOffset.y, widthWithBorder - _border.Right - _border.Left, _border.Top), borderColor); } if (_border.Left > float.Epsilon) { Rendering.DrawRect(new Rectangle(marginOffset.x, marginOffset.y, _border.Left, heightWithBorder), borderColor); } if (_border.Right > float.Epsilon) { Rendering.DrawRect(new Rectangle(marginOffset.x + _border.Left + _padding.Left + InnerWidth + _padding.Right, marginOffset.y, _border.Right, heightWithBorder), borderColor); } if (_border.Bottom > float.Epsilon) { Rendering.DrawRect(new Rectangle(marginOffset.x + _border.Left, marginOffset.y + _border.Top + _padding.Top + InnerHeight + _padding.Bottom, widthWithBorder - _border.Right - _border.Left, _border.Bottom), borderColor); } Render(); foreach (var child in Children) { var drawable = (child as Widget); if (drawable != null) { drawable.DeferRender(); } } if (CurrentStyle.Exists(Styles.Outline)) { var outline = CurrentStyle.Get <GUIPanels.Outline>(Styles.Outline); Rendering.DrawLineBox(contentBox, outline.Width, outline.Color); } if (_shouldShowTooltip) { if (_tooltip != null) { _tooltip.Draw(); } } }
public Widget AddToDrawQueue() { Rendering.SetImmediateMode(false); Rendering.UIRenderer.AddWidget(this); return(this); }
protected override void Render() { base.Render(); Rendering.DrawTexture(ImageBox, _tex); }