Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GorgonRectangle"/> class.
        /// </summary>
        /// <param name="gorgon2D">Gorgon interface that owns this renderable.</param>
        /// <param name="name">The name of the rectangle.</param>
        /// <param name="filled">TRUE to draw a filled rectangle, FALSE to draw an outline.</param>
        internal GorgonRectangle(Gorgon2D gorgon2D, string name, bool filled)
            : base(gorgon2D, name)
        {
            _colors = new[]
            {
                GorgonColor.White,
                GorgonColor.White,
                GorgonColor.White,
                GorgonColor.White
            };

            _corners = new[]
            {
                Vector2.Zero,
                Vector2.Zero,
                Vector2.Zero,
                Vector2.Zero
            };

            IsFilled = filled;
            _filled  = gorgon2D.Renderables.CreateSprite("Rectangle.Sprite", new Vector2(1), GorgonColor.White);
            _line    = new GorgonLine(gorgon2D, "Rectangle.Line")
            {
                Color      = GorgonColor.White,
                TextureEnd = new Vector2(1),
                StartPoint = Vector2.Zero,
                EndPoint   = new Vector2(1)
            };
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GorgonTriangle"/> class.
        /// </summary>
        /// <param name="gorgon2D">The gorgon 2D interface that created this object.</param>
        /// <param name="name">The name of the triangle object.</param>
        internal GorgonTriangle(Gorgon2D gorgon2D, string name)
            : base(gorgon2D, name)
        {
            Scale           = new Vector2(1);
            VertexCount     = 3;
            BaseVertexCount = 3;
            IsFilled        = true;

            _points = new GorgonPolygonPoint[3];
            _line   = new GorgonLine(gorgon2D, "Triangle.Line");

            InitializeVertices(3);
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GorgonDrawing"/> class.
        /// </summary>
        /// <param name="gorgon2D">The gorgon 2D interface that owns this object.</param>
        internal GorgonDrawing(Gorgon2D gorgon2D)
        {
            _depthStencil = new GorgonRenderable.DepthStencilStates();
            _sampler      = new GorgonRenderable.TextureSamplerState();
            _blend        = new GorgonRenderable.BlendState();

            // Default to modulated blending for drawing operations.
            BlendingMode = BlendingMode.Modulate;

            CullingMode = CullingMode.Back;

            _rect = new GorgonRectangle(gorgon2D, "Gorgon2D.Rectangle", false)
            {
                Position = Vector2.Zero,
                Size     = Vector2.Zero
            };
            _point = new GorgonPoint(gorgon2D, "Gorgon2D.Point")
            {
                Position = Vector2.Zero,
                Color    = GorgonColor.White
            };
            _line = new GorgonLine(gorgon2D, "Gorgon2D.Line")
            {
                Color      = GorgonColor.White,
                StartPoint = Vector2.Zero,
                EndPoint   = Vector2.Zero
            };
            _ellipse = new GorgonEllipse(gorgon2D, "Gorgon2D.Ellipse")
            {
                Quality = 64,
                Color   = GorgonColor.White
            };
            _triangle = new GorgonTriangle(gorgon2D,
                                           "Gorgon2D.Triangle")
            {
                IsFilled = false
            };
            _string = gorgon2D.Renderables.CreateText("Gorgon2D.String");
        }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GorgonEllipse"/> class.
 /// </summary>
 /// <param name="gorgon2D">The gorgon 2D interface that created this object.</param>
 /// <param name="name">The name of the object.</param>
 internal GorgonEllipse(Gorgon2D gorgon2D, string name)
     : base(gorgon2D, name)
 {
     _line   = new GorgonLine(gorgon2D, name + ".Line");
     Quality = 64;
 }