pub struct MegaUiContext {
pub ui: Ui,
/* private fields */
}
Expand description
A resource that is used to store bevy_megaui
context.
Since megaui::Ui doesn’t implement Send + Sync, it’s accessible only from
thread-local systems.
Fields§
§ui: Ui
Megaui context.
Implementations§
Source§impl MegaUiContext
impl MegaUiContext
Sourcepub fn draw_window(
&mut self,
id: Id,
position: Vector2,
size: Vector2,
params: impl Into<Option<WindowParams>>,
f: impl FnOnce(&mut Ui),
)
pub fn draw_window( &mut self, id: Id, position: Vector2, size: Vector2, params: impl Into<Option<WindowParams>>, f: impl FnOnce(&mut Ui), )
A helper function to draw a megaui window. You may as well use megaui::widgets::Window::new if you prefer a builder pattern.
Sourcepub fn set_megaui_texture(&mut self, id: u32, texture: Handle<Texture>)
pub fn set_megaui_texture(&mut self, id: u32, texture: Handle<Texture>)
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 megaui.
You’ll want to pass a strong handle if a texture is used only in megaui and there’s no handle copies stored anywhere else.
Sourcepub fn remove_megaui_texture(&mut self, id: u32)
pub fn remove_megaui_texture(&mut self, id: u32)
Removes a texture handle associated with the id.
Auto Trait Implementations§
impl Freeze for MegaUiContext
impl !RefUnwindSafe for MegaUiContext
impl !Send for MegaUiContext
impl !Sync for MegaUiContext
impl Unpin for MegaUiContext
impl !UnwindSafe for MegaUiContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
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
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.