From 54e244218206bdec2836086f0be54fefd043dc32 Mon Sep 17 00:00:00 2001 From: 4ian <1280130+4ian@users.noreply.github.com> Date: Mon, 27 Apr 2026 10:50:30 +0000 Subject: [PATCH] [Auto] [Improve] Document missing keyboard conditions, key names, and window expressions --- automated_updates_data.json | 4 ++ docs/gdevelop5/all-features/keyboard/index.md | 40 ++++++++++++-- docs/gdevelop5/all-features/window/index.md | 54 ++++++++++++++----- 3 files changed, 81 insertions(+), 17 deletions(-) diff --git a/automated_updates_data.json b/automated_updates_data.json index 47a68ca5430..5fd687b1b7c 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-04-27", + "summary": "Improved keyboard docs (added AnyKeyReleased, Key just pressed, mobile limitation note, and key names reference table) and window docs (added IsFullScreen condition, CenterWindow action, resize mode actions, and all window/screen dimension expressions)" } ] } diff --git a/docs/gdevelop5/all-features/keyboard/index.md b/docs/gdevelop5/all-features/keyboard/index.md index a939ed6bcbe..af99c1f58b3 100644 --- a/docs/gdevelop5/all-features/keyboard/index.md +++ b/docs/gdevelop5/all-features/keyboard/index.md @@ -5,17 +5,29 @@ title: Keyboard GDevelop gives access to all inputs made on the keyboard. This includes conditions to check if a key was pressed or released. +!!! note + + Keyboard conditions do not work with on-screen keyboards on touch devices. For mobile or touchscreen games, use mouse/touch conditions instead. + ## Any key pressed -For this condition, the corresponding action/s will be performed if any key on the keyboard is pressed. +The condition is true as long as any key on the keyboard is held down. + +## Any key released + +The condition is true during the frame when any key is released. ## Key pressed -Whenever the key selected while setting this condition is pressed, the corresponding actions are performed. +The condition remains **true as long as the key is held down**. Use this for continuous actions like moving a character while a direction key is held. + +## Key just pressed + +The condition is true only during the **single frame** when the key is first pressed. Use this for one-time actions like jumping or firing a weapon. ## Key released -Whenever the key selected while setting this condition is released, the corresponding actions are performed. +The condition is true during the frame when the selected key is released. ## Key pressed (text expression) @@ -37,6 +49,26 @@ To test a key release using this condition, you need to enter the key name in th "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". +## Key names reference + +The following strings are accepted by the text-expression conditions and returned by the `LastPressedKey()` expression: + +| Category | Key names | +|---|---| +| Letters | `a` `b` `c` `d` `e` `f` `g` `h` `i` `j` `k` `l` `m` `n` `o` `p` `q` `r` `s` `t` `u` `v` `w` `x` `y` `z` | +| Number row | `Num0` `Num1` `Num2` `Num3` `Num4` `Num5` `Num6` `Num7` `Num8` `Num9` | +| Numpad digits | `Numpad0` … `Numpad9` | +| Arrow keys | `Left` `Right` `Up` `Down` | +| Function keys | `F1` … `F12` | +| Special keys | `Space` `Return` `Escape` `Back` `Tab` `Delete` `Insert` `Pause` `Home` `End` `PageUp` `PageDown` | +| Modifier keys | `LShift` `RShift` `LControl` `RControl` `LAlt` `RAlt` | +| Symbols | `SemiColon` `Comma` `Period` `Quote` `Slash` `BackSlash` `Equal` `Dash` `LBracket` `RBracket` `Tilde` | +| Numpad operators | `Add` `Subtract` `Multiply` `Divide` | + +!!! tip + + Letter keys use lowercase names (`a`, `b`, …). Number keys on the main row use the `Num` prefix (`Num1`, `Num2`, …) to distinguish them from numpad keys (`Numpad1`, `Numpad2`, …). + ## 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/window/index.md b/docs/gdevelop5/all-features/window/index.md index c3ef482243a..85c40499bc0 100644 --- a/docs/gdevelop5/all-features/window/index.md +++ b/docs/gdevelop5/all-features/window/index.md @@ -6,39 +6,67 @@ 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. + +The **De/activate fullscreen** action toggles the game between fullscreen and windowed mode. On HTML5 games, a second parameter lets you choose whether to preserve the aspect ratio when entering fullscreen. + +Use the **Fullscreen activated?** condition to check whether the game is currently running in fullscreen. ## 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. +Notice the black borders on all four sides of the window. The width of the borders is 100px. -## Size of the window +## Game resolution and 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. +GDevelop distinguishes between two related but separate concepts: -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. +- **Game resolution** — the internal size (in pixels) of the game area that is rendered. Changing this with the **Game resolution** action resizes the rendering canvas without affecting the OS window. +- **Window size** — the actual size of the OS window on screen. Changing this with the **Game window size** action resizes the visible window. On browsers and mobile this has no effect; only the game resolution can be updated. + +When you call **Game window size** you can optionally synchronise the game resolution to match, or leave them independent (which will stretch or shrink the rendered image to fill the window). ![](/gdevelop5/all-features/annotation_2019-06-29_175454.png) -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. +### Game resolution resize mode + +The **Game resolution resize mode** action controls what happens automatically when the OS window or screen changes size at runtime: + +- **`"adaptWidth"`** — the game width is recalculated so the full height always fits. +- **`"adaptHeight"`** — the game height is recalculated so the full width always fits. +- **`""`** (empty) — the game resolution is never changed automatically. -!!! note +Use the **Automatically adapt the game resolution** action to enable or disable this automatic adaptation at runtime. - The game is cropped starting from the top-left corner of the game. +## Centering the window -![](/gdevelop5/all-features/annotation_2019-06-29_175540.png) +The **Center the game window on the screen** action repositions the OS window to the centre of the display. This only works on Windows, macOS and Linux — it has no effect in a browser or on iOS/Android. ## Window title -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. +The window title is the name of the window that is visible on the title bar (located at the top) of the window. + +With the **Window's title** action you can change the title at runtime. On Windows, macOS and Linux this updates the title bar. For HTML5 games, the web page title changes instead. Nothing is visible on Android and iOS. + +Use the `WindowTitle()` expression to read the current window title. + +By default, the game name is used for the executable name, the app name, and the title bar. You can [learn more about it in game properties.](/gdevelop5/interface/project-manager/properties) + +## Reading window and screen dimensions + +Several expressions are available to query the current dimensions at runtime: -By default, the game name is used for the executable name (on Windows, macOS and Linux), the app name (on Android and iOS) and the title bar (on Windows, macOS and Linux) (and the page title for HTML5 games). You can [learn more about it in game properties.](/gdevelop5/interface/project-manager/properties) +| Expression | Description | +|---|---| +| `SceneWindowWidth()` | Width of the game canvas (game resolution width) | +| `SceneWindowHeight()` | Height of the game canvas (game resolution height) | +| `ScreenWidth()` | Width of the browser page or screen on desktop | +| `ScreenHeight()` | Height of the browser page or screen on desktop | -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. +`SceneWindowWidth`/`SceneWindowHeight` reflect the current game resolution, while `ScreenWidth`/`ScreenHeight` reflect the outer container (browser window or monitor). ## Reference -All actions, conditions and expressions are listed in [the window reference page](/gdevelop5/all-features/window/reference/). \ No newline at end of file +All actions, conditions and expressions are listed in [the window reference page](/gdevelop5/all-features/window/reference/).