Good SDL string input

Started by
12 comments, last by Vorpy 17 years, 1 month ago
I tried your method Wave but it wouldnt compile.

So i went on and tried somthing simple like this

      while (SDL_PollEvent(&event))   {    if( event.type == SDL_KEYDOWN )         {       switch(event.key.keysym.sym){                    case SDLK_a:            str = str + 'a';            break;                         }                              }                     }


And it maybe will catch one or two out of a hundread keystrokes? Be aware this has just been dropped straight into my Update loop.
Game Development Tutorials, a few good game development tutorials located on my site.
Advertisement
It will catch every keystroke exactly once.
Its realy not... It is quite hard to actually catch a single keystroke...
Game Development Tutorials, a few good game development tutorials located on my site.
It should be catching every single keystroke. The keyboard generates events every time a key is pressed or released. The operating system sends these events to the program, and SDL generates the corresponding event which is then placed in the event queue. The only way to not detect a keystroke is if the keyboard doesn't detect it or there is a glitch in the software somewhere.

This topic is closed to new replies.

Advertisement