GrandLarceny.Button.update C# (CSharp) Method

update() public method

public update ( ) : bool
return bool
        public virtual bool update()
        {
            if (!m_isVisible) {
                return false;
            }
            if (m_bounds.Contains(Mouse.GetState().X, Mouse.GetState().Y))
            {
                m_isFocused = true;
                if (MouseHandler.lmbDown() && m_currentState != State.Pressed)
                {
                    playDownSound();
                    m_isPressed = true;
                }
                if (m_isPressed && MouseHandler.lmbUp())
                {
                    playUpSound();
                    m_isPressed = false;
                    if (m_clickEvent != null)
                    {
                        m_clickEvent(this);
                    }
                }
            }
            else if (hotkeyPressed())
            {
                if (m_downSound != null)
                {
                    m_downSound.play();
                }
                m_isPressed = true;
                if (m_clickEvent != null)
                {
                    m_clickEvent(this);
                }
            }
            else
            {
                m_isPressed = false;
                m_isFocused = false;
            }
            return m_isPressed;
        }