Magnum::Platform::GlfwApplication::Configuration class

Configuration.

Contents

Public types

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

Public functions

auto title() const -> std::string
Window title.
auto setTitle(std::string 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 cursorMode() const -> CursorMode
Cursor mode.
auto setCursorMode(CursorMode cursorMode) -> Configuration&
Set cursor mode.
auto flags() const -> GLConfiguration::Flags deprecated
Context flags.
auto setFlags(GLConfiguration::Flags flags) -> Configuration& deprecated
Set context flags.
auto version() const -> GL::Version deprecated
Context version.
auto setVersion(GL::Version version) -> Configuration& deprecated
Set context version.
auto sampleCount() const -> Int deprecated
Sample count.
auto setSampleCount(Int count) -> Configuration& deprecated
Set sample count.
auto isSRGBCapable() const -> bool deprecated
sRGB-capable default framebuffer
auto setSRGBCapable(bool enabled) -> Configuration& deprecated
Set sRGB-capable default framebuffer.

Enum documentation

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

Window flag.

Enumerators
Fullscreen

Fullscreen window

Resizable

Resizable window

Resizeable

Resizable window

Hidden

Hidden window

Maximized

Maximized window

Minimized

Minimized window

Floating

Window floating above others, top-most

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&), GlfwApplication(const Arguments&, const Configuration&), create(const Configuration&) or tryCreate(const Configuration&) to prevent implicit creation of an OpenGL context.

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

DPI scaling policy.

DPI scaling policy when requesting a particular window size. Can be overriden 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 GLConfiguration::Flag Magnum::Platform::GlfwApplication::Configuration::Flag

Context flag.

typedef GLConfiguration::Flags Magnum::Platform::GlfwApplication::Configuration::Flags

Context flags.

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

Window flags.

Function documentation

Configuration& Magnum::Platform::GlfwApplication::Configuration::setTitle(std::string 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.

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

Set cursor mode.

Returns Reference to self (for method chaining)

Default is CursorMode::Normal.

GLConfiguration::Flags Magnum::Platform::GlfwApplication::Configuration::flags() const

Context flags.

Configuration& Magnum::Platform::GlfwApplication::Configuration::setFlags(GLConfiguration::Flags flags)

Set context flags.

GL::Version Magnum::Platform::GlfwApplication::Configuration::version() const

Context version.

Configuration& Magnum::Platform::GlfwApplication::Configuration::setVersion(GL::Version version)

Set context version.

Int Magnum::Platform::GlfwApplication::Configuration::sampleCount() const

Sample count.

Configuration& Magnum::Platform::GlfwApplication::Configuration::setSampleCount(Int count)

Set sample count.

bool Magnum::Platform::GlfwApplication::Configuration::isSRGBCapable() const

sRGB-capable default framebuffer

Configuration& Magnum::Platform::GlfwApplication::Configuration::setSRGBCapable(bool enabled)

Set sRGB-capable default framebuffer.