I'm making a test 2D rpg style game. Is there a way to decrease the keyboard delay? I have the directional keys set to WASD. Everything in project to work as it's supposed to, However I don't want that 'second' delay when you hit a key for it to begin repeating.
*EDIT: got it (can't figure out how to delete this thread, maybe because its the first 1)
VB Code:
Private Declare Function SystemParametersInfo Lib "user32" Alias _ "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _ ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long Const SPI_SETKEYBOARDDELAY As Long = 23 Const SPI_SETKEYBOARDSPEED As Long = 11 Const SPIF_SENDWININICHANGE As Long = &H2 Const SPIF_UPDATEINIFILE As Long = &H1 Sub SetKeyboardRepeatInfo(ByVal Delay As Long, ByVal Speed As Long, _ Optional ByVal MakePermanent As Boolean) Dim flags As Long ' are these changes permanent? If MakePermanent Then flags = SPIF_SENDWININICHANGE Or SPIF_UPDATEINIFILE End If ' set the keyboard delay SystemParametersInfo SPI_SETKEYBOARDDELAY, Delay, ByVal 0&, flags ' set the keyboard repeat rate SystemParametersInfo SPI_SETKEYBOARDSPEED, Speed, ByVal 0&, flags End Sub ' set new values for keyboard speed and delay ' ' DELAY is the timeout after which auto.repeat starts ' can range from 0 (250ms) to 3 (1 sec) ' SPEED is the speed of repeat rate ' can range from 0 (2.5 repetitions/sec) to ' to 31 (about 30 repetitions/sec) ' If MAKEPERMANENT is True, then these new values persists among ' subsequent Windows sessions 'USAGE 'SetKeyboardRepeatInfo(0,31,True) 'THAT WILL SET EVERYTHING ON FAST




Reply With Quote