Magnum::Platform::GlfwApplication::Configuration class

Configuration.

Public types

enum class WindowFlag: UnsignedShort { Fullscreen = 1 << 0, Borderless = 1 << 1 new in 2020.06, Resizable = 1 << 2, Hidden = 1 << 3, Maximized = 1 << 4, Minimized = 1 << 5, AlwaysOnTop = 1 << 6 new in 2020.06, Floating = AlwaysOnTop deprecated in 2020.06, AutoIconify = 1 << 7, Focused = 1 << 8, Contextless = 1 << 9 }
Window flag.
enum class DpiScalingPolicy: UnsignedByte { Framebuffer, Virtual, Physical, Default }
DPI scaling policy.
enum class CursorMode: Int { Normal = GLFW_CURSOR_NORMAL deprecated in 2020.06, Hidden = GLFW_CURSOR_HIDDEN deprecated in 2020.06, Disabled = GLFW_CURSOR_DISABLED deprecated in 2020.06 } deprecated in 2020.06
Cursor mode.
using WindowFlags = Containers::EnumSet<WindowFlag>
Window flags.

Public functions

auto title() const -> Containers::StringView
Window title.
auto setTitle(Containers::StringView title) -> Configuration&
Set window title.
auto size() const -> Vector2i
Window size.
auto dpiScalingPolicy() const -> DpiScalingPolicy
DPI scaling policy.
auto dpiScaling() const -> Vector2
Custom DPI scaling.
auto setSize(const Vector2i& size, DpiScalingPolicy dpiScalingPolicy = DpiScalingPolicy::Default) -> Configuration&
Set window size.
auto setSize(const Vector2i& size, const Vector2& dpiScaling) -> Configuration&
Set window size with custom DPI scaling.
auto windowFlags() const -> WindowFlags
Window flags.
auto setWindowFlags(WindowFlags windowFlags) -> Configuration&
Set window flags.
auto addWindowFlags(WindowFlags flags) -> Configuration& new in 2020.06
Add window flags.
auto clearWindowFlags(WindowFlags flags) -> Configuration& new in 2020.06
Clear window flags.
auto cursorMode() const -> CursorMode deprecated in 2020.06
Cursor mode.
auto setCursorMode(CursorMode cursorMode) -> Configuration& deprecated in 2020.06
Set cursor mode.

Enum documentation

enum class Magnum::Platform::GlfwApplication::Configuration::WindowFlag: UnsignedShort

Window flag.

Enumerators
Fullscreen

Fullscreen window

Borderless new in 2020.06

No window decoration

Resizable

Resizable window

Hidden

Hidden window

Maximized

Maximized window

Minimized

Minimized window

AlwaysOnTop new in 2020.06

Always on top

Floating

Always on top

AutoIconify

Automatically iconify (minimize) if fullscreen window loses input focus

Focused

Window has input focus

Contextless

Do not create any GPU context. Use together with GlfwApplication(const Arguments&, const Configuration&), create(const Configuration&) or tryCreate(const Configuration&) to prevent implicit creation of an OpenGL context. Can't be used with GlfwApplication(const Arguments&, const Configuration&, const GLConfiguration&), create(const Configuration&, const GLConfiguration&) or tryCreate(const Configuration&, const GLConfiguration&).

enum class Magnum::Platform::GlfwApplication::Configuration::DpiScalingPolicy: UnsignedByte

DPI scaling policy.

DPI scaling policy when requesting a particular window size. Can be overridden on command-line using --magnum-dpi-scaling or via the MAGNUM_DPI_SCALING environment variable.

Enumerators
Framebuffer

Framebuffer DPI scaling. The window will have the same size as requested, but the framebuffer size will be different. Supported only on macOS and iOS and is also the only supported value there.

Virtual

Virtual DPI scaling. Scales the window based on UI scaling setting in the system. Falls back to DpiScalingPolicy::Physical on platforms that don't support it. Supported only on desktop platforms (except macOS) and it's the default there.

Equivalent to --magnum-dpi-scaling virtual passed on command-line.

Physical

