[futurebasic] Re: [FB] Question about the key-repeat

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2008 : Group Archive : Group : All Groups

From: Robert Purves <listrp@...>
Date: Fri, 25 Apr 2008 19:43:05 +1200
Markus Binder wrote:

> now I see that my KeyRepeat function seems to have a second problem.  
> If I set LMSetKeyThresh( 0 ) then the KeyRepeat seems to be off, but  
> the steps after that are as long or as short as set in the  
> preferences choosen. Well, that is not the work it should work like.  
> The KeyRepeat should be turned on with my procedure call "fn  
> KeyRepeat 0" and - that´s new - with very low steps between the keys  
> after that, and it should be turned on if I call "fn KeyRepeat 1",  
> and set back the original values to the steps after that too! This  
> is needed to get a quick gameplay of course independend on what  
> settings are set in the preferences!


You need to call LMSetKeyRepThresh in addition to LMSetKeyThresh.


toolbox fn LMGetKeyThresh() = SInt16
toolbox LMSetKeyThresh( SInt16 thresh )
toolbox fn LMGetKeyRepThresh() = SInt16
toolbox LMSetKeyRepThresh( SInt16 thresh )


_myKeyRepeatTicks = 5

local fn Keyrepeat( restoreOrig as long )
begin globals
dim as SInt16 sOriginalKeyThresh, sOriginalKeyRepThresh // static vars
end globals
long if ( sOriginalKeyThresh == 0 )
sOriginalKeyThresh = fn LMGetKeyThresh() // save...
sOriginalKeyRepThresh = fn LMGetKeyRepThresh() //...originals
end if
long if ( restoreOrig == 0 )
LMSetKeyThresh( _myKeyRepeatTicks )
LMSetKeyRepThresh( _myKeyRepeatTicks )
xelse
LMSetKeyThresh( sOriginalKeyThresh ) // restore...
LMSetKeyRepThresh( sOriginalKeyRepThresh ) //...originals
end if
end fn


Robert P.