Struct bevy_egui::EguiContext
source · [−]pub struct EguiContext { /* private fields */ }
Expand description
A resource for storing bevy_egui
context.
Implementations
sourceimpl EguiContext
impl EguiContext
sourcepub fn ctx(&self) -> &Context
pub fn ctx(&self) -> &Context
Egui context of the primary window.
This function is only available when the immutable_ctx
feature is enabled.
The preferable way is to use ctx_mut
to avoid unpredictable blocking inside UI systems.
sourcepub fn ctx_for_window(&self, window: WindowId) -> &Context
pub fn ctx_for_window(&self, window: WindowId) -> &Context
Egui context for a specific window.
If you want to display UI on a non-primary window, make sure to set up the render graph by
calling setup_pipeline
.
This function is only available when the immutable_ctx
feature is enabled.
The preferable way is to use ctx_for_window_mut
to avoid unpredictable blocking inside UI
systems.
sourcepub fn try_ctx_for_window(&self, window: WindowId) -> Option<&Context>
pub fn try_ctx_for_window(&self, window: WindowId) -> Option<&Context>
Fallible variant of EguiContext::ctx_for_window
. Make sure to set up the render graph by
calling setup_pipeline
.
This function is only available when the immutable_ctx
feature is enabled.
The preferable way is to use try_ctx_for_window_mut
to avoid unpredictable blocking inside
UI systems.
sourcepub fn ctx_for_window_mut(&mut self, window: WindowId) -> &Context
pub fn ctx_for_window_mut(&mut self, window: WindowId) -> &Context
Egui context for a specific window.
If you want to display UI on a non-primary window, make sure to set up the render graph by
calling setup_pipeline
.
sourcepub fn try_ctx_for_window_mut(&mut self, window: WindowId) -> Option<&Context>
pub fn try_ctx_for_window_mut(&mut self, window: WindowId) -> Option<&Context>
Fallible variant of EguiContext::ctx_for_window_mut
. Make sure to set up the render
graph by calling setup_pipeline
.
sourcepub fn ctx_for_windows_mut<const N: usize>(
&mut self,
ids: [WindowId; N]
) -> [&Context; N]
pub fn ctx_for_windows_mut<const N: usize>(
&mut self,
ids: [WindowId; N]
) -> [&Context; N]
Allows to get multiple contexts at the same time. This function is useful when you want
to get multiple window contexts without using the immutable_ctx
feature.
Panics
Panics if the passed window ids aren’t unique.
sourcepub fn try_ctx_for_windows_mut<const N: usize>(
&mut self,
ids: [WindowId; N]
) -> [Option<&Context>; N]
pub fn try_ctx_for_windows_mut<const N: usize>(
&mut self,
ids: [WindowId; N]
) -> [Option<&Context>; N]
Fallible variant of EguiContext::ctx_for_windows_mut
. Make sure to set up the render
graph by calling setup_pipeline
.
Panics
Panics if the passed window ids aren’t unique.
sourcepub fn add_image(&mut self, image: Handle<Image>) -> TextureId
pub fn add_image(&mut self, image: Handle<Image>) -> TextureId
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 application manually and you don’t want to bother with cleaning up textures in Egui.
You’ll want to pass a strong handle if a texture is used only in Egui and there are no handle copies stored anywhere else.
sourcepub fn remove_image(&mut self, image: &Handle<Image>) -> Option<TextureId>
pub fn remove_image(&mut self, image: &Handle<Image>) -> Option<TextureId>
Removes the image handle and an Egui texture id associated with it.
Trait Implementations
sourceimpl Clone for EguiContext
impl Clone for EguiContext
sourcefn clone(&self) -> EguiContext
fn clone(&self) -> EguiContext
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations
impl !RefUnwindSafe for EguiContext
impl Send for EguiContext
impl Sync for EguiContext
impl Unpin for EguiContext
impl !UnwindSafe for EguiContext
Blanket Implementations
impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
fn as_bind_group_shader_type(
&self,
_images: &HashMap<Handle<Image>, <Image as RenderAsset>::PreparedAsset, RandomState, Global>
) -> U
fn as_bind_group_shader_type(
&self,
_images: &HashMap<Handle<Image>, <Image as RenderAsset>::PreparedAsset, RandomState, Global>
) -> U
T
[ShaderType
] for self
. When used in [AsBindGroup
]
derives, it is safe to assume that all images in self
exist. Read moresourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read morefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read morefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read morefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more