-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8499aef
commit 9a898c8
Showing
1 changed file
with
2 additions
and
5 deletions.
There are no files selected for viewing
7 changes: 2 additions & 5 deletions
7
doc/src/references/builtin/User Interface/Functions/idle_ticks.nvgt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,22 @@ | ||
/* | ||
Obtain the time passed since a user has pressed a key or used the mouse. | ||
uint64 idle_ticks() | ||
uint64 idle_ticks(); | ||
## returns | ||
Returns the number of milliseconds since a user has not interacted with the machine. | ||
## remarks | ||
This function can serve as a useful utility to verify whether a user has been away from the keyboard. | ||
*/ | ||
|
||
// Example | ||
void main() | ||
{ | ||
void main() { | ||
int64 t; | ||
|
||
show_window("Idle test"); | ||
wait(50); | ||
screen_reader_speak("Press space to check the idle time and escape to exit.", true); | ||
while (!key_pressed(KEY_ESCAPE)) { | ||
wait(5); | ||
if (key_pressed(KEY_SPACE)) | ||
screen_reader_speak("You have been idle for %0 milliseconds".format(t), true); | ||
|
||
t = idle_ticks(); | ||
} | ||
} |