/// <summary> /// Draws the menu. /// </summary> public override void Draw(GameTime gameTime) { // make sure our entries are in the right place before we draw them UpdateMenuEntryLocations(); SpriteBatch spriteBatch = ScreenManager.SpriteBatch; SpriteFont font = ScreenManager.Fonts.MenuSpriteFont; spriteBatch.Begin(); // Draw each menu entry in turn. for (int i = 0; i < _menuEntries.Count; ++i) { bool isSelected = IsActive && (i == _selectedEntry); _menuEntries[i].Draw(); } // 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). Vector2 transitionOffset = new Vector2(0f, (float)Math.Pow(TransitionPosition, 2) * 100f); spriteBatch.DrawString(font, _menuTitle, _titlePosition - transitionOffset + Vector2.One * 2f, Color.Black, 0, _titleOrigin, 1f, SpriteEffects.None, 0); spriteBatch.DrawString(font, _menuTitle, _titlePosition - transitionOffset, new Color(255, 210, 0), 0, _titleOrigin, 1f, SpriteEffects.None, 0); _scrollUp.Draw(); _scrollSlider.Draw(); _scrollDown.Draw(); spriteBatch.End(); }
/// <summary> /// Draws the menu. /// </summary> public override void Draw(GameTime gameTime) { // make sure our entries are in the right place before we draw them UpdateMenuEntryLocations(); SpriteBatch spriteBatch = ScreenManager.SpriteBatch; SpriteFont font = ScreenManager.Fonts.MenuSpriteFont; spriteBatch.Begin(); // 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). Vector2 transitionOffset = new Vector2(0f, (float)Math.Pow(TransitionPosition, 2) * 100f); //Draw background spriteBatch.Draw(_background, DestinationRectangle, _rectBG, _bgColor); // Draw each menu entry in turn. for (int i = 0; i < _menuEntries.Count; ++i) { bool isSelected = IsActive && (i == _selectedEntry); _menuEntries[i].Draw(); } spriteBatch.DrawString(font, _menuTitle, _titlePosition - transitionOffset, Color.WhiteSmoke, 0, _titleOrigin, 2f, SpriteEffects.None, 0); if (_scoreSection != null) { _scoreSection.Draw(transitionOffset); } if (_menuEntries.Count > NumEntries) { _scrollUp.Draw(); _scrollSlider.Draw(); _scrollDown.Draw(); } spriteBatch.End(); }