From bbd1d87d2a24c62f2417d2b6654ff974eb4f8c91 Mon Sep 17 00:00:00 2001 From: 4ian <1280130+4ian@users.noreply.github.com> Date: Fri, 6 Mar 2026 10:19:49 +0000 Subject: [PATCH] [Auto] [Improve] Improve keyboard docs with key just pressed, key names table, and mobile warning --- automated_updates_data.json | 4 ++ docs/gdevelop5/all-features/keyboard/index.md | 47 ++++++++++++------- .../all-features/screenshot/index.md | 34 ++++++-------- 3 files changed, 50 insertions(+), 35 deletions(-) diff --git a/automated_updates_data.json b/automated_updates_data.json index 707ca2a1fb5..30eae6babd0 100644 --- a/automated_updates_data.json +++ b/automated_updates_data.json @@ -68,6 +68,10 @@ { "date": "2026-03-05", "summary": "Improved network docs: updated to async single-URL API, added HTTP methods, error variable, CORS warning, content type info, and Open URL action" + }, + { + "date": "2026-03-06", + "summary": "Improved keyboard docs with Key just pressed, Any key released, held-vs-just-pressed distinction, key name table, and mobile warning; fixed screenshot docs with correct expression syntax and desktop-only note" } ] } diff --git a/docs/gdevelop5/all-features/keyboard/index.md b/docs/gdevelop5/all-features/keyboard/index.md index a939ed6bcbe..c123d2ee148 100644 --- a/docs/gdevelop5/all-features/keyboard/index.md +++ b/docs/gdevelop5/all-features/keyboard/index.md @@ -3,40 +3,55 @@ title: Keyboard --- # Keyboard -GDevelop gives access to all inputs made on the keyboard. This includes conditions to check if a key was pressed or released. +GDevelop gives access to all inputs made on the keyboard. This includes conditions to check if a key was pressed, held, or released, and an expression to retrieve the last key pressed. -## Any key pressed +!!! warning -For this condition, the corresponding action/s will be performed if any key on the keyboard is pressed. + Keyboard conditions do **not** work with on-screen touch keyboards on mobile devices. When targeting mobile or touch-screen platforms, use mouse/touch conditions instead (or gamepad conditions with a virtual joystick). ## Key pressed -Whenever the key selected while setting this condition is pressed, the corresponding actions are performed. +This condition is true as long as the key is **held down**. It is useful for continuous actions such as moving a character — the action runs every frame while the key is down. -## Key released +## Key just pressed + +This condition is true only for the **single frame when the key is first pressed down**. Use this for one-shot actions like jumping or firing a weapon, where you want the action to trigger once per key press rather than every frame. + +!!! tip -Whenever the key selected while setting this condition is released, the corresponding actions are performed. + If a player complains that holding down the jump key makes them jump repeatedly, switch from **Key pressed** to **Key just pressed**. + +## Key released -## Key pressed (text expression) +This condition is true only for the **single frame when the key is released**. Useful for actions that should trigger at the moment the player lifts their finger. -To test a key press using this condition, you need to enter the key name in the form of text expression. For example, if you want to check condition for left arrow key press, you need to enter "Left" in the field. +## Any key pressed / Any key released -!!! danger +These conditions are true when **any** keyboard key is pressed or released, regardless of which one. Handy for "press any key to continue" prompts. - Make sure that the key name is surrounded by quotes. +Use the **Last key pressed** expression to find out which key it was — for example, to display it in a text object or store it in a variable. -![](/gdevelop5/all-features/annotation_2019-06-20_191229.png) +## Key names -## Key released (text expression) +Keys are identified by name strings. Some common names: -To test a key release using this condition, you need to enter the key name in the form of text expression. For example, if you want to check condition for left arrow key release, you need to enter "Left" in the field. +| Key | Name string | +|---|---| +| Arrow keys | `Left`, `Right`, `Up`, `Down` | +| Letter keys | `a`–`z` (lowercase) | +| Number row | `Num0`–`Num9` | +| Numpad digits | `Numpad0`–`Numpad9` | +| Function keys | `F1`–`F12` | +| Modifier keys | `LShift`, `RShift`, `LControl`, `RControl`, `LAlt`, `RAlt` | +| Space / Enter | `Space`, `Return` | +| Other | `Escape`, `Tab`, `Back` (Backspace), `Delete`, `Insert`, `Pause` | -![](/gdevelop5/all-features/annotation_2019-06-20_191302.png) +The GDevelop event editor provides a key picker, so you rarely need to type names manually. The **Key pressed (text expression)** and **Key released (text expression)** variants accept the name as a text expression, which is useful when the key to check is stored in a variable. ## Last key pressed -"Last key pressed" expression returns the last key press in the form of a string. For example, if the last key press is the left arrow key, the expression will return "Left". +The `LastPressedKey()` expression returns the name of the most recently pressed key as a string. For example, if the player presses the left arrow key, the expression returns `"Left"`. ## Reference -All actions, conditions and expressions are listed in [the keyboard reference page](/gdevelop5/all-features/keyboard/reference/). \ No newline at end of file +All actions, conditions and expressions are listed in [the keyboard reference page](/gdevelop5/all-features/keyboard/reference/). diff --git a/docs/gdevelop5/all-features/screenshot/index.md b/docs/gdevelop5/all-features/screenshot/index.md index bb4518a4228..36d9bb48907 100644 --- a/docs/gdevelop5/all-features/screenshot/index.md +++ b/docs/gdevelop5/all-features/screenshot/index.md @@ -3,36 +3,32 @@ title: Screenshot extension --- # Screenshot extension -This extension lets you save a screenshot of the running game in a specified folder. +This extension lets you save a screenshot of the running game to a file. -Note: As of GDevelop 5.0.0-beta92 the screenshot action is no longer an extension. Just add an action and search for `screenshot` or go to `Other Actions`/`Screenshot`/`Take screenshot`. +!!! warning -### Actions + Screenshots are saved to the **local file system**, so this only works in **desktop (Windows/macOS/Linux) exports** built with Electron. The action has no effect in web/browser or mobile builds. -#### Take screenshot +## Take screenshot -Use this action to save a screenshot of everything which is currently drawn on the game window into a *png* file. +Use the **Take screenshot** action to save everything currently drawn on the game window as a PNG file. -##### Parameters: +**Save path**: The absolute path where the file should be saved, including the `.png` extension. If the extension is omitted it is added automatically. -**Save path**: The file path where the screenshot should be saved. +!!! tip -The save path needs to be an absolute path on the file system (Like "C:\MyFolder\MyScreenshot.png" on Windows)' + Use the special folder expressions from the [File System extension](/gdevelop5/all-features/filesystem) to build a portable path that works across operating systems: -Relative paths are not supported. + ``` + FileSystem::PicturesPath() + FileSystem::PathDelimiter() + "my_screenshot.png" + ``` -!!! note - - In order to create a game that runs on all supported platforms you should use the special folders from the file system extension in combination with the path separator. These determine the path to common folders like *Pictures*, *Documents* or *Desktop* automatically. You can read more about it in [this article](/gdevelop5/all-features/filesystem). - -## Example + This saves the screenshot to the *Pictures* folder on Windows, macOS and Linux. -This path: - -``` () + () + "my_screenshot.png" ``` +!!! note -This will save the screenshot to the *Pictures* folder on Windows, Linux and MacOS. + Relative paths are not supported. Always use an absolute path or one built from a `FileSystem::` expression. ## Reference -All actions, conditions and expressions are listed in [the screenshot extension reference page](/gdevelop5/all-features/screenshot/reference/). \ No newline at end of file +All actions, conditions and expressions are listed in [the screenshot extension reference page](/gdevelop5/all-features/screenshot/reference/).