break next/current SDL_TEXTINPUT on dead key |
break next/current SDL_TEXTINPUT on dead key |
eric.w
|
Hi,
I just did this in quakespasm, borrowing the idea from ioquake3. The hack is, just ignore any SDL_TEXTINPUT event that arrives between a SDL_KEYDOWN for the key that’s supposed to open the console, and the next SDL_KEYUP (e.g. by setting a flag when you get the SDL_KEYDOWN that opens the console, and clearing it on the next SDL_KEYUP). It’s a tricky problem, and I couldn’t think of a good solution when first porting quakespasm to SDL2. I’m not sure if you can really do better than this; it seems to me that a more robust solution would have to involve the SDL_TEXTINPUT event telling you that it was generated from a particular SDL_KEYDOWN, so your application code could match up the events and know to ignore the SDL_TEXTINPUT for that character. Here’s our sdl input code: http://sourceforge.net/p/quakespasm/code/1020/tree//trunk/quakespasm/Quake/in_sdl.c#l522 Cheers Eric On Sep 10, 2014, at 8:43 AM, albert wrote:
|
|||||||||||||
|