public InputSettings(Display display) { axisName[0] = "X"; axisName[1] = "Y"; axisName[2] = "Z"; axisName[3] = "Rx"; axisName[4] = "Ry"; axisName[5] = "Rz"; InitializeComponent(); mainDisplay = display; pollingReadouts = new Label[2]; pollingReadouts[0] = Joystick1Info; pollingReadouts[1] = Joystick2Info; InputSelect.SelectedIndex = mainDisplay.getInputSource(); this.Show(); }
private void pollingTimer_Tick(object sender, EventArgs e) { if (mainDisplay.getInputSource() == 1) { KeyboardOutput.Text = "Pressed Keys: "; pressedKeys = mainDisplay.getPressedKeys(); if (pressedKeys != null && pressedKeys.Length > 0) { foreach (Key key in pressedKeys) { KeyboardOutput.Text += key.ToString() + " "; } } } else if (mainDisplay.getInputSource() == 0) { state = mainDisplay.getJoystickState(); updateFields(0, WheelSelect.SelectedIndex); updateFields(1, PedalSelect.SelectedIndex); if (axisNotFound) { for (int i = 0; i < 6; i++) { if (axis[i] != (int)state[joyToScan].GetType().GetProperty(axisName[i]).GetValue(state[joyToScan], null)) { switch (axisToSet) { case 0: SteeringAxisSelect.SelectedIndex = i; break; case 1: AcceleratorAxisSelect.SelectedIndex = i; break; case 2: BrakeAxisSelect.SelectedIndex = i; break; } axisNotFound = false; } } } if (buttonNotFound) { for (int i = 0; i < buttons.Length; i++) { if (buttons[joyToScan][i] != 0) { switch (buttonToSet) { case 0: DriveButtonSelect.SelectedIndex = i; break; case 1: ReverseButtonSelect.SelectedIndex = i; break; } buttonNotFound = false; } } } } }