Skip to content

Commit

Permalink
Added docs for sound::loaded_filename and itle_ticks() (#66)
Browse files Browse the repository at this point in the history
I have added 2 new files according to the docs structure.
  • Loading branch information
literary-programmer authored Jun 19, 2024
1 parent 6d6fe38 commit 8499aef
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# loaded_filename
Obtain the path of sound file that has been loaded.

`string sound::loaded_filename;`
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
Obtain the time passed since a user has pressed a key or used the mouse.
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()
{
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();
}
}

0 comments on commit 8499aef

Please sign in to comment.