Skip to content

Commit

Permalink
Merge pull request #20 from jakobhellermann/try-get-context
Browse files Browse the repository at this point in the history
add `try_ctx_for_window` function
  • Loading branch information
mvlabat committed May 3, 2021
2 parents 5dbc3a5 + c89734b commit 4f4fd49
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ impl EguiContext {
.unwrap()
}

/// Fallible variant of [`EguiContext::ctx_for_window`]. Make sure to set up the render graph by calling [`setup_pipeline`].
pub fn try_ctx_for_window(&self, window: WindowId) -> Option<&egui::CtxRef> {
self.ctx.get(&window)
}

/// Can accept either a strong or a weak handle.
///
/// You may want to pass a weak handle if you control removing texture assets in your
Expand Down

0 comments on commit 4f4fd49

Please sign in to comment.