Qbasicnews.com
Joystick functions - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: Qbasic "like" compilers/interpreters (http://qbasicnews.com/newforum/forum-5.html)
+--- Forum: FB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-15.html)
+---- Forum: FB Projects (http://qbasicnews.com/newforum/forum-16.html)
+---- Thread: Joystick functions (/thread-5321.html)



Joystick functions - adosorken - 12-11-2004

Okay...this is the first test of joystick functions I've tried in FB. I wrote up a header real quick in VB to test it out, then immediately ported it to FB. Since I just obtained a brand spankin' new gamepad which features 13 buttons (1 through 4 "action" buttons, 4 triggers on top, the typical "Start", "Select", "Mode" buttons, plus a button for each analog stick [press down on the stick]), a POV D-pad, and two analog mini-sticks (it's meant to look like a PS2 controller, but has this fan inside it which you can switch on to keep your hands cool while playing), it made for easy times testing this sucka out.

http://www.nodtveidt.net/fb/joystick-demo.exe

The file contains the header (winmm.bi, place in your /inc directory), the import library (libwinmm.a, place in your /lib directory), the demo file (joystick.exe, just run it if you've got a joystick or gamepad to test out), and the sourcecode (joystick.bas, just check it out). The POV controls utterly rock and make coding standard D-pad games soooooo much easier. But of course...I don't know if all gamepads support this, and I'm guessing the answer is a resounding NO...most gamepads out there are still analog, which means reading the X and Y axes. For my new gamepad, the X and Y axes were the first analog controller, and the Z and R axes were the second. The thing's called a Nyko AirFlo and uses the good old cross D-pad rather than the crummy circular one.