Table of Contents

Class Window

Namespace
SimulationFramework
Assembly
SimulationFramework.dll

Provides access to the simulation's window.

public static class Window
Inheritance
Window
Inherited Members

Properties

BackBuffer

The window's back buffer. Drawing to this texture during a frame will make its contents visible on the window.

public static ITexture BackBuffer { get; }

Property Value

ITexture

Display

The display the window is on.

public static IDisplay Display { get; }

Property Value

IDisplay

Height

The height of the window in pixels. To change the height of the window, see Resize(float, float).

public static int Height { get; }

Property Value

int

IsFullscreen

true when the window is fullscreen; otherwise false.

On platforms that don't have window systems (like mobile), this value will always be true.

public static bool IsFullscreen { get; }

Property Value

bool

IsMaximized

true when the window is maximized; otherwise false.

If the window cannot be maximized, this is always false.

public static bool IsMaximized { get; }

Property Value

bool

IsMinimized

true when the window is minimized; otherwise false.

If the window cannot be minimized, this is always false.

public static bool IsMinimized { get; }

Property Value

bool

IsUserResizable

Whether the window can be resized by the user. To handle user resize events, see OnResize(int, int).

If ShowSystemMenu is false, the window is never user-resizable, even if this value is true.

public static bool IsUserResizable { get; set; }

Property Value

bool

Position

The position of the window.

public static Vector2 Position { get; }

Property Value

Vector2

ShowSystemMenu

Whether the platform-specific menus should be displayed with the window.

On platforms without a system menu, this value has no effect.

public static bool ShowSystemMenu { get; set; }

Property Value

bool

Size

The size of the window, in pixels.

public static Vector2 Size { get; }

Property Value

Vector2

Title

The title of the window.

public static string Title { get; set; }

Property Value

string

Width

The width of the window, in pixels. To change the width of the window, see Resize(float, float).

public static int Width { get; }

Property Value

int

Methods

EnterFullscreen(IDisplay?)

Attempts to enter fullscreen mode. This method does not have any immediate effects, as any window state changes are made after the current frame. To check if the transition succeeded, use IsFullscreen during the next frame.

If the window is already in requested fullscreen state, this method has no effect.

public static void EnterFullscreen(IDisplay? display = null)

Parameters

display IDisplay

The monitor to enter fullscreen on. Display is used if this value is null.

ExitFullscreen()

Attempts to exit fullscreen mode. This method does not have any immediate effects, as any window state changes are made after the current frame. To check if the transition succeeded, use IsFullscreen during the next frame.

If the window is not in fullscreen, or the platform requires the window to always be fullscreen (like mobile), this method has no effect.

public static void ExitFullscreen()

GetBackBuffer()

Gets the back buffer for the window. Any rendering done to the back buffer during OnRender(ICanvas) will be visible on the window.

public static ITexture GetBackBuffer()

Returns

ITexture

The back buffer for the window.

Maximize()

Maximizes the window. If the window is fullscreen, calling this method exits fullscreen.

public static void Maximize()

Minimize()

Minimizes the window. If the window is fullscreen, calling this method exits fullscreen.

public static void Minimize()

Resize(Vector2)

Resize the window. Changes may not take effect until the next frame.

On some platforms, resizing the window is not supported. In those cases this method always throws an exception.

public static void Resize(Vector2 size)

Parameters

size Vector2

The new size for the window. Must not be negative in either dimension.

If either dimension is 0, the size of the window on that dimension is left unchanged.

This value may be clamped to be within the platform's limits, and may be rounded to the nearest integer.

Resize(float, float)

Attempts to resize the window. Changes may not take effect until the next frame.

When the window is fullscreen, the window cannot be resized, so this method will throw an exception.

public static void Resize(float width, float height)

Parameters

width float

The width to resize the window to. Must not be negative.

If this value is 0, the width of the window is left unchanged.

This value may be clamped to be within the platform's limits, or rounded to the nearest integer.

height float

The height to resize the window to. Must not be negative.

If this value is 0, the height of the window is left unchanged.

This value may be clamped to be within the platform's limits, or rounded to the nearest integer.

Restore()

Restores the window to its default state (neither minimized nor maximized). If the window is fullscreen, calling this method exits fullscreen.

public static void Restore()

SetIcon(Color[,])

public static void SetIcon(Color[,] icon)

Parameters

icon Color[,]

SetIcon(ITexture)

public static void SetIcon(ITexture icon)

Parameters

icon ITexture

SetIcon(ReadOnlySpan<Color>, int, int)

public static void SetIcon(ReadOnlySpan<Color> icon, int width, int height)

Parameters

icon ReadOnlySpan<Color>
width int
height int

SetPosition(Vector2)

Sets the position of the window.

When the window is fullscreen, the window cannot be moved, so this method will throw an exception.

public static void SetPosition(Vector2 position)

Parameters

position Vector2

The position to move the window to, in desktop (client) space.

This value may be clamped to be within the platform's limits, and may be rounded to the nearest integer.

SetPosition(float, float)

Sets the position of the window.

When the window is fullscreen, the window cannot be moved, so this method will throw an exception.

public static void SetPosition(float x, float y)

Parameters

x float

The x position to move the window to, in desktop (client) space.

This value may be clamped to be within the platform's limits, and may be rounded to the nearest integer.

y float

The y position of move the window tom in desktop (client) space.

This value may be clamped to be within the platform's limits, and may be rounded to the nearest integer.