Example #1
0
        /// <summary>
        /// Draws the gameplay screen.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            ScreenManager.GraphicsDevice.Clear(Color.Black);

            //Draw what's not taken care of by the sprite manager.
            spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Texture, SaveStateMode.None);

            playerManager.Draw(ref spriteBatch, gameTime);

            enemySpriteManager.Draw(ref spriteBatch, gameTime);

            // Draw the charge bar
            chargeBar.Draw(ref spriteBatch, gameTime);

            // Draw the repair power up
            //repairPowerup.Draw(ref spriteBatch, gameTime);

            // Draw the powerup manager
            powerupManager.Draw(ref spriteBatch, gameTime);

            //Draw particle system information
            //Defines.particleManager.Draw(ref spriteBatch, gameTime);

            //Print some stats from the enemy manager
            enemySpriteManager.ShowStats(ref spriteBatch);

            spriteBatch.End();
            DrawHud(gameTime);

            // If the game is transitioning on or off, fade it out to black.
            if (TransitionPosition > 0)
            {
                ScreenManager.FadeBackBufferToBlack(255 - TransitionAlpha);
            }
        }
        /// <summary>
        /// Draws the message box.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            // Darken down any other screens that were drawn beneath the popup.
            ScreenManager.FadeBackBufferToBlack(TransitionAlpha * 2 / 3);

            // Center the message text in the viewport.
            Viewport viewport          = ScreenManager.GraphicsDevice.Viewport;
            Vector2  viewportSize      = new Vector2(viewport.Width, viewport.Height);
            Vector2  textSize          = ScreenManager.Font.MeasureString(message);
            Vector2  textPosition      = (viewportSize - textSize) / 2;
            Vector2  usageTextSize     = smallFont.MeasureString(usageText);
            Vector2  usageTextPosition = (viewportSize - usageTextSize) / 2;

            usageTextPosition.Y = textPosition.Y +
                                  ScreenManager.Font.LineSpacing * 1.1f;

            // Fade the popup alpha during transitions.
            Color color = new Color(255, 255, 255, TransitionAlpha);

            // Draw the background rectangles
            Rectangle rect = new Rectangle(
                (int)(Math.Min(usageTextPosition.X, textPosition.X)),
                (int)(textPosition.Y),
                (int)(Math.Max(usageTextSize.X, textSize.X)),
                (int)(ScreenManager.Font.LineSpacing * 1.1f + usageTextSize.Y)
                );

            rect.X      -= (int)(0.1f * rect.Width);
            rect.Y      -= (int)(0.1f * rect.Height);
            rect.Width  += (int)(0.2f * rect.Width);
            rect.Height += (int)(0.2f * rect.Height);

            Rectangle rect2 = new Rectangle(rect.X - 1, rect.Y - 1,
                                            rect.Width + 2, rect.Height + 2);

            ScreenManager.DrawRectangle(rect2, new Color(128, 128, 128,
                                                         (byte)(192.0f * (float)TransitionAlpha / 255.0f)));
            ScreenManager.DrawRectangle(rect, new Color(0, 0, 0,
                                                        (byte)(232.0f * (float)TransitionAlpha / 255.0f)));

            // Draw the message box text.
            ScreenManager.SpriteBatch.Begin();
            ScreenManager.SpriteBatch.DrawString(ScreenManager.Font, message,
                                                 textPosition, color);
            ScreenManager.SpriteBatch.DrawString(smallFont, usageText,
                                                 usageTextPosition, color);
            ScreenManager.SpriteBatch.End();
        }
Example #3
0
        /// <summary>
        /// Draws the pause menu screen. This darkens down the gameplay screen
        /// that is underneath us, and then chains to the base MenuScreen.Draw.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            ScreenManager.FadeBackBufferToBlack(TransitionAlpha * 2 / 3);

            Viewport viewport     = ScreenManager.GraphicsDevice.Viewport;
            Vector2  viewportSize = new Vector2(viewport.Width, viewport.Height);

            // title
            Vector2 titlePosition = new Vector2(
                (viewportSize.X - titleTexture.Width) / 2f,
                viewportSize.Y * 0.18f);

            titlePosition.Y -= (float)Math.Pow(TransitionPosition, 2) * titlePosition.Y;
            Color titleColor = Color.White;

            ScreenManager.SpriteBatch.Begin();
            ScreenManager.SpriteBatch.Draw(titleTexture, titlePosition,
                                           new Color(titleColor.R, titleColor.G, titleColor.B, TransitionAlpha));
            ScreenManager.SpriteBatch.End();

            base.Draw(gameTime);
        }
Example #4
0
        public override void Draw(GameTime gameTime)
        {
            ScreenManager.GraphicsDevice.Clear(Color.Black);

            //Draw what's not taken care of by the sprite manager.
            spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Texture, SaveStateMode.None);

            //playerSpriteManager.Draw(ref spriteBatch, gameTime);
            //player1.Draw(ref spriteBatch, gameTime);
            playerManager.Draw(ref spriteBatch, gameTime);

            spriteBatch.End();

            DrawHud(gameTime);

            // If the game is transitioning on or off, fade it out to black.
            if (TransitionPosition > 0)
            {
                ScreenManager.FadeBackBufferToBlack(255 - TransitionAlpha);
            }

            base.Draw(gameTime);
        }