Esempio n. 1
0
        private void UpdateState(long tick, GamePadState gamePadState, List <TouchLocation> touches, TouchMapping mapping)
        {
            InputButtons.AButton.SetState(mapping.A.TouchArea != Rectangle.Empty && mapping.A.GetBooleanValue(touches), tick);
            InputButtons.BButton.SetState(mapping.B.TouchArea != Rectangle.Empty && mapping.B.GetBooleanValue(touches), tick);
            InputButtons.XButton.SetState(mapping.X.TouchArea != Rectangle.Empty && mapping.X.GetBooleanValue(touches), tick);
            InputButtons.YButton.SetState(mapping.Y.TouchArea != Rectangle.Empty && mapping.Y.GetBooleanValue(touches), tick);

            InputButtons.DpadDButton.SetState(mapping.DpadDown.TouchArea != Rectangle.Empty && mapping.DpadDown.GetBooleanValue(touches), tick);
            InputButtons.DpadUButton.SetState(mapping.DpadUp.TouchArea != Rectangle.Empty && mapping.DpadUp.GetBooleanValue(touches), tick);
            InputButtons.DpadLButton.SetState(mapping.DpadLeft.TouchArea != Rectangle.Empty && mapping.DpadLeft.GetBooleanValue(touches), tick);
            InputButtons.DpadRButton.SetState(mapping.DpadRight.TouchArea != Rectangle.Empty && mapping.DpadRight.GetBooleanValue(touches), tick);

            InputButtons.ShoulderLButton.SetState(mapping.LeftShoulder.TouchArea != Rectangle.Empty && mapping.LeftShoulder.GetBooleanValue(touches), tick);
            InputButtons.ShoulderRButton.SetState(mapping.RightShoulder.TouchArea != Rectangle.Empty && mapping.RightShoulder.GetBooleanValue(touches), tick);

            InputButtons.BackButton.SetState(gamePadState.Buttons.Back == ButtonState.Pressed, tick);

            InputButtons.StartButton.SetState(mapping.Start.TouchArea != Rectangle.Empty && mapping.Start.GetBooleanValue(touches), tick);
            InputButtons.LeftStickClickButton.SetState(mapping.LeftStickClick.TouchArea != Rectangle.Empty && mapping.LeftStickClick.GetBooleanValue(touches), tick);
            InputButtons.RightStickClickButton.SetState(mapping.RightStickClick.TouchArea != Rectangle.Empty && mapping.RightStickClick.GetBooleanValue(touches), tick);

            InputTriggers.LeftTriggerFloat  = mapping.LeftTrigger.TouchArea == Rectangle.Empty ? 0f : mapping.LeftTrigger.GetFloatValue(touches);
            InputTriggers.RightTriggerFloat = mapping.RightTrigger.TouchArea == Rectangle.Empty ? 0f : mapping.RightTrigger.GetFloatValue(touches);

            InputThumbSticks.LeftStickVector  = mapping.LeftStick.TouchArea == Rectangle.Empty ? Vector2.Zero : mapping.LeftStick.GetVector2Value(touches, DeadZone);
            InputThumbSticks.RightStickVector = mapping.RightStick.TouchArea == Rectangle.Empty ? Vector2.Zero : mapping.RightStick.GetVector2Value(touches, DeadZone);
        }
Esempio n. 2
0
        private void UpdateState(long tick, GamePadState gamePadState, List<TouchLocation> touches, TouchMapping mapping)
        {
            InputButtons.AButton.SetState(mapping.A.TouchArea != Rectangle.Empty && mapping.A.GetBooleanValue(touches), tick);
            InputButtons.BButton.SetState(mapping.B.TouchArea != Rectangle.Empty && mapping.B.GetBooleanValue(touches), tick);
            InputButtons.XButton.SetState(mapping.X.TouchArea != Rectangle.Empty && mapping.X.GetBooleanValue(touches), tick);
            InputButtons.YButton.SetState(mapping.Y.TouchArea != Rectangle.Empty && mapping.Y.GetBooleanValue(touches), tick);

            InputButtons.DpadDButton.SetState(mapping.DpadDown.TouchArea != Rectangle.Empty && mapping.DpadDown.GetBooleanValue(touches), tick);
            InputButtons.DpadUButton.SetState(mapping.DpadUp.TouchArea != Rectangle.Empty && mapping.DpadUp.GetBooleanValue(touches), tick);
            InputButtons.DpadLButton.SetState(mapping.DpadLeft.TouchArea != Rectangle.Empty && mapping.DpadLeft.GetBooleanValue(touches), tick);
            InputButtons.DpadRButton.SetState(mapping.DpadRight.TouchArea != Rectangle.Empty && mapping.DpadRight.GetBooleanValue(touches), tick);

            InputButtons.ShoulderLButton.SetState(mapping.LeftShoulder.TouchArea != Rectangle.Empty && mapping.LeftShoulder.GetBooleanValue(touches), tick);
            InputButtons.ShoulderRButton.SetState(mapping.RightShoulder.TouchArea != Rectangle.Empty && mapping.RightShoulder.GetBooleanValue(touches), tick);

            InputButtons.BackButton.SetState(gamePadState.Buttons.Back == ButtonState.Pressed, tick);

            InputButtons.StartButton.SetState(mapping.Start.TouchArea != Rectangle.Empty && mapping.Start.GetBooleanValue(touches), tick);
            InputButtons.LeftStickClickButton.SetState(mapping.LeftStickClick.TouchArea != Rectangle.Empty && mapping.LeftStickClick.GetBooleanValue(touches), tick);
            InputButtons.RightStickClickButton.SetState(mapping.RightStickClick.TouchArea != Rectangle.Empty && mapping.RightStickClick.GetBooleanValue(touches), tick);

            InputTriggers.LeftTriggerFloat = mapping.LeftTrigger.TouchArea == Rectangle.Empty ? 0f : mapping.LeftTrigger.GetFloatValue(touches);
            InputTriggers.RightTriggerFloat = mapping.RightTrigger.TouchArea == Rectangle.Empty ? 0f : mapping.RightTrigger.GetFloatValue(touches);

            InputThumbSticks.LeftStickVector = mapping.LeftStick.TouchArea == Rectangle.Empty ? Vector2.Zero : mapping.LeftStick.GetVector2Value(touches, DeadZone);
            InputThumbSticks.RightStickVector = mapping.RightStick.TouchArea == Rectangle.Empty ? Vector2.Zero : mapping.RightStick.GetVector2Value(touches, DeadZone);
        }