From 3e2ebdd6759a9f96deb0ed2b5575b3eb3237121e Mon Sep 17 00:00:00 2001 From: 4ian <1280130+4ian@users.noreply.github.com> Date: Thu, 19 Mar 2026 10:25:44 +0000 Subject: [PATCH] [Auto] [Improve] Enhanced keyboard key names table and window resolution expressions docs --- automated_updates_data.json | 4 ++ docs/gdevelop5/all-features/keyboard/index.md | 37 ++++++++++-- docs/gdevelop5/all-features/window/index.md | 56 ++++++++++++++----- 3 files changed, 78 insertions(+), 19 deletions(-) diff --git a/automated_updates_data.json b/automated_updates_data.json index b2ebce0524b..a12d82e932d 100644 --- a/automated_updates_data.json +++ b/automated_updates_data.json @@ -80,6 +80,10 @@ { "date": "2026-03-15", "summary": "Improved string-instructions (added StrReplaceOne/StrReplaceAll), common-conversions (added LargeNumberToString, ToJSON/ObjectVarToJSON), timers (added TimeScale and Time() format selectors), and gamepad docs (added analog triggers, deadzone, StickForceX/Y, controller type detection)" + }, + { + "date": "2026-03-19", + "summary": "Improved keyboard docs (AnyKeyReleased condition, Key just pressed clarification, full key name table) and window docs (game resolution vs window size, resize modes, CenterWindow, expressions table)" } ] } diff --git a/docs/gdevelop5/all-features/keyboard/index.md b/docs/gdevelop5/all-features/keyboard/index.md index a939ed6bcbe..0cfdfacfa68 100644 --- a/docs/gdevelop5/all-features/keyboard/index.md +++ b/docs/gdevelop5/all-features/keyboard/index.md @@ -7,15 +7,15 @@ GDevelop gives access to all inputs made on the keyboard. This includes conditio ## Any key pressed -For this condition, the corresponding action/s will be performed if any key on the keyboard is pressed. +For this condition, the corresponding action/s will be performed if any key on the keyboard is pressed. A companion condition **Any key released** is also available, which is true for one frame when any key is released. ## Key pressed -Whenever the key selected while setting this condition is pressed, the corresponding actions are performed. +Whenever the key selected while setting this condition is **pressed or held down**, the corresponding actions are performed. This condition remains true every frame while the key is held. ## Key released -Whenever the key selected while setting this condition is released, the corresponding actions are performed. +Whenever the key selected while setting this condition is released, the corresponding actions are performed. This condition is true for one frame only, the frame the key is let go. ## Key pressed (text expression) @@ -27,15 +27,44 @@ 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) +A related condition **Key just pressed (text expression)** is true only on the **first frame** the key starts being pressed — useful for actions that should fire once per key press rather than every frame while the key is held down. + ## Key released (text expression) 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. ![](/gdevelop5/all-features/annotation_2019-06-20_191302.png) +## Valid key names + +The following key names can be used in the text-based key conditions: + +| Key | Name to use | +|---|---| +| Letters A–Z | `a`, `b`, … `z` | +| Digits 0–9 (top row) | `Num0` – `Num9` | +| Numpad 0–9 | `Numpad0` – `Numpad9` | +| Arrow keys | `Left`, `Right`, `Up`, `Down` | +| Function keys | `F1` – `F12` | +| Enter / Return | `Return` | +| Space | `Space` | +| Backspace | `Back` | +| Tab | `Tab` | +| Escape | `Escape` | +| Delete | `Delete` | +| Insert | `Insert` | +| Left/Right Shift | `LShift`, `RShift` | +| Left/Right Control | `LControl`, `RControl` | +| Left/Right Alt | `LAlt`, `RAlt` | +| Page Up / Page Down | `PageUp`, `PageDown` | +| Home / End | `Home`, `End` | +| Numpad operators | `Add`, `Subtract`, `Multiply`, `Divide` | +| Punctuation | `SemiColon`, `Comma`, `Period`, `Quote`, `Slash`, `BackSlash`, `Equal`, `Dash`, `LBracket`, `RBracket`, `Tilde` | +| Pause | `Pause` | + ## 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". +"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"`. It returns an empty string if no key has been pressed yet since the game started. ## Reference diff --git a/docs/gdevelop5/all-features/window/index.md b/docs/gdevelop5/all-features/window/index.md index c3ef482243a..4bae4ad4b0b 100644 --- a/docs/gdevelop5/all-features/window/index.md +++ b/docs/gdevelop5/all-features/window/index.md @@ -5,33 +5,45 @@ title: Window and game area The window of the game is the area in which the game is displayed. It DOES NOT refer to the system window that includes the toolbar, title bar on the top and a frame on the other three sides. -## Fullscreen -The "De/activate fullscreen" action allows you to toggle the game between fullscreen on/off. When the window is in fullscreen, it will take up as much area as possible. You can control the action using the "YES" and "NO" actions. +## Game resolution vs. window size -## Window margins -The margin of the window is the distance between the side of the window and the game window displayed. Shown below is the preview of a game with 100 px margins on all 4 sides. +It is important to understand the difference between two concepts: -![](/gdevelop5/all-features/annotation_2019-06-29_174027.png) +- **Game resolution** (logical size): the number of pixels the game internally uses. Objects are positioned and drawn within this coordinate space. +- **Window/screen size** (physical size): the actual size of the browser tab, app window or device screen in pixels. -Notice the black borders on all for sides of the window. The width of the borders is 100px. +By default GDevelop scales the game to fill the available window area. You can control this behaviour with the **Game resolution resize mode** action: -## Size of the window +- **adaptWidth** – keeps the game height fixed and adjusts the game width so that it fills the window without cropping. +- **adaptHeight** – keeps the game width fixed and adjusts the game height. +- Leave it empty (no resize mode) to keep the game resolution fixed regardless of window size. -Size of the window is the number of pixels visible in the game. The "Width" field refers to the number of pixels in the horizontal directions while the "Height" field refers to the number of pixels in the vertical direction. +The **Automatically adapt the game resolution** action (Yes/No) enables or disables live adaptation: when set to Yes the game resolution is updated every time the window or screen size changes (useful for responsive games that run in a browser). -While setting the size of the window, if you want to scale the current area to the set resolution, choose "NO". This will decrease the visual quality of the game if the size entered is lower than default and will increase the visual quality if the size entered is higher than the default size. +Use the **Game resolution** action if you need to change the game's logical resolution at runtime (for example when switching between landscape and portrait). -![](/gdevelop5/all-features/annotation_2019-06-29_175454.png) +## Fullscreen + +The **De/activate fullscreen** action toggles the game between fullscreen and windowed mode. -If you want to scale the set resolution to the window area, choose "YES". This will crop the window and display only the number of pixels entered in the action. This does not affect the visual quality as long as the game is scaled up or down because of the size of the system window. +- A second parameter, **Keep aspect ratio** (HTML5 games only, enabled by default), controls whether the game is letterboxed to preserve proportions or stretched to fill the screen. +- The companion condition **Fullscreen activated?** lets you check whether the game is currently running in fullscreen. -!!! note +## Window size - The game is cropped starting from the top-left corner of the game. +The **Game window size** action resizes the operating-system window. Note that this only works on desktop (Windows, macOS and Linux); it has no effect in a browser or on mobile. The third parameter controls whether the game resolution should also be updated to match the new window size (Yes), or whether the existing content should be scaled to fit (No). -![](/gdevelop5/all-features/annotation_2019-06-29_175540.png) +The **Center the game window** action moves the window to the center of the screen. This also only works on desktop. -## Window title +## Window margins + +The margin of the window is the distance between the side of the window and the game window displayed. Shown below is the preview of a game with 100 px margins on all 4 sides. + +![](/gdevelop5/all-features/annotation_2019-06-29_174027.png) + +Notice the black borders on all for sides of the window. The width of the borders is 100px. + +## Window title and icon The window title is the name of the window that is visible on the title bar (located at the top) of the window. The default title name is "Preview of ProjectName" during a preview. @@ -39,6 +51,20 @@ By default, the game name is used for the executable name (on Windows, macOS and With the action to change the title, the title bar on Windows, macOS and Linux will be changed. Nothing will be visible on Android and iOS. For HTML5 games, the web page title will be changed. +The **Window's icon** action lets you change the game window icon at runtime by providing the name of an image resource. + +## Useful expressions + +| Expression | Returns | +|---|---| +| `SceneWindowWidth()` | Game resolution width (logical pixels) | +| `SceneWindowHeight()` | Game resolution height (logical pixels) | +| `ScreenWidth()` | Actual window/screen width (physical pixels) | +| `ScreenHeight()` | Actual window/screen height (physical pixels) | +| `WindowTitle$()` | Current window title as a string | + +`ScreenWidth()` and `ScreenHeight()` return the size of the browser tab or the device screen — useful to adapt your UI layout to different screen sizes. + ## Reference All actions, conditions and expressions are listed in [the window reference page](/gdevelop5/all-features/window/reference/). \ No newline at end of file