public void DrawRect(Box2 rect, Color color, bool filled = true)
 {
     CheckDisposed();
     if (filled)
     {
         VS.CanvasItemAddRect(Item, rect.Convert(), color.Convert());
     }
     else
     {
         DrawLine(rect.TopLeft, rect.TopRight, color);
         DrawLine(rect.TopRight, rect.BottomRight, color);
         DrawLine(rect.BottomRight, rect.BottomLeft, color);
         DrawLine(rect.BottomLeft, rect.TopLeft, color);
     }
 }
Example #2
0
        public void DrawRect(UIBox2 rect, Color color, bool filled = true)
        {
            if (!GameController.OnGodot)
            {
                return;
            }

            CheckDisposed();
            if (filled)
            {
                VS.CanvasItemAddRect(Item, rect.Convert(), color.Convert());
            }
            else
            {
                DrawLine(rect.TopLeft, rect.TopRight, color);
                DrawLine(rect.TopRight, rect.BottomRight, color);
                DrawLine(rect.BottomRight, rect.BottomLeft, color);
                DrawLine(rect.BottomLeft, rect.TopLeft, color);
            }
        }
 public void DrawRect(UIBox2 rect, Color color, bool filled = true)
 {
     CheckDisposed();
     color *= Modulate;
     if (filled)
     {
         if (_renderHandle != null)
         {
             _renderHandle.DrawTextureRect(Texture.White, rect.TopLeft, rect.BottomRight, color, null, _handleId);
         }
         else if (Item != null)
         {
             VS.CanvasItemAddRect(Item, rect.Convert(), color.Convert());
         }
     }
     else
     {
         DrawLine(rect.TopLeft, rect.TopRight, color);
         DrawLine(rect.TopRight, rect.BottomRight, color);
         DrawLine(rect.BottomRight, rect.BottomLeft, color);
         DrawLine(rect.BottomLeft, rect.TopLeft, color);
     }
 }