Magnum::Platform::EmscriptenApplication::Configuration class

Configuration.

Public types

enum class WindowFlag: UnsignedShort { Contextless = 1 << 0, Resizable = 1 << 1, AlwaysRequestAnimationFrame = 1 << 2 }
Window flag.
using WindowFlags = Containers::EnumSet<WindowFlag>
Window flags.

Public functions

template<class T>
auto setTitle(const T&) -> Configuration&
Set window title.
auto size() const -> Vector2i
Window size.
auto setSize(const Vector2i& size, const Vector2& dpiScaling = {}) -> Configuration&
Set canvas size.
auto dpiScaling() const -> Vector2
Custom DPI scaling.
auto windowFlags() const -> WindowFlags
Window flags.
auto setWindowFlags(WindowFlags windowFlags) -> Configuration&
Set window flags.
auto addWindowFlags(WindowFlags flags) -> Configuration& new in Git master
Add window flags.
auto clearWindowFlags(WindowFlags flags) -> Configuration& new in Git master
Clear window flags.

Enum documentation

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

Window flag.

Enumerators
Contextless

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

Resizable

Resizable canvas. This causes the framebuffer to be resized when the <canvas> size changes, either directly or as a consequence of browser window size change.

Implement viewportEvent() to react to the resizing events.

AlwaysRequestAnimationFrame

Always request the next animation frame. Disables the idle-efficient main loop described in Main loop implementation and unconditionally schedules window.requestAnimationFrame(), matching the behavior of Sdl2Application. Useful for testing or for simpler internal state when your app is going to redraw all the time anyway.

Note that this does not affect how drawEvent() is executed — it depends on redraw() being called independently of this flag being set.

Typedef documentation

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

Window flags.

Function documentation

template<class T>
Configuration& Magnum::Platform::EmscriptenApplication::Configuration::setTitle(const T&)

Set window title.

Returns Reference to self (for method chaining)

Configuration& Magnum::Platform::EmscriptenApplication::Configuration::setSize(const Vector2i& size, const Vector2& dpiScaling = {})

Set canvas size.

Parameters
size Desired canvas size
dpiScaling Custom DPI scaling value

Default is a zero vector, meaning a value that matches the display or canvas size is autodetected. See DPI awareness for more information. When dpiScaling is not a zero vector, this function sets the DPI scaling directly. The resulting windowSize() is size*dpiScaling and dpiScaling() is dpiScaling.

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

Custom DPI scaling.

If zero, the devices pixel ratio has a priority over this value. The --magnum-dpi-scaling option (specified via URL GET parameters) has a priority over any application-set value.

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

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::EmscriptenApplication::Configuration::addWindowFlags(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::EmscriptenApplication::Configuration::clearWindowFlags(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.