
[Solved Mostly]Can't read joystick properly
Posted Sunday, 6 June, 2010 - 19:37 by Tal inHere is my Joystick test(part of a GameWindow code and I use VS debugger):
protected override void OnUpdateFrame(FrameEventArgs e) { base.OnUpdateFrame(e); if (Keyboard[Key.Escape]) Exit(); int cont = Joysticks[0].Button.Count; for (int i = 0; i < cont; i++ ) if (Joysticks[0].Button[i]) throw (new Exception()); }
As you can guess by the title, no exeption is thrown when I push all the buttons!
I also check that the I have one and only one joystick by this test:
protected override void OnUpdateFrame(FrameEventArgs e) { base.OnUpdateFrame(e); if (Keyboard[Key.Escape]) Exit(); int cont = Joysticks.Count; if (cont == 1) throw (new Exception()); }
And as you can guess, the exeption was thrown.
(Please don't critic me about my tests that they are'nt like NUnit and etc. :-) )
My joystick is made by Xcom and it looks like a standard Playstation's joystick. Here is a picture of it(sorry about the size):

It's fully supported by DirectX, and I play TrackMania with it without problems.
So what is the problem here?


Comments
Re: Can't read joystick properly
very good work JWman,
thanks a lot for sharing!
int 10h
Re: Can't read joystick properly
Thanks for this, helped me to solve a problem