Class Monitor#

Nested Relationships#

Nested Types#

Class Documentation#

class Monitor#

Class representing a physical monitor.

Remark

Headless mode: This class is not available in headless mode.

Public Functions

constexpr ~Monitor() = default#

Destructor.

constexpr Monitor(const Monitor&) noexcept = default#

Copy constructor.

Monitor &operator=(const Monitor&) noexcept = default#

Copy assignment operator.

constexpr Monitor(Monitor&&) noexcept = default#

Move constructor.

Monitor &operator=(Monitor&&) noexcept = default#

Move assignment operator.

constexpr std::string GetName() const noexcept#

Retrieve the name of a monitor.

Returns:

Name of the monitor.

std::vector<VideoMode> GetVideoModes() const#

Retrieve a list of available video modes for the monitor.

Returns:

Vector of video modes.

std::optional<TRAP::Monitor::VideoMode> GetNativeVideoMode() const noexcept#

Retrieve the native video mode.

Returns:

Native video mode on success, empty optional otherwise.

std::optional<TRAP::Monitor::VideoMode> GetCurrentVideoMode() const noexcept#

Retrieve the current video mode.

Returns:

Current video mode on success, empty optional otherwise.

Math::Vec2 GetContentScale() const#

Retrieve the monitors content scale.

Returns:

Vec2 containing the content scale.

f32 GetContentScaleX() const#

Retrieve the monitors X content scale.

Returns:

Monitors X content scale.

f32 GetContentScaleY() const#

Retrieve the monitors Y content scale.

Returns:

Monitors Y content scale.

Math::Vec2i GetPosition() const#

Retrieve the monitors viewport position.

Returns:

Vec2i containing the monitors viewport position.

i32 GetPositionX() const#

Retrieve the monitors X viewport position.

Returns:

Monitors X viewport position.

i32 GetPositionY() const#

Retrieve the monitors Y viewport position.

Returns:

Monitors Y viewport position.

Math::Vec4i GetWorkArea() const#

Retrieve the monitors work area.

Work area is the area of a monitor without task bars or menu bars.

Returns:

Vec4i containing the monitors work area.

i32 GetWorkAreaX() const#

Retrieve the monitors X work area.

Returns:

Monitors X work area.

i32 GetWorkAreaY() const#

Retrieve the monitors Y work area.

Returns:

Monitors Y work area.

i32 GetWorkAreaWidth() const#

Retrieve the monitors work area width.

Returns:

Monitors work area width.

i32 GetWorkAreaHeight() const#

Retrieve the monitors work area height.

Returns:

Monitors work area height.

constexpr bool IsInUse() const noexcept#

Check whether the monitor is currently used by a window.

Returns:

True if monitor is currently used, false otherwise.

u32 GetID() const#

Retrieve the monitors ID.

Note

ID 0 is always the primary monitor!

Returns:

Monitors ID.

constexpr void *GetInternalMonitor() const noexcept#

Retrieve a pointer to the internal monitor.

Returns:

Pointer to the internal monitor of the Monitor.

Public Static Functions

static std::vector<Monitor> GetAllMonitors()#

Retrieve all currently connected monitors.

Returns:

Vector with all monitors.

static Monitor GetPrimaryMonitor()#

Retrieve the primary monitor.

Returns:

Primary monitor.

struct VideoMode#

Struct representing a video mode used by TRAP::Monitors.

Remark

Headless mode: This struct is not available in headless mode.

Public Functions

constexpr VideoMode(u32 width, u32 height, f64 refreshRate) noexcept#

Constructor.

Parameters:
  • width – Width.

  • height – Height.

  • refreshRate – Refresh rate.

constexpr auto operator<=>(const VideoMode &mode) const noexcept = default#

Public Members

u32 Width = 0#
u32 Height = 0#
f64 RefreshRate = 0#