Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Joystick modification.
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Mazer




PostPosted: Sun Oct 31, 2004 10:00 pm   Post subject: Joystick modification.

Here. Just a change in some lines of the already existing joystick code. Now, instead of passing a bunch of booleans as parameters to the Joystick.GetInfo procedure, pass a single array with bounds defined by you.

In the GetInfo procedure, it only checks 32 buttons. I've only got a 6 button gamepad, so whether or not adding more buttons to it manually would work, I don't know and can't check. So for now, if you try to pass an array of more than 32 boolean variables, the procedure will return right away without setting the xPos and yPos variables properly and your program will likely crash. No, this isn't a good solution. Yes, I could change it easily. But I won't. Just don't try using more than 32 buttons (does anybody actually have more than that??).

Also. In my example code, it divides (and truncates) the joyX and joyY values by 1500. This is because I was testing it on a gamepad which uses a digital control. Meaning, I'm either pushing left or I'm not. There's no "I'm pushing left, but only a little bit!" So, for joyX and joyY, I can get values of either -5000, ~-4900, 0, ~4900, or 5000. With an actual analog joystick, you should get values ranging all the way from -5000 to 5000 (though the dead zone may affect the values you get that are close to zero).

I can't think of much else to say here. Um. On a six button gamepad, if you press the 5th button and 6 flashes instead, don't blame turing. You just might have a crappy pad like myself.
(Holy crap... I just realized you could make DDR in turing if you have an adapter for a PSX/XBOX pad)

Well, if anybody has a joystick/gamepad, why not check this out?

Replace the current Joystick.tu file (in the Turing/support/predefs/ directory) with this one (of course, you may want to make a backup of the old one for whatever reason). All you need to do after that is run the example file I've attached.
If you do decide to use this, just one quick note: the online keyword lookup (F8) will just give you the parameters for the original Joystick.GetInfo procedure. If you care, it's up to you to change that (there's a text file you can edit somewhere).

'K bye.

EDIT: I'm just gonna take a guess that there isn't any support for the extra joystick stuff (like switches and those crazy POV buttons you see on top). So don't go crazy trying to remake Falcon 4.0.
Sponsor
Sponsor
Sponsor
sponsor
the_short1




PostPosted: Tue Nov 02, 2004 9:23 pm   Post subject: (No subject)

TY So Very Much!!!!! Thanks a Ton!!! i was hoping HoltSolf would fix the whole joystick thing.. but u doing it ... I am not worthy .... great stuff.. if ur werent a mod id donate 100 bits..
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: