[Gambas-bugtracker] Bug #1537: A candidate for a a GamePad/Joystick native component
bugtracker at gambaswiki.org
bugtracker at gambaswiki.org
Thu Feb 28 04:05:55 CET 2019
http://gambaswiki.org/bugtracker/edit?object=BUG.1537&from=L21haW4-
Cedron DAWG reported a new bug.
Summary
-------
A candidate for a a GamePad/Joystick native component
Type : Request
Priority : Low
Gambas version : Master
Product : Unknown
Description
-----------
(Suggested "Product" category: Native Component Programming)
Attached you will find my first attempt at writing a native component for Gambas. I started with Tobias Boege's c_joystick.c which uses the legacy joydev model to access the game pads/joysticks. I replaced all the joydev code with code to access the game pads using the evdev model. Very little of the original code remains, but the essence of the function calls and some original embedded documentation has been retained.
Despite a bit of effort I was unable to compile the code. So I am submitting it as a request for somebody to inspect the code, fix minor issues, and add it to the Gambas project.
Since this is all new to me, I am not sure it has been coded correctly. If it requires major renovation, please let me know.
As mentioned in the mailing list, I am a firm advocate of my coding style (formatting and naming conventions). If you feel a need to convert it (especially to Hungarian notation), please don't touch it. I'm happy to discuss the rationale for any and every "style rule". They aren't happenstance.
Procedure separators in an IDE are not real. Procedure separators implemented as comments are. Code readability should be judged in a monochrome text editor. Comments jammed against code are not readily visually distinguishable without color coding.
There is still a major issue left hanging open concerning the non standard assignment of axis/button numbers to the location on the gamepad. Solutions to map them by manufacturer and model to a standard set of values exist elsewhere and should maybe be explored. It is my belief that every application should allow the user to redefine any axis/button (via a settings file) so having a standard mapping is only a middle step.
A "tell me about my game pad" application should be developed that tells the user which numbers for which buttons are generated by their particular control so those values can be entered in the settings file. This functionality is inherently presented in the video game I wrote, but a special utility would be a better solution. That will be a trivial application once the joystick component is part of Gambas. The standardized mapping approach won't be as easy.
Thanks,
Ced
System information
------------------
N/A
More information about the Bugtracker
mailing list