Controller input troubles
Blitz3D Forums/Blitz3D Programming/Controller input troubles
| ||
The other day I bought a plug-in gamepad controller thats built in the layout of an xbox360 controller with anolog sticks and everything, and I was reading the Blitz3d programming manual book about joystick input. After reading and learning about the functions, I made a little program so I can test it out before I put it into my bigger project. The problem is that it doesn't seen to work and I don't know why. I checked and tested my controller and it works fine, but I don't know why the controls don't work. This was the little program I made to test it out. Can someone explain to me why it may not be working? |
| ||
You're using JoyDown wrong. Take a look at the documentation:; JoyDown Example ; Until user presses ESC, show the mouse button pressed While Not KeyHit(1) button$="No" For t = 1 To 5 If JoyDown(t) Then button$=Str(t) Print button$ + " joystick button pressed!" Next Wend Also, your joystick is on port 2? If not, you shouldn't be using "GetJoy(2)" either. Just press F1 twice over any word - GetJoy or JoyDown in this case to see a small help about the command, alongside with a sample program (The sample above appears for JoyDown) Check also JoyType - you should check it's return value not just write "JoyType(2)". Last edited 2010 |
| ||
SLotman The main problem I had was with getting the analog stick to work. Does the analog work the same even with joydown, or does that work with just buttons? I really need to get the analog stick to work and i'm still not understanding the joystick functions very well. |
| ||
Read the documentation and look at the sample code - it is pretty helpful - there are many examples of joyx/y/z commands. Joydown is simply used for the buttons on the joystick. Joy x/y/z/roll/pitch/yaw are sometimes used for a joypad - depends on brand, and whether 'analog' mode is enabled etc...you will need to play around with it. |
| ||
Yes, you are passing 203/205/200/208 as joystick buttons. That could be okay, if your joystick has more than 200 buttons. But I think these numbers should be more in the range of 0 to 3. Or perhaps 1 to 4 .. it's been a while. But not 200+. |