I'm not 100% sure I didn't miss something but it appears SDL does not
support dynamic repeats and delays of keyboard input from OSes.
This appears to be doing it for Windows:
(by replacing SDL_EnableKeyRepeat with it with #ifdef _WIN32 in
appropriate places)
static void SDL_EnableKeyRepeatWin (void) {
int delay, speed;
SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, &delay, 0);
SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &speed, 0);
//actual values on windows vary depending on hardware
//WINAPI: "0 (approximately 250 ms delay) through 3 (approximately 1
second delay)"
delay = 250 + delay * 250;
//WINAPI: "0 (approximately 2.5 repetitions per second)[400ms]
through 31 (approximately 30 repetitions per second)[33ms]"
speed = 400 - speed * 12;
SDL_EnableKeyRepeat(delay, speed);
}
I wrote it so it's free to use in GPL.
A quirk I notice is that 1) it doesn't respect an OS change unless
console is brought down and up again and 2) it's not respecting the
change in UI-only either.
(By only placing it where "SDL_EnableKeyRepeat(
SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL );" is with the
appropriate #ifdef WIN32s)
_______________________________________________
ioquake3 mailing list
[email protected]
http://lists.ioquake.org/listinfo.cgi/ioquake3-ioquake.org
By sending this message I agree to love ioquake3 and libsdl.