c# - Toggle an input -
c# - Toggle an input -
i using slimdx utilize xbox 360 controller , way of when pressing button on controller state changes on , stays on when press 1 time again becomes off. sort of toggle. have been unable 1 far(just beginner really).
thanks help. thomas.
you may utilize bool determine if button toggled on or off. need know gamepad's previous state, bool won't toggle time, because maintain pressing button.
bool mycommand = false; // declare bool gamepadstate oldstate; // need know previous state of gamepad public void update() { if (gamepad.getstate().keypressed == /*key*/ && oldstate.keypressed != /*key*/) mycommand = !mycommand; oldstate = gamepad.getstate(); } keep in mind, may need utilize other gamepad or gamepadstate, simply pseudo-code
c# windows-7 toggle slimdx gamepad
Comments
Post a Comment