Skip to content

Platform-specific native extensions for Godot, written in C# and compiled ahead ahead-of-time (AOT).

License

Notifications You must be signed in to change notification settings

chickensoft-games/Platform

Repository files navigation

🧩 Platform

Platform-specific native extensions for Godot.


Platform


✅ 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 reliably on Windows and macOS, so we use various native API's to determine the true scale factor.

  • ✅ Determine scale factor and native resolution on macOS.
  • ✅ Determine scale factor and native resolution on Windows.

Note

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.

📦 Nuget Package Installation

dotnet add package Chickensoft.Platform --prerelease

Then, use it like so:

using Chickensoft.Platform;

// Use Win32 or CoreGraphics to get the display's actual resolution.
var resolution = Displays.Singleton.GetNativeResolution(window);
// Use Win32 or CoreGraphics to determine the display's actual scale factor.
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.

About

Platform-specific native extensions for Godot, written in C# and compiled ahead ahead-of-time (AOT).

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •