Chickensoft.Platform
1.4.0
dotnet add package Chickensoft.Platform --version 1.4.0
NuGet\Install-Package Chickensoft.Platform -Version 1.4.0
<PackageReference Include="Chickensoft.Platform" Version="1.4.0" />
<PackageVersion Include="Chickensoft.Platform" Version="1.4.0" />
<PackageReference Include="Chickensoft.Platform" />
paket add Chickensoft.Platform --version 1.4.0
#r "nuget: Chickensoft.Platform, 1.4.0"
#:package Chickensoft.Platform@1.4.0
#addin nuget:?package=Chickensoft.Platform&version=1.4.0
#tool nuget:?package=Chickensoft.Platform&version=1.4.0
🧩 Platform
Platform-specific native extensions for Godot.
<p align="center"> <img alt="Platform" src="icon.png" width="200"> </p>
✅ Features
Platform provides a way to determine the actual scale factor and native resolution of the display that a Godot window is located on. Godot does not determine the actual scale factor and native resolution on Windows, macOS, or Linux, so we use various native API's and tools to determine the native pixel resolution and actual (usable) scale factor for the game window.
- ✅ Determine scale factor and native resolution on Windows 10+.
- ✅ Determine scale factor and native resolution on macOS.
- ✅ Determine scale factor and native resolution on Linux.
You may be more interested in using GameTools, which uses this project to provide a high-level display-agnostic scaling API to help your game or app look consistent and scale correctly in multi-monitor mixed-DPI environments.
Heuristic methods are used to determine display information based on the best available information from Godot in combination with native API calls (via P/Invoke) and system shell commands (on Linux). For the most part, these methods work well and should work correctly for the vast majority of users.
If you encounter an unexpected edge case that you feel can be solved, please open an issue and suggest how the correct behavior can be determined.
🪟 Windows
On Windows, Platform temporarily enables per-thread DPI awareness so that it can invoke the Win32 API's to correctly determine which monitor the window handled provided by Godot is on and its native pixel resolution. It also fetches the system scale factor since Windows' virtual desktop coordinates (device-independent pixels on Windows) do not make it easy to derive the scale factor.
🍎 macOS
On macOS, CoreGraphics is used to find the display for the native NSWindow handle provided by Godot. The display's modes are then searched to extract the native pixel resolution so that the correct scale factor can be derived.
🐧 Linux
On Linux, xrandr is used to find video outputs that match Godot's understanding of the logical resolution and DPI. The best matching display is then cross-referenced with /sys/class/drm to determine the actual native pixel resolution and derive the correct scale factor.
📦 Nuget Package Installation
Platform is available as a nuget package.
dotnet add package Chickensoft.Platform --prerelease
Then, use it like so:
using Chickensoft.Platform;
// Get the display's actual resolution on Windows, macOS, or Linux.
var resolution = Displays.Singleton.GetNativeResolution(window);
// Get the display's actual scale factor on Windows, macOS, or Linux.
var scale = Displays.Singleton.GetDisplayScaleFactor(window);
That's it!
🛠️ Building the Nuget Package
The nuget package project shares the same source code and can be built directly.
cd Chickensoft.Platform
dotnet build
It helps if you have read some of the relevant documentation:
- Microsoft: Building Native Libraries with NativeAOT
- Source generation for platform invokes (p/invoke)
There is a Godot sandbox project in sandbox/Chickensoft.Platform.SandboxRef that you can run to test the library manually from the operating system you are interested in testing.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- GodotSharp (>= 4.5.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Chickensoft.Platform:
| Package | Downloads |
|---|---|
|
Chickensoft.GameTools
A collection of tools for accelerating Godot + C# game development. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.4.0 | 21 | 11/10/2025 |
| 1.3.0-godot4.4.0-rc.1 | 6,533 | 2/21/2025 |
| 1.2.0-godot4.4.0-beta.4 | 102 | 2/19/2025 |
| 1.1.0-godot4.4.0-beta.4 | 92 | 2/19/2025 |
| 1.0.0-godot4.4.0-dev.7 | 110 | 2/11/2025 |
| 0.6.0-godot4.4.0-dev.7 | 362 | 1/19/2025 |
Chickensoft.Platform release.