Skip to content
Cole Campbell edited this page May 2, 2018 · 1 revision

A display mode represents the basic parameters which control how a scene is rendered to a window. These include the window's width and height, or resolution, as well as its bit depth and refresh rate. Each window in your application, represented by the IUltravioletWindow interface, has two display modes which can be set independently: one for fullscreen mode and one for windowed mode.

The first window which your application creates is called the primary window. For the majority of Ultraviolet applications, this is the only window which will ever exist. You can retrieve the primary window through the Platform subsystem.

var win = uvcontext.GetPlatform().Windows.GetPrimary();

Once you have access to your window object, you can use it to change the window's display mode. Changing the window's size while in windowed mode requires a call to the SetWindowedClientSize() method. This method only takes a width and height, which can be any non-zero value; the bit depth and refresh rate in windowed mode match those of the operating system desktop environment.

win.SetWindowedClientSize(640, 480);
win.SetWindowMode(WindowMode.Windowed);

Fullscreen display modes require support from the display hardware, limiting what values will be accepted. You can enumerate a display's supported display modes with the GetSupportedDisplayModes9) method of the IUltravioletDisplay interface. Every window object has a Display property which provides a reference to the display on which it currently resides.

Once you've found a supported display mode which meets your requirements, you can change a window's fullscreen display mode by calling the SetFullscreenDisplayMode() method.

win.SetFullscreenDisplayMode(640, 480, 32, 60);
win.SetWindowMode(WindowedMode.Fullscreen); // or WindowMode.FullscreenWindowed

A window's display modes will be remembered as you toggle back and forth between windowed and fullscreen mode. Additionally, the display mode of your application's primary window will be automatically persisted across instances of your application.

Clone this wiki locally