Game Development Community

Enabling joystick makes TGE crash at exit

by Gerald C · in Torque Game Engine · 01/31/2008 (6:23 am) · 0 replies

Hi,

I'm trying to use a xbox gamepad in Starter.fps (TGE 1.5.2) and it works well except when I quit the engine, Torque crashes. It's the same if I use Alt-tab or the closing cross of the windows, but it doesn't crash if I leave the mission and I use the Quit button.

Here is my code :

if (IsJoystickDetected())
{
	echo("Joystick detected, using joystick");
	enableJoystick();

	moveMap.bind( joystick0, xaxis, moveleft);
	moveMap.bind( joystick0, xaxis, moveright);
	moveMap.bind( joystick0, yaxis, moveforward);
	moveMap.bind( joystick0, yaxis, movebackward);
	moveMap.bind( joystick0, rxaxis, yaw);
	moveMap.bind( joystick0, ryaxis, pitch);
	moveMap.bind( joystick0, button10, jump);	
	moveMap.bind( joystick0, button0, mouseFire);
	moveMap.bind( joystick0, button3, setZoomFOV);
	moveMap.bind( joystick0, button2, toggleZoom);
	moveMap.bind( joystick0, button5, toggleFreeLook);
	moveMap.bind( joystick0, button6, toggleFirstPerson);
	moveMap.bind( joystick0, button7, toggleCamera);
}
else 
{
	echo("Joystick not detected, using keyboard");

	moveMap.bind( keyboard, a, moveleft );
	moveMap.bind( keyboard, d, moveright );
	moveMap.bind( keyboard, w, moveforward );
	moveMap.bind( keyboard, s, movebackward );
	moveMap.bind( mouse, xaxis, yaw );
	moveMap.bind( mouse, yaxis, pitch );
	moveMap.bind( keyboard, space, jump );
	moveMap.bind( mouse, button0, mouseFire );
	moveMap.bind( keyboard, r, setZoomFOV);
	moveMap.bind( keyboard, e, toggleZoom);
	moveMap.bind( keyboard, z, toggleFreeLook );
	moveMap.bind( keyboard, tab, toggleFirstPerson );
	moveMap.bind( keyboard, "alt c", toggleCamera);
}

If I comment the line enableJoystick(), there's no crash when I quit, but I can't use the joystick anymore.

Any help ?