示例#1
0
        public static bool CtrlPressed(string pressedFlag = "LR", bool triggerButtons = true)
        {
            // TODO
            //if (System.Windows.Forms.Control.ModifierKeys == (System.Windows.Forms.Keys.Control || System.Windows.Forms.Keys.Alt))
            //{
            //    return false;
            //}
            if (pressedFlag.Contains("L") && KeyBoardHandler.KeyDown(Keys.LeftControl))
            {
                return(true);
            }
            if (pressedFlag.Contains("L") && ControllerHandler.ButtonDown(Buttons.LeftTrigger) && triggerButtons)
            {
                return(true);
            }
            if (pressedFlag.Contains("R") && KeyBoardHandler.KeyDown(Keys.RightControl))
            {
                return(true);
            }
            if (pressedFlag.Contains("R") && ControllerHandler.ButtonDown(Buttons.RightTrigger) && triggerButtons)
            {
                return(true);
            }

            return(false);
        }
示例#2
0
 public static bool Down(bool pressed, bool arrowKeys = true, bool scroll = true, bool wasd = true, bool thumbStick = true, bool dPad = true)
 {
     if (Core.GameInstance.IsActive)
     {
         if (MouseHandler.WindowContainsMouse && scroll)
         {
             if (MouseHandler.GetScrollWheelChange() < 0)
             {
                 return(true);
             }
         }
         if (pressed)
         {
             return(CheckDirectionalPress(PressDirections.Down, Core.KeyBindings.BackwardMove, Core.KeyBindings.Down, Buttons.LeftThumbstickDown, Buttons.DPadDown, arrowKeys, wasd, thumbStick, dPad));
         }
         if (wasd)
         {
             if (KeyBoardHandler.KeyDown(Core.KeyBindings.BackwardMove))
             {
                 return(true);
             }
         }
         if (arrowKeys)
         {
             if (KeyBoardHandler.KeyDown(Core.KeyBindings.Down))
             {
                 return(true);
             }
         }
         if (thumbStick)
         {
             if (ControllerHandler.ButtonDown(Buttons.LeftThumbstickDown))
             {
                 return(true);
             }
         }
         if (dPad)
         {
             if (ControllerHandler.ButtonDown(Buttons.DPadDown))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
示例#3
0
 public static bool ShiftDown(string pressedFlag = "LR", bool triggerButtons = true)
 {
     if (pressedFlag.Contains("L") && KeyBoardHandler.KeyDown(Keys.LeftShift))
     {
         return(true);
     }
     if (pressedFlag.Contains("L") && ControllerHandler.ButtonDown(Buttons.LeftTrigger) && triggerButtons)
     {
         return(true);
     }
     if (pressedFlag.Contains("R") && KeyBoardHandler.KeyDown(Keys.RightShift))
     {
         return(true);
     }
     if (pressedFlag.Contains("R") && ControllerHandler.ButtonDown(Buttons.RightTrigger) && triggerButtons)
     {
         return(true);
     }
     return(false);
 }
示例#4
0
        private static bool CheckDirectionalPress(PressDirections direction, Keys wasdKey, Keys directionalKey, Buttons thumbStickDirection, Buttons dPadDirecion, bool arrowKeys, bool wasd, bool thumbStick, bool dPad)
        {
            bool command = false;

            if (wasd)
            {
                if (KeyBoardHandler.KeyDown(wasdKey))
                {
                    command = true;
                    if (HoldDownPress(direction))
                    {
                        return(true);
                    }
                    if (KeyBoardHandler.KeyPressed(wasdKey))
                    {
                        ChangeDirectionPressed(direction);
                        return(true);
                    }
                }
            }
            if (arrowKeys)
            {
                if (KeyBoardHandler.KeyDown(directionalKey))
                {
                    command = true;
                    if (HoldDownPress(direction))
                    {
                        return(true);
                    }
                    if (KeyBoardHandler.KeyPressed(directionalKey))
                    {
                        ChangeDirectionPressed(direction);
                        return(true);
                    }
                }
            }
            if (thumbStick)
            {
                if (ControllerHandler.ButtonDown(thumbStickDirection))
                {
                    command = true;
                    if (HoldDownPress(direction))
                    {
                        return(true);
                    }
                    if (ControllerHandler.ButtonPressed(thumbStickDirection))
                    {
                        ChangeDirectionPressed(direction);
                        return(true);
                    }
                }
            }
            if (dPad)
            {
                if (ControllerHandler.ButtonDown(dPadDirecion))
                {
                    command = true;
                    if (HoldDownPress(direction))
                    {
                        return(true);
                    }
                    if (ControllerHandler.ButtonPressed(dPadDirecion))
                    {
                        ChangeDirectionPressed(direction);
                        return(true);
                    }
                }
            }

            if (command == false)
            {
                ResetDirectionPressed(direction);
            }

            return(false);
        }