public override void Draw(GameTime gameTime) { ScreenManager.GraphicsDevice.Clear(ClearOptions.Target, new Color(0, 0, 0, 0), 0, 0); Game1.spriteBatch = ScreenManager.SpriteBatch; ScreenManager.GraphicsDevice.Clear(Color.Black); Game1.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); //Draw the backgroundTexture sized to the width //and height of the screen. Game1.spriteBatch.End(); // If the game is transitioning on or off, fade it out to black. if (TransitionPosition > 0) { ScreenManager.FadeBackBufferToBlack(255 - TransitionAlpha); } }
public override void Draw(GameTime gameTime) { ScreenManager.GraphicsDevice.Clear(ClearOptions.Target, new Color(0, 0, 0, 0), 0, 0); Game1.spriteBatch = ScreenManager.SpriteBatch; ScreenManager.GraphicsDevice.Clear(Color.Black); Game1.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); //Draw the backgroundTexture sized to the width //and height of the screen. try { // Game1.spriteBatch.Draw(images[imageToDisplay], new Vector2(1280/2-images[imageToDisplay].Width/2,720/2-images[imageToDisplay].Height/2), Color.White); Game1.spriteBatch.Draw(images[imageToDisplay], new Rectangle(0, 0, 1280, 720), Color.White); } catch { } Game1.spriteBatch.End(); // If the game is transitioning on or off, fade it out to black. if (TransitionPosition > 0) { ScreenManager.FadeBackBufferToBlack(255 - TransitionAlpha); } }
public override void Draw(GameTime gameTime) { ScreenManager.GraphicsDevice.Clear(ClearOptions.Target, new Color(0, 0, 0, 0), 0, 0); Game1.spriteBatch = ScreenManager.SpriteBatch; SpriteBatch spriteBatch = Game1.spriteBatch; ScreenManager.GraphicsDevice.Clear(Color.CornflowerBlue); Game1.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); spriteBatch.Draw(gamescreen, Vector2.Zero, Color.White); if (networkSession != null) { string message = "Players: " + networkSession.AllGamers.Count; Vector2 messagePosition = new Vector2(100, 480); // spriteBatch.DrawString(gameFont, message, messagePosition, Color.White); } Game1.spriteBatch.End(); // If the game is transitioning on or off, fade it out to black. if (TransitionPosition > 0) { ScreenManager.FadeBackBufferToBlack(255 - TransitionAlpha); } }
/// <summary> /// Draws the options screen. /// </summary> public override void Draw(GameTime gameTime) { // This game has a blue background. Why? Because! ScreenManager.GraphicsDevice.Clear(ClearOptions.Target, Color.CornflowerBlue, 0, 0); SpriteBatch spriteBatch = ScreenManager.SpriteBatch; spriteBatch.Begin(); spriteBatch.Draw(background, Vector2.Zero, Color.White); Helpers.DrawStrokedString("Your objective is to catch candy canes while\navoiding snowballs for as long as possible!\n\nUse the left thumb stick to control santa's movement.\nPress A to jump! Tap A again to double-jump!\n\nPush B to return to the main menu and start playing!", new Vector2(130, 100), Color.WhiteSmoke, Color.Black, 2, gameFont, spriteBatch); if (networkSession != null) { string message = "Players: " + networkSession.AllGamers.Count; Vector2 messagePosition = new Vector2(100, 480); spriteBatch.DrawString(gameFont, message, messagePosition, Color.White); } spriteBatch.End(); // If the game is transitioning on or off, fade it out to black. if (TransitionPosition > 0) { ScreenManager.FadeBackBufferToBlack(255 - TransitionAlpha); } }
//#region Draw /// <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(); }
public override void Draw(GameTime gameTime) { ScreenManager.GraphicsDevice.Clear(ClearOptions.Target, Color.Black, 0, 0); SpriteBatch spriteBatch = ScreenManager.SpriteBatch; spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); Rectangle fullscreen = new Rectangle(0, 0, ScreenManager.GraphicsDevice.Viewport.Width, ScreenManager.GraphicsDevice.Viewport.Height); // spriteBatch.Draw(backgroundTexture, fullscreen, Color.White); string addonstring = ""; if (changevibrations) { addonstring = "Press X to lock vibration settings"; } else { addonstring = "Press Y to unlock vibration settings"; } if (Guide.IsTrialMode) { addonstring += "Vibration strength is severely limited in the trial version"; if (vib1 > 55) { vib1 = 55; } if (vib2 > 55) { vib2 = 55; } if (vib3 > 55) { vib3 = 55; } if (vib4 > 55) { vib4 = 55; } if (vib1r > 55) { vib1r = 55; } if (vib2r > 55) { vib2r = 55; } if (vib3r > 55) { vib3r = 55; } if (vib4r > 55) { vib4r = 55; } } spriteBatch.DrawString(gameFont, addonstring + "\n\rHold R to affect the right motor\n\rHold L to affect the left motor\n\r\n\r" + "Player 1: " + vib1 + "% " + vib1r + "%\n\r" + "Player 2: " + vib2 + "% " + vib2r + "%\n\r" + "Player 3: " + vib3 + "% " + vib3r + "%\n\r" + "Player 4: " + vib4 + "% " + vib4r + "%\n\r" , new Vector2(Convert.ToInt32(ScreenManager.GraphicsDevice.Viewport.Width * .3), Convert.ToInt32(ScreenManager.GraphicsDevice.Viewport.Height * .2)), Color.White); spriteBatch.End(); // If the game is transitioning on or off, fade it out to black. if (TransitionPosition > 0) { ScreenManager.FadeBackBufferToBlack(255 - TransitionAlpha); } }
/// <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); }