示例#1
0
        protected void AssignAxialDeadZonePass1(string parSourceAxis, double parDeadZone)
        {
            if ((parDeadZone < 0) | (parDeadZone > 1))
            {
                throw new ArgumentOutOfRangeException("parDeadZone", "DeadZone must be bettween 0-1");
            }
            HID_USAGES srcAxis = StringToHID(parSourceAxis);

            if ((int)srcAxis == -1)
            {
                throw new ArgumentException("parSourceAxis", "Invalid Axis");
            }

            AxialDeadZone newDeadzone = new AxialDeadZone();

            newDeadzone.Axis     = srcAxis;
            newDeadzone.DeadZone = parDeadZone;
            m_DeadZones.Add(newDeadzone);
        }
示例#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
     }
 }
示例#3
0
        protected void AssignAxialDeadZonePass1(string parSourceAxis, double parDeadZone)
        {
            if ((parDeadZone < 0) | (parDeadZone > 1))
            {
                throw new ArgumentOutOfRangeException("parDeadZone", "DeadZone must be bettween 0-1");
            }
            HID_USAGES srcAxis = StringToHID(parSourceAxis);
            if ((int)srcAxis == -1)
            {
                throw new ArgumentException("parSourceAxis", "Invalid Axis");
            }

            AxialDeadZone newDeadzone = new AxialDeadZone();
            newDeadzone.Axis = srcAxis;
            newDeadzone.DeadZone = parDeadZone;
            m_DeadZones.Add(newDeadzone);
        }