A monitor.

Obtained from GLFW.monitors or GLFW.primaryMonitor.

Once the monitor gets disconnected the object isn't valid anymore and its usage will throw a MonitorDisconnectedException exception. You can get notified of the disconnection with the Monitor.onDisconnect or GLFW.onMonitorChange callbacks. The object is valid until the end of the callback.

Connecting the monitor again will not reuse the old Monitor object.

If the GLFW instance associated with this monitor is destroyed then using it will throw a UseAfterDestroyException exception.

Variables

read onlycontentScale:{y:Float, x:Float}

The content scale of this monitor.

The content scale is the ratio between the current DPI and the platform's default DPI. This is especially important for text and any UI elements. If the pixel dimensions of your UI scaled by this look appropriate on your machine then it should appear at a reasonable size on other machines regardless of their DPI and scaling settings. This relies on the system DPI and scaling settings being somewhat correct.

The content scale may depend on both the monitor resolution and pixel density and on user settings. It may be very different from the raw DPI calculated from the physical size and current resolution.

Thread safety: This function must only be called from the main thread.

Throws:

MonitorDisconnectedException
PlatformErrorException
null

UseAfterDestroyException

read onlycurrentVideoMode:VideoMode

The current mode of this monitor.

If you have created a fullscreen window for that monitor, the return value will depend on whether that window is iconified.

Thread safety: This function must only be called from the main thread.

Throws:

MonitorDisconnectedException
PlatformErrorException
null

UseAfterDestroyException

read onlyname:String

The name of this monitor.

This is a human-readable name, encoded as UTF-8, of the specified monitor. The name typically reflects the make and model of the monitor and is not guaranteed to be unique among the connected monitors.

Thread safety: This function must only be called from the main thread.

Throws:

MonitorDisconnectedException
null

UseAfterDestroyException

onDisconnect:Array<() ‑> Void>

The callbacks to be called when the monitor is disconnected from the system.

The object is valid until the callback returns, using it afterwards will throw a MonitorDisconnectedException exception.

Connecting the monitor again will not reuse the old Monitor object.

To add a callback push a function to this array.

read onlyphysicalSize:{width:Int, height:Int}

The physical size of the monitor.

This is the size, in millimetres, of the display area of the monitor.

Some systems do not provide accurate monitor size information, either because the monitor EDID data is incorrect or because the driver does not report it accurately.

Thread safety: This function must only be called from the main thread.

Throws:

MonitorDisconnectedException
null

UseAfterDestroyException

read onlyposition:{y:Int, x:Int}

The position of the monitor's viewport on the virtual screen.

This is the position, in screen coordinates, of the upper-left corner of the monitor.

Thread safety: This function must only be called from the main thread.

Throws:

MonitorDisconnectedException
PlatformErrorException
null

UseAfterDestroyException

read onlyvideoModes:ReadOnlyArray<VideoMode>

The available video modes of the monitor.

This is an array of all video modes supported by the monitor. The returned array is sorted in ascending order, first by color bit depth (the sum of all channel depths) and then by resolution area (the product of width and height).

Thread safety: This function must only be called from the main thread.

Throws:

MonitorDisconnectedException
PlatformErrorException
null

UseAfterDestroyException

read onlyworkarea:{y:Int, x:Int, width:Int, height:Int}

The work area of the monitor.

This is the position, in screen coordinates, of the upper-left corner of the work area of the specified monitor along with the work area size in screen coordinates. The work area is defined as the area of the monitor not occluded by the operating system task bar where present. If no task bar exists then the work area is the monitor resolution in screen coordinates.

Thread safety: This function must only be called from the main thread.

Throws:

MonitorDisconnectedException
PlatformErrorException
null

UseAfterDestroyException