public void Draw(SpriteBatch spriteBatch) { if (!_active) { return; } _inventoryHud.Draw(spriteBatch); }
public override void Draw(SpriteBatch spriteBatch) { base.Draw(spriteBatch); var viewport = new Vector2(XnaDartsGame.Viewport.Width, XnaDartsGame.Viewport.Height); var transitionTo = 0; if (IsCoveredByOtherScreen) { transitionTo = 0; } else if (State == ScreenState.Active || State == ScreenState.Entering) { transitionTo = 1; } else if (State == ScreenState.Exiting) { transitionTo = 2; } _transitionPosition += (transitionTo - _transitionPosition) * MathHelper.Lerp(0, 1, MathHelper.Clamp(_transitionTimer, 0, 1)); if (float.IsNaN(_transitionPosition)) { } var stackPanelPosition = new Vector2 { X = _transitionPosition * MenuPosition.X * viewport.X, Y = MenuPosition.Y * viewport.Y }; var sin = ((float)Math.Sin(ElapsedTime * 5f) + 1.0f) / 2.0f; var alpha = sin * 0.8f + 0.2f; var c = Color.Lerp(Color.White, XnaDartsColors.SelectedMenuItemForeground, alpha); ((MenuEntry)MenuItems.Items[_selectedEntry]).Color = c; spriteBatch.Begin(); StackPanel.Draw(spriteBatch, stackPanelPosition, TransitionAlpha); spriteBatch.End(); }