/// <summary> /// Draws the menu. /// </summary> public override void Draw(GameTime gameTime) { SpriteBatch spriteBatch = ScreenManager.SpriteBatch; SpriteFont font = ScreenManager.HudFont; Vector2 position = MenuPosition; // Make the menu slide into place during transitions, using a // power curve to make things look more interesting (this makes // the movement slow down as it nears the end). float transitionOffset = (float)Math.Pow(TransitionPosition, 2); if (ScreenState == ScreenState.TransitionOn) { position.X -= transitionOffset * 256; } else { position.X += transitionOffset * 512; } spriteBatch.Begin(); // Draw each menu entry in turn. for (int i = 0; i < menuEntries.Count; i++) { MenuEntry menuEntry = menuEntries[i]; bool isSelected = IsActive && (i == selectedEntry); menuEntry.Draw(this, position, isSelected, gameTime); position.Y += menuEntry.GetHeight(this) + LineSpacing; } // Draw the menu title. Vector2 titlePosition = TitlePosition; Vector2 titleOrigin = font.MeasureString(menuTitle); float titleScale = 1.5f; titlePosition.Y -= transitionOffset * 100; spriteBatch.DrawString(font, menuTitle, titlePosition, Color.Snow, 0, titleOrigin, titleScale, SpriteEffects.None, 0); spriteBatch.End(); }