This commit is contained in:
JMS55 2023-12-05 22:37:16 -08:00
parent 65f5a625ad
commit e913daf07c

View file

@ -12,26 +12,24 @@ use dioxus_core::{Element, Mutations, Scope, ScopeState, VirtualDom};
use std::{cell::RefCell, mem::transmute, rc::Rc};
pub fn tick_dioxus_ui(world: &mut World) {
unsafe {
let world_cell = world.as_unsafe_world_cell();
let mut command_queue = CommandQueue::default();
let apply_mutations = |mutations: Mutations, root_entity: Entity| {
todo!("Modify bevy_ui entities based on mutations");
};
let mut command_queue = CommandQueue::default();
let ecs_context = EcsContext {
world_read_only: transmute(world_cell.world()),
let ecs_context = unsafe {
EcsContext {
world_read_only: transmute(&world),
commands: Rc::new(RefCell::new(Commands::new(
transmute(&mut command_queue),
transmute(world_cell.world()),
transmute(&world),
))),
}
};
for (root_entity, mut dioxus_ui_root) in world_cell
.world_mut()
.query::<(Entity, &mut DioxusUiRoot)>()
.iter_mut(world_cell.world_mut())
for (root_entity, mut dioxus_ui_root) in
world.query::<(Entity, &mut DioxusUiRoot)>().iter_mut(world)
{
dioxus_ui_root
.virtual_dom
@ -58,7 +56,6 @@ pub fn tick_dioxus_ui(world: &mut World) {
command_queue.apply(world);
}
}
#[derive(Clone)]
struct EcsContext {