Sign in to follow this  
Mathimatica

SDL_PollEvent Issue

Recommended Posts

Hey there. I am having a very crazy problem that i cant seem to put my head around. When I use SDL_PollEvent, it is working and everything, but only on change. I am using a joystick (xbox 360 pad), and i am continously pressing left of the joystick for example, but my objects only go left once per click of the joystick. I guess what i am looking for is a way to tell SDL that i am still holding down on the joystick. Here is my SDL input code: while( SDL_PollEvent(&event) ) { switch ( event.type ) { // If there is a resize event. case SDL_VIDEORESIZE: EngineCore::getSingleton().getRenderer()->resizeDevice(event.resize.w, event.resize.h); break; case SDL_KEYDOWN: case SDL_KEYUP: if(m_pApplication) m_pApplication->onKeyEvent(&event.key); break; case SDL_MOUSEMOTION: case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: if(m_pApplication) m_pApplication->onMouseEvent(&event); break; case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONUP: if(m_pApplication) m_pApplication->onJoystickButtonEvent(&event.jbutton); break; case SDL_JOYAXISMOTION: if(m_pApplication) m_pApplication->onJoystickMoveEvent(&event.jaxis); break; case SDL_QUIT : done = true; break; default: break; } } I really dont know what to do here, so please if anyone has had this problem before, your input would be appriciated, thank you.

Share this post


Link to post
Share on other sites
Events are for exactly that, events. When something doesn't change no event has taken place. If you're interested in a continuous state, either poll that state (eg. SDL_JoystickGetAxis) or simply store the state locally, changing it in response to your events.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this