mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-20 07:54:46 +00:00
f995f38e38
The command Sleep is supposed to allow timers to trigger while the program is sleeping on the delay. This is achieved in QB64 by having commands that do delays manually call evnt() to trigger events if they come up (of which timers are one). Sleep has a custom implementation for console programs on Windows which doesn't do this, so I redid the logic so that it calls evnt() at regular intervals while waiting for input. Additionally, due to now calling evnt() we also need to check if we should exit sleep early due to an evnt() firing. Fixes: #294
13 lines
176 B
QBasic
13 lines
176 B
QBasic
$Console:Only
|
|
|
|
On Timer(2) GoSub timerhand
|
|
Timer On
|
|
|
|
' The timer triggering should end sleep early, so it only triggers once
|
|
Sleep 10
|
|
|
|
System
|
|
|
|
timerhand:
|
|
Print "Timer!"
|
|
return
|