SDL2 Joystick Events not working |
SDL2 Joystick Events not working |
Ryan C. Gordon
Guest
|
Run "./testjoystick 0" instead of "./testjoystick" ("0" being the index of the joystick you'd like to see input data from). --ryan. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
kvb
|
Thanks Ryan, I am now able to get input from a device using the test app. Still doesn't explain why my code doesn't work since, besides filling some variables for my plugin to make use of, it's nearly identical to what the test app does. Maybe it has something to do with my joystick variables being created and filled in a local context outside of the event loop function? Maybe SDL2 doesn't like that, where as it didn't make any difference in 1.x. I'll try making the joysticks a class variable with a wider scope when I get home from work and see if that does the trick (fingers crossed!).
Thanks, Kevin |
|||||||||||
|
SDL2 Joystick Events not working |
Alberto Luaces
Guest
|
"kvb" writes:
Did you open the joystick? -- Alberto _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
kvb
|
Yes, I open all joysticks on the system right after starting SDL.
|
|||||||||||
|
SDL2 Joystick Events not working |
mikelwrnc
|
Try building sdl2 from source instead of using the framework. On 2013-11-01 4:40 PM, "kvb" wrote:
|
|||||||||||||
|
SDL2 Joystick Events not working |
robenwzrdhat
Guest
|
I've the same issue. I ported my game from SDL to SDL2, and ran
if(!SDL_WasInit(SDL_INIT_JOYSTICK) && SDL_InitSubSystem(SDL_INIT_JOYSTICK)) { cerr<<"Unable to initialize the joystick subsystem"<<endl; return false; } This then lets me detect the joystick and output its name, but none of my event handling works, such as: 135 if ( event.jhat.value & SDL_HAT_RIGHT ) 136 { 137 /* Do right stuff here */ 138 character.directionX = RIGHT; 139 level.directionX = RIGHT; 140 } -- View this message in context: http://sdl.5483.n7.nabble.com/SDL2-Joystick-Events-not-working-tp37763p37879.html Sent from the SDL mailing list archive at Nabble.com. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||
|
SDL2 Joystick Events not working |
robenwzrdhat
Guest
|
Do you use openGL per chance?
I have torn the joytest.c file down to a nothing but a window and the while loop that outputs to the terminal the changes in the controller (like when a button is pushed). This all works. When I take out the window creation (leaving the init the same) and instead create an openGL context window, the application fails. Everything works until I OpenGL-ify the app, then it won't recognize events just the same. -- View this message in context: http://sdl.5483.n7.nabble.com/SDL2-Joystick-Events-not-working-tp37763p37887.html Sent from the SDL mailing list archive at Nabble.com. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||
|
Re: SDL2 Joystick Events not working |
kvb
|
I'm not using the supplied framework, I'm building from source and have tested using both the framework and static library. |
|||||||||||||||
|
SDL2 Joystick Events not working |
NY00123
Guest
|
While chances are this is not the problem, I'm still checking:
Is joystick event handling enabled using SDL_JoystickEventState? _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||
|
Re: SDL2 Joystick Events not working |
kvb
|
Yep, it's enabled. |
|||||||||||||
|
SDL2 Joystick Events not working |
Alberto Luaces
Guest
|
"kvb" writes:
How do you ran testjoystick? Try something like testjoystick 0 -- Alberto _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|