/// <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); SpriteBatch spriteBatch = ScreenManager.SpriteBatch; SpriteFont font = ScreenManager.Font; string respawnTimeRemaining = respawnTimeLeft.ToString(); // Center the text in the viewport. Viewport viewport = ScreenManager.GraphicsDevice.Viewport; Vector2 viewportSize = new Vector2(viewport.Width, viewport.Height); Vector2 textSize = font.MeasureString(respawnTimeRemaining); Vector2 textPosition = (viewportSize - textSize) / 2; spriteBatch.Begin(); spriteBatch.DrawString(font, respawnTimeRemaining, textPosition, Color.Yellow); spriteBatch.End(); base.Draw(gameTime); }
/// <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); SpriteBatch spriteBatch = ScreenManager.SpriteBatch; SpriteFont font = ScreenManager.Font; Vector2 position = new Vector2(300, 387); spriteBatch.Begin(); spriteBatch.DrawString(font, GetLevel(), position, Color.Yellow); position.Y += 27; spriteBatch.DrawString(font, GetGameModeType(), position, Color.Yellow); position.Y += 27; spriteBatch.DrawString(font, GetWeaponType(), position, Color.Yellow); position.Y += 27; spriteBatch.DrawString(font, GetScoreToWinType(), position, Color.Yellow); position.Y += 27; spriteBatch.DrawString(font, GetNoOfBots(), position, Color.Yellow); spriteBatch.End(); base.Draw(gameTime); }
/// <summary> /// Draws the gameplay screen. /// </summary> public override void Draw(GameTime gameTime) { ScreenManager.GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.White, 1, 0); ScreenManager.GraphicsDevice.RenderState.CullMode = CullMode.None; ScreenManager.GraphicsDevice.RenderState.DepthBufferEnable = true; ScreenManager.GraphicsDevice.RenderState.AlphaBlendEnable = false; ScreenManager.GraphicsDevice.RenderState.AlphaTestEnable = false; level.sky.Draw(camera.ViewMatrix, camera.ProjectionMatrix); if (currentLevel == NetworkSessionComponent.Level.Level_1) { level.level.Draw(camera, 1f); } else { level.level.Draw(camera, 1f); } foreach (NetworkGamer gamer in networkSession.AllGamers) { Player networkPlayer = gamer.Tag as Player; networkPlayer.Draw(gameTime, camera); } base.Draw(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) { SpriteBatch spriteBatch = ScreenManager.SpriteBatch; SpriteFont font = ScreenManager.Font; // 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 = font.MeasureString(message); Vector2 textPosition = (viewportSize - textSize) / 2; // The background includes a border somewhat larger than the text itself. const int hPad = 32; const int vPad = 16; Rectangle backgroundRectangle = new Rectangle((int)textPosition.X - hPad, (int)textPosition.Y - vPad, (int)textSize.X + hPad * 2, (int)textSize.Y + vPad * 2); // Fade the popup alpha during transitions. Color color = new Color(255, 255, 255, TransitionAlpha); spriteBatch.Begin(); // Draw the background rectangle. spriteBatch.Draw(gradientTexture, backgroundRectangle, color); // Draw the message box text. spriteBatch.DrawString(font, message, textPosition, color); spriteBatch.End(); }
/// <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); base.Draw(gameTime); }