Skip to content
CShift0.32

Window

Struct · namespace System.Ui · Since 0.32

struct Window : IDisposable

A window that shows the frames of a Ui (or images of your own, for games). One window at a time.

var window = try Window.Open("Demo", 400, 300);
var ui = Ui.Create();
while (window.Update()) // waits for input; false once the window was closed
{
ui.Begin(window);
ui.Label("Hello");
window.Show(ui);
}
Name Description
Open Opens a window whose inside is width x height pixels at scale 1 (on a screen with a higher scale it is larger by that factor).
static UiError<Window> Open(string title, int width, int height)

Opens a window whose inside is width x height pixels at scale 1 (on a screen with a higher scale it is larger by that factor).

Name Description
Update Handles the events of the window and waits for input first, as long as the last frame asked for (see Ui.WaitMilliseconds; after Window.Show of an image it does not wait).
Input The input since the last frame.
Width The width of the inside of the window in pixels.
Height The height of the inside of the window in pixels.
Scale The scale of the screen the window is on: 1 at 96 dpi, 1.5 at 144 dpi, …
Show Ends the frame of a Ui and shows it.
SetTitle Changes the text in the title bar.
Dispose Closes the window.
bool Update()

Handles the events of the window and waits for input first, as long as the last frame asked for (see Ui.WaitMilliseconds; after Window.Show of an image it does not wait). False once the user closed the window.

UiInput Input()

The input since the last frame.

int Width()

The width of the inside of the window in pixels.

int Height()

The height of the inside of the window in pixels.

double Scale()

The scale of the screen the window is on: 1 at 96 dpi, 1.5 at 144 dpi, …

void Show(Ui ui)

Ends the frame of a Ui and shows it.

void Show(Image image)

Shows an image (drawn from the top left corner); the next Window.Update does not wait, so a loop of Update and Show draws as many frames as the program can (an animation, a game).

void SetTitle(string title)

Changes the text in the title bar.

void Dispose()

Closes the window.