Esempio n. 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)
        {
            _scaler.SetRenderTarget();
            _spriteBatch.Begin();

            _spriteBatch.Draw(_bgScreen, Vector2.Zero, Color.White);

            // draw the enemy board
            _enemyGroup.Draw(gameTime, _spriteBatch);

            // draw the player shots
            foreach (PlayerShot playerShot in _playerShots)
            {
                playerShot.Draw(gameTime, _spriteBatch);
            }

            // draw the player
            if (_player != null)
            {
                _player.Draw(gameTime, _spriteBatch);
            }

            // draw the player explosion
            if (_playerExplosion != null)
            {
                _playerExplosion.Draw(gameTime, _spriteBatch);
            }

            Vector2 scoreSize = _font.MeasureString("Score: " + _score);

            _spriteBatch.DrawString(_font, "Score: " + _score, ScorePosition - scoreSize / 2.0f, Color.Aqua);

            _spriteBatch.End();
            _scaler.Draw();
        }
        /// <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)
        {
            _scaler.SetRenderTarget();
            _spriteBatch.Begin();

            _spriteBatch.Draw(_bgScreen, Vector2.Zero, Color.White);

            // draw the enemy board
            _enemyGroup.Draw(gameTime, _spriteBatch);

            // draw the player shots
            foreach (PlayerShot playerShot in _playerShots)
            {
                playerShot.Draw(gameTime, _spriteBatch);
            }

            // draw the player
            if (_player != null)
            {
                _player.Draw(gameTime, _spriteBatch);
            }

            // draw the player explosion
            if (_playerExplosion != null)
            {
                _playerExplosion.Draw(gameTime, _spriteBatch);
            }

            //
            // TODO: Draw score
            //

            _spriteBatch.End();
            _scaler.Draw();
        }
 /// <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)
 {
     _scaler.SetRenderTarget();
     _screen.Draw(gameTime);
     _scaler.Draw();
 }