timer while mouse is moving

BlitzPlus Forums/BlitzPlus Programming/timer while mouse is moving

allos(Posted 2003) [#1]
Hi, I have a little problem and hope someone will help me tosolve it:
I need to show a string on the screen for a small, customizable amount of time (e.g. 50-500 milliseconds)
A good result is obtained with millisecs(), but I noticed that moving the mouse around slows the execution and makes time impredictable, even if mouse is hidden (either in Blitz Basic and in Blitz Plus): use of delay() seems not useful.
Some idesas? Thank you
allos


semar(Posted 2003) [#2]
Perhaps using a timer in your main loop could help. Look for Createtimer() and Waittimer() commands.

Hope this helps,
Sergio.


Ross C(Posted 2003) [#3]
hey, try this out. might be of some use

Graphics 800,600
Text 0,0," press any key to begin"
WaitKey()
SetBuffer BackBuffer()


a$="Hello"

time=4000
timer=MilliSecs()

While Not KeyHit(1)

	Cls

	If KeyHit(200) Then timer=MilliSecs()
	Rect MouseX(),MouseY(),2,2
	
	If timer+time>MilliSecs() Then
		Text MouseX(),MouseY(),a$
		Text 0,0,"Text will display for another "+((timer+time)-MilliSecs())
	End If
	
	Text 300,0," Press up to restart timer"
	
	Flip
Wend
End