_BUTTON
#11
(04-04-2023, 02:25 AM)TerryRitchie Wrote: That information was very helpful. Thank you.

Absolutely! I'm glad you found it useful.  If you have a chance to check out the game engine further let me know what you think.  You wrote the definitive tutorial for QB64 gaming, so I would welcome any feedback.
Reply
#12
Ok, here's a situation I'm dealing with.

Over the past week I have gathered up steering wheels, joysticks, game pads, gas/brake pedals, flight yokes, and rudder pedals to test out a controller driver I'm writing in QB64. Most of the devices map buttons and axis with no issues. My joystick has 6 buttons and QB64 reports that it has 6 buttons. It has 4 axis, the joystick itself and a top hat, and again QB64 reports 4 axis. However, a few of my game pads inform QB64 (and the OS) that they have more buttons than they actually do.

The worst offender is a Nintendo clone look-a-like controller. It has 4 buttons (A, B, Select, and Start) but reports to QB64 that it has 10 buttons (it also reports 10 buttons to Windows). What's really weird is the A button is #2, the B button is #3, the Select button is #9, and the start button is #10. No logic to the ordering at all.

Sure, it would be easy enough to ask the player to press buttons to identify which are actually active (functionality I have already written into the driver and works well). However, does anyone know how I might go about identifying active buttons without actually having to have the user identify them by pressing them?
Software and cathedrals are much the same — first we build them, then we pray.
QB64 Tutorial
Reply
#13
Some of those buttons might be the D-pad, but I'd think setting up an user-config would probably be the best way to handle things as there's just so many unique input systems out there.  What if someone has a wheel and peddles attached to their PC?  Wouldn't it detect as a device, and wouldn't pressing the peddles down either be an axis event or a button event, depending on how they're configured?   Having a screen where the user "Press UP on the controller".... "Press DOWN on the controller"...and so on, seems the simplest way to detect WHICH controller they want to interact with (what if they have multiple hooked up to the PC?), and which buttons they're most comfortable with using for their games.
Reply
#14
(04-09-2023, 03:46 AM)SMcNeill Wrote: Some of those buttons might be the D-pad, but I'd think setting up an user-config would probably be the best way to handle things as there's just so many unique input systems out there.  What if someone has a wheel and peddles attached to their PC?  Wouldn't it detect as a device, and wouldn't pressing the peddles down either be an axis event or a button event, depending on how they're configured?   Having a screen where the user "Press UP on the controller".... "Press DOWN on the controller"...and so on, seems the simplest way to detect WHICH controller they want to interact with (what if they have multiple hooked up to the PC?), and which buttons they're most comfortable with using for their games.

I agree with having the user polled for controller input: "Press UP on the controller". I already have that functionality built into the driver and it does work very well.

All of the D-Pads (and top hats) on all of the game pads and joysticks/flight yokes I have identify as axis inputs. -1 (UP), 1 (DOWN), -1 (LEFT), and 1 (RIGHT). The driver I wrote converts these to buttons for easier handling since a full range of values between -1 and 1 are not utilized.

My driver also detects up to six controllers (optional keyboard, optional mouse, and up to six joysticks/game pads) and keeps track of all buttons, axis, and wheels on all controllers automagically, so no issue with multiple controllers. When I get the driver finished I'll upload it so everyone can use it.

What puzzles me is this crazy clone Nintendo controller I have. Even though it reports the incorrect number of buttons and the buttons that it does have map to strange button numbers, most of my games  and emulators that can use a game pad seem to have no issue with it without having to describe the button layout.

That's what made me wonder if there was a way to poll a controller for actual "working" buttons versus the number of "reported" buttons. The descriptive name identified by the game pad is "USB GamePad" so software isn't getting any help there unlike my joystick that identifies itself as "Saitek ST290 Pro" which gives software a clue as to its features.
Software and cathedrals are much the same — first we build them, then we pray.
QB64 Tutorial
Reply




Users browsing this thread: 7 Guest(s)