Physical DPI scaling. Takes the requested window size as a physical size that a window would have on platform's default DPI and scales it to have the same size on given display physical DPI. On platforms that don't have a concept of a window it causes the framebuffer to match screen pixels 1:1 without any scaling. Supported on desktop platforms except macOS and on mobile and web. Default on mobile and web.

Equivalent to --magnum-dpi-scaling physical passed on command-line.

Default

Default policy for current platform. Alias to one of DpiScalingPolicy::Framebuffer, DpiScalingPolicy::Virtual or DpiScalingPolicy::Physical depending on platform. See DPI awareness for details.

enum class Magnum::Platform::GlfwApplication::Configuration::CursorMode: Int

Cursor mode.

Enumerators
Normal

Visible unconstrained cursor

Hidden

Hidden cursor

Disabled

Cursor hidden and locked window

Typedef documentation

typedef Containers::EnumSet<WindowFlag> Magnum::Platform::GlfwApplication::Configuration::WindowFlags

Window flags.

Function documentation

Containers::StringView Magnum::Platform::GlfwApplication::Configuration::title() const

Window title.

The returned view is always Containers::StringViewFlag::NullTerminated and is valid until the next call to setTitle().

Configuration& Magnum::Platform::GlfwApplication::Configuration::setTitle(Containers::StringView title)

Set window title.

Returns Reference to self (for method chaining)

Default is "Magnum GLFW Application".

DpiScalingPolicy Magnum::Platform::GlfwApplication::Configuration::dpiScalingPolicy() const

DPI scaling policy.

If dpiScaling() is non-zero, it has a priority over this value. The --magnum-dpi-scaling command-line option has a priority over any application-set value.

Vector2 Magnum::Platform::GlfwApplication::Configuration::dpiScaling() const

Custom DPI scaling.

If zero, then dpiScalingPolicy() has a priority over this value. The --magnum-dpi-scaling command-line option has a priority over any application-set value.

Configuration& Magnum::Platform::GlfwApplication::Configuration::setSize(const Vector2i& size, DpiScalingPolicy dpiScalingPolicy = DpiScalingPolicy::Default)

Set window size.

Parameters
size Desired window size
dpiScalingPolicy Policy based on which DPI scaling will be set
Returns Reference to self (for method chaining)

Default is {800, 600}. See DPI awareness for more information.

Configuration& Magnum::Platform::GlfwApplication::Configuration::setSize(const Vector2i& size, const Vector2& dpiScaling)

Set window size with custom DPI scaling.

Parameters
size Desired window size
dpiScaling Custom DPI scaling value

Compared to setSize(const Vector2i&, DpiScalingPolicy) which autodetects the DPI scaling value according to given policy, this function sets the DPI scaling directly. The resulting GlfwApplication::windowSize() is size*dpiScaling and GlfwApplication::dpiScaling() is dpiScaling.

Configuration& Magnum::Platform::GlfwApplication::Configuration::setWindowFlags(WindowFlags windowFlags)

Set window flags.

Returns Reference to self (for method chaining)

Default is WindowFlag::Focused. To avoid clearing default flags by accident, prefer to use addWindowFlags() and clearWindowFlags() instead.

Configuration& Magnum::Platform::GlfwApplication::Configuration::addWindowFlags(WindowFlags flags) new in 2020.06

Add window flags.

Returns Reference to self (for method chaining)

Unlike setWindowFlags(), ORs the flags with existing instead of replacing them. Useful for preserving the defaults.

Configuration& Magnum::Platform::GlfwApplication::Configuration::clearWindowFlags(WindowFlags flags) new in 2020.06

Clear window flags.

Returns Reference to self (for method chaining)

Unlike setWindowFlags(), ANDs the inverse of flags with existing instead of replacing them. Useful for removing default flags.

CursorMode Magnum::Platform::GlfwApplication::Configuration::cursorMode() const

Cursor mode.

Configuration& Magnum::Platform::GlfwApplication::Configuration::setCursorMode(CursorMode cursorMode)

Set cursor mode.

Returns Reference to self (for method chaining)

Default is CursorMode::Normal.