Skip to main content
GameDev.net gamedev.net
🔒 Locked

SDL Question

Started by ARC inc Mar 12, 2010 at 12:25 PM 2 replies 700+ views
Original Post
ARC inc
ARC inc
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
Zakwayda
Zakwayda
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...}
Agent_Q
Agent_Q
This website should help you. Good luck!

http://lazyfoo.net/SDL_tutorials/index.php
rip-off
rip-off
Is your underlying question "How can I build a string out of SDL keysym values"?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.