From e4188b680e693427a70d10374f43a108cc13f858 Mon Sep 17 00:00:00 2001 From: 4ian <1280130+4ian@users.noreply.github.com> Date: Wed, 27 May 2026 11:25:01 +0000 Subject: [PATCH] [Auto] [Improve] Expanded keyboard docs with key names and just-pressed distinction; clarified screenshot platform support --- automated_updates_data.json | 4 ++ docs/gdevelop5/all-features/keyboard/index.md | 43 +++++++++++++------ .../all-features/screenshot/index.md | 6 ++- 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/automated_updates_data.json b/automated_updates_data.json index b2d10e2b2e..0bb9783406 100644 --- a/automated_updates_data.json +++ b/automated_updates_data.json @@ -92,6 +92,10 @@ { "date": "2026-04-22", "summary": "Improved resources-loading docs (named Preload scene action, documented SceneLoadingProgress expression and AreSceneAssetsLoaded condition, clarified custom loading screen approach) and added extension lifecycle functions table to events/functions docs" + }, + { + "date": "2026-05-27", + "summary": "Improved keyboard docs (added 'Key just pressed' vs 'Key pressed' distinction, 'Any key released' condition, key name reference, touch-device warning) and clarified screenshot docs (desktop-only support, automatic .png extension)" } ] } diff --git a/docs/gdevelop5/all-features/keyboard/index.md b/docs/gdevelop5/all-features/keyboard/index.md index a939ed6bcb..6ac0470579 100644 --- a/docs/gdevelop5/all-features/keyboard/index.md +++ b/docs/gdevelop5/all-features/keyboard/index.md @@ -3,23 +3,30 @@ 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, just pressed or released. -## 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 react to the on-screen (virtual) keyboard on touch devices. When making a game for mobile or touch screens, use the [Mouse and touch](/gdevelop5/all-features/mouse-touch) conditions instead, or combine both for cross-platform input. -## Key pressed +## Key pressed vs. Key just pressed -Whenever the key selected while setting this condition is pressed, the corresponding actions are performed. +There are two similar but distinct conditions to detect when a key is down: -## Key released +* **Key pressed**: stays true for every frame the key is held down. Use this for continuous actions, such as moving a character while an arrow key is held. +* **Key just pressed**: only true on the single frame during which the key started being pressed. Use this for one-shot actions, such as opening a menu, firing a single shot or jumping when a key is tapped. -Whenever the key selected while setting this condition is released, the corresponding actions are performed. +Use the matching **Key released** condition to detect the single frame on which a key was released. -## Key pressed (text expression) +## Any key pressed / Any key released -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. +These conditions are triggered when *any* key on the keyboard is pressed or released. They are useful for "Press any key to continue…" prompts or to detect that the player started using the keyboard. + +## Key pressed / Key released (text expression) + +These variants let you specify the key to check using a text expression (a string in quotes) instead of picking it from a list. This is useful when the key is configurable (for example, stored in a variable to support remapping controls). + +For example, to check the left arrow key, type `"Left"` in the field. !!! danger @@ -27,15 +34,25 @@ To test a key press using this condition, you need to enter the key name in the ![](/gdevelop5/all-features/annotation_2019-06-20_191229.png) -## Key released (text expression) +### Key names + +Keys are referred to by name. Some commonly used ones: + +* Letters: `"a"` to `"z"` (lowercase) +* Top-row digits: `"Num0"` to `"Num9"`. Numeric keypad: `"Numpad0"` to `"Numpad9"`. +* Arrows: `"Left"`, `"Right"`, `"Up"`, `"Down"` +* Function keys: `"F1"` to `"F12"` +* Special: `"Space"`, `"Return"` (Enter), `"Tab"`, `"Escape"`, `"Back"` (Backspace), `"Delete"`, `"Insert"`, `"Home"`, `"End"`, `"PageUp"`, `"PageDown"` +* Modifiers (location-aware): `"LShift"`/`"RShift"`, `"LControl"`/`"RControl"`, `"LAlt"`/`"RAlt"`, `"LSystem"`/`"RSystem"` (Windows/Command key) +* Punctuation: `"Comma"`, `"Period"`, `"SemiColon"`, `"Quote"`, `"Slash"`, `"BackSlash"`, `"Equal"`, `"Dash"`, `"LBracket"`, `"RBracket"`, `"Tilde"` -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. +!!! tip -![](/gdevelop5/all-features/annotation_2019-06-20_191302.png) + The left and right variants of Shift, Control, Alt and System keys are reported separately. To accept either side, check both keys with an [OR condition](/gdevelop5/all-features/advanced-conditions). ## 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, `"Left"` if the left arrow was the last key pressed). This is useful for input remapping screens where the player presses a key to assign it to an action. ## Reference diff --git a/docs/gdevelop5/all-features/screenshot/index.md b/docs/gdevelop5/all-features/screenshot/index.md index bb4518a422..2697537241 100644 --- a/docs/gdevelop5/all-features/screenshot/index.md +++ b/docs/gdevelop5/all-features/screenshot/index.md @@ -7,6 +7,10 @@ This extension lets you save a screenshot of the running game in a specified fol 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 + + Taking a screenshot to a file is only supported when the game runs on **Windows, Linux or macOS** (desktop builds and previews). It does not work in web/HTML5 builds or on Android and iOS, since those platforms do not give the game write access to the local file system. + ### Actions #### Take screenshot @@ -19,7 +23,7 @@ Use this action to save a screenshot of everything which is currently drawn on t The save path needs to be an absolute path on the file system (Like "C:\MyFolder\MyScreenshot.png" on Windows)' -Relative paths are not supported. +Relative paths are not supported. If the path does not end with `.png`, the extension is added automatically. !!! note