
GameWindow.Joysticks doesn't work
Posted Tuesday, 5 January, 2010 - 17:06 by hackulator inHi,
I'm trying to get the state of a Gamepad by using the GameWindow.Joysticks collection.
Joysticks.Count is 1 when the Gamepad is plugged in but the axes of Joysticks[0] are always 0.0 and the buttons are always unpressed.
Do I have to initialize the Joystick before I can use it?
I have WinXP, OpenTK 1.0 beta 2 and .NET Framework 3.5.
Here is a short code snippet:
protected override void OnUpdateFrame(FrameEventArgs e) { base.OnUpdateFrame(e); // Exit Game if (this.Keyboard[Key.Escape]) // the keyboard works as expected this.Exit(); // Gamepad if (this.Joysticks.Count > 0) { this.Title = this.Joysticks[0].Axis[0].ToString(); // Title will always be "0". The same for the other axes. } }
Thanks in advance.


Comments
Re: GameWindow.Joysticks doesn't work
Hi,
I'm seeing this issue as well, using an XBox 360 controller in Windows 7 64 bit. In addition, the events for Pressed, ButtonUp/ButtonDown are never fired.
Cheers,
Euan