Exemple #1
0
 public static void SetAxisDeadzone(int controller, int axis, float dz_index)
 {
     Overload.Controller controller1 = Controls.m_controllers[controller];
     if (axis == -1)
     {
         for (axis = 0; axis < controller1.m_joystick.axisCount; axis++)
         {
             SetAxisDeadzone(controller, axis, dz_index);
         }
         return;
     }
     if (controller1.isConnected)
     {
         controller1.m_joystick.calibrationMap.GetAxis(axis).deadZone = (float)dz_index / 200f;
         Controllers.controllers[controller].axes[axis].deadzone      = dz_index;
     }
 }
Exemple #2
0
 static void WriteControlDataToStream(StreamWriter w)
 {
     w.WriteLine(Controls.CONFIG_KEY + Controls.VERSION);
     bool[] array = new bool[Controls.m_controllers.Count];
     array.Populate(true);
     w.WriteLine(Controls.m_controllers.Count);
     for (int i = 0; i < Controls.m_controllers.Count; i++)
     {
         Overload.Controller controller = Controls.m_controllers[i];
         w.WriteLine((!array[i]) ? string.Empty : controller.name);
         if (array[i])
         {
             w.WriteLine(controller.m_axis_count);
             for (int j = 0; j < controller.m_axis_count; j++)
             {
                 w.WriteLine(Controllers.controllers[i].axes[j].deadzone);
                 w.WriteLine(Controllers.controllers[i].axes[j].sensitivity);
             }
         }
     }
 }
Exemple #3
0
 public static void SetAxisSensitivity(int controller, int axis, float sensitivity)
 {
     Overload.Controller controller1 = Controls.m_controllers[controller];
     if (axis == -1)
     {
         for (axis = 0; axis < controller1.m_joystick.axisCount; axis++)
         {
             SetAxisSensitivity(controller, axis, sensitivity);
         }
         return;
     }
     if (controller1.isConnected)
     {
         float sens = (float)sensitivity;
         sens *= 0.0145f;
         sens += 0.75f;
         controller1.m_joystick.calibrationMap.GetAxis(axis).sensitivity     = sens;
         controller1.m_joystick.calibrationMap.GetAxis(axis).sensitivityType = Rewired.AxisSensitivityType.Multiplier;
         Controllers.controllers[controller].axes[axis].sensitivity          = sensitivity;
     }
 }