diff --git a/doc/src/references/builtin/Audio/Global Properties/sound_default_pack.md b/doc/src/references/builtin/Audio/Global Properties/sound_default_pack.md new file mode 100644 index 00000000..43d896be --- /dev/null +++ b/doc/src/references/builtin/Audio/Global Properties/sound_default_pack.md @@ -0,0 +1,4 @@ +# sound_default_pack +The default value passed to the second argument of sound::load, in other words, a handle to an open pack object that all future sounds will load from unless otherwise specified individually. + +`pack@ sound_default_pack = null;` diff --git a/doc/src/references/builtin/Audio/Global Properties/sound_global_hrtf.md b/doc/src/references/builtin/Audio/Global Properties/sound_global_hrtf.md index 626cde50..772a37a1 100644 --- a/doc/src/references/builtin/Audio/Global Properties/sound_global_hrtf.md +++ b/doc/src/references/builtin/Audio/Global Properties/sound_global_hrtf.md @@ -3,4 +3,4 @@ Controls weather to use steam audio's functionality. If this property is set to `bool sound_global_hrtf;` -Changes take nearly instant effect from the time this property is changed. +Changes take nearly instant effect from the time this property is modified. diff --git a/doc/src/references/builtin/Concurrency/Classes/thread_event/!thread_event.nvgt b/doc/src/references/builtin/Concurrency/Classes/thread_event/!thread_event.nvgt new file mode 100644 index 00000000..447941d8 --- /dev/null +++ b/doc/src/references/builtin/Concurrency/Classes/thread_event/!thread_event.nvgt @@ -0,0 +1,36 @@ +/** + This concurrency primative implements a method by which one or more threads can safely wait on another thread for the event to become signaled. + thread_event(thread_event_type type = THREAD_EVENT_AUTO_RESET); + ## Arguments: + thread_event_type type: The type of handling to perform when a waiting thread detects that the event has been set (see remarks). + ## Remarks: + This primative can be used to make one thread inexpensively sleep until another thread wakes it up, or can more simply be used for some threads to monitor when a condition has been completed on another thread in a safe manner. + It is not a good idea to just use standard booleans in multithreaded situations where you want one thread to know when another thread has completed it's work because threads could be reading from the boolean as it is being written to by a worker thread, causing an undefined result. The thread_event object is one way around this issue, as it can signal when a standard boolean is safe to access or sometimes avoid their usage entirely. + Quite simply one thread can call the set() method on an event, and if another thread has previously called the wait() method on the same event, that wait method will return thus resuming the first thread. If the event was created with the THREAD_EVENT_AUTO_RESET type, the event will also be set to unsignaled as the waiting thread wakes up. Otherwise, the reset() method must be called manually. +*/ + +// Example: +// Globals +thread_event program_event; +bool exit_program; +string message; +void message_thread() { + while (true) { + program_event.wait(); + if (exit_program) return; + screen_reader_speak(message, true); + } +} +void main() { + show_window("press space to speak on another thread"); + async(message_thread); + while (!key_pressed(KEY_ESCAPE)) { + wait(5); + if (key_repeating(KEY_SPACE)) { + message = "the date and time is " + calendar().format(DATE_TIME_FORMAT_RFC1123); + program_event.set(); + } + } + exit_program = true; + program_event.set(); +} diff --git a/doc/src/references/builtin/Concurrency/Classes/thread_event/Methods/reset.md b/doc/src/references/builtin/Concurrency/Classes/thread_event/Methods/reset.md new file mode 100644 index 00000000..88d4084f --- /dev/null +++ b/doc/src/references/builtin/Concurrency/Classes/thread_event/Methods/reset.md @@ -0,0 +1,8 @@ +# reset +Resets an event to an unsignaled state. +`void reset();` + +## Remarks: +This method is usually only needed if THREAD_EVENT_MANUAL_RESET was specified when the event was created, however you could also cancel the signaling of an event if another thread hasn't detected the signal yet. + +See the main event and mutex chapters for examples. diff --git a/doc/src/references/builtin/Concurrency/Classes/thread_event/Methods/set.md b/doc/src/references/builtin/Concurrency/Classes/thread_event/Methods/set.md new file mode 100644 index 00000000..eac579af --- /dev/null +++ b/doc/src/references/builtin/Concurrency/Classes/thread_event/Methods/set.md @@ -0,0 +1,6 @@ +# set +Causes an event to become signaled, waking up any threads waiting for this condition. +`void set();` + +## Remarks: +All existing examples that use events must call this method, so it will not be demonstrated in this chapter. diff --git a/doc/src/references/builtin/Concurrency/Classes/thread_event/Methods/try_wait.nvgt b/doc/src/references/builtin/Concurrency/Classes/thread_event/Methods/try_wait.nvgt new file mode 100644 index 00000000..f627264c --- /dev/null +++ b/doc/src/references/builtin/Concurrency/Classes/thread_event/Methods/try_wait.nvgt @@ -0,0 +1,25 @@ +/** + Wait a given number of milliseconds for an event to become signaled. + bool try_wait(uint milliseconds); + ## Arguments: + * uint milliseconds: The amount of time to wait, may be 0 to not wait at all. + ## Returns: + bool: True if another thread has signaled the event, or false if the event is still unsignaled after the given number of milliseconds has elapsed. + ## Remarks: + The semantics of this function are exactly the same as mutex::try_wait(), accept that this function waits on an event instead of a mutex. +*/ + +// Example: +thread_event g_wait; +void test_thread() { + screen_reader_speak("started", true); + while (!g_wait.try_wait(1000)) screen_reader_speak("waiting...", true); + screen_reader_speak("ah!", true); + g_wait.set(); +} +void main() { + async(test_thread); + wait(3500); + g_wait.set(); + g_wait.wait(); // So we'll know the other thread has finished speaking it's final message. +} diff --git a/doc/src/references/builtin/Concurrency/Classes/thread_event/Methods/wait.md b/doc/src/references/builtin/Concurrency/Classes/thread_event/Methods/wait.md new file mode 100644 index 00000000..a8d02078 --- /dev/null +++ b/doc/src/references/builtin/Concurrency/Classes/thread_event/Methods/wait.md @@ -0,0 +1,11 @@ +# wait +waits for the event to become signaled, blocking indefinitely or for a given duration if required. + +1. `void wait();` +2. `void wait(uint milliseconds);` + +## Arguments (2): +* uint milliseconds: How long to wait for the event to become signaled before throwing an exception + +## Remarks: +Beware that if you use the version of the wait function that takes a timeout argument, an exception will be thrown if the timeout expires without the event having become signaled. The version of the function taking 0 arguments waits forever for the event's set() method to be called. diff --git a/doc/src/references/builtin/Concurrency/Enums/thread_event_type.md b/doc/src/references/builtin/Concurrency/Enums/thread_event_type.md new file mode 100644 index 00000000..789e0fda --- /dev/null +++ b/doc/src/references/builtin/Concurrency/Enums/thread_event_type.md @@ -0,0 +1,4 @@ +# thread_event_type +These are the possible event types that can be used to successfully construct thread_event objects. +* THREAD_EVENT_MANUAL_RESET: Many threads can wait on this event because the `thread_event::reset()` method must be manually called. +* THREAD_EVENT_AUTO_RESET: Only one thread can wait on this event because it will be automatically reset as soon as the waiting thread detects that the event has become signaled. diff --git a/doc/src/references/builtin/Concurrency/Enums/thread_priority.md b/doc/src/references/builtin/Concurrency/Enums/thread_priority.md new file mode 100644 index 00000000..643c7898 --- /dev/null +++ b/doc/src/references/builtin/Concurrency/Enums/thread_priority.md @@ -0,0 +1,7 @@ +# thread_priority +It is possible to set a thread's priority to the following values in NVGT: +* THREAD_PRIORITY_LOWEST +* THREAD_PRIORITY_LOW +* THREAD_PRIORITY_NORMAL +* THREAD_PRIORITY_HIGH +* THREAD_PRIORITY_HIGHEST diff --git a/doc/src/references/builtin/Concurrency/Functions/thread_current_id.nvgt b/doc/src/references/builtin/Concurrency/Functions/thread_current_id.nvgt new file mode 100644 index 00000000..f3cf6625 --- /dev/null +++ b/doc/src/references/builtin/Concurrency/Functions/thread_current_id.nvgt @@ -0,0 +1,11 @@ +/** + Determine the operating system specific ID of the currently executing thread. + uint thread_current_id(); + ## Returns: + uint: The ID of the thread that this function was called on. +*/ + +// Example +void main() { + alert("Current thread ID is", thread_current_id()); +} diff --git a/doc/src/references/builtin/Concurrency/Functions/thread_yield.md b/doc/src/references/builtin/Concurrency/Functions/thread_yield.md new file mode 100644 index 00000000..5e670320 --- /dev/null +++ b/doc/src/references/builtin/Concurrency/Functions/thread_yield.md @@ -0,0 +1,6 @@ +# thread_yield +Yields CPU to other threads. +void thread_yield(); + +## Remarks: +This is a little bit like executing `wait(0);` accept that it doesn't pull the window, and there is absolutely no sleeping. It will temporarily yield code execution to the next scheduled thread that is of the same or higher priority as the one that called this function. diff --git a/doc/src/references/builtin/Data Manipulation/Functions/character_to_ascii.nvgt b/doc/src/references/builtin/Data Manipulation/Functions/character_to_ascii.nvgt index 3fcf15bc..7a113798 100644 --- a/doc/src/references/builtin/Data Manipulation/Functions/character_to_ascii.nvgt +++ b/doc/src/references/builtin/Data Manipulation/Functions/character_to_ascii.nvgt @@ -5,6 +5,9 @@ * string character: the character to convert. ## Returns: uint8: the ascii value for the given character. + ## Remarks: + If a string containing more than one character is passed as input to this function, only the left-most character is checked. + If an empty string is passed, the function returns 0. */ // Example: diff --git a/doc/src/references/builtin/Data Manipulation/Functions/pack_set_global_identifier.md b/doc/src/references/builtin/Data Manipulation/Functions/pack_set_global_identifier.md index c026c4fe..5a7c544e 100644 --- a/doc/src/references/builtin/Data Manipulation/Functions/pack_set_global_identifier.md +++ b/doc/src/references/builtin/Data Manipulation/Functions/pack_set_global_identifier.md @@ -12,3 +12,4 @@ bool: true if the identifier was properly set, false otherwise. ## Remarks: * The default pack identifier is "NVPK" followed by 4 NULL bytes. * Your pack identifier should be 8 characters or less. If it's less than 8 characters, 0s will be added as padding on the end. If it's larger than 8, the first 8 characters will be used. +* NVGT will refuse to open any pack files that do not match this identifier. diff --git a/doc/src/references/builtin/Data Manipulation/Functions/regexp_match.nvgt b/doc/src/references/builtin/Data Manipulation/Functions/regexp_match.nvgt index 01c0ba48..52a394a6 100644 --- a/doc/src/references/builtin/Data Manipulation/Functions/regexp_match.nvgt +++ b/doc/src/references/builtin/Data Manipulation/Functions/regexp_match.nvgt @@ -7,6 +7,7 @@ ## Returns: bool: true if the text matches the given regular expression, false otherwise. ## Remarks: + If you would like a lower level interface to regular_expressions in NVGT, check out the regexp class which this function more or less wraps. To learn more about regular expressions, visit: https://en.wikipedia.org/wiki/Regular_expression */ diff --git a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/AM.nvgt b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/AM.nvgt index f21c930b..2909cc70 100644 --- a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/AM.nvgt +++ b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/AM.nvgt @@ -7,5 +7,5 @@ void main() { datetime d; d.set(2024, 5, 8, 14, 18); - alert("The datetime's AM value is", d.AM); + alert("The datetime's AM value was set to", d.AM); } diff --git a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/PM.nvgt b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/PM.nvgt index 45463d66..49a76d4d 100644 --- a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/PM.nvgt +++ b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/PM.nvgt @@ -7,5 +7,5 @@ void main() { datetime d; d.set(2024, 5, 8, 14, 18); - alert("The datetime's PM value is", d.PM); + alert("The datetime's set PM value is", d.PM); } diff --git a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/day.nvgt b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/day.nvgt index 88135e3b..4c5c05f8 100644 --- a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/day.nvgt +++ b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/day.nvgt @@ -7,5 +7,5 @@ void main() { datetime d; d.set(2024, 5, 8); - alert("The datetime's current day is", d.day); + alert("The datetime's set day is", d.day); } diff --git a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/hour.nvgt b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/hour.nvgt index 49425d0b..fec261fd 100644 --- a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/hour.nvgt +++ b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/hour.nvgt @@ -7,5 +7,5 @@ void main() { datetime d; d.set(d.year, d.month, d.day, 13, 47, 19); - alert("The current hour of the datetime object is", d.hour); + alert("The set hour of the datetime object is", d.hour); } diff --git a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/hour12.nvgt b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/hour12.nvgt index 1ea9df74..5bd665a3 100644 --- a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/hour12.nvgt +++ b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/hour12.nvgt @@ -7,5 +7,5 @@ void main() { datetime d; d.set(d.year, d.month, d.day, 13, 47, 19); - alert("In 12 hour time, the current hour of the datetime object is", d.hour12); + alert("In 12 hour time, the set hour of the datetime object is", d.hour12); } diff --git a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/julian_day.nvgt b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/julian_day.nvgt new file mode 100644 index 00000000..8bca0d7c --- /dev/null +++ b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/julian_day.nvgt @@ -0,0 +1,13 @@ +/** + Represents the current timestamp held by the datetime object in julian days. + const double julian_day; + ## Remarks: + The [julian day](http://en.wikipedia.org/wiki/Julian_day) measures, including decimal fractions, the amount of time that has passed (in years) since Monday, January 1st, 4713 BC at 12 PM Universal Time. +*/ + +// Example: +void main() { + datetime d; + d.set(2024, 5, 8, 16, 17, 18); + alert("The julian day represented by this datetime object is", d.julian_day); +} diff --git a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/microsecond.nvgt b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/microsecond.nvgt index 827dda77..636d95e7 100644 --- a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/microsecond.nvgt +++ b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/microsecond.nvgt @@ -7,5 +7,5 @@ void main() { datetime d; d.set(d.year, d.month, d.day, 12, 47, 19, 217, 962); - alert("The current microsecond value of the datetime object is", d.microsecond); + alert("The set microsecond value of the datetime object is", d.microsecond); } diff --git a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/millisecond.nvgt b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/millisecond.nvgt index ecb2b763..fe70e180 100644 --- a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/millisecond.nvgt +++ b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/millisecond.nvgt @@ -7,5 +7,5 @@ void main() { datetime d; d.set(d.year, d.month, d.day, 12, 47, 19, 217); - alert("The current millisecond value of the datetime object is", d.millisecond); + alert("The set millisecond value of the datetime object is", d.millisecond); } diff --git a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/minute.nvgt b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/minute.nvgt index 810c8f90..f97354bb 100644 --- a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/minute.nvgt +++ b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/minute.nvgt @@ -7,5 +7,5 @@ void main() { datetime d; d.set(d.year, d.month, d.day, 12, 47, 19); - alert("The current minute of the datetime object is", d.minute); + alert("The set minute of the datetime object is", d.minute); } diff --git a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/month.nvgt b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/month.nvgt index 0c3a403d..a660b3d8 100644 --- a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/month.nvgt +++ b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/month.nvgt @@ -7,5 +7,5 @@ void main() { datetime d; d.set(2024, 5, 8); - alert("The datetime's current month is", d.month); + alert("The datetime's set month is", d.month); } diff --git a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/second.nvgt b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/second.nvgt index 34f41af9..0fb3bae6 100644 --- a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/second.nvgt +++ b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/second.nvgt @@ -7,5 +7,5 @@ void main() { datetime d; d.set(d.year, d.month, d.day, 12, 47, 19); - alert("The current second of the datetime object is", d.second); + alert("The set second of the datetime object is", d.second); } diff --git a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/weekday.nvgt b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/weekday.nvgt index 68ca154a..949ac444 100644 --- a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/weekday.nvgt +++ b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/weekday.nvgt @@ -7,5 +7,5 @@ void main() { datetime d; d.set(2024, 5, 8); - alert("The datetime's current day of the week is", d.weekday); + alert("The datetime's set day of the week is", d.weekday); } diff --git a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/year.nvgt b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/year.nvgt index c4df2424..027baa1b 100644 --- a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/year.nvgt +++ b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/year.nvgt @@ -7,5 +7,5 @@ void main() { datetime d; d.set(2024, 5, 8); - alert("The datetime's current year is", d.year); + alert("The datetime's set year is", d.year); } diff --git a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/yearday.nvgt b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/yearday.nvgt index 3b27010c..f3b4194a 100644 --- a/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/yearday.nvgt +++ b/doc/src/references/builtin/Date and Time/Classes/datetime/Properties/yearday.nvgt @@ -7,5 +7,5 @@ void main() { datetime d; d.set(2024, 5, 8); - alert("The datetime's current day of the year is", d.yearday); + alert("The datetime's set day of the year is", d.yearday); } diff --git a/doc/src/references/builtin/Date and Time/Classes/timestamp/!timestamp.md b/doc/src/references/builtin/Date and Time/Classes/timestamp/!timestamp.md new file mode 100644 index 00000000..0d1e5643 --- /dev/null +++ b/doc/src/references/builtin/Date and Time/Classes/timestamp/!timestamp.md @@ -0,0 +1,11 @@ +# timestamp +Stores a unix timestamp with microsecond accuracy and provides methods for comparing them. +1. timestamp(); +2. timestamp(int64 epoch_microseconds); + +## Arguments 2: +* int64 epoch_microseconds: the initial value of the timestamp + +## Remarks: +If a timestamp object is initialize with the default constructor, it will be set to the system's current date and time. +The unix epoch began on January 1st, 1970 at 12 AM UTC. diff --git a/doc/src/references/builtin/Date and Time/Classes/timestamp/Methods/has_elapsed.nvgt b/doc/src/references/builtin/Date and Time/Classes/timestamp/Methods/has_elapsed.nvgt new file mode 100644 index 00000000..70484628 --- /dev/null +++ b/doc/src/references/builtin/Date and Time/Classes/timestamp/Methods/has_elapsed.nvgt @@ -0,0 +1,18 @@ +/** + determine whether the given number of microseconds has elapsed since the time point stored in this timestamp. + bool has_elapsed(int64 microseconds); + ## Arguments: + * int64 microseconds: the number of microseconds to check elapsed status of + ## Returns: + bool: Whether the given number of milliseconds has elapsed + ## Remarks: + This method serves as a shorthand version of executing `bool has_elapsed = timestamp() - this >= microseconds;` +*/ + +// Example: +void main() { + timestamp ts; + alert("test", "will you keep the alert box opened for 10 seconds?"); + if (ts.has_elapsed(10 * SECONDS)) alert("good job", "You kept the alert box opened for 10 seconds!"); + else alert("oh no", "looks like a bit of character development in regards to the trait of patience is in order..."); +} diff --git a/doc/src/references/builtin/Date and Time/Classes/timestamp/Methods/update.nvgt b/doc/src/references/builtin/Date and Time/Classes/timestamp/Methods/update.nvgt new file mode 100644 index 00000000..14914c5e --- /dev/null +++ b/doc/src/references/builtin/Date and Time/Classes/timestamp/Methods/update.nvgt @@ -0,0 +1,13 @@ +/** + Reset this timestamp to the system's current date and time. + void update(); +*/ + +// Example: +void main() { + timestamp ts; + ts -= 60 * SECONDS; + alert("timestamp before reset", ts / SECONDS); + ts.update(); + alert("current timestamp", ts / SECONDS); +} diff --git a/doc/src/references/builtin/Date and Time/Classes/timestamp/Operators/opImplConv.md b/doc/src/references/builtin/Date and Time/Classes/timestamp/Operators/opImplConv.md new file mode 100644 index 00000000..0d9e6621 --- /dev/null +++ b/doc/src/references/builtin/Date and Time/Classes/timestamp/Operators/opImplConv.md @@ -0,0 +1,3 @@ +# opImplConv +Implicitly convert the timestamp to a 64 bit integer containing a raw microsecond accuracy unix epoch. +int64 opImplConv(); diff --git a/doc/src/references/builtin/Date and Time/Classes/timestamp/Properties/UTC_time.nvgt b/doc/src/references/builtin/Date and Time/Classes/timestamp/Properties/UTC_time.nvgt new file mode 100644 index 00000000..197a1cc6 --- /dev/null +++ b/doc/src/references/builtin/Date and Time/Classes/timestamp/Properties/UTC_time.nvgt @@ -0,0 +1,12 @@ +/** + Determines a UTC based time point based on the value stored in the timestamp object. + const int64 UTC_time; + ## Remarks: + UTC based time begins on October 15, 1582 at 12 AM and uses an accuracy of 100 nanoseconds. +*/ + +// Example: +void main() { + timestamp ts; + alert("example", "The current UTC time value is " + ts.UTC_time); +} diff --git a/doc/src/references/builtin/Date and Time/Classes/timestamp/Properties/elapsed.nvgt b/doc/src/references/builtin/Date and Time/Classes/timestamp/Properties/elapsed.nvgt new file mode 100644 index 00000000..f39ac192 --- /dev/null +++ b/doc/src/references/builtin/Date and Time/Classes/timestamp/Properties/elapsed.nvgt @@ -0,0 +1,12 @@ +/** + Determine the difference of time in microseconds between this timestamp's value and now. + const int64 elapsed; + ## Remarks: + This property is a shorthand version of the expression `int64 elapsed = timestamp() - this;` +*/ + +// Example: +void main() { + datetime dt(2013, 11, 29, 1, 2, 3); + alert("example", dt.format(DATE_TIME_FORMAT_RFC850) + " was " + (dt.timestamp.elapsed / DAYS) + " days ago"); +} diff --git a/doc/src/references/builtin/Date and Time/Functions/timestamp_from_UTC_time.nvgt b/doc/src/references/builtin/Date and Time/Functions/timestamp_from_UTC_time.nvgt new file mode 100644 index 00000000..80991907 --- /dev/null +++ b/doc/src/references/builtin/Date and Time/Functions/timestamp_from_UTC_time.nvgt @@ -0,0 +1,19 @@ +/** + Create a timestamp object from a UTC time point. + timestamp timestamp_from_UTC_time(int64 UTC_time); + ## Arguments: + * int64 UTC_time: The UTC time point (see remarks). + ## Returns: + timestamp: A timestamp derived from the given value. + ## Remarks: + UTC based time begins on October 15, 1582 at 12 AM and uses an accuracy of 100 nanoseconds. +*/ + +// Example: +void main() { + calendar c(2017, 2, 3, 4, 5, 6); + alert("initial calendar", c.format(DATE_TIME_FORMAT_RFC1123)); + timestamp ts = timestamp_from_UTC_time(c.UTC_time); + calendar c2 = ts; + alert("new calendar", c2.format(DATE_TIME_FORMAT_RFC1123)); +} diff --git a/doc/src/references/builtin/User Interface/Functions/install_keyhook.nvgt b/doc/src/references/builtin/User Interface/Functions/install_keyhook.nvgt index e4e8b63b..6d5c5323 100644 --- a/doc/src/references/builtin/User Interface/Functions/install_keyhook.nvgt +++ b/doc/src/references/builtin/User Interface/Functions/install_keyhook.nvgt @@ -7,6 +7,7 @@ bool: true if the keyhook was successfully installed, false otherwise. ## Remarks: This keyhook allows NVGT games to properly capture keyboard input while the JAWS for Windows screen reader is running. + Note that installing it when JAWS is not running may yield unintended consequences, such as functionality of other screen readers being slightly limited while in your game window. */ // Example: diff --git a/doc/src/references/builtin/User Interface/Functions/is_console_available.md b/doc/src/references/builtin/User Interface/Functions/is_console_available.md deleted file mode 100644 index 4f05f535..00000000 --- a/doc/src/references/builtin/User Interface/Functions/is_console_available.md +++ /dev/null @@ -1,7 +0,0 @@ -# is_console_available -Determine if your application has access to a console window or not. - -`bool is_console_available();` - -## Returns: -bool: true if your application has access to a console window, false otherwise. diff --git a/doc/src/references/builtin/User Interface/Functions/is_console_available.nvgt b/doc/src/references/builtin/User Interface/Functions/is_console_available.nvgt new file mode 100644 index 00000000..a71246d1 --- /dev/null +++ b/doc/src/references/builtin/User Interface/Functions/is_console_available.nvgt @@ -0,0 +1,14 @@ +/** + Determine if your application has access to a console window or not. + bool is_console_available(); + ## Returns: + bool: true if your application has access to a console window, false otherwise. + ## Remarks: + If this function returns false, it is very likely that any output passed to the print or println functions or the cout/cerr datastreams will be silently dropped. +*/ + +// Example: +void main() { + if (is_console_available()) println("hello from the console!"); + else alert("console unavailable", "hello from the user interface!"); +}