pub struct FrameToken<'ctx> { /* private fields */ }Expand description
A frame opened by Context::begin_frame.
This token is intended for engine integrations that need to make the Dear ImGui frame boundary
explicit: one system opens the frame, several user systems draw through Self::ui, and one
system consumes the token to render or snapshot the frame. The existing Context::frame and
Context::render calls remain available for traditional immediate-mode loops.
Implementations§
Source§impl<'ctx> FrameToken<'ctx>
impl<'ctx> FrameToken<'ctx>
Sourcepub fn ui(&self) -> &Ui
pub fn ui(&self) -> &Ui
Borrow the UI for this frame.
This can be called repeatedly by an engine-owned frame runner to let multiple systems draw into the same frame, as long as those systems are scheduled sequentially.
Sourcepub fn lifecycle_state(&self) -> FrameLifecycleState
pub fn lifecycle_state(&self) -> FrameLifecycleState
Return the lifecycle state while this token owns the open frame.
Sourcepub fn render(self) -> &'ctx mut DrawData
pub fn render(self) -> &'ctx mut DrawData
Render this frame and return the resulting draw data.
Sourcepub fn render_snapshot(
self,
options: SnapshotOptions,
) -> Result<FrameSnapshot, SnapshotError>
pub fn render_snapshot( self, options: SnapshotOptions, ) -> Result<FrameSnapshot, SnapshotError>
Render this frame and build a thread-safe snapshot from the resulting draw data.
This is the preferred handoff shape for render-world integrations such as Bevy, where raw ImGui pointers must not cross the engine extraction boundary.