pub fn fps_monitor(window: &mut Window, cx: &mut App) -> FpsOverlayExpand description
The performance HUD, pinned to the top right of its parent.
The parent element must be relative(), since the HUD positions itself
absolutely. Call this at most once per window — a second call renders the
same monitor twice.
Whether the HUD is on screen is the caller’s to decide; render this only when it should be visible:
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
div()
.relative()
.size_full()
.child("your app")
.when(self.show_fps, |this| this.child(fps_monitor(window, cx)))
}The monitor behind it is created on first use and reused afterwards, one per
window, so this can be called straight from render every frame.