Chickensoft.Platform 1.4.0

dotnet add package Chickensoft.Platform --version 1.4.0
                    
NuGet\Install-Package Chickensoft.Platform -Version 1.4.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Chickensoft.Platform" Version="1.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Chickensoft.Platform" Version="1.4.0" />
                    
Directory.Packages.props
<PackageReference Include="Chickensoft.Platform" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Chickensoft.Platform --version 1.4.0
                    
#r "nuget: Chickensoft.Platform, 1.4.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Chickensoft.Platform@1.4.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Chickensoft.Platform&version=1.4.0
                    
Install as a Cake Addin
#tool nuget:?package=Chickensoft.Platform&version=1.4.0
                    
Install as a Cake Tool

🧩 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:

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.