FarseerPhysics.Samples.ScreenSystem.MenuEntry.Update C# (CSharp) Method

Update() public method

Updates the menu entry.
public Update ( bool isSelected, GameTime gameTime ) : void
isSelected bool
gameTime Microsoft.Xna.Framework.GameTime
return void
        public void Update(bool isSelected, GameTime gameTime)
        {
            // there is no such thing as a selected item on Windows Phone, so we always
            // force isSelected to be false
            #if WINDOWS_PHONE
            isSelected = false;
            #endif
            // When the menu selection changes, entries gradually fade between
            // their selected and deselected appearance, rather than instantly
            // popping to the new state.
            if (_type != EntryType.Separator)
            {
                float fadeSpeed = (float)gameTime.ElapsedGameTime.TotalSeconds * 4;
                if (isSelected)
                    _selectionFade = Math.Min(_selectionFade + fadeSpeed, 1f);
                else
                    _selectionFade = Math.Max(_selectionFade - fadeSpeed, 0f);

                _scale = 0.7f + 0.1f * _selectionFade;
            }
        }

Same methods

MenuEntry::Update ( bool isSelected, bool isHovered, GameTime gameTime ) : void