Sign in to follow this  
ARC inc

SDL Question

Recommended Posts

ARC inc    100
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
jyk    2094
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

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