Problems with joysticks and Actionmaps
by Hans Egermeier · in Torque Game Builder · 06/16/2006 (8:31 am) · 1 replies
We have too use a Joystick/gamepad in our game and in the Documentation "Input Interaction (Using Key and Mouse Events).pdf" you say, that the engine support it, but there ist no description how to use ist. I tried to make the same as on the keyboard actionMaps. Here are my tryings to get the Joystick working:
moveMap.bindCmd(joystick, "button0", "fishPlayerUp();", "fishPlayerUpStop();");
moveMap.bindCmd(joystick, "button1", "fishPlayerUp();", "fishPlayerUpStop();");
...
moveMap.bindCmd(joystick, "button39", "fishPlayerUp();", "fishPlayerUpStop();");
moveMap.bindCmd(joystick0, "button0", "fishPlayerUp();", "fishPlayerUpStop();");
moveMap.bindCmd(joystick0, "button1", "fishPlayerUp();", "fishPlayerUpStop();");
...
moveMap.bindCmd(joystick0, "button39", "fishPlayerUp();", "fishPlayerUpStop();");
the same with gamepad and gampad0 and mouse and mouse0 instead of joystick and joystick0. Wheater mouse nor joystick/gamepad works. There are no errors, but it don't works.
he mouse works with Callback Events so I tried too mixture them to Joystick like:
function SceneWindow2D::onJoystickDown(%this,%modfier,%worldPos,%mouseKlicks) {
playerUp();
} // this one works not
instead of
function SceneWindow2D::onMouseDown(%this,%modfier,%worldPos,%mouseKlicks) {
playerUp();
} // <<< this one works
It don't works. There is no example findable, wheather in your tutorials nor in the references. Is there really a joystick/gamepad support yet in Torque2D, if so..... how can I use it? The Joystick is enabled in pref.cs
$pref::Input::GamepadEnabled = "1";
$pref::Input::JoystickEnabled = "1";
I tried to enable them in the console too with enableGamepad() and enableJoystick() and there is a message in console which says:
moveMap.bindCmd(joystick, "button0", "fishPlayerUp();", "fishPlayerUpStop();");
moveMap.bindCmd(joystick, "button1", "fishPlayerUp();", "fishPlayerUpStop();");
...
moveMap.bindCmd(joystick, "button39", "fishPlayerUp();", "fishPlayerUpStop();");
moveMap.bindCmd(joystick0, "button0", "fishPlayerUp();", "fishPlayerUpStop();");
moveMap.bindCmd(joystick0, "button1", "fishPlayerUp();", "fishPlayerUpStop();");
...
moveMap.bindCmd(joystick0, "button39", "fishPlayerUp();", "fishPlayerUpStop();");
the same with gamepad and gampad0 and mouse and mouse0 instead of joystick and joystick0. Wheater mouse nor joystick/gamepad works. There are no errors, but it don't works.
he mouse works with Callback Events so I tried too mixture them to Joystick like:
function SceneWindow2D::onJoystickDown(%this,%modfier,%worldPos,%mouseKlicks) {
playerUp();
} // this one works not
instead of
function SceneWindow2D::onMouseDown(%this,%modfier,%worldPos,%mouseKlicks) {
playerUp();
} // <<< this one works
It don't works. There is no example findable, wheather in your tutorials nor in the references. Is there really a joystick/gamepad support yet in Torque2D, if so..... how can I use it? The Joystick is enabled in pref.cs
$pref::Input::GamepadEnabled = "1";
$pref::Input::JoystickEnabled = "1";
I tried to enable them in the console too with enableGamepad() and enableJoystick() and there is a message in console which says:
About the author
Torque 3D Owner Matthew Langley
Torque
mattl AT garagegames DOT com