问题描述
我正在构建一个c ++俄罗斯方块游戏(不是c ++ .Net).我觉得我的控制很奇怪.我想这样做,以便当用户按下其中一个箭头键时,按住它大约10毫秒即可启动重复功能窗口.默认情况下,它设置为大约500毫秒,对于我的游戏来说太慢了.如何设置从键盘按下到重复键盘按下的速度?没有重复多少次/秒.
I'm building a c++ tetris game (not c++ .Net). I feel my controls are weird. I want to make it so that when user presses one of the arrow keys, about 10ms of holding it down will start the repeat function windows has. It is set to about 500ms by default, and it is too laggy for my game. How can I set the speed at which it changes from the keydown to the repeat keydown? Not how many times / sec it repeats.
谢谢
*我要做的是将重复延迟更改为短
*what I want to do is change the repeat delay to short
在控制面板中的键盘设置中有重复率,我该如何设置?
In control panel in keyboard settings there is repeat rate, how do i set this?
推荐答案
通常,您要做的是代替对受常规键重复设置限制的WM_CHAR
消息做出反应,而是查找 WM_KEYDOWN
和WM_KEYUP
,并基于操作在您正在运行的计时器上.例如,如果您将计时器设置为每50毫秒触发一次,那么您可以每50毫秒重复一次,并在收到WM_KEYDOWN
消息后立即立即执行第一个操作.
Typically what you would do for this is instead of reacting to the WM_CHAR
message that is subject to the normal key repeat settings, you would look for WM_KEYDOWN
and WM_KEYUP
, and take action based on a timer that you've got running. If you set the timer to fire every 50 ms for example, then you can repeat every 50 ms and still take the first action immediately when you get the WM_KEYDOWN
message.
这篇关于更改重复键阈值C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!