I am using SlimDX to use my Xbox 360 controller and I would like a way of when pressing a button on the controller the state changes to on and stays on but when I press it again it becomes off. Sort of like a toggle. But I have been unable to do one so far(Just a beginner really).
Thanks for any help. Thomas.
You may use a
bool
to determine if the button is toggled on or off. You will also need to know the gamepad's previous state, so thebool
won't toggle all the time, just because you keep pressing the button.Keep in mind, that you may need to use something other than
GamePad
orGamePadState
, as this is merely pseudo-code