Beispiel #1
0
        protected void AssignRadialDeadZonePass1(string parSourceAxisA, string parSourceAxisB, double parDeadZone)
        {
            if ((parDeadZone < 0) | (parDeadZone > 1))
            {
                throw new ArgumentOutOfRangeException("parDeadZone", "DeadZone must be bettween 0-1");
            }
            HID_USAGES srcAxisA = StringToHID(parSourceAxisA);
            HID_USAGES srcAxisB = StringToHID(parSourceAxisB);

            if ((int)srcAxisA == -1)
            {
                throw new ArgumentException("parSourceAxisA", "Invalid Axis");
            }
            if ((int)srcAxisB == -1)
            {
                throw new ArgumentException("parSourceAxisB", "Invalid Axis");
            }

            RadialDeadZone newDeadzone = new RadialDeadZone();

            newDeadzone.AxisX    = srcAxisA;
            newDeadzone.AxisY    = srcAxisB;
            newDeadzone.DeadZone = parDeadZone;
            m_DeadZones.Add(newDeadzone);
        }
Beispiel #2
0
 protected void AssignDeadZonePass2()
 {
     foreach (DeadZone deadzone in m_DeadZones)
     {
         Type dzType = deadzone.GetType();
         #region Axial
         if (dzType == typeof(AxialDeadZone))
         {
             AxialDeadZone adz = (AxialDeadZone)deadzone;
             //Check if Axis is enabled
             int axisID = (int)adz.Axis - 48;
             if (!m_EnabledAxis[axisID])
             {
                 throw new Exception("DeadZone on inactive axis");
             }
             if (m_AxisL2 == adz.Axis | m_AxisL2 == adz.Axis)
             {
                 adz.AType = AxisType.Trigger;
             }
             else
             {
                 adz.AType = AxisType.Stick;
             }
         }
         #endregion
         #region Radial
         else if (dzType == typeof(RadialDeadZone))
         {
             RadialDeadZone rdz = (RadialDeadZone)deadzone;
             //Check if Axis is enabled
             int axisIDX = (int)rdz.AxisX - 48;
             int axisIDY = (int)rdz.AxisY - 48;
             if (!(m_EnabledAxis[axisIDX] & m_EnabledAxis[axisIDY]))
             {
                 throw new Exception("DeadZone on inactive axis");
             }
             AxisType at;
             if (m_AxisL2 == rdz.AxisX | m_AxisL2 == rdz.AxisX)
             {
                 at = AxisType.Trigger;
             }
             else
             {
                 at = AxisType.Stick;
             }
             if (m_AxisL2 == rdz.AxisY | m_AxisL2 == rdz.AxisY)
             {
                 if (at != AxisType.Trigger)
                 {
                     throw new Exception("Axis Types Must Match");
                 }
             }
             else
             {
                 if (at != AxisType.Stick)
                 {
                     throw new Exception("Axis Types Must Match");
                 }
             }
             rdz.AType = at;
         }
         #endregion
     }
 }
Beispiel #3
0
        protected void AssignRadialDeadZonePass1(string parSourceAxisA, string parSourceAxisB, double parDeadZone)
        {
            if ((parDeadZone < 0) | (parDeadZone > 1))
            {
                throw new ArgumentOutOfRangeException("parDeadZone", "DeadZone must be bettween 0-1");
            }
            HID_USAGES srcAxisA = StringToHID(parSourceAxisA);
            HID_USAGES srcAxisB = StringToHID(parSourceAxisB);
            if ((int)srcAxisA == -1)
            {
                throw new ArgumentException("parSourceAxisA", "Invalid Axis");
            }
            if ((int)srcAxisB == -1)
            {
                throw new ArgumentException("parSourceAxisB", "Invalid Axis");
            }

            RadialDeadZone newDeadzone = new RadialDeadZone();
            newDeadzone.AxisX = srcAxisA;
            newDeadzone.AxisY = srcAxisB;
            newDeadzone.DeadZone = parDeadZone;
            m_DeadZones.Add(newDeadzone);
        }