Skip to content

API Reference ​

The 2dog API is deliberately small. Use twodog.Engine to own one Godot instance, or use the fixture classes when xUnit owns the process.

twodog ​

TypeUse it to
EngineConfigure, start, run, and stop embedded Godot

Engine is the normal entry point from the 2dog.engine package.

Godot ​

TypeUse it to
GodotInstanceAccess the borrowed compatibility handle returned by Engine.Start()

2dog adds GodotInstance to the GodotSharp API. Use the Godot class reference for nodes, resources, scenes, and other engine types.

twodog.Testing ​

TypeUse it to
FixtureBaseBuild a fixture with custom Godot arguments
FixtureRun tests with rendering enabled
HeadlessFixtureRun headless tests, including CI

These fixtures are in the 2dog.engine package. They do not depend on a specific test framework.

twodog.Testing.Xunit ​

TypeUse it to
RenderingCollectionShare a rendered fixture across an xUnit collection
HeadlessCollectionShare a headless fixture across an xUnit collection

The collection definitions are in the 2dog.xunit package. They compile into your test assembly, so xUnit can discover them.

Lifetime at a Glance ​

csharp
using var engine = new twodog.Engine("MyGame", args: args);
engine.Start();

while (!engine.Iteration())
{
    // One frame has completed.
}

Engine owns the instance. Use RequestQuit() for a graceful shutdown. After teardown, Completion completes and Exited fires on every platform.

On desktop, Dispose() is synchronous. In a browser, await DisposeAsync() or Completion. Start a new Engine only after completion. See Single Godot Instance.

2dog is Free and Libre Open Source under the MIT License.
2dog is not affiliated with or endorsed by the Godot Foundation.
Godot is licensed under the MIT License; the Godot logo is by Andrea Calabró under CC BY 4.0. @icons made by Voxy under the MIT License.
Continuous Integration compute graciously supported by Blacksmith.