Expand description
Process-global window-state mirror for the window script namespace.
The OS window lives inside the winit event loop, not in the ECS, so the
window.title() / window.size() / window.dpr() getters and the
window.set_title / window.set_size setters cannot reach it through a
&World. They read and write this small cache instead.
publish_viewport copies the live size and device-pixel ratio here
from the main world’s Viewport, which every window backend and the
headless runner keep current; the setters write the requested title /
size, which the backend applies to the real window when one exists.
Headless runs have no window, so a setter followed by its getter
round-trips through the cache.
Functions§
- dpr
- Current device-pixel ratio / scale factor (
window.dpr). - publish_
viewport - Copy the main world’s
Viewportinto the cache whenever it changes, sowindow.size()andwindow.dpr()read what the app is running at. Registered byApp::newat the start of each tick, ahead of every script handler. - set_dpr
- Publish the live device-pixel ratio (window backend, on scale change).
- set_
size - Request a new window size in logical pixels (
window.set_size). - set_
title - Request a new window title (
window.set_title). - size
- Current window size in logical pixels (
window.size). - title
- Current window title.