GLBasic forum

Main forum => GLBasic - en => Topic started by: PeeJay on 2007-Dec-27

Title: Request - DELAY (millisecs)
Post by: PeeJay on 2007-Dec-27
Nice simple command to pause program execution for a set length of time.

While I have already written a function to do this:

Code (glbasic) Select
FUNCTION Pause: ms

LOCAL time1,time2
time1=GETTIMERALL()

WHILE TRUE
time2=GETTIMERALL()
IF time2>time1+ms THEN BREAK
WEND

ENDFUNCTION
it would be nice to have it as part of the language.
Title: Request - DELAY (millisecs)
Post by: S.O.P.M. on 2007-Dec-27
What do you think, is this the same than a delay command? Will it save CPU power?
Title: Request - DELAY (millisecs)
Post by: Schranz0r on 2007-Dec-27
IF timer < GETTIMERALL()
    ....SOME CODE.....
    timer = GETTIMERALL()+delay
ENDIF
Title: Request - DELAY (millisecs)
Post by: Kitty Hello on 2007-Dec-29
New command: SLEEP, get the update ;)
Title: Request - DELAY (millisecs)
Post by: S.O.P.M. on 2007-Dec-29
Yeah. This will save CPU power.