Exemplo n.º 1
0
        private void Controller_StateChanged(object sender, GamePadRemoteControl.XBox.Events.ControllerStateChangedEventArgs e)
        {
            var isPressed = e.CurrentInputState.Gamepad.IsButtonPressed((int)_button);

            if (!_isButtonDown)//Кнопка не нажата. Стандартное состояние
            {
                if (isPressed)
                {
                    _isButtonDown = true;
                    InvokeButtonDown(_button);
                }
            }
            else //Кнопка в нажатом состоянии
            {
                if (_isHandled)//Обработано
                {
                    Reset();
                    return;
                }
                if (!isPressed)//Кнопка отпущена
                {
                    InvokeButtonUp(_button);
                }
            }
        }
Exemplo n.º 2
0
        private void _controller_StateChanged(object sender, GamePadRemoteControl.XBox.Events.ControllerStateChangedEventArgs e)
        {
            switch (_stickType)
            {
            case StickType.Left:
                if (!_controller.LeftThumbStick.Equals(_previosValue))
                {
                    InvokeStickMotion(_controller.LeftThumbStick);
                }
                break;

            case StickType.Right:
                if (!_controller.RightThumbStick.Equals(_previosValue))
                {
                    InvokeStickMotion(_controller.RightThumbStick);
                }
                break;
            }
        }