QB64 Phoenix Edition v3.7.0 Released!
#45
(05-09-2023, 07:59 PM)TempodiBasic Wrote: Hi Terry
thank you for the time spent to solve my issue and the code posted here!
I agree with you that your code manages very well the state of connected or disconneted of the joystick.
It solves half of the problem, but it is so much and moreover you have now teached me that the state of CONNECTED/DISCONNECTED lasts in the description of the device detected.
The other half of the problem is to be able to change type of joystick on the same USB or/and  to change the USB to which the same Joystick has been connected.
Why these two limit cases? I do not think that they are weird, because in different knid of game there is the SETUP/OPTIONS section in which you can detect and choose the input controller and also map/define the action of the buttons of the controller. That is the final goal of this my tedious query.
Again thank you very much for your feedback.

Long life to the king QB64pe!  I love QB64pe and its community.

Ok, I'm having a hard time understanding exactly what you mean. However, here is my best answer.

I added a small game to my controller library that shows how you can poll the keyboard, mouse, and multiple controllers for various inputs. If you have not recently downloaded the controller library then download it again and take a look at the example game I included. The game has a setup/options screen just as you are describing for choosing controllers and inputs.

Once the actions are mapped/defined you'll need to write code to save those settings based on the controller's name (_DEVICE$). When your game/program sees that controller plugged in it can then load the mappings back in based on that controller. This is something my controller library is currently lacking and I'll be adding soon. I decided to wait to add more to the library until version 3.7.0 came out.

Each of your game/program users will only have a few game pads/joysticks so this will create a small database of the controllers they own. If they unplug all controllers then your code can fall back on the keyboard and/or mouse for inputs that were mapped as shown in the game example in the controller library. The game example uses the keyboard as the default mappings for this purpose.

I believe everything you want to do is there, it's just a matter of programming the code to make it happen. Feel free to use the code from the functions and subroutines in my controller library to use in your projects.

Terry
Software and cathedrals are much the same — first we build them, then we pray.
QB64 Tutorial
Reply


Messages In This Thread
RE: QB64 Phoenix Edition v3.7.0 Released! - by TerryRitchie - 05-09-2023, 11:44 PM



Users browsing this thread: 20 Guest(s)