[Gambas-user] Gambas class to read a joystick
Laurent Carlier
lordheavym at ...626...
Sun Mar 2 23:58:03 CET 2008
Le Sunday 02 March 2008 23:36:43 Rob, vous avez écrit :
> Someone on linuxbasic.net asked for a way to read a joystick in
> Gambas. I couldn't find anything in the SDL component for that
> purpose, so I wrote a minimal class that reads from the raw device,
> parses the data into something useful, and throws events. I wrote a
> program to demonstrate it as well.
>
> To make it work, I had to EXEC ["cat", device] instead of just OPEN
> device FOR READ WATCH. Gambas told me "System error: Invalid
> argument" every time the File_Read event fired and I tried to read
> from the file handle, even though the example makes it look like it
> works with device nodes. I'm sure there's a better way to do this,
> but ultimately gb.sdl should probably have joystick support anyway
> (and if I were more familiar with SDL, I would have done that instead
> of this.) Nonetheless, this works.
>
> In case the archived version of the list doesn't store attachments,
> it's also available at http://www.kudla.org/jstest-0.0.2.tar.gz for
> future reference.
>
> Rob
An external component (outside of sdl) should be a good idea and not be too
hard to develop.
Some hints (quick search through gg):
http://www.koders.com/c/fid19CB9E605749A439549F8CC9B8433DCAC6AC5A55.aspx
http://www.mjmwired.net/kernel/Documentation/input/joystick.txt
++
More information about the User
mailing list