Example #1
0
        /** <summary> Updates the debug menu with mouse controls. </summary> */
        private void UpdateMouseControls()
        {
            // Open submenus when highlighted.
            if (mouseHoverItem != CurrentMenu && mouseHoverItem != null)
            {
                currentItem = mouseHoverItem;
                if (mouseHoverItem.Items.Count > 0)
                {
                    StepIntoSubMenu();
                }
            }

            if (currentItem != null)
            {
                // Create path from highlighted item.
                currentPath.Clear();
                ReconstructPath(currentItem);

                // [Left] Click on the item and then close the menu.
                if (Mouse.IsButtonPressed(MouseButtons.Left) && mouseHoverItem != null)
                {
                    if (currentItem.Items.Count == 0)
                    {
                        currentItem.Press();
                        Close();
                    }
                }

                // [Right] Click on the item without closing the menu.
                else if (Mouse.IsButtonPressed(MouseButtons.Right) && mouseHoverItem != null)
                {
                    if (currentItem.Items.Count == 0)
                    {
                        currentItem.Press();
                    }
                }
            }
        }
Example #2
0
 public override bool Pressed()
 {
     return(Mouse.IsButtonPressed(ButtonCode));
 }