SDL Fix for Joysticks Under Linux
by Frank Carney · 03/11/2007 (8:38 pm) · 0 comments
I am not sure if this is the place to post this, but I just got joystick stuff working for myself under Linux in TGE 1.5. It just did not want to produce usable output and I read up on the docs from SDL and they said you should be using events instead of polling. Okay, "I understand right answer when shown". So I went and tweaked the appropriate files and now I get events ONLY WHEN EVENTS ARE OCCURRING for the joystick events. Very nice!
Here is the link to the forum (sorry, only tge owners):
www.garagegames.com/mg/forums/result.thread.php?qt=59097
Please let me know if I need to adjust anything.
One thing I can think of is adding support for other events than those it currently processes for the joystick.
In the loop I only added support for four events:
SDL_JOYBUTTONDOWN
SDL_JOYBUTTONUP
SDL_JOYAXISMOTION
SDL_JOYHATMOTION
These are the same events as originally supported in the code. I just made them work with the SDL event processing methods rather than the one that was in there. It looks as though someone had intended to do this entirely in SDL, so I just ended up fixing it, hopefully.
Here is the link to the forum (sorry, only tge owners):
www.garagegames.com/mg/forums/result.thread.php?qt=59097
Please let me know if I need to adjust anything.
One thing I can think of is adding support for other events than those it currently processes for the joystick.
In the loop I only added support for four events:
SDL_JOYBUTTONDOWN
SDL_JOYBUTTONUP
SDL_JOYAXISMOTION
SDL_JOYHATMOTION
These are the same events as originally supported in the code. I just made them work with the SDL event processing methods rather than the one that was in there. It looks as though someone had intended to do this entirely in SDL, so I just ended up fixing it, hopefully.
About the author
I Started programming in HS and have never stopped. Now an 18 year vet of programming anything from assembler on a NES console to a nuclear waste processing system. If it can be programmed I may have tried to program it!