hackulator's picture

GameWindow.Joysticks doesn't work

Hi,

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

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
emacinnes's picture

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