Exemple #1
0
        public static bool ButtonJustUpGeneric(ButtonGeneric b)
        {
            int btnID = (int)b;

            if (btnID >= 400)
            {
                lastPlayerId = (btnID - 400) / 100;
                return PadJustUp(lastPlayerId, (GamePadButton)(btnID % 100));
            }
            else if (btnID < 300)
            {
                if (KeyJustUp((Keys)btnID))
                {
                    lastPlayerId = 8; //Keyboard;
                    return true;
                }
            }
            else if (btnID < 320)
            {
                if (MouseJustUp((MouseButton)(btnID - 300)))
                {
                    lastPlayerId = 10; //Mouse;
                    return true;
                }
            }
            #if WINDOWS_PHONE || ANDROID || IOS || WINRT
            else // if (btnID < 400)
            {
                GenericTouchInput touchInput = (GenericTouchInput)(btnID - 320);
                if (touchInput == GenericTouchInput.TapAnywhere)
                {
                    return TouchTwinStick.JustTapped;
                }
                else if (touchInput == GenericTouchInput.TapLeftSide)
                {
                    return TouchTwinStick.JustTapped &&
                        TouchTwinStick.leftStickStartRegion.Contains((int)TouchTwinStick.TapPosition.X, (int)TouchTwinStick.TapPosition.Y);
                }
                else if (touchInput == GenericTouchInput.TapRightSide)
                {
                    return TouchTwinStick.JustTapped &&
                        TouchTwinStick.rightStickStartRegion.Contains((int)TouchTwinStick.TapPosition.X, (int)TouchTwinStick.TapPosition.Y);
                }
            }
            #endif
            return false;
        }
Exemple #2
0
 public static bool ButtonDownGeneric(ButtonGeneric b)
 {
     int btnID = (int)b;
     if (btnID >= 400)
     {
         // Calculate controller Id
         int padId = (btnID - 400) / 100;
         if (PadDown(padId, (GamePadButton)(btnID % 100)))
         {
             lastPlayerId = padId;
             return true;
         }
     }
     else if (btnID < 300)
     {
         if (KeyDown((Keys)btnID))
         {
             lastPlayerId = 8; //Keyboard;
             return true;
         }
     }
     else if (btnID < 320)
     {
         if (MouseDown((MouseButton)(btnID - 300)))
         {
             lastPlayerId = 10; //Mouse;
             return true;
         }
     }
     #if WINDOWS_PHONE || ANDROID || IOS || WINRT
     else
     {
         GenericTouchInput touchInput = (GenericTouchInput)(btnID - 320);
         if (touchInput == GenericTouchInput.TouchAnywhere)
         {
             return TouchTwinStick.TouchCount > 0;
         }
         else if (touchInput == GenericTouchInput.TouchLeftSide)
         {
             return TouchTwinStick.UsingLeftStick;
         }
         else if (touchInput == GenericTouchInput.TouchRightSide)
         {
             return TouchTwinStick.UsingRightStick;
         }
     }
     #endif
     return false;
 }
Exemple #3
0
        public static bool ButtonJustUpGeneric(ButtonGeneric b)
        {
            int btnID = (int)b;
            if (btnID < 300)
            {
                if (KeyJustUp((Keys)btnID))
                {
                    lastPlayerId = 8; //Keyboard;
                    return true;
                }
            }
            else if (btnID < 400)
            {
                if (MouseJustUp((MouseButton)(btnID - 300)))
                {
                    lastPlayerId = 10; //Mouse;
                    return true;
                }
            }
            else
            {
                lastPlayerId = (btnID - 400) / 100;
                return PadJustUp(lastPlayerId, (GamePadButton)(btnID % 100));
            }

            return false;
        }
Exemple #4
0
 public static void AddGenericMapping(MenuInputs menuInput, ButtonGeneric button)
 {
     List<ButtonGeneric> buttons = new List<ButtonGeneric>(ButtonMappings[(int)menuInput]);
     buttons.Add(button);
     ButtonMappings[(int)menuInput] = buttons.ToArray();
 }
Exemple #5
0
 public static bool ButtonDownGeneric(ButtonGeneric b)
 {
     int btnID = (int)b;
     if (btnID >= 400)
     {
         // Calculate controller Id
         int padId = (btnID - 400) / 100;
         if (PadDown(padId, (GamePadButton)(btnID % 100)))
         {
             lastPlayerId = padId;
             return true;
         }
     }
     else if (btnID < 300)
     {
         if (KeyDown((Keys)btnID))
         {
             lastPlayerId = 8; //Keyboard;
             return true;
         }
     }
     else // if (btnID < 400)
     {
         if (MouseDown((MouseButton)(btnID - 300)))
         {
             lastPlayerId = 10; //Mouse;
             return true;
         }
     }
     return false;
 }