Exemple #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            JoystickHelper            helper    = new JoystickHelper();
            List <JoystickDescriptor> joysticks = helper.DetectDevices();

            foreach (JoystickDescriptor jd in joysticks)
            {
                gamepadsComboBox.Items.Add(jd);
            }
            if (joysticks.Count > 0)
            {
                gamepadsComboBox.SelectedIndex = 0;
            }
            else
            {
                MessageBox.Show("Cannot find any gamepads");
                loadConfigButton.Enabled = false;
                saveConfigButton.Enabled = false;
            }

            helper.StopCapture();

            buttonNames     = new string[] { "A", "B", "X", "Y", "LShoulder", "RShoulder", "Select", "Start", "LTrigger", "RTrigger" };
            buttonTextBoxes = new TextBox[] { ATextbox, BTextbox, XTextbox, YTextbox, LSTextbox, RSTextbox, SelectTextbox, StartTextbox, LTTextbox, RTTextbox };
            tryToAutomaticallyLoadConfigFile();

            string appDataFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            string oriProfileFolder  = appDataFolderPath + "\\" + "Ori and the Blind Forest DE";

            saveFileDialog1.InitialDirectory = oriProfileFolder;
        }
Exemple #2
0
        private void gamepadsComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            JoystickDescriptor joystick = (JoystickDescriptor)gamepadsComboBox.SelectedItem;

            if (joystickHelper != null)
            {
                joystickHelper.StopCapture();
                joystickHelper = null;
            }
            joystickHelper = new JoystickHelper();
            joystickHelper.JoystickButtonPressed += onJoystickButton;
            joystickHelper.StartCapture(joystick.instanceGuid);
        }