コード例 #1
0
        /// <summary>
        /// Called by the <see cref="DeferredRenderSystem"/> when this <see cref="SpriteBase"/> component needs to draw its color map.
        /// Override this method with component-specific drawing code.
        /// </summary>
        /// <param name="gameTime">Time passed since the last call to DrawColorMap.</param>
        /// <param name="renderSystem"><see cref="DeferredRenderSystem"/> to render with.</param>
        public override void DrawColorMap(GameTime gameTime, DeferredRenderSystem renderSystem)
        {
            renderSystem.BeginRender();

            RectangleF posRect = new RectangleF(this.targetPostProcess.Position.X - this.lineWidth * 2.0f, this.targetPostProcess.Position.Y - this.lineWidth * 2.0f, this.lineWidth * 4.0f, this.lineWidth * 4.0f);
            float      lineMag = this.targetPostProcess.Velocity.Length();

            renderSystem.DrawFilledRectangle(posRect, Color.White, this.targetPostProcess.Rotation);                                                               // Draw position
            renderSystem.DrawRectangleBorder(this.targetPostProcess.GetWorldDrawBounds(), Color.Green, this.lineWidth, 0.0f);                                      // Draw bounding rectangle
            renderSystem.DrawLine(this.targetPostProcess.Position, this.targetPostProcess.Position + this.targetPostProcess.Velocity, Color.Blue, this.lineWidth); // Draw velocity line
            renderSystem.DrawLine(this.targetPostProcess.Position, this.targetPostProcess.Position + (lineMag * this.targetPostProcess.RotationVector), Color.OrangeRed, this.lineWidth);

            renderSystem.EndRender();
        }
コード例 #2
0
        /// <summary>
        /// Called by the <see cref="DeferredRenderSystem"/> when this <see cref="SpriteBase"/> component needs to draw its options map.
        /// Override this method with component-specific drawing code.
        /// </summary>
        /// <param name="gameTime">Time passed since the last call to DrawColorMap.</param>
        /// <param name="renderSystem"><see cref="DeferredRenderSystem"/> to render with.</param>
        public override void DrawOptionsMap(GameTime gameTime, DeferredRenderSystem renderSystem)
        {
            renderSystem.BeginRender(this.optionMapFlagsShader);
            this.optionMapFlagsShader.ConfigureShaderAndApplyPass(renderSystem, this);

            RectangleF posRect = new RectangleF(this.targetPostProcess.Position.X - this.lineWidth * 2.0f, this.targetPostProcess.Position.Y - this.lineWidth * 2.0f, this.lineWidth * 4.0f, this.lineWidth * 4.0f);
            float      lineMag = this.targetPostProcess.Velocity.Length();

            renderSystem.DrawFilledRectangle(posRect, Color.Black, this.targetPostProcess.Rotation);                                                                // Draw position
            renderSystem.DrawRectangleBorder(this.targetPostProcess.GetWorldDrawBounds(), Color.Black, this.lineWidth, 0.0f);                                       // Draw bounding rectangle
            renderSystem.DrawLine(this.targetPostProcess.Position, this.targetPostProcess.Position + this.targetPostProcess.Velocity, Color.Black, this.lineWidth); // Draw velocity line
            renderSystem.DrawLine(this.targetPostProcess.Position, this.targetPostProcess.Position + (lineMag * this.targetPostProcess.RotationVector), Color.Black, this.lineWidth);

            renderSystem.EndRender();
        }
コード例 #3
0
        /// <summary>
        /// Called by the <see cref="DeferredRenderSystem"/> when this <see cref="SpriteBase"/> component needs to draw its options map.
        /// Override this method with component-specific drawing code.
        /// </summary>
        /// <param name="gameTime">Time passed since the last call to DrawColorMap.</param>
        /// <param name="renderSystem"><see cref="DeferredRenderSystem"/> to render with.</param>
        public override void DrawOptionsMap(GameTime gameTime, DeferredRenderSystem renderSystem)
        {
            renderSystem.BeginRender(this.optionMapFlagsShader);
            this.optionMapFlagsShader.ConfigureShaderAndApplyPass(renderSystem, this);

            RectangleF posRect = new RectangleF(this.targetSprite.Position.X - this.lineWidth * 2.0f, this.targetSprite.Position.Y - this.lineWidth * 2.0f, this.lineWidth * 4.0f, this.lineWidth * 4.0f);

            renderSystem.DrawFilledRectangle(posRect, Color.Black, this.Rotation);                                                                   // Draw position
            renderSystem.DrawRectangleBorder(this.targetSprite.SpriteWorldBounds, Color.Black, this.lineWidth, 0.0f);                                // Draw bounding rectangle
            renderSystem.DrawLine(this.targetSprite.Position, this.targetSprite.Position + this.targetSprite.Velocity, Color.Black, this.lineWidth); // Draw velocity line

            renderSystem.EndRender();
        }
コード例 #4
0
        /// <summary>
        /// Called by the <see cref="DeferredRenderSystem"/> when this <see cref="SpriteBase"/> component needs to draw its color map.
        /// Override this method with component-specific drawing code.
        /// </summary>
        /// <param name="gameTime">Time passed since the last call to DrawColorMap.</param>
        /// <param name="renderSystem"><see cref="DeferredRenderSystem"/> to render with.</param>
        public override void DrawColorMap(GameTime gameTime, DeferredRenderSystem renderSystem)
        {
            renderSystem.BeginRender();

            RectangleF posRect = new RectangleF(this.targetSprite.Position.X - this.lineWidth * 2.0f, this.targetSprite.Position.Y - this.lineWidth * 2.0f, this.lineWidth * 4.0f, this.lineWidth * 4.0f);

            renderSystem.DrawFilledRectangle(posRect, Color.White, this.Rotation); // Draw position

            // Draw shape outline if it exists
            if (this.targetSprite.SpriteWorldShape != null)
            {
                for (int index = 0; index < this.targetSprite.SpriteWorldShape.Count - 1; index++)
                {
                    renderSystem.DrawLine(this.targetSprite.SpriteWorldShape[index], this.targetSprite.SpriteWorldShape[index + 1], Color.Red, this.lineWidth);
                }
            }

            renderSystem.DrawRectangleBorder(this.targetSprite.SpriteWorldBounds, Color.Green, this.lineWidth, 0.0f);                               // Draw bounding rectangle
            renderSystem.DrawLine(this.targetSprite.Position, this.targetSprite.Position + this.targetSprite.Velocity, Color.Blue, this.lineWidth); // Draw velocity line

            renderSystem.EndRender();
        }