[Gambas-user] gb.joystick (and Where is my gbh3?)

Cedron Dawg cedron at exede.net
Mon Feb 25 15:45:21 CET 2019


Le 24/02/2019 à 23:02, Tobias Boege a écrit :
> Hi all,
> 
> I have just pushed two commits to the gb.joystick branch. This is
> work that has been on my hard disk(s) since 2015, with a few bits
> from Cedron Dawg mixed in.
> 
> The component makes Linux' legacy Joystick API available to Gambas
> without bells and whistles. You create a joystick by opening the
> appropriate device /dev/input/jsX and then you receive Button or
> Axis events when someone touches the thing. [ There is a newer
> evdev API but the legacy one is nice too. ]
> 
> Attached is a fairly minimal toy program. Please test it if you
> have the hardware.
> 
> One thing: The first commit on that branch had a concept of a
> "stick" on your joystick which has two axes associated with it.
> That's usually what you imagine a joystick/gamepad to have.
> The second commit removes these notions because I realized that
> sticks with only one axis exist. Maybe that's the reason why
> the underlying Linux API refers to axes individually. And while
> axes do seem to come in pairs on my gamepad, they do not always
> come in the same order: sometimes the horizontal axis is index 0,
> sometimes it is index 1. So, I decided to remove that logic and
> leave the mapping of axes to the user. Tell me what you think.
> 
> 

The interface of such a component should:

1) Hide the Linux specific things as much as possible.

2) Have the same interface whatever the underlying kernel API ('js' or 
'evdev').

What do you think? Is it possible?

In the case of someone who would want to make the component work on 
FreeBSD, or something else.

I don't want to see one component by OS!

-- 
Benoît Minisini

=============================================================

Hi Benoit,

I am working on an evdev version as a C console program.  When I get that working, I plan to pound it into gb.* style code, following Tobi's example.  I don't quite totally agree with his interface design, but I should be able to match it.  If there is a serious disagreement, perhaps we can arm wrestle.

Ced



More information about the User mailing list