Magnum::Platform::EmscriptenApplication::Configuration class

Configuration.

Contents

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.

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

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)