nightshade 0.57.0

A cross-platform data-oriented game engine.
Documentation
use super::plugin::EguiState;

/// Drains the egui frame output stashed on
/// `world.plugin_resource_mut::<EguiState>()` into the renderer's
/// [`EguiFrameInputs`](crate::render::wgpu::render_configs::EguiFrameInputs), so
/// the overlay rides the frame inputs like every other input instead of poking
/// the renderer through a side channel. Returns `None` when nothing was drawn.
pub(crate) fn take_egui_frame_inputs(
    world: &mut crate::ecs::world::World,
) -> Option<crate::render::wgpu::render_configs::EguiFrameInputs> {
    world.ecs.resource::<EguiState>()?;
    let (output, primitives) = world
        .plugin_resource_mut::<EguiState>()
        .frame_output
        .take()?;
    Some(crate::render::wgpu::render_configs::EguiFrameInputs {
        textures_delta: output.textures_delta,
        pixels_per_point: output.pixels_per_point,
        paint_jobs: primitives,
    })
}