示例#1
0
        protected override void Draw(GameTime gameTime)
        {
            this.GraphicsDevice.Clear(Color.Black);


            this._SpriteBatch.Begin();
            var drawingPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X + 20, GraphicsDevice.Viewport.TitleSafeArea.Y + 20);

            if (this._State == ScreenState.GeneralMessageCountdown)
            {
                // Draw the message.
                this._SpriteBatch.DrawString(this._LargeFont, this._Message, drawingPosition, Color.White);

                // And the bug!
                var resized  = Vector2Helper.ResizeKeepingAspectRatio(Vector2Helper.GetProportionalSize(0.5f, this.GraphicsDevice.Viewport), this._Bug.Bounds);
                var location = new Vector2((float)this.GraphicsDevice.Viewport.Bounds.Center.X, (float)(this.GraphicsDevice.Viewport.Bounds.Bottom - (resized.Y + 10)));
                var rect     = new Rectangle((int)location.X, (int)location.Y, (int)resized.X, (int)resized.Y);
                var centre   = new Vector2((float)this._Bug.Width, (float)this._Bug.Height) / 2;
                this._SpriteBatch.Draw(this._Bug, rect, null, Color.White, 0f, centre, SpriteEffects.None, 0);
            }
            else if (this._State == ScreenState.TechnicalDisplay)
            {
                // Draw the exception message.
                this._SpriteBatch.DrawString(this._LargeFont, this._Message, drawingPosition, Color.White);
                this._SpriteBatch.DrawString(this._SmallFont, this._TheExceptionDump, drawingPosition + new Vector2(0, 30), Color.White);
            }
            else if (this._State == ScreenState.PublishException)
            {
                // Draw the publishing message.
                this._SpriteBatch.DrawString(this._LargeFont, this._Message, drawingPosition, Color.White);

                // And the bug!
                var resized  = Vector2Helper.ResizeKeepingAspectRatio(Vector2Helper.GetProportionalSize(0.5f, this.GraphicsDevice.Viewport), this._Bug.Bounds);
                var location = new Vector2((float)this.GraphicsDevice.Viewport.Bounds.Center.X, (float)(this.GraphicsDevice.Viewport.Bounds.Bottom - (resized.Y + 10)));
                var rect     = new Rectangle((int)location.X, (int)location.Y, (int)resized.X, (int)resized.Y);
                var centre   = new Vector2((float)this._Bug.Width, (float)this._Bug.Height) / 2;
                this._SpriteBatch.Draw(this._Bug, rect, null, Color.White, 0f, centre, SpriteEffects.None, 0);
            }
            this._SpriteBatch.End();

            base.Draw(gameTime);
        }