/// <summary> /// Draws the menu entry using the InitialEntryFont /// </summary> public override void Draw(GameScreen screen, bool isSelected, GameTime gameTime) { //Draw the selected entry in yellow, and others in white. Color color = isSelected ? Color.Yellow : Color.White; ScreenManager screenManager = screen.Manager; SpriteBatch spriteBatch = screenManager.SpriteBatch; SpriteFont font = screenManager.InitialEntryFont; clickRectangle = new Rectangle((int)Position.X, (int)Position.Y, (int)(font.MeasureString(Text).X * Scale), (int)(font.MeasureString(Text).Y * Scale)); color *= screen.TransitionAlpha; //Draw text, centered on the middle of each line. Vector2 origin = new Vector2(0, font.LineSpacing / 2); spriteBatch.DrawString(font, text, position, color, 0, origin, Scale, SpriteEffects.None, 0); }
/// <summary> /// Adds a new screen to the screen manager /// </summary> /// <param name="screen"></param> /// <param name="controllingPlayer"></param> public void AddScreen(GameScreen screen, PlayerIndex? controllingPlayer) { screen.ControllingPlayer = controllingPlayer; screen.ScreenManager = this; screen.IsExiting = false; //If we have a graphics device, tell the screen to load content. if (isInitialized) { screen.Activate(); } screens.Add(screen); }
/// <summary> /// Removes a screen from the screen manager. You should normally /// use GameScreen.ExitScreen() instead of calling this directly, /// so the screen can gradually transition off rather than being /// instantly removed. /// </summary> /// <param name="screen"></param> public void RemoveScreen(GameScreen screen) { //If we have a graphics device, tell the screen to unload content. if (isInitialized) { screen.Unload(); } screens.Remove(screen); tempScreensList.Remove(screen); }
/// <summary> /// Adds a new screen to the screen manager /// </summary> /// <param name="screen"></param> /// <param name="controllingPlayer"></param> public void AddScreen(GameScreen screen, PlayerIndex? controllingPlayer) { #if XBOX if (screen.NeedsStorage) //The screen needs storage, so check if we have access first. If not, open up a StorageMessageScreen instead. { bool storageAvailable = StorageHelper.CheckStorage(); if (!storageAvailable) { screen = new StorageMessageScreen(); } } #endif screen.ControllingPlayer = controllingPlayer; screen.Manager = this; screen.IsExiting = false; //If we have a graphics device, tell the screen to load content. if (isInitialized) { screen.Activate(); } screens.Add(screen); }