Scripting API

Scripting API

WindowSetup

Record in Abyss.Core, from Abyss.Core.

The engine's window.

public record WindowSetup

Remarks

A window hands the frame loop to the platform. Afterwards RunFrameLoop is the only way to advance the app: World.RunBevyFrame would run Bevy's schedules without pumping the window's message queue, so the window would open and then stop responding.

Make a world with one from the main thread, and run the loop from there too. The platform builds its event loop as the window is set up and expects the process's main thread; anywhere else is a panic from inside the native library, which arrives as AbyssStatus.Panic with the reason in the message. That rules out opening a window from a unit test, which is why the window is demonstrated by a sample rather than asserted by one.

Constructors

WindowSetup

public WindowSetup(string Title = "AbyssEngine", int Width = 1280, int Height = 720)

The engine's window.

Parameters

  • Title: Text in the title bar.
  • Width: Width in logical pixels.
  • Height: Height in logical pixels.

A window hands the frame loop to the platform. Afterwards RunFrameLoop is the only way to advance the app: World.RunBevyFrame would run Bevy's schedules without pumping the window's message queue, so the window would open and then stop responding.

Make a world with one from the main thread, and run the loop from there too. The platform builds its event loop as the window is set up and expects the process's main thread; anywhere else is a panic from inside the native library, which arrives as AbyssStatus.Panic with the reason in the message. That rules out opening a window from a unit test, which is why the window is demonstrated by a sample rather than asserted by one.

Properties

Title

public string Title { get; init; }

Text in the title bar.

Width

public int Width { get; init; }

Width in logical pixels.

Height

public int Height { get; init; }

Height in logical pixels.

VSync

public bool VSync { get; init; }

Whether to wait for vertical blank when presenting. On unless turned off.

Embedded

public bool Embedded { get; init; }

Whether this window is going to be docked inside another application's. Turns off decorations, starts it hidden, and lets the engine's event loop run off the main thread so the host can keep it — see World.WindowHandle for the other half.

Windows and Linux only: on macOS neither the engine nor a host toolkit can give up the main thread, so the flag is ignored and the window opens as its own.

Fullscreen

public FullscreenMode Fullscreen { get; init; }

How the window fills the screen: a window of the size given, or borderless across the screen it opens on.

Resizable

public bool Resizable { get; init; }

Whether the window can be resized. On unless turned off.

Place

public (int X, int Y)? Place { get; init; }

Where the window's client area's top left corner goes on the desktop, in physical pixels — where it was when it was last open, say — or null for where the platform puts a new window. A place on no monitor any more is not kept: the window opens in the middle of the primary one.

Maximized

public bool Maximized { get; init; }

Whether the window opens maximized: at WindowSetup.Place first, so that it goes back there when it is restored.