Misc
This commit is contained in:
parent
99344da4f4
commit
f4e9dc0c8e
|
@ -8,7 +8,7 @@ use bevy::{
|
|||
prelude::{Deref, DerefMut},
|
||||
utils::synccell::SyncCell,
|
||||
};
|
||||
use dioxus_core::{Mutations, ScopeState, VirtualDom};
|
||||
use dioxus_core::{Element, Mutations, Scope, ScopeState, VirtualDom};
|
||||
use std::{cell::RefCell, mem::transmute, rc::Rc};
|
||||
|
||||
pub fn tick_dioxus_ui(world: &mut World) {
|
||||
|
@ -104,3 +104,9 @@ pub fn use_commands<'a>(cx: &'a ScopeState) -> Rc<RefCell<Commands<'a, 'a>>> {
|
|||
#[derive(Deref, DerefMut)]
|
||||
pub struct VirtualDomUnsafe(pub SyncCell<VirtualDom>);
|
||||
unsafe impl Send for VirtualDomUnsafe {}
|
||||
|
||||
impl VirtualDomUnsafe {
|
||||
pub fn new(root_component: fn(Scope) -> Element) -> Self {
|
||||
Self(SyncCell::new(VirtualDom::new(root_component)))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,11 +4,10 @@ use self::implementation::{tick_dioxus_ui, VirtualDomUnsafe};
|
|||
use bevy::{
|
||||
app::{App, Plugin, Update},
|
||||
ecs::{component::Component, entity::Entity},
|
||||
utils::synccell::SyncCell,
|
||||
};
|
||||
use dioxus_core::{Element, Scope, VirtualDom};
|
||||
|
||||
pub use self::implementation::{use_commands, use_res, use_world};
|
||||
pub use dioxus_core::{Element, Scope};
|
||||
|
||||
pub struct DioxusUiPlugin;
|
||||
|
||||
|
@ -27,7 +26,7 @@ pub struct DioxusUiRoot {
|
|||
impl DioxusUiRoot {
|
||||
pub fn new(root_component: fn(Scope) -> Element) -> Self {
|
||||
Self {
|
||||
virtual_dom: VirtualDomUnsafe(SyncCell::new(VirtualDom::new(root_component))),
|
||||
virtual_dom: VirtualDomUnsafe::new(root_component),
|
||||
root_entity: None,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue