Can you switch the pad into DIGITAL mode? So use the 8 directional pad instead of the analog stick?
Printable View
Can you switch the pad into DIGITAL mode? So use the 8 directional pad instead of the analog stick?
OK, definitely a gamepad config.
Always + or - values between 20/45 on both axis.
I will try to find another gamepad. Better, I will buy a new one in next days.
To solve my problem I will change to
[code=thinbasic]if GetAsyncKeyState(%VK_UP) or joyY < -40 then
if GetAsyncKeyState(%VK_DOWN) or joyY > 40 then
'....
'....[/code]
Mike, THANKS FOR THE BIG PRESENT !
Thank you too! It's great to see thinBasic envolve and be a part of it. It is another little step to complete thinBasic gaming abilities.
I will head to bed now, see you tommorow.
Wow lay down to take a nap and the game input device module is HERE, woo hoo. Thanks Mike!!
Thanks Eros for putting into a game file to play with.
Very happy to report works very well with my Logitech Extreme 3D joystick.
Mike, is there a routine that checks for the number of buttons on joysticks and gamepads?
I just used directx input functions before in programming and it seemed to handle everything well.
Mayb I ask what library you are using for input handling?
I'm glad you found this a nice wake up surprise.
No, right now there are only these 5 little functions but I will add the suggested ones of course, if my coding abilities will let me do it.
I'm using PowerBasic to develop this module. With it I interface DirectInput from the MS DirectX SDK. I found some translated include files a basic example in the net.
The hard part was trying to get the joysticks report values between -1024 to 1024 bey default and not just raw data for the axxis from 0 to 65335. This was because the example I used was faulty plus the include files were also a little buggy. They used the wrong data types in some places.
So next step will be these little functions you mentioned plus functions to read all joysticks on a pad, sliders, POV. After this I will attack effects so you can have your pad rumbeling when your ship got hit. At the end I would like to able to support 2 joysticks at the same time, but I don't know right now how to do it.
It is definitly a great start and glad you will add all the support you can to it. I guess since thinBasic will always be on Windows Operating Systems going with DirectX is not an issue. I didn't know you could use part of an SDK for making your own dll modules. That is great to know.
I got another question for you, why were you concerned about dealing with 0 to 65335 as a range compared to the now -1024 to 1024, just curious?
I found it more usefull, then saying the middle is 37thousandsomething. Plus I needed this functionality anyway to be able to control the deadzone of a joystick. You will get a function where you can set the range yourself.
The other solution for Joystick would be using the SDL lib, but then we would have to ship allways another dll with it. Plus effects are not available on it I think.
I see Mike, thanks. MY course that I ordered will show SDL, but I am not even to getting there yet to see what all it can do. They just mentioned it was great for making games. I will know more in a few months I guess once I make my way through.
Last night I implemented allmost everything that I wanted. Onlyforce feedback is missing now. One problem I have is what Eros suggested, calling Init and Close from the attach and detach processes. thinbasic hangs up without any complain/message, etc. First I want to check it again before I call Eros for help. ;) After I did more documentation and write a sample script, I will release this version.
Ok, I know where it hangs up now. In any example and the sdk docu, you have to acquiere the joystick before you use it. So I do that within the TBDI_Init function. It works. When I call this function from the DLL's attach process, it hangs at this part. The funny part is that when I don't acquiere the joystick, the joystick still works. Go figure ???
As I don't know if leaving it out will have bad sideeffects, I will stay with the external version of TBDI_Init and TBDI_Close for now. I think two extra commands won't make it that bad. When I have everything inside the module, I will give Eros the sources and let him have a try. Maybe I'm doing something wrong with the DLL's attach process. Regarding to TBDI_Close, when I put that inside the DETACH process of the DLL, it doesn't get called. Mmmh, maybe a bug inside thinbasic.
Tommorow night (my time) I will release this version. Tonight I find no time as we have friends over for dinner.