Joystick

Started by bottomleypotts, August 12, 2023, 01:48:16 PM

Previous topic - Next topic

bottomleypotts

Is it possible to read joystick keys in Winbatch?

td

I guess it is possible as long as the "keys" map to standard keyboard keys. Never tried it though.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

ChuckC

What are joystick "keys"?  Are you referring to the various button controls that may be present on a joystick, or is this some kind of fancy hybrid joystick device that has an actual keypad on with a couple of keys that look like they are from a numeric keypad or regular full size keyboard?

td

I was assuming that the device driver for the Joy Stick was generating the equivalent of arrow-key key codes or something like it. Since I vaguely remember that being the case in the last century, that assumption is likely completely wrong.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

JTaylor

I would suggest creating a script using WaitForKeyEx() in a while loop and load it with possible keys like the arrow keys and see if it is triggered by any of those.

Jim

ChuckC

I used to play "Mechwarrior" a lot as well as indulging in Microsoft Flight Simulator back in the early/mid 2000's, and I had all kinds of gaming controllers hooked up via USB... a Cyborg 3D joystic that had 3 axis plus all kinds of buttons such as a main trigger on the front of the stick handle, a directional "hat" controller on the top and left & right side firing buttons as well as 10 programmable keys on the base, plus an external Nostromo gamepad that had a small programmable keyboard and a D-pad controller, along with a set of rudder pedals.  In most cases, the device driver and user-mode configuration software would make all of the "keys" send various keystrokes, but the joystick fire buttons didn't work that way... they were handled via the same game controller interface that the various axis position readings were handled for yaw, pitch, roll, throttle, etc.  Somewhere in Microsoft's documentation, possibly in whatever the descendent of or successor to DirectX is, there are functions for USB HID devices of the gaming controller type.  Consuming that interface functionality is where I'd have expected program could would have to go in terms of detecting button presses for the joystick fire button as opposed to detecting a keystroke from a programmable key.