Hi,
I am using C# and DirectX to query a Joystick connected to a Game Port, to see which buttons are pressed. Calling Device.CurrentJoystickState.GetButtons() is giving me the data that I need, but only once a button is pressed. Until then the array is all 0's.
For example, if button 1 is held on then the app is started, all 4 buttons show as off. If I turn, say, button 3 on, then buttons 1 AND 3 instantly show as being on. So turning any button on refreshes the state of all buttons.
So does anyone know why I am not getting the initial state of the buttons, and/or how I can?
My code is based loosely (well actually quite tightly!) around the example at http://www.codeproject.com/KB/directx/joystick.aspx. The example there, if you download it, has exactly the same results.
Finally, does anyone know what the 4 differnent "modes" on a game port are? (it is a switch on the USB to Game Port adapter that I have). It doesn't seem to make any difference to my issue anyway.
Thanks in advance.
Chris
Loading
Chris VocePosted Jun 8, 2011, 7:01 PM
Does anyone have any ideas? Or if you agree that this isn't possible then let me know that too.
I think I am going to have to build a hardware workaround with a 555 timer to toggle a spare input every second or so to refresh everything - but that wastes an input and seems a bit of a rubbish solution.
Cheers,
Chris
Jaganathan BantheswaranPosted Jun 6, 2011, 1:38 AM
Why you need to hold the Button before starting the app. It is the problem i guess.