Example #1
0
        public override void Draw(Shapes shapes, bool displayCollisionCircles)
        {
            if (this.isRocketForce)
            {
                FlatTransform transform = new FlatTransform(this.position, this.angle, 1f);
                shapes.DrawPolygon(this.rocketVertices, transform, 1f, Color.Yellow);
            }

            base.Draw(shapes, displayCollisionCircles);
        }
Example #2
0
        public virtual void Draw(Shapes shapes, bool displayCollisionCircles = false)
        {
            FlatTransform transform = new FlatTransform(this.position, this.angle, 1f);

            shapes.DrawPolygon(this.vertices, transform, 1f, this.color);

            if (displayCollisionCircles)
            {
                shapes.DrawCircle(this.position.X, this.position.Y, this.radius, 32, 1f, this.CircleColor);
            }
        }
Example #3
0
        public void DrawPolygon(Vector2[] vertices, FlatTransform transform, float thickness, Color color)
        {
            for (int i = 0; i < vertices.Length; i++)
            {
                Vector2 a = vertices[i];
                Vector2 b = vertices[(i + 1) % vertices.Length];

                a = Util.Transform(a, transform);
                b = Util.Transform(b, transform);

                this.DrawLine(a, b, thickness, color);
            }
        }
Example #4
0
        public void DrawPolygonFill(Vector2[] vertices, int[] triangleIndices, FlatTransform transform, Color color)
        {
#if DEBUG
            if (vertices is null)
            {
                throw new ArgumentNullException("vertices");
            }

            if (indices is null)
            {
                throw new ArgumentNullException("indices");
            }

            if (vertices.Length < 3)
            {
                throw new ArgumentOutOfRangeException("verticess");
            }

            if (indices.Length < 3)
            {
                throw new ArgumentOutOfRangeException("indices");
            }
#endif

            this.EnsureStarted();
            this.EnsureSpace(vertices.Length, triangleIndices.Length);

            for (int i = 0; i < triangleIndices.Length; i++)
            {
                this.indices[this.indexCount++] = triangleIndices[i] + this.vertexCount;
            }

            for (int i = 0; i < vertices.Length; i++)
            {
                Vector2 vertex = vertices[i];
                vertex = Util.Transform(vertex, transform);
                this.vertices[this.vertexCount++] = new VertexPositionColor(new Vector3(vertex.X, vertex.Y, 0f), color);
            }

            this.shapeCount++;
        }