Exemplo n.º 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;
            }
        }
Exemplo n.º 2
0
        public ControllerDevice(Joystick joy, int num)
        {
            joystick = joy;
            deviceNumber = num;
            name = joystick.Information.InstanceName;
            cOutput = new OutputState();

            //initialize values
            joystick.Poll();
            JoystickState jState = joystick.GetCurrentState();
            buttons = jState.GetButtons();
            dPads = jState.GetPointOfViewControllers();
            analogs = GetAxes(jState);
            
            //TODO: delete this code.  Initial value is already blank.
            //for (int i = 0; i < controlMappings.Length; i++)
            //{
            //    controlMappings[i] = 255; //Changed default mapping to blank
            //}

            var saveData = SaveManager.LoadDeviceControls(joy.Information.ProductName.ToString());
            if (saveData != null)
            {
                controlMappings = saveData;
            }
        }
Exemplo n.º 3
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.ProductGuid.ToString());
     if (saveData != null)
         mapping = saveData;
 }
Exemplo n.º 4
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;
     }
 }
Exemplo n.º 5
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;
            }
        }