Skip to content

Commit

Permalink
documentation and removal of a debug string
Browse files Browse the repository at this point in the history
* Document get_characters function.

* Fix minor formatting issues in idle_ticks documentation.

* Update contributors a bit, though could still do with some work after looking carefully at commit log.

[skip ci]
  • Loading branch information
samtupy committed Jun 25, 2024
1 parent 670762f commit 144ca36
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
4 changes: 3 additions & 1 deletion doc/src/appendix/Contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ This file contains the names of anyone who has helped contribute to the NVGT eng
* [Quin G](https://github.com/thequinbox): responsible for a growing number of API references documentation topics, beta testing.
* [Rory Michie](https://github.com/RoryMichie): Has done much work on the NVGT user manual.
* [Tyler Spivey](https://github.com/tspivey): rewrote the executable loader on Windows to work with packers such as UPX.
* [Ethin Probst](https://github.com/ethindp): major optimizations to parts of the code, rewrote sound effect parsing.
* [Ethin Probst](https://github.com/ethindp): major optimizations to parts of the code, rewrote sound effect parsing, libspeechd integration, docs.
* Valiant8086: Documentation on game distribution.
* Gruia Chiscop: AVSpeech implementation.
* Beta testers including but not limited to Patrick Wilson, Quin G, Steven D, Lucas Brown, Liam Erven, DJWolfy, Lukáš Hosnedl, Heaven Games, Pragma and Day Garwood, without the valuable feedback and suggestions provided by these people NVGT would have never gotten this far.
* Last but not least, nothing is worth maintaining or developing without users, and so thank you to everyone who uses this engine and gives it their feedback, time and attention!
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
Determine any printable characters typed into the games window since this function's lass call.
string get_characters();
## Returns:
string: Any characters typed since this function was last called, or an empty string if none are available.
## Remarks:
This is the function one would use if they wished to integrate a virtual text field of any sort into their games or applications.
Unlike functions such as key_down or keys_pressed, this function focuses specifically on textual content which has been input to the application. A character returned from this function, for example, could be anything from the space bar to an emoticon inserted using the windows emoji picker.
A typical use case would involve calling this function once per iteration of your game loop and storing any new characters that are typed into a buffer that composes a chat message or a username or anything else requiring virtual text input.
*/

// Example:
void main() {
string buffer;
show_window("get_characters example");
while (!key_pressed(KEY_ESCAPE)) {
wait(5);
string char = get_characters();
if (!char.empty()) {
buffer += char;
screen_reader_speak(char, true); // You need to process this further for screen readers, such as replacing . with period and other punctuation.
}
if (key_pressed(KEY_RETURN)) {
screen_reader_speak("You typed " + (!buffer.empty()? buffer : "nothing"), true);
buffer = "";
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/**
Obtain the time passed since a user has pressed a key or used the mouse.
Obtain the time passed in milliseconds 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.
uint64: the number of milliseconds since a user has last interacted with the machine.
## remarks
This function can serve as a useful utility to verify whether a user has been away from the keyboard.
It is currently integrated for windows and MacOS. On linux, it will always return 0 until further notice.
*/

// Example
Expand Down
1 change: 0 additions & 1 deletion src/threading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ class async_result : public RefCountedObject, public Runnable {
engine->ReturnContext(ctx);
return false;
}
printf("function receives %s\n", engine->GetTypeDeclaration(param_typeid));
if (gen->GetArgCount() - 2 <= i || param_default) {
if (!param_default) {
aCtx->SetException("Not enough arguments");
Expand Down

0 comments on commit 144ca36

Please sign in to comment.