- Online Community Forums » Allegro Development » set_keyboard_rate

This thread is locked; no one can reply to it. rss feed Print
Serial H
Member #6,937
February 2006

I have a problem with the function set_keyboard_rate.
It works when I use set_keyboard_rate(0,0) to disable the repeat key, but I just want to slow down the repeat key.
when I use
it doesn't work.

Matt Smith
Member #783
November 2000

As far as I can recall (I've not been paying attention recently) this function only works in DOS because it calls the BIOS function. In other O/S the repeat rate is set by the O/S for all programs and allegro (deliberately?) refrains from changing system-wide parameters, as this would affect other users and programs.

Member #6,862
February 2006

This function works just great under Windows and Linux. Reread the docs on it - the order of the parameters is
set_keyboard_rate( int delay, int rate );
set_keyboard_rate(1000,0), as was your example, sets the delay to 1000ms but a repeat rate of 0 - that's disabled.

The repeat rate is "number of milliseconds between each key repeat"

Here's some examples -

//delay of 500ms, repeats 1000 times per second
set_keyboard_rate( 500, 1 );

//delay of 100ms, repeats 10 times per second
set_keyboard_rate( 100, 100 );

//delay of 1ms, repeats twice per second
set_keyboard_rate( 1, 500 );

Good luck!

[url]OpenLayer[/url is an OpenGL accelerated 2D library for fast and easy graphics development under Allegro

Go to: