//gamepad thumb stick private void stickValueRequest(GamepadStates gpStick) { elevationLabelValue.Text = Convert.ToString(gpStick.LeftStick.Position.Y); elevationTrackBar.Value = Convert.ToInt32(gpStick.LeftStick.Position.Y); moveXLabelValue.Text = Convert.ToString(gpStick.RightStick.Position.X); moveXTrackBar.Value = Convert.ToInt32(gpStick.RightStick.Position.X); moveYLabelValue.Text = Convert.ToString(gpStick.RightStick.Position.Y); moveYTrackBar.Value = Convert.ToInt32(gpStick.RightStick.Position.Y); }
private void timer1_Tick(object sender, EventArgs e) { GamepadStates g = new GamepadStates(UserIndex.One); if (g.Connected) { joystickStatus.Text = "Joystick Connected"; JoystickProgressBar.Value = 10; System.Threading.Thread.Sleep(10); g.Update(); stickValueRequest(g); buttonPushRequests(g); } else { joystickStatus.Text = "Joystick Not Connected"; JoystickProgressBar.Value = 0; } }
// gampad buttons private void buttonPushRequests(GamepadStates gp) { if (gp.X) { if (radioButton1.Checked) radioButton1.Checked = false; else radioButton1.Checked = true; } if (gp.Y) { if (radioButton4.Checked) radioButton4.Checked = false; else radioButton4.Checked = true; } if (gp.A) { if (radioButton2.Checked) radioButton2.Checked = false; else radioButton2.Checked = true; } if (gp.B) { if (radioButton3.Checked) radioButton3.Checked = false; else radioButton3.Checked = true; } if (gp.LeftShoulder) { if (radioButton5.Checked) radioButton5.Checked = false; else radioButton5.Checked = true; } if (gp.RightShoulder) { if (radioButton6.Checked) radioButton6.Checked = false; else radioButton6.Checked = true; } }