Пример #1
0
        public override void KeyPressed(KeyPayload payload)
        {
            if (settings.triggerPush || settings.triggerPushAndRelease)
            {
                if (_virtualJoystick == null || !_virtualJoystickAcquired)
                {
                    _virtualJoystick.AcquireVJD(Convert.ToUInt32(settings.vJoyDeviceId));
                }


                if (settings.vJoyElementType == "btn")
                {
                    // Es ist ein Button
                    _virtualJoystick.SetBtn(true, Convert.ToUInt32(settings.vJoyDeviceId), Convert.ToUInt32(settings.vJoyButtonId));
                }
                else
                {
                    // Es ist eine Achse
                    var        axisValue = 0;
                    HID_USAGES theAxis   = getAxisNameByString(settings.vJoyElementType);


                    if (settings.setToMin)
                    {
                        axisValue = GetJoystickAxisMinValue(theAxis);
                    }
                    else if (settings.setToMax)
                    {
                        axisValue = GetJoystickAxisMaxValue(theAxis);
                    }
                    else if (settings.setToCenter)
                    {
                        axisValue = GetJoystickAxisCenter(theAxis);
                    }
                    else if (settings.setToCustom)
                    {
                        axisValue = Convert.ToInt32(settings.setToCustomValue);
                    }
                    else if (settings.setToStepUp)
                    {
                        axisValue = stepUpAxisValue(theAxis, settings.setStepUp);
                    }
                    else if (settings.setToStepDown)
                    {
                        axisValue = stepDownAxisValue(theAxis, settings.setStepDown);
                    }

                    setAxisValue(axisValue, theAxis);
                    axisValues[theAxis] = axisValue;
                }
                _virtualJoystick?.RelinquishVJD(Convert.ToUInt32(settings.vJoyDeviceId));
            }
        }
Пример #2
0
 private void ToggleJoystickButton()
 {
     EnsureAcquireJoystick();
     if (ButtonIsCurrentlyPressed)
     {
         if (_virtualJoystick.SetBtn(false, Convert.ToUInt32(settings.vJoyDeviceId), Convert.ToUInt32(settings.vJoyButtonId)))
         {
             Connection.SetStateAsync(0);
             ButtonIsCurrentlyPressed = false;
         }
     }
     else
     {
         if (_virtualJoystick.SetBtn(true, Convert.ToUInt32(settings.vJoyDeviceId), Convert.ToUInt32(settings.vJoyButtonId)))
         {
             ButtonIsCurrentlyPressed = true;
             Connection.SetStateAsync(1);
         }
     }
 }
Пример #3
0
 public void TestButton()
 {
     Vjoy.SetBtn(true, _vJoyNumber, 3);
 }