Magnum::Platform::Sdl2Application::Configuration class

Configuration.

Public types

enum class Flag: Uint32 { Contextless = 1u << 31, OpenGL = SDL_WINDOW_OPENGL, Vulkan = SDL_WINDOW_VULKAN } new in Git master
Flag.
enum class WindowFlag: Uint32 { Resizable = Uint32(Sdl2Application::WindowFlag::Resizable) deprecated in Git master, Fullscreen = Uint32(Sdl2Application::WindowFlag::Fullscreen) deprecated in Git master, FullscreenDesktop = Uint32(Sdl2Application::WindowFlag::FullscreenDesktop) deprecated in Git master, Borderless = Uint32(Sdl2Application::WindowFlag::Borderless) deprecated in Git master, Hidden = Uint32(Sdl2Application::WindowFlag::Hidden) deprecated in Git master, Maximized = Uint32(Sdl2Application::WindowFlag::Maximized) deprecated in Git master, Minimized = Uint32(Sdl2Application::WindowFlag::Minimized) deprecated in Git master, MouseLocked = Uint32(Sdl2Application::WindowFlag::MouseLocked) deprecated in Git master, AlwaysOnTop = Uint32(Sdl2Application::WindowFlag::AlwaysOnTop) deprecated in Git master, SkipTaskbar = Uint32(Sdl2Application::WindowFlag::SkipTaskbar) deprecated in Git master, Utility = Uint32(Sdl2Application::WindowFlag::Utility) deprecated in Git master, Tooltip = Uint32(Sdl2Application::WindowFlag::Tooltip) deprecated in Git master, PopupMenu = Uint32(Sdl2Application::WindowFlag::PopupMenu) deprecated in Git master, Contextless = Uint32(Flag::Contextless) deprecated in Git master, OpenGL = Uint32(Flag::OpenGL) deprecated in Git master, Vulkan = Uint32(Flag::Vulkan) deprecated in Git master } deprecated in Git master
Window flag.
enum class DpiScalingPolicy: UnsignedByte { Framebuffer, Virtual, Physical, Default }
DPI scaling policy.
using Flags = Containers::EnumSet<Flag> new in Git master
Flags.
using WindowFlags = Containers::EnumSet<WindowFlag> deprecated in Git master
Window flags.

Public functions

