Skip to content

Class Window

Namespace: Apogee.Platform
Assembly: Apogee.Platform.dll

An SDL window. Create it after , on the main thread, and dispose it before .

public sealed class Window : IDisposable

Inheritance

object ← Window

Implements

IDisposable

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Constructors

Window(string, int, int, WindowOptions)

public Window(string title, int width, int height, WindowOptions options = WindowOptions.Resizable | WindowOptions.HighPixelDensity)

Parameters

title string

width int

height int

options WindowOptions

Properties

CloseRequested

The user clicked the close button (or the platform asked the window to close). The application decides what happens.

public bool CloseRequested { get; }

Property Value

bool

HasFocus

The window has keyboard focus.

public bool HasFocus { get; }

Property Value

bool

Id

public uint Id { get; }

Property Value

uint

IsMinimized

public bool IsMinimized { get; }

Property Value

bool

LogicalSize

The size in points, which is what the window manager and mouse coordinates use.

public (int Width, int Height) LogicalSize { get; }

Property Value

(int Width, int Height)

NativeHandle

The SDL window, for code that talks to SDL directly (the dev tools' input backend).

public Window* NativeHandle { get; }

Property Value

Window*

PixelDensity

Pixels per point: 1 on a standard display, 2 on Retina, 1.5 at 150% scaling.

public float PixelDensity { get; }

Property Value

float

PixelSize

The size of the window's drawable area in pixels: the swapchain's size. Empty while minimized on some platforms.

public PixelSize PixelSize { get; }

Property Value

PixelSize

Title

public string Title { get; set; }

Property Value

string

Methods

ClearCloseRequest()

public void ClearCloseRequest()

ConsumeResize()

True once when the pixel size differs from the last time this returned true or the window was created: the swapchain has to be recreated.

public bool ConsumeResize()

Returns

bool

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

SetFullscreen(bool)

public void SetFullscreen(bool fullscreen)

Parameters

fullscreen bool

SetIcon(int, int, ReadOnlySpan<byte>)

Gives the window an icon, from width x height pixels of RGBA8 (four bytes a pixel, rows one after the other). What shows it (the title bar, the task bar, the window switcher) is up to the platform: Windows and macOS take theirs from the executable and the bundle, and a driver without icons returns false.

public bool SetIcon(int width, int height, ReadOnlySpan<byte> rgba)

Parameters

width int

height int

rgba ReadOnlySpan<byte>

Returns

bool

Exceptions

ArgumentException

rgba is smaller than the image.

SetMouseLook(bool)

Hides the pointer and reports only its movement (for a camera that turns with the mouse); false gives the pointer back.

public void SetMouseLook(bool enabled)

Parameters

enabled bool