GettingTorqueConsoleReady

From TDN

Introduction

Torque and TGEA are running on Xbox, PS2, Xbox 360 and more are on the horizon. Making your game console-ready with Torque while still on the PC is very easy if you follow a few guidelines. You need a Torque Console License before you can publish your game on a console, but that doesn't stop you from preparing for the future today by preparing your game to support gamepads and the like.

Enable Direct Input

Firstly, you need to do the following:

$enableDirectInput = "1";
activateDirectInput();

To enable DirectInput. This has already been done in the examples for Torque 1.4 in PlayGui.cs. The Gamepad runs through DirectInput and, by default, Torque does not enable DirectInput until you are "in game". You can then bind commands to the gamepad just like you would any other device:

GlobalActionMap.bindCmd( gamepad, btn_a, "echo(make);", "echo(break);" );

Note that there are two ways to reference buttons, by default. There is Xbox controller syntax support, so 'btn_a' is the same as 'button0' in Torque. More can be added if you look at SDK\engine\sim\actionMap.cc and find the strings.

Enable Gamepads

Of course you also need to enable gamepad input. Simply include this line in _prefs.cs_:

$pref::Input::GamepadEnabled = "1";

But that might be a little weird, because prefs.cs is a generated file in the 1.4 examples. So you could also use a script command:

enableJoystick();
disableJoystick();

--Pat Wilson 17:41, 17 Jun 2005 (CDT)