Example #1
0
        public ControllerDevice(Joystick joy, int num)
        {
            joystick     = joy;
            deviceNumber = num;
            name         = joystick.Information.InstanceName;

            joystick.Acquire();
            joystick.Poll();
            JoystickState jState = joystick.GetCurrentState();

            joystick.Unacquire();
            //buttons = jState.GetButtons();
            //dPads = jState.GetPointOfViewControllers();
            analogs = GetAxes(jState);
            sliders = jState.GetSliders();

            cOutput = new OutputState();
            for (int i = 0; i < 50; i++)
            {
                mapping[i] = 255; //Changed default mapping to blank
            }
            byte[] saveData = SaveManager.Load(joy.Information.InstanceGuid.ToString());
            if (saveData != null)   //if there's already a mapping saved, apply it (else, the default mapping is kept)
            {
                mapping = saveData;
            }
        }
Example #2
0
 public ControllerDevice(Joystick joy, int num)
 {
     joystick     = joy;
     deviceNumber = num;
     name         = joystick.Information.InstanceName;
     cOutput      = new OutputState();
     for (int i = 0; i < 42; i++)
     {
         mapping[i] = 255; //Changed default mapping to blank
     }
     byte[] saveData = SaveManager.Load(joy.Information.ProductName.ToString());
     if (saveData != null)
     {
         mapping = saveData;
     }
 }
Example #3
0
        public ControllerDevice(Joystick joy, int num)
        {
            joystick     = joy;
            deviceNumber = num;
            name         = joystick.Information.InstanceName;
            cOutput      = new OutputState();

            joystick.Poll();
            JoystickState jState = joystick.GetCurrentState();

            buttons = jState.GetButtons();
            dPads   = jState.GetPointOfViewControllers();
            analogs = GetAxes(jState);

            for (int i = 0; i < mapping.Length; i++)
            {
                mapping[i] = 255; //Changed default mapping to blank
            }
            byte[] saveData = SaveManager.Load(joy.Information.ProductName.ToString());
            if (saveData != null)
            {
                mapping = saveData;
            }
        }