auto title() const -> Containers::StringView
Window title.
auto setTitle(const 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 flags() const -> Flags new in Git master
Flags.
auto setFlags(Flags flags) -> Configuration& new in Git master
Set flags.
auto addFlags(Flags flags) -> Configuration& new in Git master
Add flags.
auto clearFlags(Flags flags) -> Configuration& new in Git master
Clear flags.
auto windowFlags() const -> Sdl2Application::WindowFlags
Window flags.
auto setWindowFlags(Sdl2Application::WindowFlags flags) -> Configuration& new in Git master
Set window flags.
auto addWindowFlags(Sdl2Application::WindowFlags flags) -> Configuration& new in Git master
Add window flags.
auto clearWindowFlags(Sdl2Application::WindowFlags flags) -> Configuration& new in Git master
Clear window flags.
auto setWindowFlags(WindowFlags flags) -> Configuration& deprecated in Git master
Set window flags.
auto addWindowFlags(WindowFlags flags) -> Configuration& deprecated in Git master
Add window flags.
auto clearWindowFlags(WindowFlags flags) -> Configuration& deprecated in Git master
Clear window flags.

Enum documentation

enum class Magnum::Platform::Sdl2Application::Configuration::Flag: Uint32 new in Git master

Flag.

Enumerators
Contextless

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

OpenGL

Request a window for use with OpenGL. Enabled implicitly when creating an OpenGL context using Sdl2Application(const Arguments&, const Configuration&, const GLConfiguration&), create(const Configuration&, const GLConfiguration&) or tryCreate(const Configuration&, const GLConfiguration&). Use in combination with Flag::Contextless and Sdl2Application(const Arguments&, const Configuration&), create(const Configuration&) or tryCreate(const Configuration&) to create a window for use with OpenGL without actually creating the OpenGL context.

Vulkan

Request a window for use with Vulkan. Use in combination with Flag::Contextless and Sdl2Application(const Arguments&, const Configuration&), create(const Configuration&) or tryCreate(const Configuration&) to create a window for use exclusively with Vulkan. Use without Flag::Contextless on builds with MAGNUM_TARGET_GL enabled to create a window for use by both OpenGL and Vulkan.

enum class Magnum::Platform::Sdl2Application::Configuration::WindowFlag: Uint32

Window flag.

Enumerators
Resizable

Resizable window. On iOS this allows the application to respond to display orientation changes, on Emscripten this causes the framebuffer to be resized when the <canvas> size changes.

Implement viewportEvent() to react to the resizing events.

Fullscreen

Fullscreen window

FullscreenDesktop

Fullscreen window at the current desktop resolution

Borderless

No window decoration. On iOS this hides the menu bar.

Hidden

Hidden window

Maximized

Maximized window

Minimized

Minimized window

MouseLocked

Window with mouse locked

See also Cursor::HiddenLocked for locking a mouse to the window area together with hiding it.

AlwaysOnTop

Always on top

SkipTaskbar

Don't add the window to taskbar

Utility

Window should be treated as a utility window

Tooltip

Window should be treated as a tooltip

PopupMenu

Window should be treated as a popup menu

Contextless

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

OpenGL

Request a window for use with OpenGL. Enabled implicitly when creating an OpenGL context using Sdl2Application(const Arguments&, const Configuration&, const GLConfiguration&), create(const Configuration&, const GLConfiguration&) or tryCreate(const Configuration&, const GLConfiguration&). Use in combination with Flag::Contextless and Sdl2Application(const Arguments&, const Configuration&), create(const Configuration&) or tryCreate(const Configuration&) to create a window for use with OpenGL without actually creating the OpenGL context.

Vulkan

Request a window for use with Vulkan. Use in combination with Flag::Contextless and Sdl2Application(const Arguments&, const Configuration&), create(const Configuration&) or tryCreate(const Configuration&) to create a window for use exclusively with Vulkan. Use without Flag::Contextless on builds with MAGNUM_TARGET_GL enabled to create a window for use by both OpenGL and Vulkan.

enum class Magnum::Platform::Sdl2Application::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.

Typedef documentation

typedef Containers::EnumSet<Flag> Magnum::Platform::Sdl2Application::Configuration::Flags new in Git master

Flags.

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

Window flags.

Function documentation

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

Window title.

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

Configuration& Magnum::Platform::Sdl2Application::Configuration::setTitle(const Containers::StringView title)

Set window title.

Returns Reference to self (for method chaining)

Default is "Magnum SDL2 Application".

DpiScalingPolicy Magnum::Platform::Sdl2Application::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::Sdl2Application::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::Sdl2Application::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} on desktop platforms. On Emscripten and iOS the default is a zero vector, meaning a value that matches the display or canvas size is autodetected. See DPI awareness for more information.

Configuration& Magnum::Platform::Sdl2Application::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 Sdl2Application::windowSize() is size*dpiScaling and Sdl2Application::dpiScaling() is dpiScaling.

Flags Magnum::Platform::Sdl2Application::Configuration::flags() const new in Git master

Flags.

Configuration& Magnum::Platform::Sdl2Application::Configuration::setFlags(Flags flags) new in Git master

Set flags.

Returns Reference to self (for method chaining)

Default are none, although Flag::OpenGL is implicitly enabled when creating an OpenGL context using Sdl2Application(const Arguments&, const Configuration&, const GLConfiguration&), create(const Configuration&, const GLConfiguration&) or tryCreate(const Configuration&, const GLConfiguration&). To avoid clearing default flags by accident, prefer to use addFlags() and clearFlags() instead.

Configuration& Magnum::Platform::Sdl2Application::Configuration::addFlags(Flags flags) new in Git master

Add flags.

Returns Reference to self (for method chaining)

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

Configuration& Magnum::Platform::Sdl2Application::Configuration::clearFlags(Flags flags) new in Git master

Clear flags.

Returns Reference to self (for method chaining)

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

Sdl2Application::WindowFlags Magnum::Platform::Sdl2Application::Configuration::windowFlags() const

Window flags.

Configuration& Magnum::Platform::Sdl2Application::Configuration::setWindowFlags(Sdl2Application::WindowFlags flags) new in Git master

Set window flags.

Returns Reference to self (for method chaining)

Default are none. To avoid clearing default flags by accident, prefer to use addWindowFlags() and clearWindowFlags() instead.

Configuration& Magnum::Platform::Sdl2Application::Configuration::addWindowFlags(Sdl2Application::WindowFlags flags) new in Git master

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::Sdl2Application::Configuration::clearWindowFlags(Sdl2Application::WindowFlags flags) new in Git master

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.

Configuration& Magnum::Platform::Sdl2Application::Configuration::setWindowFlags(WindowFlags flags)

Set window flags.

Configuration& Magnum::Platform::Sdl2Application::Configuration::addWindowFlags(WindowFlags flags)

Add window flags.

Configuration& Magnum::Platform::Sdl2Application::Configuration::clearWindowFlags(WindowFlags flags)

Clear window flags.