Ejemplo n.º 1
0
        public void Draw(SelectionPopupScreen screen, Vector2 position, bool isSelected, GameTime gameTime)
        {
            var spritebatch = screen.ScreenManager.SpriteBatch;
            var font = screen.ScreenManager.SharedHeaderFont;

            // Draw the selected entry in yellow, otherwise white.
            Color color = isSelected ? Color.Yellow : Color.White;

            // Pulsate the size of the selected menu entry.
            double time = gameTime.TotalGameTime.TotalSeconds;

            float pulsate = (float)Math.Sin(time * 6) + 1;

            float scale = 1 + pulsate * 0.05f * selectionFade;
            Vector2 origin = new Vector2(0, font.LineSpacing / 2);

            //            spritebatch.DrawString(font, Text, position, color);
            spritebatch.DrawString(font, Text, position, color, 0.0f, origin, scale, SpriteEffects.None, 0);
        }
Ejemplo n.º 2
0
        internal void RaiseSelectedEvent(SelectionPopupScreen screen)
        {
            if (closeOnSelection)
                screen.ExitScreen();

            if (EntrySelected != null)
                EntrySelected(this);
        }
Ejemplo n.º 3
0
        public void Update(SelectionPopupScreen screen, bool isSelected, GameTime gameTime)
        {
            float fadeSpeed = (float)gameTime.ElapsedGameTime.TotalSeconds * 4;

            if (isSelected)
                selectionFade = Math.Min(selectionFade + fadeSpeed, 1);
            else
                selectionFade = Math.Max(selectionFade - fadeSpeed, 0);
        }