diff --git a/automated_updates_data.json b/automated_updates_data.json index 6c71cb99bf..05bf0115de 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-01", + "summary": "Improved window/index.md: added game resolution vs window size distinction, resize modes (adaptWidth/adaptHeight), IsFullScreen condition, dimension expressions (SceneWindowWidth/Height, ScreenWidth/Height, WindowTitle), CenterWindow, SetWindowIcon, and Advanced Window extension pointer; also rewrote screenshot/index.md to remove outdated beta note and clarify desktop-only support" } ] } diff --git a/docs/gdevelop5/all-features/screenshot/index.md b/docs/gdevelop5/all-features/screenshot/index.md index bb4518a422..6d9fd6d5cf 100644 --- a/docs/gdevelop5/all-features/screenshot/index.md +++ b/docs/gdevelop5/all-features/screenshot/index.md @@ -3,35 +3,29 @@ title: Screenshot extension --- # Screenshot extension -This extension lets you save a screenshot of the running game in a specified folder. +The **Take screenshot** action saves everything currently drawn on the game window to a PNG file on disk. -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 + This action is only supported on **Windows, macOS, and Linux** desktop builds. It has no effect in a browser or on mobile. -#### Take screenshot +## Taking a screenshot -Use this action to save a screenshot of everything which is currently drawn on the game window into a *png* file. +The action requires an absolute file path as the save location. Relative paths are not supported. -##### Parameters: +To build a path that works across operating systems, combine expressions from the [Filesystem extension](/gdevelop5/all-features/filesystem) with the image file name: -**Save path**: The file path where the screenshot should be saved. +``` +FileSystem::PicturesPath() + FileSystem::PathDelimiter() + "my_screenshot.png" +``` -The save path needs to be an absolute path on the file system (Like "C:\MyFolder\MyScreenshot.png" on Windows)' +This saves the screenshot to the system Pictures folder on Windows, Linux, and macOS. -Relative paths are not supported. +You can also target other common folders (`FileSystem::DocumentsPath()`, `FileSystem::DesktopPath()`, etc.) or construct a fully custom path. The folder must already exist — the action will fail silently if it does not. -!!! note +!!! tip - 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 path: - -``` () + () + "my_screenshot.png" ``` - -This will save the screenshot to the *Pictures* folder on Windows, Linux and MacOS. + The screenshot captures the full game canvas at the moment the action runs. To give a specific filename per capture, use a variable that you increment or stamp with the current time. ## Reference diff --git a/docs/gdevelop5/all-features/window/index.md b/docs/gdevelop5/all-features/window/index.md index c3ef482243..5afa0e2368 100644 --- a/docs/gdevelop5/all-features/window/index.md +++ b/docs/gdevelop5/all-features/window/index.md @@ -6,7 +6,9 @@ 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 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. An optional parameter lets you control whether the aspect ratio is preserved (applies to HTML5 games). + +Use the **"Fullscreen activated?"** condition to check whether the game is currently in fullscreen — for example, to show or hide a fullscreen toggle button in your UI. ## 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. @@ -15,15 +17,18 @@ The margin of the window is the distance between the side of the window and the Notice the black borders on all for sides of the window. The width of the borders is 100px. -## Size of the window +## Window size and game resolution -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. +- **Window size** — the size of the system window on the screen (only changeable on desktop platforms; browsers and mobile devices ignore this). +- **Game resolution** — the number of logical pixels used to render the game. This controls what the player actually sees and can be updated on any platform. -![](/gdevelop5/all-features/annotation_2019-06-29_175454.png) +The **"Game window size"** action resizes the system window and optionally updates the game resolution to match. If you choose not to update the resolution, the game is stretched or shrunk to fill the new window. -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. +The **"Game resolution"** action changes the resolution independently of the window, which is useful for effects like zooming in or implementing different quality settings without resizing the window. + +![](/gdevelop5/all-features/annotation_2019-06-29_175454.png) !!! note @@ -31,13 +36,40 @@ If you want to scale the set resolution to the window area, choose "YES". This w ![](/gdevelop5/all-features/annotation_2019-06-29_175540.png) +### Adapting the resolution automatically + +For games that should adapt to different screen sizes (responsive design), use the **"Game resolution resize mode"** action to set one of three modes: + +- **`adaptWidth`** — the game width expands or contracts to fill the window while the height stays fixed. Useful for portrait-oriented games on different screen widths. +- **`adaptHeight`** — the game height adapts while width stays fixed. Useful for landscape games. +- **Empty (disabled)** — the resolution never changes automatically, and the game is scaled to fit the window. + +Pair this with **"Automatically adapt the game resolution"** to have GDevelop re-apply the resize mode whenever the window or browser page size changes at runtime. This is particularly useful for web games where the browser window can be resized freely. + +## Reading screen and window dimensions + +Several expressions let you read the current dimensions at runtime: + +- `SceneWindowWidth()` / `SceneWindowHeight()` — the current game canvas size in pixels. Use these when you want to position objects relative to the edges of the game area. +- `ScreenWidth()` / `ScreenHeight()` — the full screen resolution (or page size for HTML5 games in a browser). Useful for detecting the device's display size. + +## Other window actions + +The **"Center the game window"** action repositions the window to the center of the screen. This only works on Windows, macOS, and Linux — it has no effect in a browser or on mobile. + +You can also set the **window icon** at runtime using the "Window's icon" action, passing the name of an image resource from your project. + ## 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. 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) -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. +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 `WindowTitle()` expression returns the current title string so you can read it back if needed. + +## Advanced window management (desktop) + +For desktop games (Windows, macOS, Linux), the **Advanced Window** extension provides additional control over the system window — such as making it always-on-top, setting its opacity, controlling whether it can be resized or moved, minimizing or maximizing it programmatically, enabling kiosk mode, and more. Search for "Advanced Window" in the extension manager to add it to your project. ## Reference