예제 #1
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            // TODO: Add your drawing code here
            minefield.Draw(spriteBatch, textField);
            if (dead == true)
            {
                spriteBatch.Begin();
                spriteBatch.DrawString(font, "YOU DIE", new Vector2(graphics.PreferredBackBufferWidth - 70, 0), Color.Black);
                spriteBatch.End();
            }
            else if (win == true)
            {
                spriteBatch.Begin();
                spriteBatch.DrawString(font, "YOU WIN", new Vector2(graphics.PreferredBackBufferWidth - 70, 0), Color.Black);
                spriteBatch.End();
            }

            spriteBatch.Begin();
            spriteBatch.DrawString(font, "" + (int)time, Vector2.Zero, Color.Black);
            int m = minefield.GetMines() - minefield.GetNumberOfFlags();

            spriteBatch.DrawString(font, "" + m, new Vector2(graphics.PreferredBackBufferWidth / 2, 0), Color.Black);
            spriteBatch.Draw(textField, new Rectangle(graphics.PreferredBackBufferWidth / 2 - 20, 0, 20, 20), new Rectangle(440, 0, 40, 40), Color.White);
            spriteBatch.End();

            base.Draw(gameTime);
        }