View Full Version : SDL Polling vs ??

23-03-2011, 09:07 PM
What other techniques in SDL besides polling the events can i use to handle input? Is SDL_PollEvent really the best option?

01-04-2011, 01:17 AM
I believe Event Polling is the only method of getting accurate input through SDL. You can of course build a controls interface that will track the states of all your gamepads' game buttons and directional controls, mouse a keyboard input, like I and many others have. This will make designing the game controls of your game much easier as you develop your game.

01-04-2011, 09:52 AM
You can get the state of the keyboard, mouse and joysticks at any time. Use the following routines:

SDL_GetKeyState (http://www.libsdl.org/cgi/docwiki.cgi/SDL_GetKeyState)
SDL_GetMouseState (http://www.libsdl.org/cgi/docwiki.cgi/SDL_GetMouseState)
Joystick functions (scroll down) (http://www.libsdl.org/cgi/docwiki.cgi/SDL_API)

Hope this helps.