コード例 #1
0
        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            if (ListOpen)
            {
                for (int i = 0; i < Items.Count; i++)
                {
                    GUIComponent c = Items[i];
                    if (c != null)
                    {
                        c.Update(gameTime);
                    }
                    if (disposed)
                    {
                        return;
                    }
                }

                for (int i = 0; i < components.Count; i++)
                {
                    GUIComponent c = components[i];
                    if (c != null)
                    {
                        c.Update(gameTime);
                    }
                    if (disposed)
                    {
                        return;
                    }
                }
            }
            else
            {
                if (currentItem != null)
                {
                    currentItem.Update(gameTime);
                }
                if (OpenCloseList != null)
                {
                    OpenCloseList.Update(gameTime);
                }

                if (disposed)
                {
                    return;
                }
            }

            base.Update(gameTime);
        }
コード例 #2
0
        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            //no point updating if there's no input thing!
            if (input == null)
            {
                return;
            }
            Vector2 mouseLoc = input.MousePosition;

            if (input.IsMouseButtonPressed("left") && (titleBarBounds.Contains(Convert.ToInt32(mouseLoc.X), Convert.ToInt32(mouseLoc.Y)) || ignoreMouseOutOfBounds))
            {
                ignoreMouseOutOfBounds = true;
                UpdateLocation(input.GetMouseDisplacement());
            }
            else if (input.IsMouseButtonClicked("right") && (titleBarBounds.Contains(Convert.ToInt32(mouseLoc.X), Convert.ToInt32(mouseLoc.Y)) || ignoreMouseOutOfBounds))
            {
                minimised = !minimised;
            }
            else
            {
                ignoreMouseOutOfBounds = false;
            }

            //if (fontDimensions == Vector2.Zero)
            //    Caption = Caption;
            for (int i = 0; i < components.Count; i++)
            {
                GUIComponent c = components[i];
                if (c != null)
                {
                    c.Update(gameTime);
                }
                c = null;
                if (disposed)
                {
                    return;
                }
            }
            base.Update(gameTime);
        }