Jump to content
  • Advertisement
Sign in to follow this  
ARC inc

SDL Question

This topic is 2994 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is it possible to get user input from SDL using the keyboard? Like a edit control box? I know we can use mouse input and write text to the screen but how can we get user input using SDL

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Is it possible to get user input from SDL using the keyboard? Like a edit control box? I know we can use mouse input and write text to the screen but how can we get user input using SDL
For text entry in an SDL application, you would typically use SDL_PollEvent(). Most SDL applications will have an event processing loop somewhere in the main loop that consumes and dispatches any pending events, so in this case it would be a simple matter of dispatching 'key down' events to the appropriate module.

Here's an example of what your typical event processing loop will look like (C or C++):
SDL_Event event;
while (SDL_PollEvent(&event)) {
// Event processing goes here...
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!