Skip to content

KernelAPI reference

Class GameSettings

Namespace: MicroEngine.Core
Assembly: MicroEngine.dll
Guide: Game lifecycle and time

Window/backbuffer settings a game declares. The virtual size is the canvas everything is drawn on: 320×180 pixel art by default, or a high-resolution canvas such as 1280×720 or 1920×1080 with HighResolution2D.

C#
public sealed record GameSettings : IEquatable<GameSettings>

Inheritance

object ← GameSettings

Implements

IEquatable<GameSettings>

Constructors

GameSettings(string, int, int, int)

Window/backbuffer settings a game declares. The virtual size is the canvas everything is drawn on: 320×180 pixel art by default, or a high-resolution canvas such as 1280×720 or 1920×1080 with HighResolution2D.

C#
public GameSettings(string Title, int VirtualWidth = 320, int VirtualHeight = 180, int Scale = 4)

Parameters

Title string

Window title and application name shown by the system.

VirtualWidth int

Width of the virtual canvas in pixels (320 by default). Everything is drawn in these pixels and scaled to the window.

VirtualHeight int

Height of the virtual canvas in pixels (180 by default).

Scale int

Initial window size as a multiple of the virtual size on desktop (4 by default); the launcher’s –scale overrides it. A window that would not fit the display opens at the largest size that does.

Properties

Background

Colour the canvas is cleared to before the scenes draw each frame (black by default).

C#
public Color Background { get; init; }

Property Value

Color

DefaultTextureFilter

The filter textures get when they do not choose one: TextureFilter, or the magnification filter of the presentation’s default sampler.

C#
public TextureFilter DefaultTextureFilter { get; }

Property Value

TextureFilter

Graphics

Graphics options: platform, graphics API, VSync, frame limit, GPU, window mode and display (all automatic by default).

C#
public GraphicsSettings Graphics { get; init; }

Property Value

GraphicsSettings

Letterbox

Colour of the window around the frame when the window’s shape differs from the canvas (black by default).

C#
public Color Letterbox { get; init; }

Property Value

Color

Presentation

How the canvas reaches the window, one choice per field (scale rounding, aspect, the canvas’s upscale sampler, the textures’ default sampler, the capture scale, whole-factor windows, camera snapping, the UI scale). PixelArt by default; a high-resolution game sets HighResolution2D, and a game that needs another combination starts from a preset and changes what it needs: Presentation = Presentation.PixelArt with { Upscale = SamplerDescription.LinearClamp }.

C#
public Presentation Presentation { get; init; }

Property Value

Presentation

Exceptions

ArgumentNullException

The value is null.

Scale

Initial window size as a multiple of the virtual size on desktop (4 by default); the launcher’s –scale overrides it. A window that would not fit the display opens at the largest size that does.

C#
public int Scale { get; init; }

Property Value

int

TextureFilter

The filter of textures created without one (images, atlases). Null (the default) follows the presentation’s default sampler (DefaultSampler): nearest for pixel art, linear for high-resolution 2D. Each texture can still choose its own. Glyph pages of TTF/OTF fonts do not follow it: their filter is Filter, or linear for antialiased text and nearest otherwise.

C#
public TextureFilter? TextureFilter { get; init; }

Property Value

TextureFilter?

Title

Window title and application name shown by the system.

C#
public string Title { get; init; }

Property Value

string

UpdateRate

Fixed simulation rate in updates per second.

C#
public int UpdateRate { get; init; }

Property Value

int

VirtualHeight

Height of the virtual canvas in pixels (180 by default).

C#
public int VirtualHeight { get; init; }

Property Value

int

VirtualWidth

Width of the virtual canvas in pixels (320 by default). Everything is drawn in these pixels and scaled to the window.

C#
public int VirtualWidth { get; init; }

Property Value

int

Methods

<Clone>$()

C#
public GameSettings <Clone>$()

Returns

GameSettings

Deconstruct(out string, out int, out int, out int)

C#
public void Deconstruct(out string Title, out int VirtualWidth, out int VirtualHeight, out int Scale)

Parameters

Title string

VirtualWidth int

VirtualHeight int

Scale int

Equals(object?)

C#
public override bool Equals(object? obj)

Parameters

obj object?

Returns

bool

Equals(GameSettings?)

C#
public bool Equals(GameSettings? other)

Parameters

other GameSettings?

Returns

bool

GetHashCode()

C#
public override int GetHashCode()

Returns

int

ToString()

C#
public override string ToString()

Returns

string

Operators

operator ==(GameSettings?, GameSettings?)

C#
public static bool operator ==(GameSettings? left, GameSettings? right)

Parameters

left GameSettings?

right GameSettings?

Returns

bool

operator !=(GameSettings?, GameSettings?)

C#
public static bool operator !=(GameSettings? left, GameSettings? right)

Parameters

left GameSettings?

right GameSettings?

Returns

bool