예제 #1
0
        public override void Process()
        {
            foreach (var c in Components)
            {
                var collider = (ColliderComponent)c;
                _adapter.SetTransform(Transform.CreateBasic(collider.GameObject));
                switch (collider.Mesh.Shape)
                {
                case Shapes.Circle:
                    var cir = (CircleMesh)collider.Mesh;
                    _adapter.DrawElipseOutline(collider.AABB.Center, cir.Radius, DebugBoxes);
                    break;

                case Shapes.Polygon:
                    var p   = (PolygonMesh)collider.Mesh;
                    var pos = collider.AABB.Center;
                    for (int i = 0; i < p.Vertices.Length - 1; i++)
                    {
                        var v1 = p.Vertices[i] + pos;
                        var v2 = p.Vertices[i + 1] + pos;
                        _adapter.DrawLine(v1, v2, DebugBoxes);
                    }
                    _adapter.DrawLine(p.Vertices[p.Vertices.Length - 1] + pos, p.Vertices[0] + pos, DebugBoxes);
                    break;
                }
            }
        }
예제 #2
0
 public override void Draw(IGraphicsAdapter pSystem)
 {
     pSystem.DrawRect(Bounds, Background);
     if (IsChecked)
     {
         pSystem.DrawLine(new Vector2(Bounds.Left, Bounds.Top), new Vector2(Bounds.Right, Bounds.Bottom), Foreground);
         pSystem.DrawLine(new Vector2(Bounds.Left, Bounds.Bottom), new Vector2(Bounds.Right, Bounds.Top), Foreground);
     }
 }
예제 #3
0
        public override void Draw(IGraphicsAdapter pSystem)
        {
            pSystem.DrawRect(Bounds, Background);

            pSystem.DrawText(Text, Bounds, Font, true); //TODO clip, DrawTextLayout?

            if (_showCursor && IsFocused)
            {
                var s = Font.MeasureString(Text.Substring(0, _cursorPos), ActualWidth);
                var x = Bounds.Left + s.Width + 1;
                pSystem.DrawLine(new Vector2(x, Bounds.Top + 1), new Vector2(x, Bounds.Bottom - 1), Cursor);
            }
        }