-
-
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.
documented set_application_name, focus_window, is_window_hidden, and …
…get_window_text. Also fixed parameter name being inconsistent in pack::read_file's documentation, and removed joystick_count from the documentation as it was an old SDL2 function.
- Loading branch information
1 parent
bab0c9a
commit eb19d7d
Showing
6 changed files
with
65 additions
and
15 deletions.
There are no files selected for viewing
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
20 changes: 20 additions & 0 deletions
20
doc/src/references/builtin/User Interface/Functions/focus_window.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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
Attempt to bring your NVGT window to the foreground. | ||
bool focus_window(); | ||
## Returns: | ||
bool: true if the window was successfully focused, false otherwise. | ||
*/ | ||
|
||
// Example: | ||
void main() { | ||
timer focuser; | ||
show_window("Focus every 5 seconds example"); | ||
while (true) { | ||
wait(5); | ||
if (key_pressed(KEY_ESCAPE)) exit(); | ||
if (focuser.has_elapsed(5000)) { | ||
focuser.restart(); | ||
focus_window(); | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
doc/src/references/builtin/User Interface/Functions/get_window_text.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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
Returns the title of your window. | ||
string get_window_text(); | ||
## Returns: | ||
string: the title of your window. | ||
*/ | ||
|
||
// Example: | ||
void main() { | ||
string[] possible_titles = {"Hello world", "NVGT test", "My game", "Example", "Window title example"}; | ||
show_window(possible_titles[random(0, possible_titles.length() - 1)]); | ||
while (true) { | ||
wait(5); | ||
if (key_pressed(KEY_ESCAPE)) exit(); | ||
if (key_pressed(KEY_SPACE)) { | ||
screen_reader_output("The window title currently is: " + get_window_text(), true); | ||
show_window(possible_titles[random(0, possible_titles.length() - 1)]); // Randomize the title again. | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
doc/src/references/builtin/User Interface/Functions/is_window_hidden.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
Determines if your game's window is hidden or not. | ||
bool is_window_hidden(); | ||
## Returns: | ||
bool: true if your game window is hidden, false if it's shown. | ||
*/ | ||
|
||
// Example: | ||
void main() { | ||
show_window("Test"); | ||
bool hide = random_bool(); | ||
if (hide) hide_window(); | ||
alert("The window is", is_window_hidden() ? "hidden" : "shown"); | ||
} |
14 changes: 0 additions & 14 deletions
14
doc/src/references/builtin/User Interface/Functions/joystick_count.nvgt
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
doc/src/references/builtin/User Interface/Functions/set_application_name.md
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# set_application_name | ||
This function lets you set the name of your application. This is a name that's sent to your operating system in certain instances, for example in volume mixer dialogs or when an app goes not responding. It does not effect the window title or anything similar. | ||
|
||
`bool set_application_name(string application_name);` | ||
|
||
## Arguments: | ||
* string application_name: the name to set for your application. | ||
|
||
## Returns: | ||
bool: true if the name was successfully set, false otherwise. |