Game Development Community

Activate joystick/gamepad

by AIDan · in Torque Game Engine · 11/24/2001 (5:30 pm) · 25 replies

Hi

How to activate it??

$pref::Input::JoystickEnabled= 1;

Does not work.

greetings
Daniel
Page «Previous 1 2
#1
11/25/2001 (11:26 am)
I retooled the Win32 input code to use DInput 8 before I got the joystick working.
#2
07/22/2002 (11:50 am)
Hi,

I also have problem on activating joystick. I have used the joystickfix file from James "Defiant" Lupiani but the joystick is not working even so. It seems like that the variable $pref::Input::JoystickEnabled is always overwritten back to 0. Any idea?

Thanks a lot
#3
07/22/2002 (12:08 pm)
The fix I wrote is actually in the current CVS head tag if you follow that branch.

To check how input's working, you can type "echoInputState();" in the console window. As for it resetting, I'm not sure why. Maybe it's being set elsewhere?
#4
07/22/2002 (2:09 pm)
Hi,

I am actually using the HEAD version. The problem is that even I type "enableJoystick();" in the console window, it always says "directinput joystick failed to enable". If I check with "echoInputState();", it says
"joystick is inactive and disabled". Does anybody know the reason?

Thanks a lot
#5
07/22/2002 (5:57 pm)
That is very strange.

I just added some global binds in for the joystick in default.bind.cs and then typed enablejoystick(); in the console and it works fine for me
#6
07/23/2002 (2:48 pm)
Hi,

I figure out that I can enable the joystick (on the menu screen) before I actually enter the game. However, the joystick is still not responding during the game since I have checked with "isjoystickdetected();" and the answer is false. I use the same binding technique for the joystick (e.g., moveMap.bind(joystick0, "button0", moveforward);). Any idea on how to fix the problem?

Thanks a lot
#7
07/24/2002 (2:01 pm)
Do this:

$enableDirectInput = 1;
enableJoystick();
echoInputState();

The last command will tell you whether the joystick is activated. If after this it still doesn't work, then its probably not detecting your joystick properly. What kind of stick do you have?
#8
07/24/2002 (3:25 pm)
Are you sure the joystick's plugged in?

I seem to recall similar problems I experienced, only to realize that the joystick had come unplugged when I pulled my computer out a bit.
#9
07/29/2002 (3:51 pm)
Hi,

Does the torque engine treat a steering wheel different from a jostick? The console window does not display "joystick0 input device created" if I plug in a wheel.

Thanks a lot
#10
01/17/2003 (11:22 am)
Does anyone get a steering wheel to work in torque ? Also, I have a Logitech Wingman cordless Rumble pad and the buttons are working, but none of the POV. Is there any trick ? All is working in windowsXP gaming controls and on any games. Thanks for any help with this.
#11
01/17/2003 (1:34 pm)
I do not know for the steering wheel, but for a flight stick i did some change in the torque code (C++ code) as my microsoft flight stick was not recognized by Torque. Torque knows only regular joystick. If you need it, send me an email and i will email you the little change.
#12
01/17/2003 (4:03 pm)
Just a note since I don't think I've posted a bug report in the project manager yet... Joysticks that don't use polled input are apparently broken in Torque. This means digital (USB) sticks won't work correctly. You can make isPolled() return true all the time to work around it for now.
#13
01/17/2003 (5:42 pm)
Frank, thanks. Mail sent :)

James, That seems a good news if it solve the prob. All my devices are USB. Where would you suggest to write that command to activate it ? Thanks for the infos !
#14
01/17/2003 (11:21 pm)
@James: i'm using a USB flight stick for DoP with minor modification in the code and it works fine. I will post a resource for that too and send you an email Gilles. Do not hesitate to remind it to me if you do not receive something in the next 2 days ;)
#15
01/18/2003 (10:15 am)
Thanks Frank ! I will send you a "buzz" if you forget :) Nice idea to make this a ressource too. Thanks for sharing this. It will be greatly appreciated.
#16
01/18/2003 (11:46 am)
Gilles: It's in DInputDevice.h under platformWin32.
inline bool DInputDevice::isPolled()
{
   return true;
//   return ( mDeviceCaps.dwFlags & DIDC_POLLEDDEVICE );
}

I'm also interested in hearing where the minor modifications were. The problem with USB sticks has occured on at least two machines running different hardware, but I have an analog stick so I can't test it directly. It seems to be axis range related.
#17
01/18/2003 (1:11 pm)
Oh JOY, my STICK is working for directions :) Thanks James. It's a little primitive right now for vehicles as it is ON-OFF, but it's a good start. I will study these input files. The second POV doen't work, like in Tribes 2, but it's maybe not too hard to find why. Badly, my steering wheel is still not detected by this, but maybe Frank have a twist at the solution with his codes. I will also go try with other wheel devices to see if they work. But, I know where to look into now. :) Thanks !
#18
01/19/2003 (6:27 am)
Here is the ressource : www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3780

It seems the code tag does not work well.
If you need the modified file, you can go on our website at darkhand.webhop.orgin the download files area.
#19
01/19/2003 (11:13 am)
Thanks much Frank ! I will go try and study this tonight.
#20
01/19/2003 (6:54 pm)
i've tried modifying the isPolled() function and my AxisPad still isn't working. When i step through the code i notice that in the following function, the loop is only traversed through twice. The first time it's gone through, the dptr object points to keyboard0. The second time through, it points to mouse0. It never goes through a third time trying to acquire joystick0. Here's the function that i'm talking about:

bool DInputManager::acquire( U8 deviceType, U8 deviceID )
{
bool anyActive = false;
DInputDevice* dptr;
for ( iterator ptr = begin(); ptr != end(); ptr++ )
{
dptr = dynamic_cast( *ptr );
if ( dptr
&& ( ( deviceType == SI_ANY ) || ( dptr->getDeviceType() == deviceType ) )
&& ( ( deviceID == SI_ANY ) || ( dptr->getDeviceID() == deviceID ) ) )
{
if ( dptr->acquire() )
anyActive = true;
}
}

return anyActive;
}

I don't know if i'm on the right track stepping through this function, but I thought i'd throw it out there. Anybody have any thoughts on why my joystick is not being recognized? Thanks in advance. oh - and it's plugged in :)
Page «Previous 1 2